From 54057f59dd832b27b3d777ed7982677beb95dfb2 Mon Sep 17 00:00:00 2001 From: StillLutto Date: Sun, 22 Dec 2024 13:37:43 +0100 Subject: [PATCH] refactor: some minor refactoring --- .../stellar/data/argument/Operation.kt | 1 - .../main/kotlin/com/undefined/stellar/Main.kt | 10 +++----- .../stellar/v1_19_2/ArgumentHelper.kt | 8 +++--- .../stellar/v1_19_3/ArgumentHelper.kt | 8 +++--- .../stellar/v1_19_4/ArgumentHelper.kt | 8 +++--- .../undefined/stellar/v1_20/ArgumentHelper.kt | 24 +++++++++++++++--- .../stellar/v1_20_1/ArgumentHelper.kt | 25 ++++++++++++++++--- .../stellar/v1_20_2/ArgumentHelper.kt | 8 +++--- .../stellar/v1_20_4/ArgumentHelper.kt | 8 +++--- .../stellar/v1_20_6/ArgumentHelper.kt | 8 +++--- .../undefined/stellar/v1_21/ArgumentHelper.kt | 8 +++--- .../stellar/v1_21_1/ArgumentHelper.kt | 8 +++--- .../stellar/v1_21_3/ArgumentHelper.kt | 8 +++--- .../stellar/v1_21_4/ArgumentHelper.kt | 8 +++--- 14 files changed, 97 insertions(+), 43 deletions(-) diff --git a/common/src/main/kotlin/com/undefined/stellar/data/argument/Operation.kt b/common/src/main/kotlin/com/undefined/stellar/data/argument/Operation.kt index 7c50e24..658d703 100644 --- a/common/src/main/kotlin/com/undefined/stellar/data/argument/Operation.kt +++ b/common/src/main/kotlin/com/undefined/stellar/data/argument/Operation.kt @@ -19,6 +19,5 @@ enum class Operation(val string: String, private val application: (a: Float, b: } fun apply(a: Float, b: Float): Float = application(a, b) - fun apply(a: Int, b: Int): Float = apply(a.toFloat(), b.toFloat()) } \ No newline at end of file diff --git a/server/src/main/kotlin/com/undefined/stellar/Main.kt b/server/src/main/kotlin/com/undefined/stellar/Main.kt index 8c9163d..c3cb6a4 100644 --- a/server/src/main/kotlin/com/undefined/stellar/Main.kt +++ b/server/src/main/kotlin/com/undefined/stellar/Main.kt @@ -1,18 +1,16 @@ package com.undefined.stellar -import org.bukkit.Bukkit -import org.bukkit.Material import org.bukkit.entity.Player -import org.bukkit.inventory.ItemStack import org.bukkit.plugin.java.JavaPlugin class Main : JavaPlugin() { override fun onEnable() { - StellarCommand("test") - .addStringArgument(name = "string") + StellarCommand("set-time") + .addTimeArgument("time") .addExecution { - sender.sendMessage(getArgument("string")) + val time = getArgument("time") + sender.world.time = time } .register(this) } diff --git a/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/ArgumentHelper.kt b/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/ArgumentHelper.kt index edbb02b..02c816c 100644 --- a/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/ArgumentHelper.kt +++ b/v1_19_2/src/main/kotlin/com/undefined/stellar/v1_19_2/ArgumentHelper.kt @@ -221,8 +221,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -241,7 +243,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is GameModeArgument -> throwArgumentVersionException(argument) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> throwArgumentVersionException(argument) diff --git a/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/ArgumentHelper.kt b/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/ArgumentHelper.kt index c82ee0c..8f6d390 100644 --- a/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/ArgumentHelper.kt +++ b/v1_19_3/src/main/kotlin/com/undefined/stellar/v1_19_3/ArgumentHelper.kt @@ -223,8 +223,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -243,7 +245,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> throwArgumentVersionException(argument) diff --git a/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/ArgumentHelper.kt b/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/ArgumentHelper.kt index 1264a41..c44d19f 100644 --- a/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/ArgumentHelper.kt +++ b/v1_19_4/src/main/kotlin/com/undefined/stellar/v1_19_4/ArgumentHelper.kt @@ -231,8 +231,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -251,7 +253,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) diff --git a/v1_20/src/main/kotlin/com/undefined/stellar/v1_20/ArgumentHelper.kt b/v1_20/src/main/kotlin/com/undefined/stellar/v1_20/ArgumentHelper.kt index 5c71bfa..0325335 100644 --- a/v1_20/src/main/kotlin/com/undefined/stellar/v1_20/ArgumentHelper.kt +++ b/v1_20/src/main/kotlin/com/undefined/stellar/v1_20/ArgumentHelper.kt @@ -228,8 +228,9 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, 0.0, 0.0, 0.0, rotation.y, rotation.x) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -248,7 +249,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) @@ -388,7 +389,24 @@ object ArgumentHelper { private fun getBukkitDisplaySlot(slot: Int): DisplaySlot = when (slot) { 0 -> DisplaySlot.PLAYER_LIST + 1 -> DisplaySlot.SIDEBAR 2 -> DisplaySlot.BELOW_NAME + 3 -> DisplaySlot.SIDEBAR_TEAM_BLACK + 4 -> DisplaySlot.SIDEBAR_TEAM_DARK_BLUE + 5 -> DisplaySlot.SIDEBAR_TEAM_DARK_GREEN + 6 -> DisplaySlot.SIDEBAR_TEAM_DARK_AQUA + 7 -> DisplaySlot.SIDEBAR_TEAM_DARK_RED + 8 -> DisplaySlot.SIDEBAR_TEAM_DARK_PURPLE + 9 -> DisplaySlot.SIDEBAR_TEAM_GOLD + 10 -> DisplaySlot.SIDEBAR_TEAM_GRAY + 11 -> DisplaySlot.SIDEBAR_TEAM_DARK_GRAY + 12 -> DisplaySlot.SIDEBAR_TEAM_BLUE + 13 -> DisplaySlot.SIDEBAR_TEAM_GREEN + 14 -> DisplaySlot.SIDEBAR_TEAM_AQUA + 15 -> DisplaySlot.SIDEBAR_TEAM_RED + 16 -> DisplaySlot.SIDEBAR_TEAM_LIGHT_PURPLE + 17 -> DisplaySlot.SIDEBAR_TEAM_YELLOW + 18 -> DisplaySlot.SIDEBAR_TEAM_WHITE else -> DisplaySlot.SIDEBAR } diff --git a/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/ArgumentHelper.kt b/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/ArgumentHelper.kt index cc78d48..7e6bec9 100644 --- a/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/ArgumentHelper.kt +++ b/v1_20_1/src/main/kotlin/com/undefined/stellar/v1_20_1/ArgumentHelper.kt @@ -228,8 +228,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -248,7 +250,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) @@ -388,7 +390,24 @@ object ArgumentHelper { private fun getBukkitDisplaySlot(slot: Int): DisplaySlot = when (slot) { 0 -> DisplaySlot.PLAYER_LIST + 1 -> DisplaySlot.SIDEBAR 2 -> DisplaySlot.BELOW_NAME + 3 -> DisplaySlot.SIDEBAR_TEAM_BLACK + 4 -> DisplaySlot.SIDEBAR_TEAM_DARK_BLUE + 5 -> DisplaySlot.SIDEBAR_TEAM_DARK_GREEN + 6 -> DisplaySlot.SIDEBAR_TEAM_DARK_AQUA + 7 -> DisplaySlot.SIDEBAR_TEAM_DARK_RED + 8 -> DisplaySlot.SIDEBAR_TEAM_DARK_PURPLE + 9 -> DisplaySlot.SIDEBAR_TEAM_GOLD + 10 -> DisplaySlot.SIDEBAR_TEAM_GRAY + 11 -> DisplaySlot.SIDEBAR_TEAM_DARK_GRAY + 12 -> DisplaySlot.SIDEBAR_TEAM_BLUE + 13 -> DisplaySlot.SIDEBAR_TEAM_GREEN + 14 -> DisplaySlot.SIDEBAR_TEAM_AQUA + 15 -> DisplaySlot.SIDEBAR_TEAM_RED + 16 -> DisplaySlot.SIDEBAR_TEAM_LIGHT_PURPLE + 17 -> DisplaySlot.SIDEBAR_TEAM_YELLOW + 18 -> DisplaySlot.SIDEBAR_TEAM_WHITE else -> DisplaySlot.SIDEBAR } diff --git a/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/ArgumentHelper.kt b/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/ArgumentHelper.kt index d15c477..76b7e99 100644 --- a/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/ArgumentHelper.kt +++ b/v1_20_2/src/main/kotlin/com/undefined/stellar/v1_20_2/ArgumentHelper.kt @@ -228,8 +228,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -248,7 +250,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) diff --git a/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/ArgumentHelper.kt b/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/ArgumentHelper.kt index 929c808..59f80b1 100644 --- a/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/ArgumentHelper.kt +++ b/v1_20_4/src/main/kotlin/com/undefined/stellar/v1_20_4/ArgumentHelper.kt @@ -228,8 +228,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -248,7 +250,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) diff --git a/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt b/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt index 2aaf4c8..a454403 100644 --- a/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt +++ b/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt @@ -226,8 +226,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -246,7 +248,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) diff --git a/v1_21/src/main/kotlin/com/undefined/stellar/v1_21/ArgumentHelper.kt b/v1_21/src/main/kotlin/com/undefined/stellar/v1_21/ArgumentHelper.kt index 3f2b2ae..4f60aec 100644 --- a/v1_21/src/main/kotlin/com/undefined/stellar/v1_21/ArgumentHelper.kt +++ b/v1_21/src/main/kotlin/com/undefined/stellar/v1_21/ArgumentHelper.kt @@ -227,8 +227,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -247,7 +249,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) diff --git a/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/ArgumentHelper.kt b/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/ArgumentHelper.kt index b58eee6..263fe24 100644 --- a/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/ArgumentHelper.kt +++ b/v1_21_1/src/main/kotlin/com/undefined/stellar/v1_21_1/ArgumentHelper.kt @@ -227,8 +227,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -247,7 +249,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) diff --git a/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/ArgumentHelper.kt b/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/ArgumentHelper.kt index a2d9e0e..030c51d 100644 --- a/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/ArgumentHelper.kt +++ b/v1_21_3/src/main/kotlin/com/undefined/stellar/v1_21_3/ArgumentHelper.kt @@ -227,8 +227,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -247,7 +249,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name) diff --git a/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/ArgumentHelper.kt b/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/ArgumentHelper.kt index 639f119..7566118 100644 --- a/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/ArgumentHelper.kt +++ b/v1_21_4/src/main/kotlin/com/undefined/stellar/v1_21_4/ArgumentHelper.kt @@ -227,8 +227,10 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.math.AngleArgument -> AngleArgument.getAngle(context, argument.name) is com.undefined.stellar.argument.types.math.RotationArgument -> { - val rotation = RotationArgument.getRotation(context, argument.name).getPosition(context.source) - Location(context.source.level.world, rotation.x, rotation.y, rotation.z) + val coordinates = RotationArgument.getRotation(context, argument.name) + val position = coordinates.getPosition(context.source) + val rotation = coordinates.getRotation(context.source) + Location(context.source.bukkitWorld, position.x, position.y, position.z, rotation.x, rotation.y) } is DisplaySlotArgument -> getBukkitDisplaySlot(ScoreboardSlotArgument.getDisplaySlot(context, argument.name)) is com.undefined.stellar.argument.types.scoreboard.ScoreHolderArgument -> when (argument.type) { @@ -247,7 +249,7 @@ object ArgumentHelper { } is com.undefined.stellar.argument.types.world.DimensionArgument -> DimensionArgument.getDimension(context, argument.name).world.environment is com.undefined.stellar.argument.types.player.GameModeArgument -> GameMode.getByValue(GameModeArgument.getGameMode(context, argument.name).id) - is com.undefined.stellar.argument.types.math.TimeArgument -> Duration.ofSeconds(IntegerArgumentType.getInteger(context, argument.name).toLong() / 20) + is com.undefined.stellar.argument.types.math.TimeArgument -> IntegerArgumentType.getInteger(context, argument.name).toLong() is MirrorArgument -> Mirror.valueOf(TemplateMirrorArgument.getMirror(context, argument.name).name) is StructureRotationArgument -> StructureRotation.valueOf(TemplateRotationArgument.getRotation(context, argument.name).name) is HeightMapArgument -> HeightMap.valueOf(HeightmapTypeArgument.getHeightmap(context, argument.name).name)