Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. public class Main extends JavaPlugin implements Listener {
  2.  
  3. Map<String, Boolean> hashOfBoolean = new HashMap<String, Boolean>();
  4. public void onEnable() {
  5.  
  6. Bukkit.getPluginManager().registerEvents(this, this);
  7. }
  8.  
  9. @Override
  10. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  11. if(!(sender instanceof Player)) {
  12. sender.sendMessage(ChatColor.RED + "Apenas players podem usar esse comando");
  13. return true;
  14. }
  15. Player localPlayer = (Player)sender;
  16. if(cmd.getName().equalsIgnoreCase("comando")) {
  17. if(!localPlayer.hasPermission("comando.usar")) {
  18. localPlayer.sendMessage("Sem permissao!");
  19. return true;
  20. }
  21. if(!hashOfBoolean.get("Chat") == true) {
  22. hashOfBoolean.put("Chat", true);
  23. localPlayer.sendMessage("True ativado!");
  24. }else{
  25. localPlayer.sendMessage("True ativado!");
  26. hashOfBoolean.put("Chat", false);
  27. }
  28. }
  29. return false;
  30. }
  31.  
  32.  
  33. @EventHandler
  34. public void chat(AsyncPlayerChatEvent e) {
  35. Player p = (Player)e.getPlayer();
  36. if(hashOfBoolean.get("Chat") == null) return;
  37. if(hashOfBoolean.get("Chat") == false) {
  38. if(p.isOp()) return;
  39. e.setCancelled(true);
  40. p.sendMessage(ChatColor.RED + "shiiiiu");
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement