diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 48e990b..c762a98 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -28,12 +28,25 @@ public class ChatListener extends BasicListener { @EventHandler public void onChatEvent(ChatEvent e){ + sanitize7(e); if(e.getMessage().startsWith("/")) onCommand(e); else onChat(e); } + /* + * Replaces 7(7)command to /(/)command. + * */ + private void sanitize7(ChatEvent e){ + String begin = e.getMessage().split(" ", 2)[0]; + if(begin.startsWith("7") && begin.substring(1).matches("[A-Za-z]+")){ + e.setMessage("/" + e.getMessage().substring(1)); + }else if(begin.startsWith("77") && begin.substring(2).matches("[A-Za-z]+")){ + e.setMessage("//" + e.getMessage().substring(2)); + } + } + private void onCommand(ChatEvent e){ String [] command = e.getMessage().split(" "); if(command[0].contains(":")){