diff options
author | KHobbits <rob@khobbits.co.uk> | 2014-01-26 20:00:41 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-01-26 20:00:41 +0000 |
commit | b9d09dd7b0c2abfd421e3a0e7450df3a3354194f (patch) | |
tree | 614f1f3601a5414a30c73b223f5c77486437b20b | |
parent | 1c035457bbc2edf2629871651a22037d2fde7e21 (diff) | |
download | Essentials-b9d09dd7b0c2abfd421e3a0e7450df3a3354194f.tar Essentials-b9d09dd7b0c2abfd421e3a0e7450df3a3354194f.tar.gz Essentials-b9d09dd7b0c2abfd421e3a0e7450df3a3354194f.tar.lz Essentials-b9d09dd7b0c2abfd421e3a0e7450df3a3354194f.tar.xz Essentials-b9d09dd7b0c2abfd421e3a0e7450df3a3354194f.zip |
Make /speed persist on world change if permissions exist.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 60be7e239..dd2726186 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -161,9 +161,8 @@ public class EssentialsPlayerListener implements Listener final Player player = event.getPlayer(); event.setQuitMessage( ess.getSettings().getCustomQuitMessage() - .replace("{PLAYER}", player.getDisplayName()) - .replace("{USERNAME}", player.getName()) - ); + .replace("{PLAYER}", player.getDisplayName()) + .replace("{USERNAME}", player.getName())); } if (ess.getSettings().removeGodOnDisconnect() && user.isGodModeEnabled()) @@ -195,7 +194,7 @@ public class EssentialsPlayerListener implements Listener delayedJoin(event.getPlayer(), joinMessage); } }); - if(ess.getSettings().allowSilentJoinQuit() || ess.getSettings().isCustomJoinMessage()) + if (ess.getSettings().allowSilentJoinQuit() || ess.getSettings().isCustomJoinMessage()) { event.setJoinMessage(null); } @@ -260,11 +259,10 @@ public class EssentialsPlayerListener implements Listener { ess.getServer().broadcastMessage( ess.getSettings().getCustomJoinMessage() - .replace("{PLAYER}", player.getDisplayName()) - .replace("{USERNAME}", player.getName()) - ); + .replace("{PLAYER}", player.getDisplayName()) + .replace("{USERNAME}", player.getName())); } - else if(ess.getSettings().allowSilentJoinQuit()) + else if (ess.getSettings().allowSilentJoinQuit()) { ess.getServer().broadcastMessage(message); } @@ -474,8 +472,23 @@ public class EssentialsPlayerListener implements Listener user.setFallDistance(0f); user.setAllowFlight(false); } - user.setFlySpeed(0.1f); - user.setWalkSpeed(0.2f); + if (!user.isAuthorized("essentials.speed")) + { + user.setFlySpeed(0.1f); + user.setWalkSpeed(0.2f); + } + else + { + if (user.getFlySpeed() > ess.getSettings().getMaxFlySpeed() && !user.isAuthorized("essentials.speed.bypass")) + { + user.setFlySpeed((float)ess.getSettings().getMaxFlySpeed()); + } + + if (user.getWalkSpeed() > ess.getSettings().getMaxWalkSpeed() && !user.isAuthorized("essentials.speed.bypass")) + { + user.setWalkSpeed((float)ess.getSettings().getMaxWalkSpeed()); + } + } } @EventHandler(priority = EventPriority.MONITOR) |