SHARE
TWEET

Untitled

a guest Oct 18th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Module.Info(name = "ColouredChat", category = Module.Category.MISC, description = "Automatically puts a > in front of all your messages")
  2. public class ColourChat extends Module {
  3.     private Setting<ColourMode> mode = register(Settings.e("Mode", ColourMode.GREEN));
  4.  
  5.     @EventHandler
  6.     public Listener<PacketEvent.Send> listener = new Listener<>(event -> {
  7.         if (event.getPacket() instanceof CPacketChatMessage) {
  8.             String z = ((CPacketChatMessage) event.getPacket()).getMessage();
  9.             if (z.startsWith("/")) return;
  10.             if (z.startsWith("#")) return;
  11.             if (z.startsWith(".")) return;
  12.             if (z.startsWith("!")) return;
  13.             if (z.startsWith("-")) return;
  14.             switch (mode.getValue()) {
  15.                 case GREEN:
  16.                     z = ">| " + z;
  17.                     if (z.length() >= 256) z = z.substring(0,256);
  18.                     ((CPacketChatMessage) event.getPacket()).message = z;
  19.                     break;
  20.                 case RED:
  21.                     z = "<| " + z;
  22.                     if (z.length() >= 256) z = z.substring(0,256);
  23.                     ((CPacketChatMessage) event.getPacket()).message = z;
  24.                     break;
  25.                 case ORANGE:
  26.                     z = ",| " + z;
  27.                     if (z.length() >= 256) z = z.substring(0,256);
  28.                     ((CPacketChatMessage) event.getPacket()).message = z;
  29.                     break;
  30.                 case LIGHT_BLUE:
  31.                     z = ":| " + z;
  32.                     if (z.length() >= 256) z = z.substring(0,256);
  33.                     ((CPacketChatMessage) event.getPacket()).message = z;
  34.                     break;
  35.                 case DARK_BLUE:
  36.                     z = ";| " + z;
  37.                     if (z.length() >= 256) z = z.substring(0,256);
  38.                     ((CPacketChatMessage) event.getPacket()).message = z;
  39.                     break;
  40.                 case GREY:
  41.                     z = "[| " + z;
  42.                     if (z.length() >= 256) z = z.substring(0,256);
  43.                     ((CPacketChatMessage) event.getPacket()).message = z;
  44.                     break;
  45.                 case BLACK:
  46.                     z = "]| " + z;
  47.                     if (z.length() >= 256) z = z.substring(0,256);
  48.                     ((CPacketChatMessage) event.getPacket()).message = z;
  49.                     break;
  50.             }
  51.         }
  52.     }
  53.     );
  54.     private enum ColourMode {
  55.         GREEN, RED, ORANGE, LIGHT_BLUE, DARK_BLUE, GREY, BLACK
  56.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top