mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
ignoreCancelled events.
This commit is contained in:
parent
2a8e44dda8
commit
44d8c85450
@ -235,7 +235,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onCraftItemEvent(final CraftItemEvent event)
|
||||
{
|
||||
HumanEntity entity = event.getWhoClicked();
|
||||
@ -256,14 +256,14 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||
{
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
final ItemStack item = event.getItem().getItemStack();
|
||||
|
||||
if (!metaPermCheck(user, "craft", item.getTypeId(), item.getData().getData()))
|
||||
if (!metaPermCheck(user, "pickup", item.getTypeId(), item.getData().getData()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getItem().setPickupDelay(50);
|
||||
@ -271,7 +271,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
|
||||
|
@ -25,14 +25,9 @@ public class EssentialsProtectBlockListener implements Listener
|
||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockPlace(final BlockPlaceEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
final Block blockPlaced = event.getBlockPlaced();
|
||||
@ -79,13 +74,9 @@ public class EssentialsProtectBlockListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockIgnite(BlockIgniteEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Block block = event.getBlock();
|
||||
if ((block.getType() == Material.RAILS || block.getType() == Material.POWERED_RAIL || block.getType() == Material.DETECTOR_RAIL)
|
||||
&& prot.getSettingBool(ProtectConfig.protect_rails))
|
||||
@ -130,13 +121,9 @@ public class EssentialsProtectBlockListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockFromTo(final BlockFromToEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Block toBlock = event.getToBlock();
|
||||
if ((toBlock.getType() == Material.RAILS || toBlock.getType() == Material.POWERED_RAIL || toBlock.getType() == Material.DETECTOR_RAIL)
|
||||
&& prot.getSettingBool(ProtectConfig.protect_rails))
|
||||
@ -171,13 +158,9 @@ public class EssentialsProtectBlockListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockBurn(final BlockBurnEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Block block = event.getBlock();
|
||||
if ((block.getType() == Material.RAILS || block.getType() == Material.POWERED_RAIL || block.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails))
|
||||
{
|
||||
@ -207,13 +190,9 @@ public class EssentialsProtectBlockListener implements Listener
|
||||
BlockFace.SELF
|
||||
};
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockBreak(final BlockBreakEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
final Block block = event.getBlock();
|
||||
@ -290,13 +269,9 @@ public class EssentialsProtectBlockListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (Block block : event.getBlocks())
|
||||
{
|
||||
if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS
|
||||
@ -338,10 +313,10 @@ public class EssentialsProtectBlockListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event)
|
||||
{
|
||||
if (event.isCancelled() || !event.isSticky())
|
||||
if (!event.isSticky())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -26,13 +26,9 @@ public class EssentialsProtectEntityListener implements Listener
|
||||
this.ess = prot.getEssentialsConnect().getEssentials();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamage(final EntityDamageEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Entity target = event.getEntity();
|
||||
|
||||
if (target instanceof Villager && prot.getSettingBool(ProtectConfig.prevent_villager_death))
|
||||
@ -191,10 +187,10 @@ public class EssentialsProtectEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityExplode(final EntityExplodeEvent event)
|
||||
{
|
||||
if (event.isCancelled() || event.getEntity() == null)
|
||||
if (event.getEntity() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -263,17 +259,13 @@ public class EssentialsProtectEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onCreatureSpawn(final CreatureSpawnEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final EntityType creature = event.getEntityType();
|
||||
if (creature == null)
|
||||
{
|
||||
@ -290,13 +282,9 @@ public class EssentialsProtectEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityTarget(final EntityTargetEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!(event.getTarget() instanceof Player))
|
||||
{
|
||||
return;
|
||||
@ -316,7 +304,7 @@ public class EssentialsProtectEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event)
|
||||
{
|
||||
if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball)
|
||||
@ -326,13 +314,9 @@ public class EssentialsProtectEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (event.getEntityType() == EntityType.ENDERMAN && prot.getSettingBool(ProtectConfig.prevent_enderman_pickup))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
@ -17,11 +17,10 @@ public class EssentialsProtectWeatherListener implements Listener
|
||||
this.prot = prot;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onWeatherChange(final WeatherChangeEvent event)
|
||||
{
|
||||
if (!event.isCancelled()
|
||||
&& prot.getSettingBool(ProtectConfig.disable_weather_storm)
|
||||
if (prot.getSettingBool(ProtectConfig.disable_weather_storm)
|
||||
&& event.toWeatherState())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
@ -29,21 +28,19 @@ public class EssentialsProtectWeatherListener implements Listener
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onLightningStrike(final LightningStrikeEvent event)
|
||||
{
|
||||
if (!event.isCancelled()
|
||||
&& prot.getSettingBool(ProtectConfig.disable_weather_lightning))
|
||||
if (prot.getSettingBool(ProtectConfig.disable_weather_lightning))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onThunderChange(final ThunderChangeEvent event)
|
||||
{
|
||||
if (!event.isCancelled()
|
||||
&& prot.getSettingBool(ProtectConfig.disable_weather_thunder)
|
||||
if (prot.getSettingBool(ProtectConfig.disable_weather_thunder)
|
||||
&& event.toThunderState())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user