Refractor Barrel

This commit is contained in:
Sn0wStorm
2019-10-16 19:35:29 +02:00
parent 7c0dcefb1b
commit 7d177a3d9f
7 changed files with 509 additions and 397 deletions
@@ -76,7 +76,7 @@ public class IntegrationListener implements Listener {
// If the Clicked Block was the Sign, LWC already knows and we dont need to do anything here
if (!LegacyUtil.isSign(event.getClickedBlock().getType())) {
Block sign = event.getBarrel().getSignOfSpigot();
Block sign = event.getBarrel().getBody().getSignOfSpigot();
// If the Barrel does not have a Sign, it cannot be locked
if (!sign.equals(event.getClickedBlock())) {
Player player = event.getPlayer();
@@ -24,7 +24,7 @@ public class LWCBarrel {
public static boolean denyDestroy(Player player, Barrel barrel) {
LWC lwc = LWC.getInstance();
Block sign = barrel.getSignOfSpigot();
Block sign = barrel.getBody().getSignOfSpigot();
//if (!Boolean.parseBoolean(lwc.resolveProtectionConfiguration(sign, "ignoreBlockDestruction"))) {
Protection protection = lwc.findProtection(sign);
if (protection != null) {
@@ -82,7 +82,7 @@ public class LWCBarrel {
// If a Barrel is destroyed without player
public static void remove(Barrel barrel) {
Protection protection = LWC.getInstance().findProtection(barrel.getSignOfSpigot());
Protection protection = LWC.getInstance().findProtection(barrel.getBody().getSignOfSpigot());
if (protection != null) {
protection.remove();
}
@@ -90,13 +90,13 @@ public class LWCBarrel {
// Returns true if the block that exploded should not be removed
public static boolean denyExplosion(Barrel barrel) {
Protection protection = LWC.getInstance().findProtection(barrel.getSignOfSpigot());
Protection protection = LWC.getInstance().findProtection(barrel.getBody().getSignOfSpigot());
return protection != null && !protection.hasFlag(Flag.Type.ALLOWEXPLOSIONS);
}
// Returns true if the block that was destroyed should not be removed
public static boolean denyDestroyOther(Barrel barrel) {
return LWC.getInstance().findProtection(barrel.getSignOfSpigot()) != null;
return LWC.getInstance().findProtection(barrel.getBody().getSignOfSpigot()) != null;
}
}