public class ChatUtil { public static void sendMsg(final Player p, final String msg) { p.sendMessage(fixColor(msg).replace("{NICK}", p.getName())); } public static void sendMsgS(final CommandSender sender, final String msg) { sender.sendMessage(fixColor(msg).replace("{NICK}", sender.getName())); } public static String fixColor(final String text) { return text.replace(">>", "»").replace("<<", "«").replace("&", "§"); } public static boolean isInteger(final String string) { return Pattern.matches("-?[0-9]+", string.subSequence(0, string.length())); } public static String locToString(final double x, final double y, final double z) { return String.valueOf(String.valueOf(x)) + ":" + y + ":" + z + ":" + 0.0f + ":" + 0.0f; } public static String locToString(final Location loc) { return String.valueOf(String.valueOf(loc.getX())) + ":" + loc.getY() + ":" + loc.getZ() + ":" + loc.getYaw() + ":" + loc.getPitch(); } public static Location locFromString(final String str) { final String[] str2loc = str.split(":"); final Location loc = new Location((World)Bukkit.getWorlds().get(0), 0.0, 0.0, 0.0, 0.0f, 0.0f); loc.setX(Double.parseDouble(str2loc[0])); loc.setY(Double.parseDouble(str2loc[1])); loc.setZ(Double.parseDouble(str2loc[2])); loc.setYaw(Float.parseFloat(str2loc[3])); loc.setPitch(Float.parseFloat(str2loc[4])); return loc; } }