Skip to content

Instantly share code, notes, and snippets.

@kvizdos
Created February 11, 2017 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvizdos/dce51d1fea3cc28dd0324d9452bc7a3a to your computer and use it in GitHub Desktop.
Save kvizdos/dce51d1fea3cc28dd0324d9452bc7a3a to your computer and use it in GitHub Desktop.
public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlayerBreakBlockEvent(BlockBreakEvent e) {
Player p = e.getPlayer();
p.sendMessage("You broke a " + ChatColor.GREEN + e.getBlock().getType());
// TODO: THEN TEST!!!!!!!!!!!!!!!!!!!
if(e.getBlock().getType().equals(Material.STONE)) {
p.sendMessage("NO BREAKING STONE!");
e.setCancelled(true);
} else {
p.sendMessage("You broke a " + ChatColor.GREEN + e.getBlock().getType());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment