mirror of
https://github.com/songoda/EpicFarming.git
synced 2025-02-21 15:01:25 +01:00
Added protection plugin support for interacting with the farm.
This commit is contained in:
parent
e6ecdb5deb
commit
5142f8f0a8
@ -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.EntityStackerManager;
|
||||
import com.songoda.core.hooks.ProtectionManager;
|
||||
import com.songoda.core.nms.NmsManager;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import com.songoda.core.utils.TextUtils;
|
||||
@ -111,6 +112,9 @@ public class EpicFarming extends SongodaPlugin {
|
||||
// Load Economy
|
||||
EconomyManager.load();
|
||||
|
||||
// Load protection manager.
|
||||
ProtectionManager.load(this);
|
||||
|
||||
// Setup Config
|
||||
Settings.setupConfig();
|
||||
this.setLocale(Settings.LANGUGE_MODE.getString(), false);
|
||||
|
@ -4,6 +4,7 @@ import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.CompatibleParticleHandler;
|
||||
import com.songoda.core.compatibility.CompatibleSound;
|
||||
import com.songoda.core.hooks.EconomyManager;
|
||||
import com.songoda.core.hooks.ProtectionManager;
|
||||
import com.songoda.epicfarming.EpicFarming;
|
||||
import com.songoda.epicfarming.farming.levels.Level;
|
||||
import com.songoda.epicfarming.gui.OverviewGui;
|
||||
@ -60,6 +61,11 @@ public class Farm {
|
||||
|
||||
if (opened != null && !force) return;
|
||||
|
||||
if (Settings.USE_PROTECTION_PLUGINS.getBoolean() && !ProtectionManager.canInteract(player, location)) {
|
||||
player.sendMessage(EpicFarming.getInstance().getLocale().getMessage("event.general.protected").getPrefixedMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
opened = new OverviewGui(this, player);
|
||||
|
||||
EpicFarming.getInstance().getGuiManager().showGUI(player, opened);
|
||||
|
@ -40,6 +40,9 @@ public class Settings {
|
||||
public static final ConfigSetting DISABLE_AUTO_TIL_LAND = new ConfigSetting(config, "Main.Disable Auto Til Land", false,
|
||||
"Should farms not auto til land around them?");
|
||||
|
||||
public static final ConfigSetting USE_PROTECTION_PLUGINS = new ConfigSetting(config, "Main.Use Protection Plugins", true,
|
||||
"Should we use protection plugins?");
|
||||
|
||||
public static final ConfigSetting ECONOMY_PLUGIN = new ConfigSetting(config, "Main.Economy", EconomyManager.getEconomy() == null ? "Vault" : EconomyManager.getEconomy().getName(),
|
||||
"Which economy plugin should be used?",
|
||||
"Supported plugins you have installed: \"" + EconomyManager.getManager().getRegisteredPlugins().stream().collect(Collectors.joining("\", \"")) + "\".");
|
||||
|
@ -50,6 +50,7 @@ command:
|
||||
event:
|
||||
general:
|
||||
nopermission: '&cYou do not have permission to do that.'
|
||||
protected: '&cThis farm is protected and you cannot access it.'
|
||||
upgrade:
|
||||
cannotafford: '&cYou cannot afford this upgrade.'
|
||||
success: '&7You successfully upgraded this farm to &6level %level%&7!'
|
||||
|
Loading…
Reference in New Issue
Block a user