- * Assumes 0 patch version.
- *
- * @param minor Min Minor Version
- * @return Meets the version requested
- */
- public static boolean isVersion(int minor) {
- return PaperLib.isVersion(minor);
- }
-
- /**
- * Detects if the current MC version is at least the following version.
- * @param minor Min Minor Version
- * @param patch Min Patch Version
- * @return Meets the version requested
- */
- public static boolean isVersion(int minor, int patch) {
- return PaperLib.isVersion(minor, patch);
- }
-
- /**
- * Gets the current Minecraft Minor version. IE: 1.13.1 returns 13
- * @return The Minor Version
- */
- public static int getMinecraftVersion() {
- return PaperLib.getMinecraftVersion();
- }
-
- /**
- * Gets the current Minecraft Patch version. IE: 1.13.1 returns 1
- * @return The Patch Version
- */
- public static int getMinecraftPatchVersion() {
- return PaperLib.getMinecraftPatchVersion();
+ return world.isChunkGenerated(x, z);
}
/**
@@ -562,42 +540,26 @@ public static boolean isVersionCompatible(String version, String requiredVersion
return !(!isRequiredSnapshot && isVersionSnapshot);
}
- /**
- * Check if the server has access to the Spigot API
- * @return True for Spigot and Paper environments
- */
- public static boolean isSpigot() {
- return PaperLib.isSpigot();
- }
-
/**
* Check if the server has access to the Paper API
* @return True for Paper environments
*/
public static boolean isPaper() {
- return !isJUnitTest() && PaperLib.isPaper();
- }
-
- /**
- * I don't like doing this, but otherwise we need to set a flag in every test
- */
- private static boolean isJUnitTest() {
- StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
- for (StackTraceElement element : stackTrace) {
- if (element.getClassName().startsWith("org.junit.")) {
- return true;
- }
+ try {
+ Class.forName("com.destroystokyo.paper.PaperConfig");
+ return true; // Paper-specific class exists
+ } catch (ClassNotFoundException e) {
+ return false; // Not a Paper server
}
- return false;
}
-
/**
* This method translates color codes in given string and strips whitespace after them.
* This code parses both: hex and old color codes.
* @param textToColor Text which color codes must be parsed.
* @return String text with parsed colors and stripped whitespaces after them.
*/
+ @SuppressWarnings("deprecation")
@NonNull
public static String translateColorCodes(@NonNull String textToColor) {
// Use matcher to find hex patterns in given text.
@@ -760,8 +722,14 @@ public static void runCommands(User user, String ownerName, @NonNull List