1818import org .bukkit .persistence .PersistentDataType ;
1919import org .bukkit .plugin .java .JavaPlugin ;
2020
21+ import valorless .valorlessutils .Server .Version ;
2122import valorless .valorlessutils .config .Config ;
2223import valorless .valorlessutils .crafting .CraftRecipe ;
2324import valorless .valorlessutils .crafting .CraftRecipe .RecipeType ;
2627import valorless .valorlessutils .types .Vector3 ;
2728
2829public final class ValorlessUtils extends JavaPlugin implements Listener {
29- public enum Version { NULL , v1_17 , v1_17_1 , v1_18 , v1_18_1 , v1_18_2 , v1_19 , v1_19_1 , v1_19_2 , v1_19_3 , v1_19_4 , v1_20 , v1_20_1 , v1_20_3 , v1_20_4 , v1_20_5 , v1_20_6 , v1_21 , v1_21_1 }
3030 public static JavaPlugin thisPlugin ;
31+ public static JavaPlugin plugin ;
3132 String Name = "§7[§6Valorless§bUtils§7]§r" ;
3233
33- public static class Server {
34- public static Version version ;
35- }
34+ private static Version version ;
3635
3736 public static Config config ;
3837
@@ -60,10 +59,17 @@ public static void bread() {
6059 */
6160 public void onLoad () {
6261 thisPlugin = this ;
63- Log .Debug (this , Bukkit .getVersion ());
64- Log .Debug (this , Bukkit .getBukkitVersion ());
65- ResolveVersion ();
62+ plugin = this ;
63+ Server .ResolveVersion ();
6664 }
65+
66+ /**
67+ * Gets the Version of the server.
68+ * @return {@link valorless.valorlessutils.Server.Version Version}.
69+ */
70+ public static Version getServerVersion () {
71+ return version ;
72+ }
6773
6874 @ Override
6975 public void onEnable () {
@@ -144,7 +150,7 @@ public void onDisable() {
144150 * @return The instance of the plugin.
145151 */
146152 public static ValorlessUtils GetInstance () {
147- return (ValorlessUtils ) thisPlugin ;
153+ return (ValorlessUtils ) plugin ;
148154 }
149155
150156 /**
@@ -159,21 +165,10 @@ public void AddCommand(String command, String... alias) {
159165 getCommand (alias [0 ]).setExecutor (this );
160166 }
161167 }
162-
163- void ResolveVersion () {
164- try {
165- String v = Bukkit .getBukkitVersion ().split ("-" )[0 ];
166- Server .version = Version .valueOf ("v" + v .replace ("." , "_" ));
167- //Log.Debug(plugin, server.toString());
168- } catch (Exception e ) {
169- Server .version = Version .NULL ;
170- Log .Error (this , "Failed to resolve server version, some functions might not work correctly." );
171- }
172- }
173168
174169 // Functions
175170
176- /**
171+ /**
177172 * Deprecated utility class. Use 'valorless.valorlessutils.utils.Utils' instead.
178173 * @deprecated Will be removed at a later date.
179174 */
0 commit comments