I swear to god, my plugin hates me or something... nothing is working properly... anyway, PHP: public void onBlockPlace(BlockPlaceEvent event){ System.out.println("TEST PLEASE WORK"); } doesn't work! I swear to god... I have searched, probed the javadocs, tried everything. No. It doesn't want to trigger. Please help a noob
Unfortunately i can't help you, i can only say my test plugin doesn't get the event either. In the roadmap the event is marked as "done", but in the java docs it still says "not implemented yet".
It works. Code: public void onBlockPlace(BlockPlaceEvent event) { Block block = event.getBlockPlaced(); event.getPlayer().sendMessage(block.getType().name()); event.setCancelled(false); if (event.getBlockPlaced().getType().equals(Material.TNT)) { event.getBlockPlaced().setType(Material.AIR); event.setCancelled(true); }
Okay, i found an error in my code after looking into RightLegRed's example. I wrote onBlockPlaced(). Now that i changed it to onBlockPlace() it works for me too. Could you paste more of your code David? The error must be somewhere else.
Maybe you forgot to register the event? Code: pm.registerEvent(Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
-.- I looked at my event code and I retyped BLOCK_PLACED (even though it was that in the first place and valid) and it works now... Thanks
To avoid such mistakes try using the annotation @Override before the method to ensure your using a method from the base listener.
Sorry to resurrect a bit of a dead topic, but I think it would be better than making a new one on the same sort of topic. I'm having trouble getting my onBlockPlace to work. Heres my function in my block listener: public void onBlockPlace(BlockPlaceEvent be){ Block b = be.getBlock(); be.getPlayer().sendMessage("Block placed: " + b.getType().name()); if(isSign(b)){ plugin.getServer().broadcastMessage("Sign placed."); if(isBlockIndirectlyPowered(b)){ plugin.getServer().broadcastMessage("Sign placed, powered, outside of onSignPowered"); onSignPowered(b); } } } And my register line: pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this); Now it doesn't matter what my functions mean (isSign, the others - one which I borrowed from Afforess ), that first sendMessage() should work, but that message only seems to show up if its not a sign/signpost, or redstone dust. It makes no sense to me. I'm guessing it just doesn't work for signs or redstone yet?