7
7
import com .earth2me .essentials .utils .DateUtil ;
8
8
import com .earth2me .essentials .utils .FormatUtil ;
9
9
import com .earth2me .essentials .utils .StringUtil ;
10
+ import java .text .DateFormat ;
10
11
import java .util .ArrayList ;
12
+ import java .util .Date ;
11
13
import java .util .List ;
12
14
import org .bukkit .BanList ;
13
15
import org .bukkit .Bukkit ;
14
16
import java .util .UUID ;
17
+ import org .bukkit .BanEntry ;
15
18
import org .bukkit .Location ;
16
19
import org .bukkit .Server ;
17
20
@@ -56,15 +59,14 @@ protected void seen(final Server server, final CommandSource sender, final Strin
56
59
seenIP (server , sender , args [0 ]);
57
60
return ;
58
61
}
59
- else if (Bukkit .getBanList (BanList .Type .IP ).isBanned (args [0 ]))
62
+ else if (ess . getServer () .getBanList (BanList .Type .IP ).isBanned (args [0 ]))
60
63
{
61
64
sender .sendMessage (tl ("isIpBanned" , args [0 ]));
62
65
return ;
63
66
}
64
-
65
- else if (Bukkit .getBanList (BanList .Type .NAME ).isBanned (args [0 ]))
67
+ else if (ess .getServer ().getBanList (BanList .Type .NAME ).isBanned (args [0 ]))
66
68
{
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" )));
68
70
return ;
69
71
}
70
72
else
@@ -145,7 +147,19 @@ private void seenOffline(final Server server, final CommandSource sender, User u
145
147
146
148
if (user .getBase ().isBanned ())
147
149
{
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
+ }
149
163
}
150
164
final String location = user .getGeoLocation ();
151
165
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
170
184
{
171
185
final UserMap userMap = ess .getUserMap ();
172
186
173
- if (Bukkit .getBanList (BanList .Type .IP ).isBanned (ipAddress ))
187
+ if (ess . getServer () .getBanList (BanList .Type .IP ).isBanned (ipAddress ))
174
188
{
175
189
sender .sendMessage (tl ("isIpBanned" , ipAddress ));
176
190
}