001 package org.bukkit.event.player; 002 003 import org.bukkit.entity.Player; 004 import org.bukkit.event.Cancellable; 005 import org.bukkit.event.HandlerList; 006 007 /** 008 * Called when a player toggles their sprinting state 009 */ 010 public class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable { 011 private static final HandlerList handlers = new HandlerList(); 012 private final boolean isSprinting; 013 private boolean cancel = false; 014 015 public PlayerToggleSprintEvent(final Player player, final boolean isSprinting) { 016 super(player); 017 this.isSprinting = isSprinting; 018 } 019 020 /** 021 * Gets whether the player is now sprinting or not. 022 * 023 * @return sprinting state 024 */ 025 public boolean isSprinting() { 026 return isSprinting; 027 } 028 029 public boolean isCancelled() { 030 return cancel; 031 } 032 033 public void setCancelled(boolean cancel) { 034 this.cancel = cancel; 035 } 036 037 @Override 038 public HandlerList getHandlers() { 039 return handlers; 040 } 041 042 public static HandlerList getHandlerList() { 043 return handlers; 044 } 045 }