mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-22 10:36:10 +01:00
Fix for water removing block protection when we should keep it
This commit is contained in:
parent
a945f55104
commit
48e67d0426
@ -108,8 +108,8 @@ public class BlockProtectionManager {
|
||||
Bp.setPaid(paid);
|
||||
Bp.setTime(time);
|
||||
|
||||
// If timer is under 2 hours, we can run scheduler to remove it when time comes
|
||||
if (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 60 * 2)
|
||||
// If timer is under 5 min, we can run scheduler to remove it when time comes
|
||||
if (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 5)
|
||||
Bp.setScheduler(CMIScheduler.runAtLocationLater(loc, () -> remove(loc), (time - System.currentTimeMillis()) / 50));
|
||||
|
||||
Bpm.put(v, Bp);
|
||||
|
@ -14,6 +14,7 @@ import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||
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;
|
||||
import net.Zrips.CMILib.PersistentData.CMIBlockPersistentDataContainer;
|
||||
|
||||
public class ExploitProtectionManager {
|
||||
@ -76,7 +77,7 @@ public class ExploitProtectionManager {
|
||||
}
|
||||
|
||||
public void remove(Block block) {
|
||||
|
||||
CMIDebug.d("remove protection", block.getType());
|
||||
// In case double plant was destroyed we should remove both blocks from records
|
||||
CMIMaterial cmat = CMIMaterial.get(block);
|
||||
switch (cmat) {
|
||||
|
@ -128,9 +128,12 @@ public class JobsListener implements Listener {
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
if (Jobs.getGCManager().useNewBlockProtection)
|
||||
if (CMIMaterial.isWater(event.getBlock().getType()))
|
||||
return;
|
||||
|
||||
if (Jobs.getGCManager().useNewBlockProtection) {
|
||||
Jobs.getExploitManager().remove(event.getToBlock());
|
||||
else
|
||||
} else
|
||||
Jobs.getBpManager().remove(event.getToBlock());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user