-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix problems on load in versions >1.19.3
- Loading branch information
1 parent
8faf22a
commit 3f94ab4
Showing
3 changed files
with
33 additions
and
8 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
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
22 changes: 22 additions & 0 deletions
22
src/main/java/net/tonimatasdev/perworldplugins/util/Version.java
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,22 @@ | ||
package net.tonimatasdev.perworldplugins.util; | ||
|
||
import org.bukkit.Bukkit; | ||
|
||
public class Version { | ||
private static final String[] versionString = Bukkit.getBukkitVersion().split("-")[0].split("\\."); | ||
|
||
public static int getVersion() { | ||
// Create new StringBuilder. | ||
StringBuilder version = new StringBuilder(); | ||
|
||
// Append all versions. | ||
for (String number : versionString) { | ||
version.append(number); | ||
} | ||
|
||
if (versionString.length == 2) version.append(0); | ||
|
||
// Return version int (Example: 188 - 1.8.8) | ||
return Integer.parseInt(version.toString()); | ||
} | ||
} |