Add ban reason to /banip

This commit is contained in:
KHobbits 2014-07-12 17:03:11 +01:00
parent 093a1f677b
commit 575a8142ff
2 changed files with 18 additions and 5 deletions

View File

@ -6,9 +6,12 @@ import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil;
import java.util.logging.Level;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.Server;
//TODO: Add kick to online players matching ip ban.
public class Commandbanip extends EssentialsCommand
{
public Commandbanip()
@ -49,9 +52,19 @@ public class Commandbanip extends EssentialsCommand
throw new PlayerNotFoundException();
}
ess.getServer().banIP(ipAddress);
server.getLogger().log(Level.INFO, tl("playerBanIpAddress", senderName, ipAddress));
String banReason;
if (args.length > 1)
{
banReason = FormatUtil.replaceFormat(getFinalArg(args, 1).replace("\\n", "\n").replace("|", "\n"));
}
else
{
banReason = tl("defaultBanReason");
}
ess.broadcastMessage("essentials.ban.notify", tl("playerBanIpAddress", senderName, ipAddress));
Bukkit.getBanList(BanList.Type.IP).addBan(ipAddress, banReason, null, senderName);
server.getLogger().log(Level.INFO, tl("playerBanIpAddress", senderName, ipAddress, banReason));
ess.broadcastMessage("essentials.ban.notify", tl("playerBanIpAddress", senderName, ipAddress, banReason));
}
}

View File

@ -321,8 +321,8 @@ pWeatherPlayers=\u00a76These players have their own weather\:\u00a7r
pWeatherReset=\u00a76Player weather has been reset for\: \u00a7c{0}
pWeatherSet=\u00a76Player weather is set to \u00a7c{0}\u00a76 for\: \u00a7c{1}.
pendingTeleportCancelled=\u00a74Pending teleportation request cancelled.
playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address\:\u00a7c {1}\u00a76.
playerBanned=\u00a76Player\u00a7c {0} \u00a76banned\u00a7c {1} \u00a76for \u00a7c{2}\u00a76.
playerBanIpAddress=\u00a76Player\u00a7c {0} \u00a76banned IP address\u00a7c {1} \u00a76for\: \u00a7c{2}\u00a76.
playerBanned=\u00a76Player\u00a7c {0} \u00a76banned\u00a7c {1} \u00a76for\: \u00a7c{2}\u00a76.
playerInJail=\u00a74Player is already in jail\u00a7c {0}\u00a74.
playerJailed=\u00a76Player\u00a7c {0} \u00a76jailed.
playerJailedFor=\u00a76Player\u00a7c {0} \u00a76jailed for {1}.