Hi, I've got a class that should listen for people clicking on a stick called §cWand, and if so, summon a fireball. However, absolutely nothing happens, no errors, nothing. Code (Text): package me.piggypiglet.warrior; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import static org.bukkit.Material.*; import static org.bukkit.entity.EntityType.*; import static org.bukkit.event.block.Action.*; public class MageEvent implements Listener { @EventHandler public void onPlayerInteractEvent(PlayerInteractEvent e) { Player p = e.getPlayer(); Action a = e.getAction(); if (a == RIGHT_CLICK_AIR || a == RIGHT_CLICK_BLOCK || a == LEFT_CLICK_AIR || a == LEFT_CLICK_BLOCK) { if (e.getItem().getType() == STICK) { if (e.getItem().getItemMeta().getDisplayName().equals("§cWand")) { return; } } } p.getWorld().spawnEntity(p.getLocation(), FIREBALL); } } Any help is appreciated. I am also a beginner in plugin development but I will do my best to understand responses. EDIT: I have registered it in main, in onenable by getServer().getPluginManager().registerEvents(new MageEvent(), this); EDIT 2: Just tried this, Code (Text): if (a == RIGHT_CLICK_AIR || a == RIGHT_CLICK_BLOCK || a == LEFT_CLICK_AIR || a == LEFT_CLICK_BLOCK) { if (p.getInventory().getItemInMainHand().getType() == STICK) { if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals("§cWand")) { return; } } } Didn't work either.
@md_5 Good idea, fairly silly of me to not put the fix in here since I've suggest many people to do the same. Fixed by changing Code (Text): if (a == RIGHT_CLICK_AIR || a == RIGHT_CLICK_BLOCK || a == LEFT_CLICK_AIR || a == LEFT_CLICK_BLOCK) { if (e.getItem().getType() == STICK) { if (e.getItem().getItemMeta().getDisplayName().equals("§cWand")) { return; } } } p.getWorld().spawnEntity(p.getLocation(), FIREBALL); to Code (Text): if (a == RIGHT_CLICK_AIR || a == RIGHT_CLICK_BLOCK || a == LEFT_CLICK_AIR || a == LEFT_CLICK_BLOCK) { if (e.getItem().getType() == STICK) { if (e.getItem().getItemMeta().getDisplayName().equals("§cWand")) { p.getWorld().spawnEntity(p.getLocation(), FIREBALL); } } } https://github.com/PiggyPiglet/Chal...Warrior/me/piggypiglet/warrior/MageEvent.java