diff --git a/pom.xml b/pom.xml index 390cbf6..6818052 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ com.songoda EpicHoppers 4.0.0 - 4.6.16b + 4.6.17 clean install EpicHoppers-${project.version} diff --git a/src/main/java/com/songoda/epichoppers/EpicHoppers.java b/src/main/java/com/songoda/epichoppers/EpicHoppers.java index 21be662..3af5c72 100644 --- a/src/main/java/com/songoda/epichoppers/EpicHoppers.java +++ b/src/main/java/com/songoda/epichoppers/EpicHoppers.java @@ -10,6 +10,7 @@ import com.songoda.core.database.DatabaseConnector; import com.songoda.core.database.SQLiteConnector; import com.songoda.core.gui.GuiManager; import com.songoda.core.hooks.EconomyManager; +import com.songoda.core.hooks.ProtectionManager; import com.songoda.core.locale.Locale; import com.songoda.core.nms.NmsManager; import com.songoda.core.nms.nbt.NBTItem; @@ -99,6 +100,9 @@ public class EpicHoppers extends SongodaPlugin { // Load Economy EconomyManager.load(); + // Load protection hook + ProtectionManager.load(this); + // Setup Config Settings.setupConfig(); this.setLocale(Settings.LANGUGE_MODE.getString(), false); diff --git a/src/main/java/com/songoda/epichoppers/listeners/HopperListeners.java b/src/main/java/com/songoda/epichoppers/listeners/HopperListeners.java index 078b2ff..f24041a 100644 --- a/src/main/java/com/songoda/epichoppers/listeners/HopperListeners.java +++ b/src/main/java/com/songoda/epichoppers/listeners/HopperListeners.java @@ -66,10 +66,10 @@ public class HopperListeners implements Listener { // Special cases when a hopper is picking up items if (destination.getHolder() instanceof org.bukkit.block.Hopper) { - if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && !instance.getHopperManager().isHopper(destinationLocation)) + Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation); + if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && toHopper == null) return; // minecraft 1.8 doesn't have a method to get the hopper's location from the inventory, so we use the holder instead - Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation); final ItemStack toMove = event.getItem(); // Don't fill the last inventory slot on crafting hoppers (fixes crafters getting stuck) diff --git a/src/main/java/com/songoda/epichoppers/listeners/InteractListeners.java b/src/main/java/com/songoda/epichoppers/listeners/InteractListeners.java index 2e81871..be6325a 100644 --- a/src/main/java/com/songoda/epichoppers/listeners/InteractListeners.java +++ b/src/main/java/com/songoda/epichoppers/listeners/InteractListeners.java @@ -1,5 +1,6 @@ package com.songoda.epichoppers.listeners; +import com.songoda.core.hooks.ProtectionManager; import com.songoda.core.hooks.WorldGuardHook; import com.songoda.epichoppers.EpicHoppers; import com.songoda.epichoppers.hopper.Hopper; @@ -64,6 +65,11 @@ public class InteractListeners implements Listener { if (WorldGuardHook.isInteractAllowed(event.getClickedBlock().getLocation())) return; + if (Settings.USE_PROTECTION_PLUGINS.getBoolean() && !ProtectionManager.canInteract(player, event.getClickedBlock().getLocation())) { + player.sendMessage(instance.getLocale().getMessage("event.general.protected").getPrefixedMessage()); + return; + } + if (Bukkit.getPluginManager().isPluginEnabled("FabledSkyBlock")) { SkyBlock skyBlock = SkyBlock.getInstance(); diff --git a/src/main/java/com/songoda/epichoppers/settings/Settings.java b/src/main/java/com/songoda/epichoppers/settings/Settings.java index b089944..22dce58 100644 --- a/src/main/java/com/songoda/epichoppers/settings/Settings.java +++ b/src/main/java/com/songoda/epichoppers/settings/Settings.java @@ -54,6 +54,9 @@ public class Settings { public static final ConfigSetting MAX_CHUNK = new ConfigSetting(config, "Main.Max Hoppers Per Chunk", -1, "The maximum amount of hoppers per chunk."); + public static final ConfigSetting USE_PROTECTION_PLUGINS = new ConfigSetting(config, "Main.Use Protection Plugins", true, + "Should we use protection plugins?"); + public static final ConfigSetting BLOCKBREAK_PARTICLE = new ConfigSetting(config, "Main.BlockBreak Particle Type", "LAVA", "The particle shown when the block break module performs a block break."); diff --git a/src/main/resources/en_US.lang b/src/main/resources/en_US.lang index 5cd7f8f..3dad51b 100644 --- a/src/main/resources/en_US.lang +++ b/src/main/resources/en_US.lang @@ -79,6 +79,7 @@ command: event: general: nopermission: '&cYou do not have permission to do that.' + protected: '&cThis hopper is protected and you cannot access it.' upgrade: cannotafford: '&cYou cannot afford this upgrade.' success: '&7You successfully upgraded this hopper to &6level %level%&7!'