org.bukkit.event.player.PlayerToggleSprintEvent Java Examples

The following examples show how to use org.bukkit.event.player.PlayerToggleSprintEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataUpdaterEvents.java    From AACAdditionPro with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onToggleSprint(final PlayerToggleSprintEvent event)
{
    final User user = UserManager.getUser(event.getPlayer().getUniqueId());

    if (user != null) {
        user.getDataMap().setValue(DataKey.SPRINTING, event.isSprinting());
        if (!event.isSprinting()) {
            user.getDataMap().setValue(DataKey.LAST_SPRINT_DURATION, user.getTimestampMap().passedTime(TimestampKey.LAST_SPRINT_TOGGLE));
        }
        user.getTimestampMap().updateTimeStamp(TimestampKey.LAST_SPRINT_TOGGLE);
    }
}
 
Example #2
Source File: TalismanListener.java    From Slimefun4 with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler
public void onSprint(PlayerToggleSprintEvent e) {
    if (e.isSprinting()) {
        Talisman.checkFor(e, SlimefunItems.TALISMAN_TRAVELLER);
    }
}