diff --git a/README.md b/README.md index 6f1862f1..f4b5e5e3 100644 --- a/README.md +++ b/README.md @@ -159,8 +159,8 @@ This plugin is licensed under the MIT license. For more information on it, you c Because I don't have the time or motivation to support a lot of versions, and it is generally advised to update to the latest Minecraft/Spigot versions only the last 3 major updates with the latest builds are supported. -At the time of writing this would be 1.19.3, 1.18.2 and 1.17.1, but not 1.18, 1.16.4 or 1.15.2. +At the time of writing this would be 1.20, 1.19.4 and 1.18.2 but not 1.18, 1.16.4 or 1.15.2. ### Java version -Java 16 is the minimum required version. +Java 17 is the minimum required version. diff --git a/gradle.properties b/gradle.properties index 99a444be..8385f8c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,21 +2,21 @@ org.gradle.jvmargs=-Xmx2G org.gradle.warning.mode=all # Kotlin -jvmTarget=16 -kotlinVersion=1.8.10 +jvmTarget=17 +kotlinVersion=1.8.21 shadowVersion=8.1.0 dokkaVersion=1.7.20 group=de.md5lukas.waypoints -version=3.6.3 +version=3.6.4 # Spigot -spigotVersion=1.17.1-R0.1-SNAPSHOT +spigotVersion=1.18.2-R0.1-SNAPSHOT # Required dependencies md5CommonsVersion=2.0.0 sqliteHelperVersion=1.2.0 kinvsVersion=1.0.2 anvilGUIVersion=1.6.6-SNAPSHOT bstatsVersion=3.0.1 -commandApiVersion=9.0.0 +commandApiVersion=9.0.2 # Optional dependencies vaultVersion=1.7.1 dynmapVersion=3.3 diff --git a/utils/src/main/kotlin/de/md5lukas/waypoints/util/SpigotHelper.kt b/utils/src/main/kotlin/de/md5lukas/waypoints/util/SpigotHelper.kt index 2ac4bce5..bd3c385e 100644 --- a/utils/src/main/kotlin/de/md5lukas/waypoints/util/SpigotHelper.kt +++ b/utils/src/main/kotlin/de/md5lukas/waypoints/util/SpigotHelper.kt @@ -89,21 +89,10 @@ fun parseLocationString(player: Player, input: String): Location? { } } -private const val MAX_MAP_SIZE: Double = 30_000_000.0 +fun isLocationOutOfBounds(location: Location): Boolean { + val world = location.world!! -fun isLocationOutOfBounds(plugin: Plugin, location: Location): Boolean { - if (abs(location.x) >= MAX_MAP_SIZE || abs(location.z) >= MAX_MAP_SIZE) { - return true - } - - // TODO: Remove once 1.20 is out - val validYValues = if (isMinecraftVersionEqualOrLaterThan(plugin, 18, 0)) { - -64..320 - } else { - 0..256 - } - - return location.y.roundToInt() !in validYValues + return !world.worldBorder.isInside(location) || location.y.roundToInt() !in world.minHeight until world.maxHeight } fun isMinecraftVersionEqualOrLaterThan(plugin: Plugin, major: Int, minor: Int = 0): Boolean { diff --git a/waypoints/build.gradle.kts b/waypoints/build.gradle.kts index db358dab..2e180caf 100644 --- a/waypoints/build.gradle.kts +++ b/waypoints/build.gradle.kts @@ -109,7 +109,7 @@ kotlin { tasks.withType { // To make sure we have an explicit dependency on the project itself because otherwise we will get a warning that we only depend on an output file and not the project itself - dependsOn(project(":api-sqlite").tasks.jar) + dependsOn(project(":api-sqlite").tasks.shadowJar) } tasks.withType { @@ -154,7 +154,7 @@ modrinth { versionType.set("release") uploadFile.set(tasks.shadowJar as Any) - gameVersions.addAll("1.19.3", "1.18.2", "1.17.1") + gameVersions.addAll("1.20", "1.19.4", "1.18.2") loaders.addAll("spigot", "paper") syncBodyFrom.set(rootProject.file("README.md").readText()) diff --git a/waypoints/src/main/kotlin/de/md5lukas/waypoints/command/WaypointsCommand.kt b/waypoints/src/main/kotlin/de/md5lukas/waypoints/command/WaypointsCommand.kt index 71236b66..3736aa71 100644 --- a/waypoints/src/main/kotlin/de/md5lukas/waypoints/command/WaypointsCommand.kt +++ b/waypoints/src/main/kotlin/de/md5lukas/waypoints/command/WaypointsCommand.kt @@ -172,7 +172,7 @@ class WaypointsCommand(private val plugin: WaypointsPlugin) { playerExecutor { player, args -> val location = args[0] as Location - if (isLocationOutOfBounds(plugin, location)) { + if (isLocationOutOfBounds(location)) { translations.WAYPOINT_CREATE_COORDINATES_OUT_OF_BOUNDS.send(player) } else { plugin.api.pointerManager.let { diff --git a/waypoints/src/main/kotlin/de/md5lukas/waypoints/command/WaypointsScriptCommand.kt b/waypoints/src/main/kotlin/de/md5lukas/waypoints/command/WaypointsScriptCommand.kt index fa43f2f1..510d8406 100644 --- a/waypoints/src/main/kotlin/de/md5lukas/waypoints/command/WaypointsScriptCommand.kt +++ b/waypoints/src/main/kotlin/de/md5lukas/waypoints/command/WaypointsScriptCommand.kt @@ -78,7 +78,7 @@ class WaypointsScriptCommand(private val plugin: WaypointsPlugin) { return@anyExecutor } - if (isLocationOutOfBounds(plugin, target)) { + if (isLocationOutOfBounds(target)) { translations.WAYPOINT_CREATE_COORDINATES_OUT_OF_BOUNDS.send(sender) } else { plugin.api.pointerManager.let { diff --git a/waypoints/src/main/kotlin/de/md5lukas/waypoints/gui/pages/GUIFolderPage.kt b/waypoints/src/main/kotlin/de/md5lukas/waypoints/gui/pages/GUIFolderPage.kt index 0213c801..8b373c5f 100644 --- a/waypoints/src/main/kotlin/de/md5lukas/waypoints/gui/pages/GUIFolderPage.kt +++ b/waypoints/src/main/kotlin/de/md5lukas/waypoints/gui/pages/GUIFolderPage.kt @@ -200,7 +200,7 @@ class GUIFolderPage(wpGUI: WaypointsGUI, private val guiFolder: GUIFolder) : Lis if (location === null) { wpGUI.translations.WAYPOINT_CREATE_COORDINATES_INVALID_FORMAT.send(wpGUI.viewer) AnvilGUI.ResponseAction.replaceInputText(coordinates) - } else if (isLocationOutOfBounds(wpGUI.plugin, location)) { + } else if (isLocationOutOfBounds(location)) { wpGUI.translations.WAYPOINT_CREATE_COORDINATES_OUT_OF_BOUNDS.send(wpGUI.viewer) AnvilGUI.ResponseAction.replaceInputText(coordinates) } else { diff --git a/waypoints/src/main/kotlin/de/md5lukas/waypoints/util/APIHelper.kt b/waypoints/src/main/kotlin/de/md5lukas/waypoints/util/APIHelper.kt index 59a492d3..a624c7b2 100644 --- a/waypoints/src/main/kotlin/de/md5lukas/waypoints/util/APIHelper.kt +++ b/waypoints/src/main/kotlin/de/md5lukas/waypoints/util/APIHelper.kt @@ -110,7 +110,7 @@ private fun creationPreChecks(plugin: WaypointsPlugin, player: Player, location: return WorldUnavailable } - if (isLocationOutOfBounds(plugin, location)) { + if (isLocationOutOfBounds(location)) { plugin.translations.WAYPOINT_CREATE_COORDINATES_OUT_OF_BOUNDS.send(player) return LocationOutOfBounds }