Skip to content

Commit

Permalink
Update to 1.20 (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrexHD committed Jun 19, 2023
1 parent 18c76af commit 218a6d7
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 30 deletions.
17 changes: 8 additions & 9 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
[versions]
minecraft = "1.19.3"
fabric-loader = "0.14.11"
yarn-mappings = "1.19.3+build.2"
minecraft = "1.20-rc1"
fabric-loader = "0.14.21"
yarn-mappings = "1.20-rc1+build.2"

fabric-api = "0.68.1+1.19.3"
fabric-api = "0.83.0+1.20"

# Kotlin
kotlin = "1.7.22"
fabric-kotlin = "1.8.7+kotlin.1.7.22"
fabric-kotlin = "1.9.4+kotlin.1.8.21"

# Discord
kord-extensions = "1.5.5-SNAPSHOT"
kord-extensions = "1.5.6"
mc-discord-reserializer = "4.3.0"
emoji-java = "5.1.1"
adventure-gson = "4.11.0"

placeholder-api = "2.0.0-pre.2+1.19.3"
placeholder-api = "2.1.1+1.20"
permission-api = "0.2-SNAPSHOT"
vanish-api = "1.3.0"
vanish-api = "1.4.0+1.19.4"
konf = "1.1.2"

[libraries]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MemberCommandsExtension : Extension() {
guild(config.getGuild(bot))

action {
val profile = server.userCache.findByName(arguments.player).unwrap()
val profile = server.userCache?.findByName(arguments.player)?.unwrap()
if (profile == null) {
respond {
content = config[MemberCommandsSpec.WhiteListSpec.MessagesSpec.unknownPlayer].replace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.coroutines.runBlocking
import net.minecraft.server.command.CommandOutput
import net.minecraft.text.Text

class DiscordCommandOutput(private val commandContext: EphemeralSlashCommandContext<out InlineCommandsExtension.InlineCommandsArgs>) :
class DiscordCommandOutput(private val commandContext: EphemeralSlashCommandContext<out InlineCommandsExtension.InlineCommandsArgs, *>) :
CommandOutput {
private val buffer = StringBuffer()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ class LinkCommand(private val dispatcher: Dispatcher) {

if (BlockBotDiscord.linkedAccounts.remove(player.uuid)) {
logInfo("Unlinked ${player.name} from $id")
context.source.sendFeedback(TextParserUtils.formatText(config[LinkingSpec.MessagesSpec.successfulUnlink]), false)
context.source.sendFeedback(
{ TextParserUtils.formatText(config[LinkingSpec.MessagesSpec.successfulUnlink]) },
false
)

if (config[LinkingSpec.requireLinking]) {
context.source.playerOrThrow.networkHandler.disconnect(
Expand All @@ -74,7 +77,10 @@ class LinkCommand(private val dispatcher: Dispatcher) {
)
}
} else {
context.source.sendFeedback(TextParserUtils.formatText(config[LinkingSpec.MessagesSpec.failedUnlink]), false)
context.source.sendFeedback(
{ TextParserUtils.formatText(config[LinkingSpec.MessagesSpec.failedUnlink]) },
false
)
}

return 1
Expand All @@ -97,14 +103,17 @@ class LinkCommand(private val dispatcher: Dispatcher) {

if (id != null && BlockBotDiscord.linkedAccounts.get(id) != null) {
val user = kord.getUser(id)
source.sendFeedback(Text.literal(user?.tag ?: id.toString()), false)
source.sendFeedback({ Text.literal(user?.tag ?: id.toString()) }, false)

for (uuid in BlockBotDiscord.linkedAccounts.get(id)!!) {
val account = source.server.userCache.getByUuid(uuid).unwrap()
source.sendFeedback(Text.literal(" - ${account?.name ?: uuid.toString()}"), false)
val account = source.server.userCache?.getByUuid(uuid)?.unwrap()
source.sendFeedback({ Text.literal(" - ${account?.name ?: uuid.toString()}") }, false)
}
} else {
source.sendFeedback(TextParserUtils.formatText(config[LinkingSpec.MessagesSpec.noLinkedAccounts]), false)
source.sendFeedback(
{ TextParserUtils.formatText(config[LinkingSpec.MessagesSpec.noLinkedAccounts]) },
false
)
}
}

Expand All @@ -117,21 +126,25 @@ class LinkCommand(private val dispatcher: Dispatcher) {

if (user != null) {
context.source.sendFeedback(
TextParserUtils.formatText(
config[LinkingSpec.MessagesSpec.alreadyLinked].replace(
"{user}",
user.tag
{
TextParserUtils.formatText(
config[LinkingSpec.MessagesSpec.alreadyLinked].replace(
"{user}",
user.tag
)
)
), false
}, false
)
} else {
context.source.sendFeedback(
TextParserUtils.formatText(
config[LinkingSpec.MessagesSpec.linkCode].replace(
"{code}",
player.gameProfile.linkCode
{
TextParserUtils.formatText(
config[LinkingSpec.MessagesSpec.linkCode].replace(
"{code}",
player.gameProfile.linkCode
)
)
), false
}, false
)
player.syncDiscord()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class LinkingExtension : Extension() {
BlockBotDiscord.linkedAccounts.add(snowflake, uuid)
logInfo("Linked $uuid to $snowflake")
linkCodes.remove(arguments.code)
val profile = server.userCache.getByUuid(uuid).unwrap()
val profile = server.userCache?.getByUuid(uuid)?.unwrap()

respond {
content = config[LinkingSpec.MessagesSpec.successfulLink].replace("{player}", profile?.name ?: "Unknown")
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"blockbot-discord.mixins.json"
],
"depends": {
"minecraft": ">=1.19.1",
"minecraft": ">=1.20",
"blockbot-api": ">=1.0.0",
"fabric-language-kotlin": "~1.8.2+kotlin.1.7.10",
"fabric-language-kotlin": ">=1.9.4+kotlin.1.8.21",
"fabric": ">=${fabricApi}",
"fabricloader": ">=${fabricLoader}"
}
Expand Down

0 comments on commit 218a6d7

Please sign in to comment.