Add Flag.WATER_DESTROY to needed RegionData's
Fix ScoreboardElement showing stuff not applicable in region
This commit is contained in:
@@ -60,6 +60,7 @@ public class FireListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getRegionData().has(Flag.FIRE).isNotApplicable()) return null;
|
||||
if (region.getRegionData().get(Flag.FIRE).isWithDefault(FireMode.DENY)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FIRE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.FIRE).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
|
||||
@@ -249,6 +249,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getRegionData().has(Flag.FREEZE).isNotApplicable()) return null;
|
||||
if (region.getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.FREEZE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.FREEZE).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public class ItemsListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getRegionData().has(Flag.ITEMS).isNotApplicable()) return null;
|
||||
if (region.getRegionData().get(Flag.ITEMS).isWithDefault(ItemMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.ITEMS).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
|
||||
+1
@@ -54,6 +54,7 @@ public class NoGravityListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getRegionData().has(Flag.NO_GRAVITY).isNotApplicable()) return null;
|
||||
if (region.getRegionData().get(Flag.NO_GRAVITY).isWithDefault(NoGravityMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.NO_GRAVITY).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
|
||||
+1
@@ -70,6 +70,7 @@ public class ProtectListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getRegionData().has(Flag.PROTECT).isNotApplicable()) return null;
|
||||
if (region.getRegionData().get(Flag.PROTECT).isWithDefault(ProtectMode.INACTIVE)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.PROTECT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.PROTECT).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ public class TNTListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getRegionData().has(Flag.TNT).isNotApplicable()) return null;
|
||||
if (region.getRegionData().get(Flag.TNT).isWithDefault(TNTMode.ALLOW)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.TNT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.TNT).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
|
||||
+1
@@ -53,6 +53,7 @@ public class WaterDestroyListener implements Listener, ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.getRegionData().has(Flag.WATER_DESTROY).isNotApplicable()) return null;
|
||||
if (region.getRegionData().get(Flag.WATER_DESTROY).isWithDefault(WaterDestroyMode.ALLOW)) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.WATER_DESTROY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.WATER_DESTROY).getWithDefault().getChatValue(), p);
|
||||
}
|
||||
|
||||
@@ -35,4 +35,8 @@ public enum RegionFlagPolicy {
|
||||
public boolean isApplicable() {
|
||||
return readable || writable;
|
||||
}
|
||||
|
||||
public boolean isNotApplicable() {
|
||||
return this == NOT_APPLICABLE;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class GlobalRegionData extends RegionData {
|
||||
if (flag.oneOf(Flag.ITEMS) && Core.getVersion() >= 20) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
if (flag.oneOf(Flag.TNT, Flag.FIRE, Flag.FREEZE)) {
|
||||
if (flag.oneOf(Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.WATER_DESTROY)) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
return RegionFlagPolicy.NOT_APPLICABLE;
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class SpecialRegionData extends RegionData {
|
||||
|
||||
@Override
|
||||
public @NonNull <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag) {
|
||||
if (flag.oneOf(Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.PROTECT, Flag.NO_GRAVITY, Flag.CHANGED)) {
|
||||
if (flag.oneOf(Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.PROTECT, Flag.NO_GRAVITY, Flag.WATER_DESTROY, Flag.CHANGED)) {
|
||||
return RegionFlagPolicy.WRITABLE;
|
||||
}
|
||||
if (flag.oneOf(Flag.ITEMS) && Core.getVersion() >= 20) {
|
||||
|
||||
Reference in New Issue
Block a user