API
Listeners
TreeCutEvent
public class TreeCutListener implements Listener {
@EventHandler
public void onTreeCut(TreeCutEvent e) {
//player triggered event
Player p = e.getPlayer();
//block to cut
Set<Block> blocks = e.getBlocks();
//can be canceled
e.setCancelled(true);
}
} TreeGlowEvent
TreeGlowEvent
public class TreeGlowListener implements Listener {
@EventHandler
public void onTreeCut(TreeGlowEvent e) {
//player triggered event
Player p = e.getPlayer();
//block to glow
Set<Block> blocks = e.getBlocks();
//can be canceled
e.setCancelled(true);
}
}
Don't forget to register listeners!
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new TreeGlowListener(), this);
getServer().getPluginManager().registerEvents(new TreeCutListener(), this);
}
Last updated