Clean up tempban messages to be a little clearer.

This commit is contained in:
KHobbits 2014-07-14 21:23:56 +01:00
parent ae984c2055
commit c829a32555
30 changed files with 80 additions and 19 deletions

View File

@ -63,7 +63,7 @@ public class Commandban extends EssentialsCommand
banReason = tl("defaultBanReason");
}
Bukkit.getBanList(BanList.Type.NAME).addBan(user.getName(), banReason, null, senderName);
ess.getServer().getBanList(BanList.Type.NAME).addBan(user.getName(), banReason, null, senderName);
String banDisplay = tl("banFormat", banReason, senderName);

View File

@ -62,7 +62,7 @@ public class Commandbanip extends EssentialsCommand
banReason = tl("defaultBanReason");
}
Bukkit.getBanList(BanList.Type.IP).addBan(ipAddress, banReason, null, senderName);
ess.getServer().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

@ -7,11 +7,14 @@ import com.earth2me.essentials.UserMap;
import com.earth2me.essentials.utils.DateUtil;
import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.StringUtil;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import java.util.UUID;
import org.bukkit.BanEntry;
import org.bukkit.Location;
import org.bukkit.Server;
@ -56,15 +59,14 @@ public class Commandseen extends EssentialsCommand
seenIP(server, sender, args[0]);
return;
}
else if (Bukkit.getBanList(BanList.Type.IP).isBanned(args[0]))
else if (ess.getServer().getBanList(BanList.Type.IP).isBanned(args[0]))
{
sender.sendMessage(tl("isIpBanned", args[0]));
return;
}
else if (Bukkit.getBanList(BanList.Type.NAME).isBanned(args[0]))
else if (ess.getServer().getBanList(BanList.Type.NAME).isBanned(args[0]))
{
sender.sendMessage(tl("whoisBanned", showBan ? Bukkit.getBanList(BanList.Type.NAME).getBanEntry(args[0]).getReason() : tl("true")));
sender.sendMessage(tl("whoisBanned", showBan ? ess.getServer().getBanList(BanList.Type.NAME).getBanEntry(args[0]).getReason() : tl("true")));
return;
}
else
@ -145,7 +147,19 @@ public class Commandseen extends EssentialsCommand
if (user.getBase().isBanned())
{
sender.sendMessage(tl("whoisBanned", showBan ? Bukkit.getBanList(BanList.Type.NAME).getBanEntry(user.getName()).getReason() : tl("true")));
final BanEntry banEntry = ess.getServer().getBanList(BanList.Type.NAME).getBanEntry(user.getName());
final String reason = showBan ? banEntry.getReason() : tl("true");
sender.sendMessage(tl("whoisBanned", reason));
if (banEntry.getExpiration() != null)
{
Date expiry = banEntry.getExpiration();
String expireString = tl("now");
if (expiry.after(new Date()))
{
expireString = DateUtil.formatDateDiff(expiry.getTime());
}
sender.sendMessage(tl("whoisTempBanned", expireString));
}
}
final String location = user.getGeoLocation();
if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show")))
@ -170,7 +184,7 @@ public class Commandseen extends EssentialsCommand
{
final UserMap userMap = ess.getUserMap();
if (Bukkit.getBanList(BanList.Type.IP).isBanned(ipAddress))
if (ess.getServer().getBanList(BanList.Type.IP).isBanned(ipAddress))
{
sender.sendMessage(tl("isIpBanned", ipAddress));
}

View File

@ -9,7 +9,6 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.Server;
@ -63,13 +62,13 @@ public class Commandtempban extends EssentialsCommand
}
final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
Bukkit.getBanList(BanList.Type.NAME).addBan(user.getName(), banReason, new Date(banTimestamp), senderName);
ess.getServer().getBanList(BanList.Type.NAME).addBan(user.getName(), banReason, new Date(banTimestamp), senderName);
final String expiry = DateUtil.formatDateDiff(banTimestamp);
String banDisplay = tl("tempBanned", DateUtil.formatDateDiff(banTimestamp), senderName, banReason);
final String banDisplay = tl("tempBanned", expiry, senderName, banReason);
user.getBase().kickPlayer(banDisplay);
server.getLogger().log(Level.INFO, tl("playerBanned", senderName, user.getName(), banDisplay));
final String message = tl("playerBanned", senderName, user.getName(), banReason, DateUtil.formatDateDiff(banTimestamp));
final String message = tl("playerTempBanned", senderName, user.getName(), expiry, banReason);
server.getLogger().log(Level.INFO, message);
ess.broadcastMessage("essentials.ban.notify", message);
}

View File

@ -30,7 +30,7 @@ public class Commandunban extends EssentialsCommand
{
final User user = getPlayer(server, args, 0, true, true);
name = user.getName();
Bukkit.getBanList(BanList.Type.NAME).pardon(name);
ess.getServer().getBanList(BanList.Type.NAME).pardon(name);
}
catch (NoSuchFieldException e)
{
@ -40,12 +40,12 @@ public class Commandunban extends EssentialsCommand
{
throw new Exception(tl("playerNotFound"), e);
}
Bukkit.getBanList(BanList.Type.NAME).pardon(name);
ess.getServer().getBanList(BanList.Type.NAME).pardon(name);
}
final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
server.getLogger().log(Level.INFO, tl("playerUnbanned", senderName, name));
ess.broadcastMessage("essentials.ban.notify", tl("playerUnbanned", senderName, name));
}
}

View File

@ -25,7 +25,7 @@ public class Commandunbanip extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
String ipAddress;
if (FormatUtil.validIP(args[0]))
{
@ -48,9 +48,9 @@ public class Commandunbanip extends EssentialsCommand
{
throw new PlayerNotFoundException();
}
Bukkit.getBanList(BanList.Type.IP).pardon(ipAddress);
ess.getServer().getBanList(BanList.Type.IP).pardon(ipAddress);
final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
server.getLogger().log(Level.INFO, tl("playerUnbanIpAddress", senderName, ipAddress));

View File

@ -552,3 +552,5 @@ itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -552,3 +552,5 @@ itemsConverted=\u00a76Converted all items into blocks.
itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.

View File

@ -553,3 +553,5 @@ itemsNotConverted=\u00a74You have no items that can be converted into blocks.
mailSentTo=\u00a7c{0}\u00a76 has been sent the following mail\:
mailMessage={0}
whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.