Getting block placed

Discussion in 'Plugin Development' started by beastman3226, Aug 29, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    beastman3226

    I'm using getBlockPlaced but I can't get the if it equals tnt then do this.
     
  2. Offline

    caldabeast

    Code:java
    1.  
    2. public class PortalInteract implements Listener{
    3. @EventHandler
    4. public static void onBlockPlace(final BlockPlaceEvent e){
    5. if(e.getBlock().getType() == Material.TNT){
    6. //do stuff
    7. }
    8. }
    9. }
    10.  
    EDIT:
    And don't forget to register the listener. Add this line to the OnEnable() if you have the onBlockPlace method in the main class.
    Code:java
    1.  
    2. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    3.  
    Also, the main class needs to implement Listener.
     
Thread Status:
Not open for further replies.

Share This Page