diff --git a/build.gradle b/build.gradle index 840c31a..1a199a0 100644 --- a/build.gradle +++ b/build.gradle @@ -50,9 +50,9 @@ dependencies { modImplementation include("net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}") modImplementation include("me.lucko:fabric-permissions-api:0.2-SNAPSHOT") - modImplementation include("eu.pb4:sgui:1.2.1+1.19.3") + modImplementation include("eu.pb4:sgui:1.2.2+1.20") modImplementation include("com.github.Lortseam.completeconfig:base:2.3.1") - modImplementation include("xyz.nucleoid:server-translations-api:2.0.0-beta.2+1.19.4-pre2") + modImplementation include("xyz.nucleoid:server-translations-api:2.0.0+1.20") } processResources { diff --git a/gradle.properties b/gradle.properties index d82acc8..b5290ca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,21 +1,21 @@ kotlin.code.style=official org.gradle.jvmargs=-Xmx4G -minecraft_version_group=1.19.x +minecraft_version_group=1.20.x # Fabric Properties # Check these on https://fabricmc.net/versions.html -minecraft_version=1.19.4 -yarn_mappings=1.19.4+build.2 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.2 loader_version=0.14.21 #Fabric api -fabric_version=0.83.0+1.19.4 +fabric_version=0.83.1+1.20.1 loom_version=1.2-SNAPSHOT # Mod Properties -mod_version = 2.0.4 +mod_version = 2.1.0 maven_group = space.rogi27 archives_base_name = homabric diff --git a/src/main/kotlin/space/rogi27/homabric/commands/AdminCommands.kt b/src/main/kotlin/space/rogi27/homabric/commands/AdminCommands.kt index f8ba173..a5dbd63 100644 --- a/src/main/kotlin/space/rogi27/homabric/commands/AdminCommands.kt +++ b/src/main/kotlin/space/rogi27/homabric/commands/AdminCommands.kt @@ -55,7 +55,7 @@ object AdminCommands { Homabric.config.load() Homabric.homesConfig.load() context.source.sendFeedback( - Text.translatable("text.homabric.admin_config_reloaded").formatted(Formatting.GRAY), false + { Text.translatable("text.homabric.admin_config_reloaded").formatted(Formatting.GRAY) }, false ) return 1 } @@ -66,13 +66,15 @@ object AdminCommands { "%s by Rogi27", "%s", "%s", "%s" ) context.source.sendFeedback( - Text.translatable( - java.lang.String.join("\n", info), - Text.literal("Homabric").formatted(Formatting.AQUA), - Text.translatable("text.homabric.admin_info_line1").formatted(Formatting.GRAY), - Text.literal(" - /help homabric").formatted(Formatting.GRAY), - Text.literal(" - /help home").formatted(Formatting.GRAY) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + java.lang.String.join("\n", info), + Text.literal("Homabric").formatted(Formatting.AQUA), + Text.translatable("text.homabric.admin_info_line1").formatted(Formatting.GRAY), + Text.literal(" - /help homabric").formatted(Formatting.GRAY), + Text.literal(" - /help home").formatted(Formatting.GRAY) + ).formatted(Formatting.GREEN) + }, false ) return 1 } @@ -83,14 +85,14 @@ object AdminCommands { val player = HomesConfig.getPlayer(context.getArgument("player", String::class.java)) if (player == null) { context.source.sendFeedback( - Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED), false + { Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED) }, false ) return 1 } val home: HomeObject? = player.getHome(homeName) if (home == null) { - context.source.sendFeedback(Text.translatable("text.homabric.no_home").formatted(Formatting.RED), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_home").formatted(Formatting.RED) }, false) return 0 } @@ -98,9 +100,11 @@ object AdminCommands { TeleportHelper.runTeleport(context.source.player!!, fun() { home.teleportPlayer(context.source.player!!) context.source.sendFeedback( - Text.translatable( - "text.homabric.teleport_done", Text.literal(homeName).formatted(Formatting.WHITE) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.teleport_done", Text.literal(homeName).formatted(Formatting.WHITE) + ).formatted(Formatting.GREEN) + }, false ) }) return 1 @@ -117,26 +121,30 @@ object AdminCommands { val player = HomesConfig.getPlayer(context.getArgument("player", String::class.java)) if (player == null) { context.source.sendFeedback( - Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED), false + { Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED) }, false ) return 1 } val result: PlayerObject.HomeCreationResult = player.createOrUpdateHome(context.source, homeName!!) if (result === PlayerObject.HomeCreationResult.HOME_CREATED) { context.source.sendFeedback( - Text.translatable( - "text.homabric.admin_new_home_created", Text.literal(homeName).formatted( - Formatting.WHITE - ), context.getArgument("player", String::class.java).format(Formatting.AQUA) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.admin_new_home_created", Text.literal(homeName).formatted( + Formatting.WHITE + ), context.getArgument("player", String::class.java).format(Formatting.AQUA) + ).formatted(Formatting.GREEN) + }, false ) } else { context.source.sendFeedback( - Text.translatable( - "text.homabric.admin_home_location_updated", Text.literal(homeName).formatted( - Formatting.WHITE - ), context.getArgument("player", String::class.java).format(Formatting.AQUA) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.admin_home_location_updated", Text.literal(homeName).formatted( + Formatting.WHITE + ), context.getArgument("player", String::class.java).format(Formatting.AQUA) + ).formatted(Formatting.GREEN) + }, false ) } Homabric.saveAndReloadConfig() @@ -156,22 +164,24 @@ object AdminCommands { ) if (player == null) { context.source.sendFeedback( - Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED), false + { Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED) }, false ) return 1 } val result: PlayerObject.HomeRemoveResult = player.removeHome(homeName) when (result) { PlayerObject.HomeRemoveResult.NO_HOME -> { - context.source.sendFeedback(Text.translatable("text.homabric.no_home").formatted(Formatting.RED), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_home").formatted(Formatting.RED) }, false) } PlayerObject.HomeRemoveResult.HOME_REMOVED -> { context.source.sendFeedback( - Text.translatable( - "text.homabric.admin_home_removed", Text.literal(homeName).formatted( - Formatting.WHITE - ), context.getArgument("player", String::class.java).format(Formatting.AQUA) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.admin_home_removed", Text.literal(homeName).formatted( + Formatting.WHITE + ), context.getArgument("player", String::class.java).format(Formatting.AQUA) + ).formatted(Formatting.GREEN) + }, false ) } } @@ -182,7 +192,7 @@ object AdminCommands { fun list(context: CommandContext): Int { val playerData = HomesConfig.getPlayer(context.getArgument("player", String::class.java)) if (playerData == null) { - context.source.sendFeedback(Text.translatable("text.homabric.no_homes").formatted(Formatting.YELLOW), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_homes").formatted(Formatting.YELLOW) }, false) return 1 } val gui = playerData.getHomesGUI(context.source) diff --git a/src/main/kotlin/space/rogi27/homabric/commands/BaseCommands.kt b/src/main/kotlin/space/rogi27/homabric/commands/BaseCommands.kt index cdd10a7..80425b6 100644 --- a/src/main/kotlin/space/rogi27/homabric/commands/BaseCommands.kt +++ b/src/main/kotlin/space/rogi27/homabric/commands/BaseCommands.kt @@ -78,22 +78,24 @@ object BaseCommands { val homeName = context.getArgument("home", String::class.java) val home: HomeObject? = getOrCreatePlayer(context.source.name).getHome(homeName) if (home == null) { - context.source.sendFeedback(Text.translatable("text.homabric.no_home").formatted(Formatting.RED), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_home").formatted(Formatting.RED) }, false) return 1 } when (home.setIcon(context.getArgument("item", Identifier::class.java))) { HomeObject.IconResult.WRONG_ICON -> { - context.source.sendFeedback(Text.translatable("text.homabric.no_icon"), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_icon") }, false) } HomeObject.IconResult.ICON_SET -> { context.source.sendFeedback( - Text.translatable( - "text.homabric.icon_changed", Text.literal(homeName).formatted( - Formatting.WHITE - ), Registries.ITEM[context.getArgument( - "item", Identifier::class.java - )].name.copy().formatted(Formatting.AQUA) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.icon_changed", Text.literal(homeName).formatted( + Formatting.WHITE + ), Registries.ITEM[context.getArgument( + "item", Identifier::class.java + )].name.copy().formatted(Formatting.AQUA) + ).formatted(Formatting.GREEN) + }, false ) } } @@ -111,7 +113,7 @@ object BaseCommands { val home: HomeObject? = player.getHome(homeName) if (home == null) { - context.source.sendFeedback(Text.translatable("text.homabric.no_home"), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_home") }, false) return 0 } @@ -119,9 +121,11 @@ object BaseCommands { TeleportHelper.runTeleport(context.source.player!!, fun() { home.teleportPlayer(context.source.player!!) context.source.sendFeedback( - Text.translatable( - "text.homabric.teleport_done", Text.literal(homeName).formatted(Formatting.WHITE) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.teleport_done", Text.literal(homeName).formatted(Formatting.WHITE) + ).formatted(Formatting.GREEN) + }, false ) }) @@ -136,20 +140,20 @@ object BaseCommands { when (result) { PlayerObject.TeleportToOtherResult.NO_PLAYER -> { context.source.sendFeedback( - Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED), false + { Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED) }, false ) } PlayerObject.TeleportToOtherResult.NO_HOME -> { - context.source.sendFeedback(Text.translatable("text.homabric.no_home").formatted(Formatting.RED), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_home").formatted(Formatting.RED) }, false) } PlayerObject.TeleportToOtherResult.NO_ACCESS -> { context.source.sendFeedback( - Text.translatable("text.homabric.no_home_access").formatted(Formatting.RED), false + { Text.translatable("text.homabric.no_home_access").formatted(Formatting.RED) }, false ) } PlayerObject.TeleportToOtherResult.TELEPORT_DONE -> { context.source.sendFeedback( - Text.translatable("text.homabric.teleport_done").formatted(Formatting.RED), false + { Text.translatable("text.homabric.teleport_done").formatted(Formatting.RED) }, false ) } } @@ -171,7 +175,7 @@ object BaseCommands { if (player != null) { if (player.isLimitReached(context.source)) { context.source.sendFeedback( - Text.translatable("text.homabric.home_limit_reached").formatted(Formatting.RED), false + { Text.translatable("text.homabric.home_limit_reached").formatted(Formatting.RED) }, false ) return 1 } @@ -179,19 +183,23 @@ object BaseCommands { val result: PlayerObject.HomeCreationResult? = homeName?.let { player?.createOrUpdateHome(context.source, it) } if (result === PlayerObject.HomeCreationResult.HOME_CREATED) { context.source.sendFeedback( - Text.translatable( - "text.homabric.new_home_created", Text.literal(homeName).formatted( - Formatting.WHITE - ) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.new_home_created", Text.literal(homeName).formatted( + Formatting.WHITE + ) + ).formatted(Formatting.GREEN) + }, false ) } else { context.source.sendFeedback( - Text.translatable( - "text.homabric.home_location_updated", Text.literal(homeName).formatted( - Formatting.WHITE - ) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.home_location_updated", Text.literal(homeName).formatted( + Formatting.WHITE + ) + ).formatted(Formatting.GREEN) + }, false ) } Homabric.saveAndReloadConfig() @@ -206,15 +214,17 @@ object BaseCommands { val homeName = context.getArgument("home", String::class.java) when (getOrCreatePlayer(context.source.name).removeHome(homeName)) { PlayerObject.HomeRemoveResult.NO_HOME -> { - context.source.sendFeedback(Text.translatable("text.homabric.no_home").formatted(Formatting.RED), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_home").formatted(Formatting.RED) }, false) } PlayerObject.HomeRemoveResult.HOME_REMOVED -> { context.source.sendFeedback( - Text.translatable( - "text.homabric.home_removed", Text.literal(homeName).formatted( - Formatting.WHITE - ) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.home_removed", Text.literal(homeName).formatted( + Formatting.WHITE + ) + ).formatted(Formatting.GREEN) + }, false ) } } @@ -236,31 +246,31 @@ object BaseCommands { when (getOrCreatePlayer(context.source.name).allowHome(homeName, allowedPlayer)) { PlayerObject.HomeAllowResult.NO_PLAYER -> { context.source.sendFeedback( - Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED), false + { Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED) }, false ) } PlayerObject.HomeAllowResult.NO_SELF_ALLOW -> { context.source.sendFeedback( - Text.translatable("text.homabric.allow_self").formatted(Formatting.BLUE), false + { Text.translatable("text.homabric.allow_self").formatted(Formatting.BLUE) }, false ) } PlayerObject.HomeAllowResult.NO_HOME -> { - context.source.sendFeedback(Text.translatable("text.homabric.no_home").formatted(Formatting.RED), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_home").formatted(Formatting.RED) }, false) } PlayerObject.HomeAllowResult.ALREADY_ALLOWED -> { context.source.sendFeedback( - Text.translatable("text.homabric.already_allowed").formatted(Formatting.RED), false + { Text.translatable("text.homabric.already_allowed").formatted(Formatting.RED) }, false ) } PlayerObject.HomeAllowResult.HOME_ALLOWED -> { context.source.sendFeedback( - Text.translatable( - "text.homabric.allowed", Text.literal(homeName).formatted( - Formatting.WHITE - ), Text.literal(allowedPlayer.entityName).formatted(Formatting.AQUA) - ).formatted( - Formatting.GREEN - ), false + { + Text.translatable( + "text.homabric.allowed", Text.literal(homeName).formatted( + Formatting.WHITE + ), Text.literal(allowedPlayer.entityName).formatted(Formatting.AQUA) + ).formatted(Formatting.GREEN) + }, false ) } } @@ -274,24 +284,26 @@ object BaseCommands { when (getOrCreatePlayer(context.source.name).disallowHome(homeName, disallowedPlayer)) { PlayerObject.HomeDisallowResult.NO_PLAYER -> { context.source.sendFeedback( - Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED), false + { Text.translatable("text.homabric.no_player_exists").formatted(Formatting.RED) }, false ) } PlayerObject.HomeDisallowResult.NO_HOME -> { - context.source.sendFeedback(Text.translatable("text.homabric.no_home").formatted(Formatting.RED), false) + context.source.sendFeedback({ Text.translatable("text.homabric.no_home").formatted(Formatting.RED) }, false) } PlayerObject.HomeDisallowResult.NOT_ALLOWED -> { context.source.sendFeedback( - Text.translatable("text.homabric.no_player_disallow").formatted(Formatting.RED), false + { Text.translatable("text.homabric.no_player_disallow").formatted(Formatting.RED) }, false ) } PlayerObject.HomeDisallowResult.HOME_ALLOWED -> { context.source.sendFeedback( - Text.translatable( - "text.homabric.disallowed", Text.literal(homeName).formatted( - Formatting.WHITE - ), Text.literal(disallowedPlayer).formatted(Formatting.AQUA) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.disallowed", Text.literal(homeName).formatted( + Formatting.WHITE + ), Text.literal(disallowedPlayer).formatted(Formatting.AQUA) + ).formatted(Formatting.GREEN) + }, false ) } } diff --git a/src/main/kotlin/space/rogi27/homabric/objects/HomeObject.kt b/src/main/kotlin/space/rogi27/homabric/objects/HomeObject.kt index 5d809c3..c903c76 100644 --- a/src/main/kotlin/space/rogi27/homabric/objects/HomeObject.kt +++ b/src/main/kotlin/space/rogi27/homabric/objects/HomeObject.kt @@ -61,8 +61,8 @@ class HomeObject { player.addExperience(0) } - player.getWorld().spawnParticles(ParticleTypes.GLOW_SQUID_INK, oldPos.x, oldPos.y, oldPos.z, 50, 2.0, 2.0, 2.0, 0.1) - player.getWorld().spawnParticles(ParticleTypes.GLOW_SQUID_INK, x, y, z, 50, 2.0, 2.0, 2.0, 0.1) + player.serverWorld.spawnParticles(ParticleTypes.GLOW_SQUID_INK, oldPos.x, oldPos.y, oldPos.z, 50, 2.0, 2.0, 2.0, 0.1) + player.serverWorld.spawnParticles(ParticleTypes.GLOW_SQUID_INK, x, y, z, 50, 2.0, 2.0, 2.0, 0.1) return true } diff --git a/src/main/kotlin/space/rogi27/homabric/objects/PlayerObject.kt b/src/main/kotlin/space/rogi27/homabric/objects/PlayerObject.kt index b316bb2..efcbe88 100644 --- a/src/main/kotlin/space/rogi27/homabric/objects/PlayerObject.kt +++ b/src/main/kotlin/space/rogi27/homabric/objects/PlayerObject.kt @@ -133,9 +133,11 @@ class PlayerObject { TeleportHelper.runTeleport(source.player!!, fun() { data.teleportPlayer(source.player!!) source.sendFeedback( - Text.translatable( - "text.homabric.teleport_done", Text.literal(key).formatted(Formatting.WHITE) - ).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.teleport_done", Text.literal(key).formatted(Formatting.WHITE) + ).formatted(Formatting.GREEN) + }, false ) }) }.build() @@ -244,7 +246,12 @@ class PlayerObject { TeleportHelper.runTeleport(player, fun() { home.teleportPlayer(player) source.sendFeedback( - Text.translatable("text.homabric.teleport_done", Text.literal(homeName).formatted(Formatting.WHITE)).formatted(Formatting.GREEN), false + { + Text.translatable( + "text.homabric.teleport_done", + Text.literal(homeName).formatted(Formatting.WHITE) + ).formatted(Formatting.GREEN) + }, false ) }) return TeleportToOtherResult.TELEPORT_DONE