From fbcacf6d4010618c91b2c936b459984dbc486431 Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 19 Oct 2012 11:40:06 +0200 Subject: [PATCH] Re-order some stuff. --- .../checks/combined/CombinedListener.java | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/combined/CombinedListener.java b/src/fr/neatmonster/nocheatplus/checks/combined/CombinedListener.java index 97c205b8..4696f9fb 100644 --- a/src/fr/neatmonster/nocheatplus/checks/combined/CombinedListener.java +++ b/src/fr/neatmonster/nocheatplus/checks/combined/CombinedListener.java @@ -31,18 +31,6 @@ public class CombinedListener implements Listener { this.improbable = new Improbable(); } - @EventHandler(priority=EventPriority.LOW) - public void onPlayerToggleSneak(final PlayerToggleSneakEvent event){ - // Check also in case of cancelled events. - if (Improbable.check(event.getPlayer(), 0.35f, System.currentTimeMillis())) event.setCancelled(true); - } - - @EventHandler(priority=EventPriority.LOW) - public void onPlayerToggleSprint(final PlayerToggleSprintEvent event){ - // Check also in case of cancelled events. - if (Improbable.check(event.getPlayer(), 0.35f, System.currentTimeMillis())) event.setCancelled(true); - } - @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = false) public final void onPlayerMove(final PlayerMoveEvent event){ final long now = System.currentTimeMillis(); @@ -100,6 +88,12 @@ public class CombinedListener implements Listener { event.setCancelled(true); } + @EventHandler(priority=EventPriority.LOW) + public void onPlayerToggleSprint(final PlayerToggleSprintEvent event){ + // Check also in case of cancelled events. + if (Improbable.check(event.getPlayer(), 0.35f, System.currentTimeMillis())) event.setCancelled(true); + } + /** * A workaround for cancelled PlayerToggleSprintEvents. * @@ -109,20 +103,16 @@ public class CombinedListener implements Listener { @EventHandler( priority = EventPriority.HIGHEST) public void onPlayerToggleSprintHighest(final PlayerToggleSprintEvent event) { - /* - * _____ _ _______ _ _____ _ _ - * | __ \| | |__ __| | | / ____| (_) | | - * | |__) | | __ _ _ _ ___ _ __ | | ___ __ _ __ _| | ___ | (___ _ __ _ __ _ _ __ | |_ - * | ___/| |/ _` | | | |/ _ \ '__| | |/ _ \ / _` |/ _` | |/ _ \ \___ \| '_ \| '__| | '_ \| __| - * | | | | (_| | |_| | __/ | | | (_) | (_| | (_| | | __/ ____) | |_) | | | | | | | |_ - * |_| |_|\__,_|\__, |\___|_| |_|\___/ \__, |\__, |_|\___| |_____/| .__/|_| |_|_| |_|\__| - * __/ | __/ | __/ | | | - * |___/ |___/ |___/ |_| - */ // Some plugins cancel "sprinting", which makes no sense at all because it doesn't stop people from sprinting // and rewards them by reducing their hunger bar as if they were walking instead of sprinting. if (event.isCancelled() && event.isSprinting()) event.setCancelled(false); } + + @EventHandler(priority=EventPriority.LOW) + public void onPlayerToggleSneak(final PlayerToggleSneakEvent event){ + // Check also in case of cancelled events. + if (Improbable.check(event.getPlayer(), 0.35f, System.currentTimeMillis())) event.setCancelled(true); + } }