mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
remove use of legacy currentMinecraftVersionArray
This commit is contained in:
parent
f82ccfa07e
commit
9d616d2fd0
4 changed files with 15 additions and 38 deletions
|
|
@ -6,29 +6,29 @@ object MinecraftVersionUtil {
|
|||
|
||||
val craftbukkitVersion: String?
|
||||
get() {
|
||||
val versionParts = UpdateUtils.currentMinecraftVersionArray()
|
||||
if (versionParts[0] != 1) return null
|
||||
val version = UpdateUtils.currentMinecraftVersion()
|
||||
if (version.major != 1) return null
|
||||
|
||||
return when (versionParts[1]) {
|
||||
17 -> when (versionParts[2]) {
|
||||
return when (version.minor) {
|
||||
17 -> when (version.patch) {
|
||||
0, 1 -> "1_17R1"
|
||||
else -> null
|
||||
}
|
||||
|
||||
18 -> when (versionParts[2]) {
|
||||
18 -> when (version.patch) {
|
||||
0, 1 -> "1_18R1"
|
||||
2 -> "1_18R2"
|
||||
else -> null
|
||||
}
|
||||
|
||||
19 -> when (versionParts[2]) {
|
||||
19 -> when (version.patch) {
|
||||
0, 1, 2 -> "1_19R1"
|
||||
3 -> "1_19R2"
|
||||
4 -> "1_19R3"
|
||||
else -> null
|
||||
}
|
||||
|
||||
20 -> when (versionParts[2]) {
|
||||
20 -> when (version.patch) {
|
||||
0, 1 -> "1_20R1"
|
||||
2 -> "1_20R2"
|
||||
3, 4 -> "1_20R3"
|
||||
|
|
@ -36,7 +36,7 @@ object MinecraftVersionUtil {
|
|||
else -> null
|
||||
}
|
||||
|
||||
21 -> when (versionParts[2]) {
|
||||
21 -> when (version.patch) {
|
||||
0, 1 -> "1_21R1"
|
||||
2, 3 -> "1_21R2"
|
||||
4 -> "1_21R3"
|
||||
|
|
@ -52,8 +52,7 @@ object MinecraftVersionUtil {
|
|||
}
|
||||
|
||||
val isTooNewForSpigot: Boolean get() {
|
||||
val versionParts = UpdateUtils.currentMinecraftVersionArray()
|
||||
return versionParts[0] != 1
|
||||
return UpdateUtils.currentMinecraftVersion().major != 1
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,8 +38,8 @@ object PacketManagerSelector {
|
|||
// Reobfuscated packet manager for spigot or paper as it remap
|
||||
private val reobfPacketManager: PacketManagerBase?
|
||||
get() {
|
||||
val versionParts = UpdateUtils.currentMinecraftVersionArray()
|
||||
if (versionParts[0] != 1) return null
|
||||
val versionParts = UpdateUtils.currentMinecraftVersion()
|
||||
if (versionParts.major != 1) return null
|
||||
|
||||
try {
|
||||
val clazz = Class.forName("xyz.alexcrea.cuanvil.dependency.packet.versions." +
|
||||
|
|
@ -47,7 +47,7 @@ object PacketManagerSelector {
|
|||
|
||||
val manager = clazz.getConstructor().newInstance()
|
||||
return manager as PacketManagerBase
|
||||
} catch (e: ClassNotFoundException) {
|
||||
} catch (_: ClassNotFoundException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue