Archived
0

Moved colorify method into Utils class

This commit is contained in:
Pepich
2017-05-05 10:23:21 +02:00
parent 628c182aa3
commit c1ac03fb57

View File

@@ -27,7 +27,7 @@ import com.redstoner.misc.Utils;
import com.redstoner.modules.Module; import com.redstoner.modules.Module;
@AutoRegisterListener @AutoRegisterListener
@Version(major = 2, minor = 0, revision = 5, compatible = 2) @Version(major = 2, minor = 0, revision = 6, compatible = 2)
public class Chatalias implements Module, Listener public class Chatalias implements Module, Listener
{ {
// to export chatalias data to json: // to export chatalias data to json:
@@ -119,22 +119,11 @@ public class Chatalias implements Module, Listener
return; return;
} }
} }
event.setMessage(colorify(event.getMessage(), player)); event.setMessage(Utils.colorify(event.getMessage(), player));
if (changed) if (changed)
saveAliases(uuid); saveAliases(uuid);
} }
public static String colorify(String message, CommandSender sender)
{
if (sender.hasPermission("essentials.chat.color"))
message = message.replaceAll("&([0-9a-fA-FrR])", "§$1");
if (sender.hasPermission("essentials.chat.format"))
message = message.replaceAll("&(l-oL-OrR)", "§$1");
if (sender.hasPermission("essentials.chat.magic"))
message = message.replaceAll("&([kKrR])", "§$1");
return message;
}
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerCommand(PlayerCommandPreprocessEvent event) public void onPlayerCommand(PlayerCommandPreprocessEvent event)
{ {