Re-order some stuff.

This commit is contained in:
asofold 2012-10-19 11:40:06 +02:00
parent f30bccd7d3
commit fbcacf6d40

View File

@ -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);
}
}