use of com.laytonsmith.abstraction.MCPlayer in project CommandHelper by EngineHub.
the class Static method SendMessage.
/**
* This function sends a message to the player. If the player is not online, a CRE is thrown.
*
* @param m
* @param msg
*/
public static void SendMessage(final MCCommandSender m, String msg, final Target t) {
if (m != null && !(m instanceof MCConsoleCommandSender)) {
if (m instanceof MCPlayer) {
MCPlayer p = (MCPlayer) m;
if (!p.isOnline()) {
throw new CREPlayerOfflineException("The player " + p.getName() + " is not online", t);
}
}
m.sendMessage(msg);
} else {
msg = Static.MCToANSIColors(msg);
if (msg.contains("\033")) {
// We have terminal colors, we need to reset them at the end
msg += TermColors.reset();
}
StreamUtils.GetSystemOut().println(msg);
}
}
Aggregations