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

项目:Crescent    文件:NoSwingA.java   
@Override
public void call(Event event) {
    if (event instanceof PlayerInteractEvent) {
        final PlayerInteractEvent pie = (PlayerInteractEvent) event;

        // Types of interacting where the arm must swing.
        if (pie.getAction() == Action.LEFT_CLICK_AIR || pie.getAction() == Action.LEFT_CLICK_BLOCK) {
            lastInteract = System.currentTimeMillis();
        }
    } else if (event instanceof PlayerAnimationEvent) {
        final PlayerAnimationEvent pae = (PlayerAnimationEvent) event;

        if (pae.getAnimationType() == PlayerAnimationType.ARM_SWING) {
            final long difference = System.currentTimeMillis() - lastInteract;

            Bukkit.broadcastMessage("swing difference: " + difference);
        }
    }
}
项目:ProjectAres    文件:PlayerStaminaState.java   
void onEvent(PlayerAnimationEvent event) {
    if(event.getAnimationType() != PlayerAnimationType.ARM_SWING) return;
    if(event.getPlayer().isDigging()) return;
    if(!isHoldingWeapon()) return;

    swinging = true;
    lastSwingTick = player.getMatch().getClock().now().tick;
}
项目:ProjectAres    文件:PlayerMovementListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void detectBlockPunch(PlayerAnimationEvent event) {
    if(event.getAnimationType() != PlayerAnimationType.ARM_SWING) return;
    if(event.getPlayer().getGameMode() != GameMode.ADVENTURE) return;

    // Client will not punch blocks in adventure mode, so we detect it ourselves and fire a BlockPunchEvent.
    // We do this in the kit module only because its the one that is responsible for putting players in adventure mode.
    // A few other modules rely on this, including StaminaModule and BlockDropsModule.
    RayBlockIntersection hit = event.getPlayer().getTargetedBlock(true, false);
    if(hit == null) return;

    eventBus.callEvent(new BlockPunchEvent(event.getPlayer(), hit));
}
项目:RoyalSurvivors    文件:ThirstListener.java   
@EventHandler
public void thirstSwing(PlayerAnimationEvent e) {
    if (e.getAnimationType() != PlayerAnimationType.ARM_SWING) return;
    Player p = e.getPlayer();
    if (!RUtils.isInInfectedWorld(p)) return;
    final ItemStack hand = p.getItemInHand();
    if (hand == null || hand.getType() == Material.AIR) changeThirst(p, -Config.thirstSwing);
    else changeThirst(p, -Config.thirstSwingItem);
}
项目:ZentrelaRPG    文件:CombatManager.java   
@EventHandler
public void onAnim(PlayerAnimationEvent event) {
    if (event.getAnimationType() == PlayerAnimationType.ARM_SWING) {
        check(event.getPlayer().getInventory().getItemInMainHand(), event.getPlayer());
    }
}
项目:ProjectAres    文件:DamageDisplayPlayerFacet.java   
@TargetedEventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSwing(PlayerAnimationEvent event) {
    if(event.getAnimationType() != PlayerAnimationType.ARM_SWING) return;
    if(event.getPlayer().isDigging()) return;
    updateSpeedometer();
}
项目:Pore    文件:PorePlayerAnimationEvent.java   
@Override
public PlayerAnimationType getAnimationType() {
    throw new NotImplementedException("TODO"); // TODO
}
项目:BedrockAPI    文件:PlayerAnimationEvent.java   
public PlayerAnimationType getAnimationType() {
    return null;
}