FL4ZH

NoWorkBench Code

Apr 7th, 2014
40
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.ZygoZ;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Material;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.block.BlockPlaceEvent;
  10. import org.bukkit.plugin.PluginManager;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13. public class NoWorkBench extends JavaPlugin implements Listener {
  14.  
  15. public static Material[] banList = {Material.WORKBENCH};
  16.  
  17. public void onEnable(){
  18. PluginManager pm = Bukkit.getPluginManager();
  19. pm.registerEvents(this, this);
  20. }
  21.  
  22. @EventHandler
  23.  
  24. public void onBlockPlace(BlockPlaceEvent event) {
  25. Material block = event.getBlock().getType();
  26. Player player = event.getPlayer();
  27.  
  28. for(Material blocked : banList) {
  29. if(blocked == block) {
  30. if(player.isOp()) {
  31.  
  32. }
  33. else {
  34. event.getBlock().setType(Material.AIR);
  35. player.sendMessage(ChatColor.RED + "[NoWorkBench]" + ChatColor.DARK_RED + " Du må ikke crafte!");
  36. }
  37. }
  38.  
  39.  
  40. }
  41. }
  42.  
  43.  
  44. }
RAW Paste Data