mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2025-01-21 21:01:20 +01:00
Ignore most cancelled Events
This commit is contained in:
parent
40d226af9e
commit
23972e69c6
@ -16,7 +16,7 @@ import com.dre.brewery.P;
|
||||
|
||||
public class BlockListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
String[] lines = event.getLines();
|
||||
|
||||
@ -36,7 +36,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
Block block = event.getBlock();
|
||||
// remove cauldron
|
||||
|
@ -14,26 +14,22 @@ import com.dre.brewery.Brew;
|
||||
public class EntityListener implements Listener {
|
||||
|
||||
// Remove the Potion from Brew when it despawns
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onItemDespawn(ItemDespawnEvent event) {
|
||||
if (!event.isCancelled()) {
|
||||
ItemStack item = event.getEntity().getItemStack();
|
||||
if (item.getTypeId() == 373) {
|
||||
Brew.remove(item);
|
||||
}
|
||||
ItemStack item = event.getEntity().getItemStack();
|
||||
if (item.getTypeId() == 373) {
|
||||
Brew.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityCombust(EntityCombustEvent event) {
|
||||
if (!event.isCancelled()) {
|
||||
Entity entity = event.getEntity();
|
||||
if (entity.getType().getTypeId() == 1) {
|
||||
if (entity instanceof Item) {
|
||||
ItemStack item = ((Item) entity).getItemStack();
|
||||
if (item.getTypeId() == 373) {
|
||||
Brew.remove(item);
|
||||
}
|
||||
Entity entity = event.getEntity();
|
||||
if (entity.getType().getTypeId() == 1) {
|
||||
if (entity instanceof Item) {
|
||||
ItemStack item = ((Item) entity).getItemStack();
|
||||
if (item.getTypeId() == 373) {
|
||||
Brew.remove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import com.dre.brewery.Brew;
|
||||
|
||||
public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onBrew(BrewEvent event) {
|
||||
int slot = 0;
|
||||
BrewerInventory inv = event.getContents();
|
||||
@ -52,7 +52,7 @@ public class InventoryListener implements Listener {
|
||||
}
|
||||
|
||||
// convert to non colored Lore when taking out of Barrel/Brewer
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if (event.getInventory().getType() == InventoryType.BREWING) {
|
||||
if (event.getSlot() > 2) {
|
||||
@ -84,7 +84,7 @@ public class InventoryListener implements Listener {
|
||||
}
|
||||
|
||||
// block the pickup of items where getPickupDelay is > 1000 (puke)
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onInventoryPickupItem(InventoryPickupItemEvent event){
|
||||
Item item = event.getItem();
|
||||
|
||||
|
@ -28,7 +28,7 @@ import com.dre.brewery.Wakeup;
|
||||
import com.dre.brewery.P;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
Block clickedBlock = event.getClickedBlock();
|
||||
|
||||
@ -118,7 +118,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
// player drinks a custom potion
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerItemConsume(PlayerItemConsumeEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
ItemStack item = event.getItem();
|
||||
|
@ -24,13 +24,11 @@ public class WorldListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onWorldUnload(WorldUnloadEvent event) {
|
||||
if (!event.isCancelled()) {
|
||||
P.p.saveData();
|
||||
Barrel.onUnload(event.getWorld().getName());
|
||||
BCauldron.onUnload(event.getWorld().getName());
|
||||
}
|
||||
P.p.saveData();
|
||||
Barrel.onUnload(event.getWorld().getName());
|
||||
BCauldron.onUnload(event.getWorld().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user