From 1cd742a5fb69cb9925538282316ae41ceb58bbec Mon Sep 17 00:00:00 2001 From: Fernando Pettinelli Date: Fri, 22 Jan 2021 16:01:45 -0300 Subject: [PATCH] Added protection plugin support. --- src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java | 4 ++++ .../java/com/songoda/epicfurnaces/furnace/Furnace.java | 7 +++++++ .../java/com/songoda/epicfurnaces/settings/Settings.java | 3 +++ src/main/resources/en_US.lang | 1 + src/main/resources/plugin.yml | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java b/src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java index eeae3bd..d403dd8 100644 --- a/src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java +++ b/src/main/java/com/songoda/epicfurnaces/EpicFurnaces.java @@ -11,6 +11,7 @@ import com.songoda.core.database.SQLiteConnector; import com.songoda.core.gui.GuiManager; import com.songoda.core.hooks.EconomyManager; import com.songoda.core.hooks.HologramManager; +import com.songoda.core.hooks.ProtectionManager; import com.songoda.core.nms.NmsManager; import com.songoda.core.nms.nbt.NBTCore; import com.songoda.core.nms.nbt.NBTItem; @@ -105,6 +106,9 @@ public class EpicFurnaces extends SongodaPlugin { // Register Hologram Plugin HologramManager.load(this); + // Load Protection hooks + ProtectionManager.load(this); + // Setup Config Settings.setupConfig(); this.setLocale(Settings.LANGUGE_MODE.getString(), false); diff --git a/src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java b/src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java index 1fe7dcc..aa10ee7 100644 --- a/src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java +++ b/src/main/java/com/songoda/epicfurnaces/furnace/Furnace.java @@ -4,6 +4,7 @@ import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.compatibility.ServerVersion; import com.songoda.core.gui.GuiManager; import com.songoda.core.hooks.EconomyManager; +import com.songoda.core.hooks.ProtectionManager; import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.boost.BoostData; import com.songoda.epicfurnaces.furnace.levels.Level; @@ -65,6 +66,12 @@ public class Furnace { if (placedBy == null) placedBy = player.getUniqueId(); if (!player.hasPermission("epicfurnaces.overview")) return; + + if (Settings.USE_PROTECTION_PLUGINS.getBoolean() && !ProtectionManager.canInteract(player, location)) { + player.sendMessage(plugin.getLocale().getMessage("event.general.protected").getPrefixedMessage()); + return; + } + guiManager.showGUI(player, new GUIOverview(plugin, this, player)); } diff --git a/src/main/java/com/songoda/epicfurnaces/settings/Settings.java b/src/main/java/com/songoda/epicfurnaces/settings/Settings.java index 470187c..ece6a38 100644 --- a/src/main/java/com/songoda/epicfurnaces/settings/Settings.java +++ b/src/main/java/com/songoda/epicfurnaces/settings/Settings.java @@ -35,6 +35,9 @@ public class Settings { "might leave a few spots. Minimum value is 16. To disable, just set", "this to a very high value, such as your worldborder size."); + public static final ConfigSetting USE_PROTECTION_PLUGINS = new ConfigSetting(config, "Main.Use Protection Plugins", true, + "Should we use protection plugins?"); + public static final ConfigSetting FURNACE_ITEM = new ConfigSetting(config, "Main.Remember Furnace Item Levels", true, "Should furnace levels be remembered when broken?"); diff --git a/src/main/resources/en_US.lang b/src/main/resources/en_US.lang index 66a1489..8328a52 100644 --- a/src/main/resources/en_US.lang +++ b/src/main/resources/en_US.lang @@ -57,6 +57,7 @@ command: event: general: nopermission: '&cYou do not have permission to do that.' + protected: '&cThis furnace is protected. You cannot access it.' upgrade: cannotafford: '&cYou cannot afford this upgrade.' success: '&7You successfully upgraded this furnace to &6level %level%&7!' diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index fa0a511..352cd19 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: EpicFurnaces description: EpicFurnaces version: maven-version-number -softdepend: [FabledSkyBlock, HolographicDisplays, PlotSquared, GriefPrevention, USkyBlock, SkyBlock, WorldGuard, Factions] +softdepend: [FabledSkyBlock, HolographicDisplays, PlotSquared, GriefPrevention, USkyBlock, SkyBlock, WorldGuard, Factions, Lands, RedProtect, UltimateClaims, BentoBox] main: com.songoda.epicfurnaces.EpicFurnaces author: songoda api-version: 1.13