Code: public class Main extends JavaPlugin implements Listener { booleanseed = false; Integer count = 0; public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args) { if (sender.hasPermission("uhc.seeddodgers")){ if (args.length == 1){ if (cmd.getName().equalsIgnoreCase("seeddodgers")){ if (args[0].equalsIgnoreCase("enable")){ seed = true; count = 0; Bukkit.broadcastMessage(ChatColor.GRAY + "Seed Dodgers Enabled"); } if (args[0].equalsIgnoreCase("disable")){ seed = false; count = 0; Bukkit.broadcastMessage(ChatColor.GRAY + "Seed Dodgers Disabled"); } } } } returnfalse; } @SuppressWarnings("deprecation") @EventHandler public void onPickup(PlayerPickupItemEvent event){ Item i = event.getItem(); ItemStack item = i.getItemStack(); Player p = event.getPlayer(); if(item.getType() == Material.SEEDS){ if (seed == true){ if (count < 21){ count ++; p.damage(20); Bukkit.broadcastMessage(ChatColor.GRAY + " " + p + " Picked up a seed and is now dead!" ); Bukkit.broadcastMessage(ChatColor.GRAY + "" + count + "/20 Dead"); }else{ p.sendMessage("hi"); } if (count == 21){ seed = false; Bukkit.broadcastMessage(ChatColor.GRAY + " Seed Dodger is now off!"); } } else{ p.sendMessage("Hi"); } } } The Pickup event is not working, but the command is.
have you registered your events in another class? cuz I didn't see it. for the pickup event to actually work you need to register your events. do this with the following: getServer().getPluginManager().registerEvents(this, this); have you got an onEnable and everything?
It's working for me.. Code: Bukkit.broadcastMessage(ChatColor.GRAY + " " + p + " Picked up a seed and is now dead!" ); And you should use p.getName() here..
AFAIK there's nothing here that shouldn't work if everything is registered (events and commands.) As for the broadcasting, I know nothing about it but the code @AdobeGFX has seems to look good. Try reloading your server.