Merge branch 'development'

This commit is contained in:
Brianna 2021-06-13 14:25:00 -05:00
commit ac618bca64
8 changed files with 27 additions and 2 deletions

View File

@ -19,7 +19,7 @@
<img alt="Patreon" src="https://img.shields.io/badge/-Support_on_Patreon-F96854.svg?logo=patreon&style=flat&logoColor=white"> <img alt="Patreon" src="https://img.shields.io/badge/-Support_on_Patreon-F96854.svg?logo=patreon&style=flat&logoColor=white">
</a> </a>
<br> <br>
<img alt="Latest" src="https://img.shields.io/badge/-ver_3.1.1-4078C0.svg?logo=github&style=flat&logoColor=white&color=blue&label=Latest&labelColor=black"> <img alt="Latest" src="https://img.shields.io/badge/dynamic/xml?label=version&query=string%28%2F%2F%2A%5Blocal-name%28.%29%3D%27version%27%20and%20namespace-uri%28.%29%3D%27http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0%27%5D%5B1%5D%29&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsongoda%2FEpicFarming%2Fmaster%2Fpom.xml&logo=github&style=flat&logoColor=white&color=blue&labelColor=black">
<a href="https://app.codacy.com/gh/songoda/EpicFarming/dashboard"> <a href="https://app.codacy.com/gh/songoda/EpicFarming/dashboard">
<img alt="quality" src="https://img.shields.io/codacy/grade/88eb57700298485482781b1bff439fec"> <img alt="quality" src="https://img.shields.io/codacy/grade/88eb57700298485482781b1bff439fec">
</a> </a>

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>EpicFarming</artifactId> <artifactId>EpicFarming</artifactId>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>3.1.1b</version> <version>3.1.2</version>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>
<finalName>EpicFarming-${project.version}</finalName> <finalName>EpicFarming-${project.version}</finalName>

View File

@ -11,6 +11,7 @@ import com.songoda.core.database.SQLiteConnector;
import com.songoda.core.gui.GuiManager; import com.songoda.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager; import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.EntityStackerManager; import com.songoda.core.hooks.EntityStackerManager;
import com.songoda.core.hooks.ProtectionManager;
import com.songoda.core.nms.NmsManager; import com.songoda.core.nms.NmsManager;
import com.songoda.core.nms.nbt.NBTItem; import com.songoda.core.nms.nbt.NBTItem;
import com.songoda.core.utils.TextUtils; import com.songoda.core.utils.TextUtils;
@ -111,6 +112,9 @@ public class EpicFarming extends SongodaPlugin {
// Load Economy // Load Economy
EconomyManager.load(); EconomyManager.load();
// Load protection manager.
ProtectionManager.load(this);
// Setup Config // Setup Config
Settings.setupConfig(); Settings.setupConfig();
this.setLocale(Settings.LANGUGE_MODE.getString(), false); this.setLocale(Settings.LANGUGE_MODE.getString(), false);

View File

@ -4,6 +4,7 @@ import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleParticleHandler; import com.songoda.core.compatibility.CompatibleParticleHandler;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.hooks.EconomyManager; import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.ProtectionManager;
import com.songoda.epicfarming.EpicFarming; import com.songoda.epicfarming.EpicFarming;
import com.songoda.epicfarming.farming.levels.Level; import com.songoda.epicfarming.farming.levels.Level;
import com.songoda.epicfarming.gui.OverviewGui; import com.songoda.epicfarming.gui.OverviewGui;
@ -60,11 +61,24 @@ public class Farm {
if (opened != null && !force) return; 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); opened = new OverviewGui(this, player);
EpicFarming.getInstance().getGuiManager().showGUI(player, opened); EpicFarming.getInstance().getGuiManager().showGUI(player, opened);
} }
public void forceMenuClose() {
if (opened == null) {
return;
}
opened.close();
}
public void upgrade(UpgradeType type, Player player) { public void upgrade(UpgradeType type, Player player) {
EpicFarming instance = EpicFarming.getInstance(); EpicFarming instance = EpicFarming.getInstance();
if (instance.getLevelManager().getLevels().containsKey(this.level.getLevel() + 1)) { if (instance.getLevelManager().getLevels().containsKey(this.level.getLevel() + 1)) {

View File

@ -112,6 +112,7 @@ public class BlockListeners implements Listener {
if (farm == null) return; if (farm == null) return;
plugin.getDataManager().deleteFarm(farm); plugin.getDataManager().deleteFarm(farm);
farm.forceMenuClose();
FarmTask.getCrops(farm, false); FarmTask.getCrops(farm, false);
@ -140,6 +141,7 @@ public class BlockListeners implements Listener {
FarmTask.getCrops(farm, false); FarmTask.getCrops(farm, false);
plugin.getDataManager().deleteFarm(farm); plugin.getDataManager().deleteFarm(farm);
farm.forceMenuClose();
event.setCancelled(true); event.setCancelled(true);

View File

@ -110,6 +110,7 @@ public class EntityListeners implements Listener {
Farm farm = plugin.getFarmManager().removeFarm(block.getLocation()); Farm farm = plugin.getFarmManager().removeFarm(block.getLocation());
plugin.getDataManager().deleteFarm(farm); plugin.getDataManager().deleteFarm(farm);
farm.forceMenuClose();
FarmTask.getCrops(farm, false); FarmTask.getCrops(farm, false);

View File

@ -40,6 +40,9 @@ public class Settings {
public static final ConfigSetting DISABLE_AUTO_TIL_LAND = new ConfigSetting(config, "Main.Disable Auto Til Land", false, 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?"); "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(), public static final ConfigSetting ECONOMY_PLUGIN = new ConfigSetting(config, "Main.Economy", EconomyManager.getEconomy() == null ? "Vault" : EconomyManager.getEconomy().getName(),
"Which economy plugin should be used?", "Which economy plugin should be used?",
"Supported plugins you have installed: \"" + EconomyManager.getManager().getRegisteredPlugins().stream().collect(Collectors.joining("\", \"")) + "\"."); "Supported plugins you have installed: \"" + EconomyManager.getManager().getRegisteredPlugins().stream().collect(Collectors.joining("\", \"")) + "\".");

View File

@ -50,6 +50,7 @@ command:
event: event:
general: general:
nopermission: '&cYou do not have permission to do that.' nopermission: '&cYou do not have permission to do that.'
protected: '&cThis farm is protected and you cannot access it.'
upgrade: upgrade:
cannotafford: '&cYou cannot afford this upgrade.' cannotafford: '&cYou cannot afford this upgrade.'
success: '&7You successfully upgraded this farm to &6level %level%&7!' success: '&7You successfully upgraded this farm to &6level %level%&7!'