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

下面列出了怎么用org.bukkit.event.player.PlayerOnGroundEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: PGM   文件: 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.getTick().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);
    }
  }
}
 
源代码2 项目: 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);
        }
    }
}
 
源代码3 项目: PGM   文件: 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.getTick().tick - info.getTime().tick <= MAX_SPLEEF_TICKS) {
      match.callEvent(new PlayerSpleefEvent(player, block, info));
    }
  }
}
 
源代码4 项目: 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));
        }
    }
}
 
源代码5 项目: 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);
}
 
 类所在包
 类方法
 同包方法