NoMoeTNT.java
package me.Z645.nomoetnt; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class NoMoeTNT extends JavaPlugin { public void onEnable(){ PluginManager manager = this.getServer().getPluginManager(); manager.registerEvents(new NoMoeTNTTNTListener(), this); this.getCommand("nomoetnt").setExecutor(new NoMoeTNTCommandExecutor(this)); } public void onDisable(){ } }NoMoeTNTTNTlistener.java
package me.Z645.nomoetnt; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; public class NoMoeTNTTNTListener implements Listener { @EventHandler(priority = EventPriority.HIGH) public void onBlockPlace(BlockPlaceEvent event){ if (event.isCancelled()) return; if (event.getBlock().getType() == Material.TNT){ event.setCancelled(true); Player player = event.getPlayer(); player.sendMessage(ChatColor.RED + "You are not allowed to place TNT!"); for (Player onlinePlayer : Bukkit.getServer().getOnlinePlayers()){ if (onlinePlayer.isOp()){ onlinePlayer.sendMessage(ChatColor.RED + "Player " + player.getName() + " tried placing a block of TNT!"); } } } if (event.getBlock().getType() == Material.LAVA){ event.setCancelled(true); Player player = event.getPlayer(); player.sendMessage(ChatColor.RED + "You are not allowed to place Lava!"); for (Player onlinePlayer : Bukkit.getServer().getOnlinePlayers()){ if (onlinePlayer.isOp()){ onlinePlayer.sendMessage(ChatColor.RED + "Player" + player.getName() + "tried to place Lava"); } } } } @EventHandler(priority = EventPriority.HIGH) public void onExplosionPrime(ExplosionPrimeEvent event){ if (event.isCancelled()) return; if (event.getEntity() instanceof TNTPrimed){ event.setCancelled(true); } } }plugin.yml
name: NoMoeTNT version: 0.2 main: me.Z645.nomoetnt.NoMoeTNT commands: nomoetnt: description: Enables and Disables the plugin. usage: /nomoetnt permission: nomoetnt.basic permission-message: You don't have <permission>NoMoeTNTCommandExecutor.java
package me.Z645.nomoetnt; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; public class NoMoeTNTCommandExecutor implements CommandExecutor{ public NoMoeTNTCommandExecutor(NoMoeTNT plugin){ } public boolean onCommand(CommandSender sender, Command command, String label, String[] args){ onLoad(); return false; } }Also, if anyone could help me: I am trying to add more blocks to be denied, but I don't know if I put it in the first Public Class, or do I make a new one for it.