Java 类org.bukkit.event.player.PlayerOnGroundEvent 实例源码

项目:ProjectAres    文件:FallTracker.java   
/**
 * Called when the player touches or leaves the ground
 */
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerOnGroundChanged(final PlayerOnGroundEvent event) {
    MatchPlayer player = match.getParticipant(event.getPlayer());
    if(player == null) return;

    FallState fall = this.falls.get(player);
    if(fall != null) {
        if(event.getOnGround()) {
            // Falling player landed on the ground, cancel the fall if they are still there after MAX_ON_GROUND_TIME
            fall.onGroundTick = match.getClock().now().tick;
            fall.groundTouchCount++;
            this.scheduleCheckFallTimeout(fall, FallState.MAX_ON_GROUND_TICKS + 1);
        } else {
            // Falling player left the ground, check if it was caused by the attack
            this.playerBecameUnsupported(fall);
        }
    }
}
项目:ProjectAres    文件:SpleefTracker.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerOnGroundChanged(final PlayerOnGroundEvent event) {
    MatchPlayer player = match.getParticipant(event.getPlayer());
    if(player == null) return;

    Block block = this.lastBlockBrokenUnderPlayer(player);
    if(block != null) {
        SpleefInfo info = brokenBlocks.get(block);
        if(match.getClock().now().tick - info.getTime().tick <= MAX_SPLEEF_TICKS) {
            match.callEvent(new PlayerSpleefEvent(player, block, info));
        }
    }
}
项目:Cardinal    文件:DoubleJumpListener.java   
/**
 * Checks to add players in the landed map.
 *
 * @param event The event called.
 */
@EventHandler
public void onPlayerGround(PlayerOnGroundEvent event) {
  UUID id = event.getPlayer().getUniqueId();
  KitDoubleJump.DoubleJumpData data = players.get(id);
  if (event.getOnGround() && data != null && data.isEnabled()
      && !data.isRechargeBeforeLanding() && !landed.contains(id)) {
    landed.add(id);
  }
}
项目:CardinalPGM    文件:DoubleJumpKit.java   
@EventHandler
public void onPlayerGround(PlayerOnGroundEvent event) {
    if (!enabled || rechargeBeforeLanding) return;
    UUID id = event.getPlayer().getUniqueId();
    if (!players.contains(id) || landed.contains(id)) return;
    if (event.getOnGround()) landed.add(id);
}