Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (sub[0].equals("banir")) {
- MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(sub[1]);
- String time = sub[2];
- int hours = Integer.parseInt(sub[2]);
- String description = joinStringFrom(sub, 2);
- String reason = player.getName() + " baniu "+victim.getName()+" por "+description;
- if(victim == null || description == null || time == null){
- player.message("!banir [jogador] [tempo] [motivo]");
- return true;
- }
- if(hours == 0 && player.gmLevel() >= 3){
- player.message("Somente administradores podem banir permanetemente!");
- return true;
- }
- if(hours > 0){
- try {
- String tempban = "STR_TO_DATE("+sub[2]+" "+sub[3]+",'%Y/%m/%d %H:%i')"; /* pega a data atual e soma o time, depois convert em str */
- try (PreparedStatement p = DatabaseConnection.getConnection().prepareStatement("UPDATE accounts "
- + "SET tempban = '"+tempban+"', "
- + "banreason = '"+description+"' "
- + "WHERE id = " + victim.getName())) {
- p.executeUpdate();
- }
- victim.getClient().disconnect(false, false);
- victim.sendPolice("Voce foi banido do FlameStory. Rasao: "+ description +"; Tempo:"+ time +" horas.");
- player.dropMessage("Voce baniu "+ victim.getName() +". Rasao: "+ description +"; Tempo:"+ time +" horas.");
- logger logger = new logger(player.getName()+"baniu "+ victim.getName() +". Rasao: "+ description +"; Tempo:"+ time +" horas.");
- } catch (Exception e) {
- player.message("Ocorreu algum erro ao tentar banir o jogador "+victim.getName()+".");
- }
- return true;
- }else{
- String ip = victim.getClient().getSession().getRemoteAddress().toString().split(":")[0];
- reason += " (IP: " + ip + ")";
- victim.ban(reason);
- victim.sendPolice("Voce foi banido do FlameStory. Rasao: "+ description +".");
- player.dropMessage("Voce baniu "+ victim.getName() +". Rasao: "+ description +".");
- logger logger = new logger(player.getName()+"baniu "+ victim.getName() +". Rasao: "+ description +"; Tempo: permanente.");
- return true;
- }
- }
Add Comment
Please, Sign In to add comment