當前位置: 首頁>>代碼示例>>Java>>正文


Java Player.isGliding方法代碼示例

本文整理匯總了Java中org.bukkit.entity.Player.isGliding方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.isGliding方法的具體用法?Java Player.isGliding怎麽用?Java Player.isGliding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.isGliding方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: click

import org.bukkit.entity.Player; //導入方法依賴的package包/類
private void click(Player p, boolean left) {
    if (p.isGliding())
        return;
    if (!casters.containsKey(p.getUniqueId()))
        casters.put(p.getUniqueId(), new Caster());
    PlayerDataRPG pd = plugin.getPD(p);
    ItemStack item = p.getEquipment().getItemInMainHand();
    boolean spellWep = false;
    if (item != null)
        spellWep = isSpellWeapon(item);
    if (pd != null) {
        if (lastPress.containsKey(p.getUniqueId())) {
            if (System.currentTimeMillis() - lastPress.get(p.getUniqueId()) < 50)
                return;
        }
        lastPress.put(p.getUniqueId(), System.currentTimeMillis());
        final Caster c = casters.get(p.getUniqueId());
        if (spellWep) {
            c.press(left);
        } else {
            c.clear();
        }
        checkState(p, pd, c);
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:26,代碼來源:SpellManager.java

示例2: onPlayerFall

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true)
public void onPlayerFall(PlayerMoveEvent event) {
    Player player = event.getPlayer();
    if (!InventoryManager.playerIsLoaded(player) || player.isFlying()
            || player.getVehicle() != null) {
        return;
    }

    PlayerWrapper playerWrapper = InventoryManager.get(player);
    boolean endFalling = false;
    if (!player.isOnGround()) {
        if (playerIsSneakOnLadder(player) || isPlayerCanFall(player)) {
            playerWrapper.onFall();
        } else if (!player.isGliding()) {
            endFalling = true;
        }
    } else if (playerWrapper.isFalling()) {
        endFalling = true;
    }

    if (endFalling) {
        playerWrapper.setFalling(false);
    }
}
 
開發者ID:EndlessCodeGroup,項目名稱:RPGInventory,代碼行數:25,代碼來源:ElytraListener.java

示例3: isImmune

import org.bukkit.entity.Player; //導入方法依賴的package包/類
/**
 * Is the player in a state or situation that we should deem them not flying?
 * @param player
 * @return immune
 */
private static boolean isImmune(Player player) {
    return player.getGameMode() != GameMode.SURVIVAL
            || Utils.getRank(player).isAtLeast(EnumRank.MEDIA) // Don't bypass this check.
            || player.isGliding() // Not using Elytra
            || player.hasPotionEffect(PotionEffectType.LEVITATION) // Doesn't have a levitation potion
            || player.getVehicle() != null // Not in a vehicle
            || player.getVelocity().getY() > 0 // Not being launched up
            || player.getNearbyEntities(1, 2, 1).stream().anyMatch(e -> e.getType() == EntityType.BOAT) // Not standing on a boat.
            || player.getLocation().getBlock().isLiquid(); // Not in water.
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:16,代碼來源:Flight.java

示例4: doInteraction

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public void doInteraction(Player player, ItemStack stack)
{
    if (stack.getType() == Material.COMPASS)
    {
        this.hub.getGuiManager().openGui(player, new GuiMain(this.hub));
    }
    else if (stack.getType() == Material.SKULL_ITEM)
    {
        this.hub.getGuiManager().openGui(player, new GuiProfile(this.hub));
    }
    else if (stack.getType() == Material.ENDER_CHEST)
    {
        this.hub.getGuiManager().openGui(player, new GuiCosmetics(this.hub));
    }
    else if (stack.getType() == Material.GOLD_INGOT)
    {
        this.hub.getGuiManager().openGui(player, new GuiShop(this.hub));
    }
    else if (stack.getType() == Material.BARRIER && this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()) != null)
    {
        this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()).quitPlayer(player);
    }
    else if (stack.getType() == Material.ENDER_PEARL && this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()) != null)
    {
        this.hub.getParkourManager().getPlayerParkour(player.getUniqueId()).failPlayer(player);
    }
    else if (player.getInventory().getHeldItemSlot() == 6)
    {
        this.hub.getServer().getScheduler().runTask(this.hub, () -> this.hub.getCosmeticManager().getGadgetManager().useSelectedCosmetic(player, stack));
    }
    else if (stack.getType() == Material.ELYTRA)
    {
        if (stack.getEnchantments().isEmpty())
        {
            ItemStack elytra = new ItemStack(Material.ELYTRA);
            ItemMeta meta = elytra.getItemMeta();
            meta.spigot().setUnbreakable(true);
            elytra.setItemMeta(meta);

            player.getInventory().setChestplate(elytra);
            this.setInventoryToPlayer(player);
        }
        else
        {
            player.getInventory().setChestplate(null);
            this.setInventoryToPlayer(player);
        }

        player.playSound(player.getLocation(), Sound.ENTITY_HORSE_SADDLE, 1F, 1F);
    }
    else if (stack.getType() == Material.FEATHER && player.isGliding() && player.getVelocity().lengthSquared() != 0)
    {
        if (!SamaGamesAPI.get().getPermissionsManager().hasPermission(player, "network.vip"))
        {
            player.sendMessage(ChatColor.RED + "Devenez VIP pour utiliser le booster.");
            return;
        }

        Vector velocity = player.getVelocity().add(player.getLocation().getDirection().normalize().multiply(1.5D));
        ((CraftPlayer)player).getHandle().motX = velocity.getX();
        ((CraftPlayer)player).getHandle().motY = velocity.getY();
        ((CraftPlayer)player).getHandle().motZ = velocity.getZ();
        ((CraftPlayer)player).getHandle().velocityChanged = true;
        player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_FLAP, 2F, 2F);

        this.hub.getServer().getScheduler().runTask(this.hub, () -> SamaGamesAPI.get().getAchievementManager().getAchievementByID(5).unlock(player.getUniqueId()));
    }
}
 
開發者ID:SamaGames,項目名稱:Hub,代碼行數:69,代碼來源:StaticInventory.java


注:本文中的org.bukkit.entity.Player.isGliding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。