From db05b391b03581d4b881060cafc2d55461523b58 Mon Sep 17 00:00:00 2001 From: Aria Date: Fri, 20 Dec 2019 00:37:21 +0100 Subject: [PATCH] Fixed not loading MMOItems properly, disabling some compatability. (Mainly Custom Block Regen) --- src/main/java/net/Indyuce/mmocore/MMOCore.java | 9 ++++++--- .../java/net/Indyuce/mmocore/listener/BlockListener.java | 2 +- .../net/Indyuce/mmocore/manager/CustomBlockManager.java | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index e7673d1b..899d1cdb 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -138,7 +138,7 @@ public class MMOCore extends JavaPlugin { public final MMOLoadManager loadManager = new MMOLoadManager(); public RPGUtilHandler rpgUtilHandler = new DefaultRPGUtilHandler(); - private boolean miLoaded; + private boolean miLoaded, miChecked; public void onLoad() { plugin = this; @@ -363,8 +363,6 @@ public class MMOCore extends JavaPlugin { } }.runTaskTimerAsynchronously(MMOCore.plugin, autosave, autosave); } - - miLoaded = Bukkit.getPluginManager().isPluginEnabled("MMOItems"); } public void onDisable() { @@ -444,6 +442,11 @@ public class MMOCore extends JavaPlugin { } public boolean isMILoaded() { + if(!miChecked) { + miLoaded = Bukkit.getPluginManager().isPluginEnabled("MMOItems"); + miChecked = true; + } + return miLoaded; } } diff --git a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java index d05247b0..93f03ce7 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java @@ -64,7 +64,7 @@ public class BlockListener implements Listener { return; } - if (!perms.canMine(getBlockName(block))) { + if(!perms.canMine(getBlockName(block))) { MMOCore.plugin.configManager.getSimpleMessage("cannot-break").send(player); event.setCancelled(true); return; diff --git a/src/main/java/net/Indyuce/mmocore/manager/CustomBlockManager.java b/src/main/java/net/Indyuce/mmocore/manager/CustomBlockManager.java index c292f304..4b9e59cd 100644 --- a/src/main/java/net/Indyuce/mmocore/manager/CustomBlockManager.java +++ b/src/main/java/net/Indyuce/mmocore/manager/CustomBlockManager.java @@ -60,7 +60,7 @@ public class CustomBlockManager extends MMOManager { if(MMOCore.plugin.isMILoaded()) if(MMOItems.plugin.getCustomBlocks().isMushroomBlock(block.getType())) { CustomBlock cblock = CustomBlock.getFromData(block.getBlockData()); - if(block != null) + if(cblock != null) return map.getOrDefault("mi-custom-" + cblock.getId(), map.getOrDefault(block.getType().name(), null)); }