Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. @EventHandler
  2. public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent e) {
  3. Player p = e.getPlayer();
  4. User user = UserManager.getUser(p.getUniqueId());
  5. if (user.hasGuild())
  6. {
  7. if (e.getMessage().startsWith("!!"))
  8. {
  9. ChatUtil.sendMessage(user.getGuild().getUsersListWithLeader(), MessagesConfig.GUILD_ALLY_CHAT_FORMAT.replace("%NICK%", p.getName()).replace("%TAG%", user.getGuild().getTag()).replace("%MESSAGE%", e.getMessage()));
  10. for (Guild g : user.getGuild().getAlly()) {
  11. ChatUtil.sendMessage(g, MessagesConfig.GUILD_ALLY_CHAT_FORMAT.replace("%NICK%", p.getName()).replace("%MESSAGE%", e.getMessage()));
  12. }
  13. e.setCancelled(true);
  14. }
  15. if (e.getMessage().startsWith("!"))
  16. {
  17. ChatUtil.sendMessage(user.getGuild().getUsersListWithLeader(), MessagesConfig.GUILD_TEAM_CHAT_FORMAT.replace("%NICK%", p.getName()).replace("%TAG%", user.getGuild().getTag()).replace("%MESSAGE%", e.getMessage())); return;
  18. }
  19. }
  20. if (!p.hasPermission("xGuilds.chat_bypass")) {
  21. if (user.isMuted()) {
  22. ChatUtil.sendMessage(p, "&cNie mozesz pisac, jestes wyciszony przez &7"+user.getMuteName()+" &cz powodem: &7"+user.getMuuteReason()+" &cdo: &7"+ TimeUtil.getDate(user.getMute()));
  23. e.setCancelled(true);
  24. }
  25. }
  26. if (user.hasGuild())
  27. {
  28. if (e.getMessage().startsWith("!") || (e.getMessage().startsWith("!!"))) {
  29. e.setCancelled(true);
  30. }
  31. String format = e.getFormat();
  32. format = format.replace("{POINTS}", String.valueOf(user.getRanking().getPoints()));
  33. if (user.hasGuild()) {
  34. format = format.replace("{TAG}", ChatUtil.fixColors("&8[" + RelationUtil.getRelation(user, user).getColor() + user.getGuild().getTag() + "&8] "));
  35. } else {
  36. format = format.replace("{TAG}", "");
  37. }
  38. e.setFormat(format);
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement