Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent e) {
- Player p = e.getPlayer();
- User user = UserManager.getUser(p.getUniqueId());
- if (user.hasGuild())
- {
- if (e.getMessage().startsWith("!!"))
- {
- ChatUtil.sendMessage(user.getGuild().getUsersListWithLeader(), MessagesConfig.GUILD_ALLY_CHAT_FORMAT.replace("%NICK%", p.getName()).replace("%TAG%", user.getGuild().getTag()).replace("%MESSAGE%", e.getMessage()));
- for (Guild g : user.getGuild().getAlly()) {
- ChatUtil.sendMessage(g, MessagesConfig.GUILD_ALLY_CHAT_FORMAT.replace("%NICK%", p.getName()).replace("%MESSAGE%", e.getMessage()));
- }
- e.setCancelled(true);
- }
- if (e.getMessage().startsWith("!"))
- {
- ChatUtil.sendMessage(user.getGuild().getUsersListWithLeader(), MessagesConfig.GUILD_TEAM_CHAT_FORMAT.replace("%NICK%", p.getName()).replace("%TAG%", user.getGuild().getTag()).replace("%MESSAGE%", e.getMessage())); return;
- }
- }
- if (!p.hasPermission("xGuilds.chat_bypass")) {
- if (user.isMuted()) {
- ChatUtil.sendMessage(p, "&cNie mozesz pisac, jestes wyciszony przez &7"+user.getMuteName()+" &cz powodem: &7"+user.getMuuteReason()+" &cdo: &7"+ TimeUtil.getDate(user.getMute()));
- e.setCancelled(true);
- }
- }
- if (user.hasGuild())
- {
- if (e.getMessage().startsWith("!") || (e.getMessage().startsWith("!!"))) {
- e.setCancelled(true);
- }
- String format = e.getFormat();
- format = format.replace("{POINTS}", String.valueOf(user.getRanking().getPoints()));
- if (user.hasGuild()) {
- format = format.replace("{TAG}", ChatUtil.fixColors("&8[" + RelationUtil.getRelation(user, user).getColor() + user.getGuild().getTag() + "&8] "));
- } else {
- format = format.replace("{TAG}", "");
- }
- e.setFormat(format);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement