Adds LiquidFlow exploit handling

“hand” merged from HCF. Adds option in conf.json that defaults to false
which if enabled will prevent liquid from flowing between into other
factions if it shouldn’t.
This commit is contained in:
Nick Porillo 2015-05-12 12:08:42 -04:00
parent 2b0638f54f
commit cb0043600d
2 changed files with 25 additions and 0 deletions

View File

@ -102,6 +102,7 @@ public class Conf {
public static boolean handleExploitEnderPearlClipping = true;
public static boolean handleExploitInteractionSpam = true;
public static boolean handleExploitTNTWaterlog = false;
public static boolean handleExploitLiquidFlow = false;
public static boolean homesEnabled = true;
public static boolean homesMustBeInClaimedTerritory = true;

View File

@ -38,6 +38,30 @@ public class FactionsBlockListener implements Listener {
}
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockFromTo(BlockFromToEvent event) {
if (!Conf.handleExploitLiquidFlow) {
return;
}
if (event.getBlock().isLiquid()) {
if (event.getToBlock().isEmpty()) {
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
if (from == to) {
// not concerned with inter-faction events
return;
}
// from faction != to faction
if (to.isNormal()) {
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
return;
}
event.setCancelled(true);
}
}
}
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {