From 6932fa56dd74a240c850c044e46c35fcb1f71aba Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Wed, 31 Aug 2016 08:10:15 -0400 Subject: [PATCH] Changed Listeners to return boolean values --- .../listeners/ConflictCompassCraftingListener.java | 14 ++++++++++++++ .../listeners/DiamondArmorBlocker.java | 5 +++-- src/iie/DeathListener.java | 7 ++++--- 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 src/alisolarflare/listeners/ConflictCompassCraftingListener.java diff --git a/src/alisolarflare/listeners/ConflictCompassCraftingListener.java b/src/alisolarflare/listeners/ConflictCompassCraftingListener.java new file mode 100644 index 0000000..e7f1f58 --- /dev/null +++ b/src/alisolarflare/listeners/ConflictCompassCraftingListener.java @@ -0,0 +1,14 @@ +package alisolarflare.listeners; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.CraftItemEvent; + +public class ConflictCompassCraftingListener implements Listener{ + + @EventHandler + public boolean onConflictCompassCraft(CraftItemEvent event){ + + return false; + } +} diff --git a/src/alisolarflare/listeners/DiamondArmorBlocker.java b/src/alisolarflare/listeners/DiamondArmorBlocker.java index 52c7547..842f307 100644 --- a/src/alisolarflare/listeners/DiamondArmorBlocker.java +++ b/src/alisolarflare/listeners/DiamondArmorBlocker.java @@ -15,10 +15,10 @@ import org.bukkit.inventory.ItemStack; public class DiamondArmorBlocker implements Listener{ public static List blockedItems = Arrays.asList(Material.DIAMOND_BOOTS, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_HELMET); @EventHandler - public void onArmorSmith(CraftItemEvent event){ + public boolean onArmorSmith(CraftItemEvent event){ //SANITATION - hardcore if(event.getWhoClicked().getWorld().getName() != "hardcore"){ - return; + return false; } //INIT - inventory, targetItem @@ -33,6 +33,7 @@ public class DiamondArmorBlocker implements Listener{ event.getWhoClicked().getWorld().playSound(event.getWhoClicked().getLocation(), Sound.AMBIENT_CAVE,0,0); event.getWhoClicked().getWorld().playSound(event.getWhoClicked().getLocation(), Sound.ENTITY_ITEM_BREAK,0,0); } + return false; } diff --git a/src/iie/DeathListener.java b/src/iie/DeathListener.java index 36aa3c1..964aef3 100644 --- a/src/iie/DeathListener.java +++ b/src/iie/DeathListener.java @@ -19,7 +19,7 @@ public class DeathListener implements Listener { } @EventHandler(priority = EventPriority.MONITOR) - public void onHardcoreDeath(PlayerDeathEvent deathEvent){ + public boolean onHardcoreDeath(PlayerDeathEvent deathEvent){ String timeString = String.valueOf(System.currentTimeMillis()); Player player = deathEvent.getEntity(); @@ -40,11 +40,12 @@ public class DeathListener implements Listener { //player.sendMessage("Key saved: " + playerString); //player.sendMessage("Data saved: " + HelloWorldPlugin.deathMap.get(playerString)); } + return false; } @EventHandler(priority = EventPriority.MONITOR) - public void onPlayerLogin(PlayerJoinEvent joinEvent){ + public boolean onPlayerLogin(PlayerJoinEvent joinEvent){ @@ -65,7 +66,7 @@ public class DeathListener implements Listener { if (HelloWorldPlugin.deathMap.get(playerString) == null && score.getScore() != 0){ HelloWorldPlugin.deathMap.put(playerString, String.valueOf((score.getScore()) * 1000)); } - + return false; } }