How does the new Eventlistner work? i found this. http://jd.bukkit.org/doxygen/dc/dc5/interfaceorg_1_1bukkit_1_1event_1_1Listener.html it looks like it Listens to all events. i need to work width BlockListener, but it has canged to something i dont know. Edit: also the PlayerListener
First fix your event class to extend listener, add the @EventHandler tag, and then to register, replace all of those pm.registerEvent with: Code: getServer().getPluginManager().registerEvents(playerListener, this); getServer().getPluginManager().registerEvents(entityListener, this); etc. And you're done.
hmm i use it like this anywere but not above public class Code: public final MyBlockListener blockListener = new MyBlockListener(); onEnable Code: PluginManager pm = getServer().getPluginManager(); pm.registerEvents(this.blockListener, this); And then make a new class file named MyBlockListener and u can add these Code: @EventHandler public void blockBreaking(BlockBreakEvent event){ if (event.getBlock().getType() == Material.NETHER_BRICK_STAIRS) event.getPlayer().setHealth(2);//2 half hearts = 1 heart if (event.getBlock().getType() == Material.NETHER_BRICK) event.getPlayer().setHealth(2);//2 half hearts = 1 heart if (event.getBlock().getType() == Material.DIRT) event.getPlayer().getInventory(); if (event.getBlock().getType() == Material.COBBLESTONE) event.getBlock().getDrops(); } @EventHandler public void blockPlacing(BlockPlaceEvent event){ if (event.getBlock().getType() == Material.TNT) event.getPlayer().setHealth(0); } So on blockplacing some stuff will happen. Example with that code of me, if a player destroys a nether brick they lose health thats why the Code: event.getPlayer().setHealth(2);//2 half hearts = 1 heart But im just saying thats the way i do
Ok, Thx i see if i can figure out how to fix my problem. HOLY SH*T it finaly WORKS! THX! (Prety New to java) +1