Added protection plugin support.

This commit is contained in:
Fernando Pettinelli 2021-01-25 15:20:50 -03:00
parent ce27044153
commit 2bdcf56b7f
4 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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.");

View File

@ -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!'