diff --git a/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java b/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java index a451adfd..79c3c820 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java @@ -12,7 +12,10 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.container.BlockProtection; import com.gamingmesh.jobs.container.DBAction; +import net.Zrips.CMILib.Container.CMIBlock; +import net.Zrips.CMILib.Container.CMIBlock.Bisect; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Logs.CMIDebug; public class BlockProtectionManager { @@ -36,6 +39,21 @@ public class BlockProtectionManager { } public void add(Block block, Integer cd) { + + // Assuming that block is bottom part of flower we will add top part to the record too + CMIMaterial cmat = CMIMaterial.get(block); + switch (cmat) { + case LILAC: + case SUNFLOWER: + case ROSE_BUSH: + case PEONY: + CMIBlock cmb = new CMIBlock(block); + // We are only interested in this being bottom block as this should never trigger for top part of placed block + if (cmb.getBisect().equals(Bisect.BOTTOM)) + add(block.getLocation().clone().add(0, 1, 0), cd, true); + break; + } + add(block, cd, true); } @@ -112,6 +130,21 @@ public class BlockProtectionManager { } public BlockProtection remove(Block block) { + // In case double plant was destroyed we should remove both blocks from records + CMIMaterial cmat = CMIMaterial.get(block); + switch (cmat) { + case LILAC: + case SUNFLOWER: + case ROSE_BUSH: + case PEONY: + CMIBlock cmb = new CMIBlock(block); + if (cmb.getBisect().equals(Bisect.BOTTOM)) + remove(block.getLocation().clone().add(0, 1, 0)); + else + remove(block.getLocation().clone().add(0, -1, 0)); + break; + } + return remove(block.getLocation()); } diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 2e9be64c..7c87a5c8 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -555,9 +555,6 @@ public class GeneralConfigManager { "Setting this too low may cause tick lag. Increase this to improve economy performance (at the cost of delays in payment)"); economyBatchDelay = c.get("economy-batch-delay", 5); - // We need this to be atleast 1 or more seconds - economyBatchDelay = economyBatchDelay < 1 ? 1 : economyBatchDelay; - c.addComment("economy-async", "Enable async economy calls.", "Disable this if you have issues with payments or your plugin is not thread safe."); economyAsync = c.get("economy-async", true); diff --git a/src/main/java/com/gamingmesh/jobs/tasks/BufferedPaymentThread.java b/src/main/java/com/gamingmesh/jobs/tasks/BufferedPaymentThread.java index a69e9980..2bf41829 100644 --- a/src/main/java/com/gamingmesh/jobs/tasks/BufferedPaymentThread.java +++ b/src/main/java/com/gamingmesh/jobs/tasks/BufferedPaymentThread.java @@ -27,7 +27,9 @@ public class BufferedPaymentThread extends Thread { public BufferedPaymentThread(int duration) { super("Jobs-BufferedPaymentThread"); - this.sleep = duration * 1000; + // We need this to be atleast 1 or more seconds + duration = duration < 1 ? 1 : duration; + this.sleep = duration * 1000; } @Override