77import com .earth2me .essentials .utils .DateUtil ;
88import com .earth2me .essentials .utils .FormatUtil ;
99import com .earth2me .essentials .utils .StringUtil ;
10+ import java .text .DateFormat ;
1011import java .util .ArrayList ;
12+ import java .util .Date ;
1113import java .util .List ;
1214import org .bukkit .BanList ;
1315import org .bukkit .Bukkit ;
1416import java .util .UUID ;
17+ import org .bukkit .BanEntry ;
1518import org .bukkit .Location ;
1619import org .bukkit .Server ;
1720
@@ -56,15 +59,14 @@ protected void seen(final Server server, final CommandSource sender, final Strin
5659 seenIP (server , sender , args [0 ]);
5760 return ;
5861 }
59- else if (Bukkit .getBanList (BanList .Type .IP ).isBanned (args [0 ]))
62+ else if (ess . getServer () .getBanList (BanList .Type .IP ).isBanned (args [0 ]))
6063 {
6164 sender .sendMessage (tl ("isIpBanned" , args [0 ]));
6265 return ;
6366 }
64-
65- else if (Bukkit .getBanList (BanList .Type .NAME ).isBanned (args [0 ]))
67+ else if (ess .getServer ().getBanList (BanList .Type .NAME ).isBanned (args [0 ]))
6668 {
67- sender .sendMessage (tl ("whoisBanned" , showBan ? Bukkit .getBanList (BanList .Type .NAME ).getBanEntry (args [0 ]).getReason () : tl ("true" )));
69+ sender .sendMessage (tl ("whoisBanned" , showBan ? ess . getServer () .getBanList (BanList .Type .NAME ).getBanEntry (args [0 ]).getReason () : tl ("true" )));
6870 return ;
6971 }
7072 else
@@ -145,7 +147,19 @@ private void seenOffline(final Server server, final CommandSource sender, User u
145147
146148 if (user .getBase ().isBanned ())
147149 {
148- sender .sendMessage (tl ("whoisBanned" , showBan ? Bukkit .getBanList (BanList .Type .NAME ).getBanEntry (user .getName ()).getReason () : tl ("true" )));
150+ final BanEntry banEntry = ess .getServer ().getBanList (BanList .Type .NAME ).getBanEntry (user .getName ());
151+ final String reason = showBan ? banEntry .getReason () : tl ("true" );
152+ sender .sendMessage (tl ("whoisBanned" , reason ));
153+ if (banEntry .getExpiration () != null )
154+ {
155+ Date expiry = banEntry .getExpiration ();
156+ String expireString = tl ("now" );
157+ if (expiry .after (new Date ()))
158+ {
159+ expireString = DateUtil .formatDateDiff (expiry .getTime ());
160+ }
161+ sender .sendMessage (tl ("whoisTempBanned" , expireString ));
162+ }
149163 }
150164 final String location = user .getGeoLocation ();
151165 if (location != null && (!(sender .isPlayer ()) || ess .getUser (sender .getPlayer ()).isAuthorized ("essentials.geoip.show" )))
@@ -170,7 +184,7 @@ private void seenIP(final Server server, final CommandSource sender, final Strin
170184 {
171185 final UserMap userMap = ess .getUserMap ();
172186
173- if (Bukkit .getBanList (BanList .Type .IP ).isBanned (ipAddress ))
187+ if (ess . getServer () .getBanList (BanList .Type .IP ).isBanned (ipAddress ))
174188 {
175189 sender .sendMessage (tl ("isIpBanned" , ipAddress ));
176190 }
0 commit comments