Fix plot redstone disabling (not sure why it was the way it was, but it was never going to work, so I fixed? it)

also minor reformat to PlayerEvents
This commit is contained in:
dordsor21 2018-12-28 17:25:29 +00:00
parent 750be6c5fe
commit 3156741664

View File

@ -58,8 +58,7 @@ import java.util.regex.Pattern;
/** /**
* Player Events involving plots. * Player Events involving plots.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused") public class PlayerEvents extends PlotListener implements Listener {
public class PlayerEvents extends PlotListener implements Listener {
private boolean pistonBlocks = true; private boolean pistonBlocks = true;
private float lastRadius; private float lastRadius;
@ -237,10 +236,9 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} }
@EventHandler @EventHandler public void onRedstoneEvent(BlockRedstoneEvent event) {
public void onRedstoneEvent(BlockRedstoneEvent event) {
Block block = event.getBlock(); Block block = event.getBlock();
switch (block.getType()) { /* switch (block.getType()) {
case OBSERVER: case OBSERVER:
case REDSTONE: case REDSTONE:
case REDSTONE_ORE: case REDSTONE_ORE:
@ -286,7 +284,7 @@ public class PlayerEvents extends PlotListener implements Listener {
case OAK_FENCE_GATE: case OAK_FENCE_GATE:
case POWERED_RAIL: case POWERED_RAIL:
return; return;
default: default:*/
Location loc = BukkitUtil.getLocation(block.getLocation()); Location loc = BukkitUtil.getLocation(block.getLocation());
PlotArea area = loc.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
@ -334,7 +332,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
event.setNewCurrent(0); event.setNewCurrent(0);
} }
} //}
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
@ -416,8 +414,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} }
@EventHandler @EventHandler public void onProjectileLaunch(ProjectileLaunchEvent event) {
public void onProjectileLaunch(ProjectileLaunchEvent event) {
Projectile entity = event.getEntity(); Projectile entity = event.getEntity();
if (!(entity instanceof ThrownPotion)) { if (!(entity instanceof ThrownPotion)) {
return; return;
@ -438,8 +435,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} }
@EventHandler @EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
public boolean onProjectileHit(ProjectileHitEvent event) {
Projectile entity = event.getEntity(); Projectile entity = event.getEntity();
Location loc = BukkitUtil.getLocation(entity); Location loc = BukkitUtil.getLocation(entity);
if (!PlotSquared.get().hasPlotArea(loc.getWorld())) { if (!PlotSquared.get().hasPlotArea(loc.getWorld())) {
@ -850,8 +846,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW) public void onChat(AsyncPlayerChatEvent event) {
public void onChat(AsyncPlayerChatEvent event) {
if (event.isCancelled()) if (event.isCancelled())
return; return;
@ -903,8 +898,7 @@ public class PlayerEvents extends PlotListener implements Listener {
PlotSquared.debug(full); PlotSquared.debug(full);
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) {
public void blockDestroy(BlockBreakEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
@ -2073,8 +2067,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} }
@EventHandler @EventHandler public void onPrime(ExplosionPrimeEvent event) {
public void onPrime(ExplosionPrimeEvent event) {
this.lastRadius = event.getRadius() + 1; this.lastRadius = event.getRadius() + 1;
} }
@ -2234,8 +2227,7 @@ public class PlayerEvents extends PlotListener implements Listener {
PlotInventory.removePlotInventoryOpen(BukkitUtil.getPlayer(player)); PlotInventory.removePlotInventoryOpen(BukkitUtil.getPlayer(player));
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR) public void onLeave(PlayerQuitEvent event) {
public void onLeave(PlayerQuitEvent event) {
TaskManager.TELEPORT_QUEUE.remove(event.getPlayer().getName()); TaskManager.TELEPORT_QUEUE.remove(event.getPlayer().getName());
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer()); PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
pp.unregister(); pp.unregister();
@ -2523,8 +2515,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) { public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
EntityDamageByEntityEvent eventChange = null; EntityDamageByEntityEvent eventChange = null;
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),