diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index bc4703276..8e6d46958 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -340,8 +340,11 @@ public class EssentialsPlayerListener implements Listener @EventHandler(priority = EventPriority.LOWEST) public void onPlayerLogin2(final PlayerLoginEvent event) { - if (event.getResult() != Result.KICK_BANNED) + switch (event.getResult()) { + case KICK_BANNED: + break; + default: return; } @@ -352,20 +355,19 @@ public class EssentialsPlayerListener implements Listener @EventHandler(priority = EventPriority.HIGH) public void onPlayerLogin(final PlayerLoginEvent event) { - if (event.getResult() == Result.KICK_FULL) + switch (event.getResult()) { - final User user = ess.getUser(event.getPlayer()); - if (user.isAuthorized("essentials.joinfullserver")) + case KICK_FULL: + final User kfuser = ess.getUser(event.getPlayer()); + if (kfuser.isAuthorized("essentials.joinfullserver")) { event.allow(); return; } event.disallow(Result.KICK_FULL, tl("serverFull")); - return; - } + break; - if (event.getResult() == Result.KICK_BANNED || event.getPlayer().isBanned()) - { + case KICK_BANNED: final User user = ess.getUser(event.getPlayer()); final boolean banExpired = user.checkBanTimeout(System.currentTimeMillis()); if (banExpired) @@ -384,6 +386,10 @@ public class EssentialsPlayerListener implements Listener banReason += "\n\n" + "Expires in " + DateUtil.formatDateDiff(user.getBanTimeout()); } event.disallow(Result.KICK_BANNED, banReason); + break; + + default: + break; } } |