Remove unused BlockFromToEvent handler in ArenaListener.

This is dead code and contains calls to deprecated API.
This commit is contained in:
Andreas Troelsen
2019-07-21 23:38:25 +02:00
parent e62b361766
commit a970bac85a
2 changed files with 0 additions and 64 deletions
@@ -353,63 +353,6 @@ public class ArenaListener
} }
} }
/*
* TODO: Figure out a solution to this problem with soft-restore.
*
* When a player empties a water bucket, and the flowing water creates a
* new source block somewhere else because of it, currently, this source
* block is not added to the set of blocks to clear at arena end.
*
* This method fixes this, but it is currently not called from the global
* listener, because it introduces a new issue; source blocks formed when
* a player FILLS a water bucket (due to the other source blocks flowing
* back in) are also caught, which means the arena region will restore
* incorrectly, i.e. the method is not specific enough.
*/
public void onBlockFromTo(BlockFromToEvent event) {
if (!protect) return;
if (!arena.isRunning())
return;
if (!arena.getRegion().contains(event.getBlock().getLocation()))
return;
Block from = event.getBlock();
Block to = event.getToBlock();
if (isWaterSource(from) && isWaterNonSource(to)) {
for (BlockFace face : EnumSet.of(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST)) {
Block adj = to.getRelative(face);
if (!adj.equals(from) && isWaterSource(adj)) {
arena.addBlock(to);
return;
}
}
}
}
private boolean isWater(Block block) {
switch (block.getType()) {
case WATER:
return true;
default:
return false;
}
}
private boolean isSource(Block block) {
return block.getData() == 0x0;
}
private boolean isWaterSource(Block block) {
return isWater(block) && isSource(block);
}
private boolean isWaterNonSource(Block block) {
return isWater(block) && !isSource(block);
}
public void onBlockIgnite(BlockIgniteEvent event) { public void onBlockIgnite(BlockIgniteEvent event) {
// If the arena isn't protected, care // If the arena isn't protected, care
if (!protect) return; if (!protect) return;
@@ -100,13 +100,6 @@ public class MAGlobalListener implements Listener
arena.getEventListener().onBlockForm(event); arena.getEventListener().onBlockForm(event);
} }
// // TODO: See ArenaListener.onBlockFromTo()
// @EventHandler(priority = EventPriority.NORMAL)
// public void blockFromTo(BlockFromToEvent event) {
// for (Arena arena : am.getArenas())
// arena.getEventListener().onBlockFromTo(event);
// }
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void blockFade(BlockFadeEvent event) { public void blockFade(BlockFadeEvent event) {
for (Arena arena : am.getArenas()) { for (Arena arena : am.getArenas()) {