This repository has been archived by the owner on Dec 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b4e419
commit 7b61c3b
Showing
28 changed files
with
1,748 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,7 @@ bin/ | |
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store | ||
.DS_Store | ||
|
||
### Minecraft ### | ||
run/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
dist/src/main/kotlin/kr/toxicity/animator/util/MinecraftVersion.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package kr.toxicity.animator.util | ||
|
||
import org.bukkit.Bukkit | ||
|
||
data class MinecraftVersion( | ||
val first: Int, | ||
val second: Int, | ||
val third: Int | ||
): Comparable<MinecraftVersion> { | ||
companion object { | ||
val current = MinecraftVersion(Bukkit.getBukkitVersion().substringBefore('-')) | ||
|
||
val version1_21_3 = MinecraftVersion(1, 21, 3) | ||
val version1_21_2 = MinecraftVersion(1, 21, 2) | ||
val version1_21_1 = MinecraftVersion(1, 21, 1) | ||
val version1_21 = MinecraftVersion(1, 21, 0) | ||
val version1_20_6 = MinecraftVersion(1, 20, 6) | ||
val version1_20_5 = MinecraftVersion(1, 20, 5) | ||
val version1_20_4 = MinecraftVersion(1, 20, 4) | ||
val version1_20_3 = MinecraftVersion(1, 20, 3) | ||
val version1_20_2 = MinecraftVersion(1, 20, 2) | ||
val version1_20_1 = MinecraftVersion(1, 20, 1) | ||
val version1_20 = MinecraftVersion(1, 20, 0) | ||
val version1_19_4 = MinecraftVersion(1, 19, 4) | ||
|
||
private val comparator = Comparator.comparing { v: MinecraftVersion -> | ||
v.first | ||
}.thenComparing { v: MinecraftVersion -> | ||
v.second | ||
}.thenComparing { v: MinecraftVersion -> | ||
v.third | ||
} | ||
} | ||
|
||
constructor(string: String): this(string.split('.')) | ||
constructor(string: List<String>): this( | ||
if (string.isNotEmpty()) string[0].toInt() else 0, | ||
if (string.size > 1) string[1].toInt() else 0, | ||
if (string.size > 2) string[2].toInt() else 0 | ||
) | ||
override fun compareTo(other: MinecraftVersion): Int { | ||
return comparator.compare(this, other) | ||
} | ||
|
||
override fun toString(): String { | ||
return if (third == 0) "$first.$second" else "$first.$second.$third" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.