Java 类org.bukkit.event.player.PlayerFishEvent.State 实例源码

项目:AnnihilationPro    文件:Scout.java   
@EventHandler(priority = EventPriority.NORMAL)
    public void Grappler(PlayerFishEvent event)
    {
        Player player = event.getPlayer();
        if(event.getState() == State.IN_GROUND)
        {
            AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
            if(p != null && p.getKit().equals(this))
            {
                if(isGrappleItem(player.getItemInHand()))
                {
                    //event.getHook().
                    Location playerloc = player.getLocation();
                    Location loc = event.getHook().getLocation();
                    if (playerloc.distance(loc) < 3.0D) 
                        pullPlayerSlightly(player, loc);
                    else 
                        pullEntityToLocation(player, loc);
//                  Vector vec = playerloc.toVector();
//                  Vector vec2 = loc.toVector();
//                  player.setVelocity(vec2.subtract(vec).normalize().multiply(1));
                    player.getItemInHand().setDurability((short)0);
                }
            }
        }
    }
项目:Statz    文件:ItemsCaughtListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onFishCaught(final PlayerFishEvent event) {

    final PlayerStat stat = PlayerStat.ITEMS_CAUGHT;

    // Get player
    final Player player = event.getPlayer();

    // Do general check
    if (!plugin.doGeneralCheck(player, stat))
        return;

    Entity entity;
    ItemStack item;

    String materialName = null;

    if (event.getCaught() != null) {
        entity = event.getCaught();

        if (!(entity instanceof Item)) {
            return; // Did not catch an item
        }

        item = ((Item) entity).getItemStack();

        if (event.getState().equals(State.CAUGHT_FISH)) {
            materialName = StatzUtil.getFoodName(item);

            if (materialName == null) {
                materialName = item.getType().toString();
            }

        } else {
            materialName = item.getType().toString();
        }
    } else {
        // Did not catch anything.
        return;
    }

    final String material = materialName;

    // Update value to new stat.
    plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
            player.getUniqueId().toString(), "value", 1, "caught", material, "world", player.getWorld().getName()));

}
项目:BedrockAPI    文件:PlayerFishEvent.java   
@Deprecated public PlayerFishEvent(Player player, Entity entity, PlayerFishEvent.State state) {
       super(player);
}
项目:BedrockAPI    文件:PlayerFishEvent.java   
public PlayerFishEvent(Player player, Entity entity, Fish hookEntity, PlayerFishEvent.State state) {
       super(player);
}
项目:BedrockAPI    文件:PlayerFishEvent.java   
public PlayerFishEvent.State getState() {
    return null;
}