Example #1
0
 /**
  * Convert a MobsChat Protocol coloured string to Bukkit coloured string
  *
  * @param message
  * @return
  */
 public static String InternalMarkupToBukkit(String message) {
   String sep = "§";
   String f = "";
   boolean first = true;
   for (String s : message.split(sep)) {
     if (first) {
       f = f + s;
       first = false;
     } else {
       String single = s.substring(0, 7);
       String rest = s.substring(7, s.length());
       Colour c = new Colour(single);
       String formating = "";
       if (c.isBold()) {
         formating = formating + "§l";
       }
       if (c.isItalic()) {
         formating = formating + "§o";
       }
       if (c.isUnderline()) {
         formating = formating + "§n";
       }
       if (c.isMagic()) {
         formating = formating + "§k";
       }
       if (c.isStrikethrough()) {
         formating = formating + "§m";
       }
       f = f + getBukkitColour(c) + formating + rest + "§r";
     }
   }
   return f;
 }