if (Player.getClient().getUserName().equals(player.getName())) {
logger.info("Kick Player inGame: "
+ Player.getClient().getUserName());
game
.sendAll(new MessageMessage("System",
"<span style=\"color:red;\">"
+ Player.getClient().getUserName()
+ " were kicked by <b>"
+ adminClient.getUserName()
+ "</b></span>"));
game.sendAll(new MessageMessage("System", Player
.getClient().getUserName()
+ " has left..."));
game.removeClient(Player.getClient());
if (game.getClients().isEmpty()) {
game.shutdown();
gameTerminated(game);
} else {
game.sendAll(new PlayerQuitMessage(player.getName(),
"Kick", Player.getClient().getClientID()));
game.gamePlayersChanged();
}
Player.getClient().disconnect();
gamesMessage();
adminClient
.send(new MessageMessage("System",
"<span style=\"color:red;\">"
+ Player.getClient().getUserName()
+ " were kicked by <b>"
+ adminClient.getUserName()
+ "</b></span>"));
kik = true;
break;
}
}
if (kik == true)
break;
}
if (kik == false) {
for (Client client : this.clients) {
if (client.getUserName().equals(player.getName())) {
logger.info("Kick Player inLobby: " + client.getUserName());
sendAll(new MessageMessage("System",
"<span style=\"color:red;\">"
+ client.getUserName()
+ " were kicked by <b>"
+ adminClient.getUserName() + "</b></span>"));
sendAll(new MessageMessage("System", client.getUserName()
+ " has left..."));
client.disconnect();
kik = true;
break;
}
}
}
if (kik == false) {
adminClient.send(new MessageMessage("System",
"<span style=\"color:red;\"> " + player.getName()
+ " User not Online !</span>"));
}
if (banUser == true) {
player.setBlocked(true);
try {
EntityManager entityManager =
PersistenceManager.getInstance().getEntityManager();
EntityTransaction entityTransaction = entityManager
.getTransaction();
entityTransaction.begin();
entityManager.merge(player);
entityManager.flush();
entityTransaction.commit();
adminClient.send(new MessageMessage("System","<span style=\"color:red;\">"
+ player.getName()
+ " (Account) has been banned !</span>"));
logger.debug("Block for User " + player.getName() + " / "
+ player.getMac() + " saved.");
} catch (Throwable t) {
logger.error("error while saving block for User "
+ player.getName() + " / " + player.getMac() + " ", t);
}
}
if (banUserAndMac == true) {
adminClient.send(new MessageMessage("System","<span style=\"color:red;\">"
+ player.getName()
+ " (Mac) has been blacklisted !</span>"));
try {
EntityManager entityManager = PersistenceManager