Changed Listeners to return boolean values

This commit is contained in:
alisolarflare 2016-08-31 08:10:15 -04:00
parent 2b4ba7f8eb
commit 6932fa56dd
3 changed files with 21 additions and 5 deletions

View file

@ -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;
}
}

View file

@ -15,10 +15,10 @@ import org.bukkit.inventory.ItemStack;
public class DiamondArmorBlocker implements Listener{ public class DiamondArmorBlocker implements Listener{
public static List<Material> blockedItems = Arrays.asList(Material.DIAMOND_BOOTS, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_HELMET); public static List<Material> blockedItems = Arrays.asList(Material.DIAMOND_BOOTS, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_HELMET);
@EventHandler @EventHandler
public void onArmorSmith(CraftItemEvent event){ public boolean onArmorSmith(CraftItemEvent event){
//SANITATION - hardcore //SANITATION - hardcore
if(event.getWhoClicked().getWorld().getName() != "hardcore"){ if(event.getWhoClicked().getWorld().getName() != "hardcore"){
return; return false;
} }
//INIT - inventory, targetItem //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.AMBIENT_CAVE,0,0);
event.getWhoClicked().getWorld().playSound(event.getWhoClicked().getLocation(), Sound.ENTITY_ITEM_BREAK,0,0); event.getWhoClicked().getWorld().playSound(event.getWhoClicked().getLocation(), Sound.ENTITY_ITEM_BREAK,0,0);
} }
return false;
} }

View file

@ -19,7 +19,7 @@ public class DeathListener implements Listener {
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onHardcoreDeath(PlayerDeathEvent deathEvent){ public boolean onHardcoreDeath(PlayerDeathEvent deathEvent){
String timeString = String.valueOf(System.currentTimeMillis()); String timeString = String.valueOf(System.currentTimeMillis());
Player player = deathEvent.getEntity(); Player player = deathEvent.getEntity();
@ -40,11 +40,12 @@ public class DeathListener implements Listener {
//player.sendMessage("Key saved: " + playerString); //player.sendMessage("Key saved: " + playerString);
//player.sendMessage("Data saved: " + HelloWorldPlugin.deathMap.get(playerString)); //player.sendMessage("Data saved: " + HelloWorldPlugin.deathMap.get(playerString));
} }
return false;
} }
@EventHandler(priority = EventPriority.MONITOR) @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){ if (HelloWorldPlugin.deathMap.get(playerString) == null && score.getScore() != 0){
HelloWorldPlugin.deathMap.put(playerString, String.valueOf((score.getScore()) * 1000)); HelloWorldPlugin.deathMap.put(playerString, String.valueOf((score.getScore()) * 1000));
} }
return false;
} }
} }