Przeglądaj źródła

Add UltraPermission warning to mcMMO

nossr50 4 lat temu
rodzic
commit
4f08c69557
2 zmienionych plików z 17 dodań i 2 usunięć
  1. 2 1
      Changelog.txt
  2. 15 1
      src/main/java/com/gmail/nossr50/mcMMO.java

+ 2 - 1
Changelog.txt

@@ -4,7 +4,8 @@ Version 2.1.182
     Fixed several errors in de locale (Thanks TheBusyBiscuit & w1tcherrr)
     Fixed a bug where double smelt never succeeded if the furnace was empty
     Added some safety so that mcMMO automatic save interval is never more frequent than 1 minute
-    Removed a few "silent" exceptions for scoreboards & mcMMO
+    Removed a few silent exceptions for scoreboards & mcMMO
+    Added warning about UltraPermissions to mcMMO
 
 Version 2.1.181
     mcMMO no longer pointlessly tries to check for missing UUIDs for FlatFile database

+ 15 - 1
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -74,6 +74,10 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class mcMMO extends JavaPlugin {
+    public static final String ULTRA_PERMISSONS = "UltraPermissons";
+    public static final String UP_WARNING_2 = "Stop using " + ULTRA_PERMISSONS + " with mcMMO immediately!";
+    public static final String UP_WARNING_1 = "mcMMO has detected " + ULTRA_PERMISSONS + " on your server, users have reported a severe plugin conflict between these two plugins which severely degrades server performance";
+    public static final String UP_WARNING_3 = "The author of UltraPermissions has passed away and its unlikely this issue will ever be solved";
     /* Managers */
     private static PlatformManager platformManager;
     private static ChunkManager       placeStore;
@@ -273,7 +277,17 @@ public class mcMMO extends JavaPlugin {
 //                getLogger().severe("mcMMO has detected ChatControlRed on your server, users have reported a severe plugin conflict between these two plugins which degrades server performance and wastes many server resources.");
 //                getLogger().severe("It is HIGHLY RECOMMENDED that you do --NOT-- use ChatControlRed until this issue is resolved!");
 //            }
-
+            if(pluginManager.getPlugin(ULTRA_PERMISSONS) != null) {
+                Bukkit.getScheduler().runTaskTimer(this, () -> {
+                    getLogger().severe(UP_WARNING_1);
+                    getLogger().severe(UP_WARNING_2);
+                    getLogger().severe(UP_WARNING_3);
+
+                    Bukkit.broadcastMessage(UP_WARNING_1);
+                    Bukkit.broadcastMessage(UP_WARNING_2);
+                    Bukkit.broadcastMessage(UP_WARNING_3);
+                    }, 0L, 1200L);
+            }
         }
         catch (Throwable t) {
             getLogger().severe("There was an error while enabling mcMMO!");