From 25bb3b1c4e4a0376ad5c45d5ddc0197a9441d7b0 Mon Sep 17 00:00:00 2001
From: MysteriousKyle <39589930+MysteriousKyle@users.noreply.github.com>
Date: Sun, 17 Jan 2021 08:57:32 -0600
Subject: [PATCH 1/4] Update README.MD
Made the version badge automatically update.
---
README.MD | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.MD b/README.MD
index 80b8d6d..2388ae6 100644
--- a/README.MD
+++ b/README.MD
@@ -19,7 +19,7 @@
-
+
From e6ecdb5deb2066eca2489425df0e7ed27a73c202 Mon Sep 17 00:00:00 2001
From: Fernando Pettinelli
Date: Mon, 25 Jan 2021 22:42:30 -0300
Subject: [PATCH 2/4] Fixed dupe bug when removing farms.
---
src/main/java/com/songoda/epicfarming/farming/Farm.java | 8 ++++++++
.../com/songoda/epicfarming/listeners/BlockListeners.java | 2 ++
.../songoda/epicfarming/listeners/EntityListeners.java | 1 +
3 files changed, 11 insertions(+)
diff --git a/src/main/java/com/songoda/epicfarming/farming/Farm.java b/src/main/java/com/songoda/epicfarming/farming/Farm.java
index 33bcb16..1957c9c 100644
--- a/src/main/java/com/songoda/epicfarming/farming/Farm.java
+++ b/src/main/java/com/songoda/epicfarming/farming/Farm.java
@@ -65,6 +65,14 @@ public class Farm {
EpicFarming.getInstance().getGuiManager().showGUI(player, opened);
}
+ public void forceMenuClose() {
+ if (opened == null) {
+ return;
+ }
+
+ opened.close();
+ }
+
public void upgrade(UpgradeType type, Player player) {
EpicFarming instance = EpicFarming.getInstance();
if (instance.getLevelManager().getLevels().containsKey(this.level.getLevel() + 1)) {
diff --git a/src/main/java/com/songoda/epicfarming/listeners/BlockListeners.java b/src/main/java/com/songoda/epicfarming/listeners/BlockListeners.java
index 7864f95..fb6b34a 100644
--- a/src/main/java/com/songoda/epicfarming/listeners/BlockListeners.java
+++ b/src/main/java/com/songoda/epicfarming/listeners/BlockListeners.java
@@ -112,6 +112,7 @@ public class BlockListeners implements Listener {
if (farm == null) return;
plugin.getDataManager().deleteFarm(farm);
+ farm.forceMenuClose();
FarmTask.getCrops(farm, false);
@@ -140,6 +141,7 @@ public class BlockListeners implements Listener {
FarmTask.getCrops(farm, false);
plugin.getDataManager().deleteFarm(farm);
+ farm.forceMenuClose();
event.setCancelled(true);
diff --git a/src/main/java/com/songoda/epicfarming/listeners/EntityListeners.java b/src/main/java/com/songoda/epicfarming/listeners/EntityListeners.java
index b8655a9..0c7e097 100644
--- a/src/main/java/com/songoda/epicfarming/listeners/EntityListeners.java
+++ b/src/main/java/com/songoda/epicfarming/listeners/EntityListeners.java
@@ -110,6 +110,7 @@ public class EntityListeners implements Listener {
Farm farm = plugin.getFarmManager().removeFarm(block.getLocation());
plugin.getDataManager().deleteFarm(farm);
+ farm.forceMenuClose();
FarmTask.getCrops(farm, false);
From 5142f8f0a82b67b293c72eada9b9f80fd60af1f1 Mon Sep 17 00:00:00 2001
From: Fernando Pettinelli
Date: Tue, 26 Jan 2021 00:03:37 -0300
Subject: [PATCH 3/4] Added protection plugin support for interacting with the
farm.
---
src/main/java/com/songoda/epicfarming/EpicFarming.java | 4 ++++
src/main/java/com/songoda/epicfarming/farming/Farm.java | 6 ++++++
.../java/com/songoda/epicfarming/settings/Settings.java | 3 +++
src/main/resources/en_US.lang | 1 +
4 files changed, 14 insertions(+)
diff --git a/src/main/java/com/songoda/epicfarming/EpicFarming.java b/src/main/java/com/songoda/epicfarming/EpicFarming.java
index 926e5a6..0a0d9da 100644
--- a/src/main/java/com/songoda/epicfarming/EpicFarming.java
+++ b/src/main/java/com/songoda/epicfarming/EpicFarming.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.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);
diff --git a/src/main/java/com/songoda/epicfarming/farming/Farm.java b/src/main/java/com/songoda/epicfarming/farming/Farm.java
index 1957c9c..fd161fe 100644
--- a/src/main/java/com/songoda/epicfarming/farming/Farm.java
+++ b/src/main/java/com/songoda/epicfarming/farming/Farm.java
@@ -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);
diff --git a/src/main/java/com/songoda/epicfarming/settings/Settings.java b/src/main/java/com/songoda/epicfarming/settings/Settings.java
index d8c5bd6..c396098 100644
--- a/src/main/java/com/songoda/epicfarming/settings/Settings.java
+++ b/src/main/java/com/songoda/epicfarming/settings/Settings.java
@@ -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("\", \"")) + "\".");
diff --git a/src/main/resources/en_US.lang b/src/main/resources/en_US.lang
index 9a501ec..8feaec3 100644
--- a/src/main/resources/en_US.lang
+++ b/src/main/resources/en_US.lang
@@ -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!'
From 42bd31e6504bb230d00d9cdf25d63ba582dbb29e Mon Sep 17 00:00:00 2001
From: Fernando Pettinelli
Date: Tue, 26 Jan 2021 00:06:40 -0300
Subject: [PATCH 4/4] Version 3.1.2
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 31b7a5e..fffba0b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
com.songoda
EpicFarming
4.0.0
- 3.1.1b
+ 3.1.2
clean install
EpicFarming-${project.version}