* @param sender
* @param name Trimmed name.
* @param reason
*/
void ban(CommandSender sender, String name, String reason) {
final Server server = Bukkit.getServer();
Player player = DataManager.getPlayer(name);
// Pro logic below.
if (player == null && !IdUtil.isValidMinecraftUserName(name)) {
UUID id = IdUtil.UUIDFromStringSafe(name);
if (id != null) {
LogUtil.logWarning("Banning by UUID might not work (" + id.toString()+"), relay to the vanilla command.");
} else {
LogUtil.logWarning("Might not be a valid user name: " + name);
}
}
if (player != null){
player.kickPlayer(reason);
}
// Relay to the server command for compatibility reasons.
server.dispatchCommand(server.getConsoleSender(), "ban " + name);
logBan(sender, player, name, reason);
}