Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---- Detect Custom Chat - This was added to allow custom commands with custom chats! - Added v0.8.2
- @EventHandler
- public void detectCustomChat(PlayerCommandPreprocessEvent e) {
- Player p = e.getPlayer();
- if (p.hasPermission("vippluschat.allowchat")) {
- try {
- String[] cmd = e.getMessage().split(" ");
- int chatID = detectChatID(cmd[0].replace("/", ""));
- if (chatID > -1 & p.hasPermission("vippluschat.chat." + getCustomChats().getString(chatID + ".permission"))) {
- String msg = "";
- for(int i = 0; i < cmd.length; i++){
- if (i != 0) {
- String fmsg = cmd[i] + " ";
- msg = msg + fmsg;
- }
- }
- e.setCancelled(true);
- if (serverAntiSwear(chatID)) {
- msg = antiswearServerCheck(msg, chatID);
- if (msg.equalsIgnoreCase("ERROR: 1337 - Banned Message")) {
- pMessage(getConfig().getString("Messages.antiswear-banned").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), e.getPlayer());
- } else {
- sendMessages(msg, e.getPlayer(), "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
- }
- } else {
- sendMessages(msg, e.getPlayer(), "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
- }
- }
- } catch (ArrayIndexOutOfBoundsException catcherror) {
- int chatID = detectChatID(e.getMessage().replace("/", ""));
- if (chatID > -1) {
- if (p.hasPermission("vippluschat.chat." + getCustomChats().getString(chatID + ".permission"))) {
- e.setCancelled(true);
- }
- }
- }
- }
- }
- //---- End Detect Custom Chat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement