Skip to content

Commit

Permalink
Clean up tempban messages to be a little clearer.
Browse files Browse the repository at this point in the history
  • Loading branch information
khobbits committed Jul 14, 2014
1 parent ae984c2 commit c829a32
Show file tree
Hide file tree
Showing 30 changed files with 80 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void run(final Server server, final CommandSource sender, final String co
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void run(final Server server, final CommandSource sender, final String co
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));
Expand Down
26 changes: 20 additions & 6 deletions Essentials/src/com/earth2me/essentials/commands/Commandseen.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
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;

Expand Down Expand Up @@ -56,15 +59,14 @@ protected void seen(final Server server, final CommandSource sender, final Strin
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
Expand Down Expand Up @@ -145,7 +147,19 @@ private void seenOffline(final Server server, final CommandSource sender, User u

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")))
Expand All @@ -170,7 +184,7 @@ private void seenIP(final Server server, final CommandSource sender, final Strin
{
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.GregorianCalendar;
import java.util.logging.Level;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.Server;


Expand Down Expand Up @@ -63,13 +62,13 @@ public void run(final Server server, final CommandSource sender, final String co
}

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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void run(final Server server, final CommandSource sender, final String co
{
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)
{
Expand All @@ -40,12 +40,12 @@ public void run(final Server server, final CommandSource sender, final String co
{
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void run(final Server server, final CommandSource sender, final String co
{
throw new NotEnoughArgumentsException();
}

String ipAddress;
if (FormatUtil.validIP(args[0]))
{
Expand All @@ -48,9 +48,9 @@ public void run(final Server server, final CommandSource sender, final String co
{
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));

Expand Down
2 changes: 2 additions & 0 deletions Essentials/src/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_cs.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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}

This comment has been minimized.

Copy link
@necrodoom

necrodoom Jul 15, 2014

Contributor

Whys the empty line?

This comment has been minimized.

Copy link
@khobbits

khobbits Jul 15, 2014

Author Member

It's just a temp file until the files are regenerated with crowdin, doesn't really matter, I just used the netbeans TL tool to add the message to all TL files.

This comment has been minimized.

Copy link
@necrodoom

necrodoom Jul 16, 2014

Contributor

Oh, thanks.

whoisTempBanned=\u00a76 - Ban expires:\u00a7r {0}
playerTempBanned=\u00a76Player \u00a7c{0}\u00a76 temporarily banned \u00a7c{1}\u00a76 for \u00a7c{2}\u00a76: \u00a7c{3}\u00a76.
2 changes: 2 additions & 0 deletions Essentials/src/messages_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_et.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_fi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_hu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_ko.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_lt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_pl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_pt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_ro.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_zh_HK.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions Essentials/src/messages_zh_TW.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit c829a32

Please sign in to comment.