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


Java Player.setCanPickupItems方法代碼示例

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


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

示例1: reset

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void reset(Player player, boolean heal) {
    if (heal) player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
    player.setFoodLevel(20);
    player.setSaturation(20);
    player.getInventory().clear();
    player.getInventory().setArmorContents(new ItemStack[]{new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR)});
    player.setItemOnCursor(new ItemStack(Material.AIR));

    player.getActivePotionEffects().forEach(potionEffect -> {
        try {
            player.removePotionEffect(potionEffect.getType());
        } catch (NullPointerException ignored) {}
    });

    player.setFireTicks(0);
    player.setFallDistance(0);
    player.setTotalExperience(0);
    player.setExp(0);
    player.setLevel(0);
    player.setWalkSpeed(0.2F);
    player.setFlySpeed(0.1F);

    player.setSneaking(false);
    player.setInvulnerable(false);
    player.setCanPickupItems(true);
    player.setCollidable(true);
    player.setFlying(false);
    player.setAllowFlight(false);

    player.resetTitle();

    for (Attribute attribute : Attribute.values()) {
        if (player.getAttribute(attribute) == null) continue;
        for (AttributeModifier modifier : player.getAttribute(attribute).getModifiers()) {
            player.getAttribute(attribute).removeModifier(modifier);
        }
    }
    player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).addModifier(new AttributeModifier(UUID.randomUUID(), "generic.attackSpeed", 24.000D, AttributeModifier.Operation.ADD_SCALAR));

    player.updateInventory();
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:42,代碼來源:Players.java

示例2: setSpectator

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void setSpectator(Player player, String prefix, Location spawn) {
    if (!PREFIXES.containsKey(player.getName()))
        PREFIXES.put(player.getName(), prefix);

    player.setFoodLevel(20);
    player.setLevel(0);
    player.setGameMode(GameMode.ADVENTURE);
    player.setAllowFlight(true);
    player.setPlayerListName(prefix + player.getDisplayName());
    player.setDisplayName(prefix + player.getDisplayName());
    player.setExp(0);
    player.setHealthScale(20);
    player.setHealth(20);
    player.setTotalExperience(0);
    player.setCanPickupItems(false);
    player.setCustomName(prefix + player.getDisplayName());
    player.setCustomNameVisible(true);
    for (PotionEffect eff : player.getActivePotionEffects()) {
        player.removePotionEffect(eff.getType());
    }
    player.teleport(spawn);

    for (Player p : Bukkit.getOnlinePlayers()) {
        p.hidePlayer(player);
    }

    PlayerUtil.addDeadPlayer(player);
}
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:29,代碼來源:Spectator.java

示例3: removeSpectator

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void removeSpectator(Player player) {
    player.setFoodLevel(20);
    player.setLevel(0);
    player.setGameMode(GameMode.SURVIVAL);
    player.setAllowFlight(false);
    player.setExp(0);
    player.setHealthScale(20);
    player.setHealth(20);
    player.setTotalExperience(0);
    player.setCanPickupItems(false);
    for (PotionEffect eff : player.getActivePotionEffects()) {
        player.removePotionEffect(eff.getType());
    }

    if (PREFIXES.containsKey(player.getName())) {
        player.setCustomName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
        player.setPlayerListName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
        player.setDisplayName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
        player.setCustomNameVisible(true);
    }

    for (Player p : Bukkit.getOnlinePlayers()) {
        p.showPlayer(player);
    }

    PlayerUtil.removeDeadPlayer(player);
}
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:28,代碼來源:Spectator.java

示例4: onJoin

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onJoin(PlayerJoinEvent event) {
    event.setJoinMessage(null);

    Player player = event.getPlayer();
    player.setMaximumNoDamageTicks(19);

    GameUtils.resetPlayer(player);

    player.getInventory().setContents(GameUtils.getLobbyInventory());
    player.updateInventory();

    ManagerHandler.getConfig().teleportToSpawn(player);

    player.setCanPickupItems(false);

    if (player.getGameMode() != GameMode.CREATIVE) {
        player.setAllowFlight(false);
    }

    player.spigot().setCollidesWithEntities(false);

    player.sendMessage(ChatColor.GRAY + ChatColor.STRIKETHROUGH.toString() + "---------------------------------------------");
    player.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + " * " + ChatColor.GRAY + "Welcome to " + ChatColor.AQUA + "" + ChatColor.BOLD + "PvPTemple" + ChatColor.GRAY + "!");
    player.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + " * " + ChatColor.GRAY + "TeamSpeak: " + ChatColor.AQUA + "ts.pvptemple.it:1919");
    player.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + " * " + ChatColor.GRAY + "Store: " + ChatColor.AQUA + "store.pvptemple.it");
    player.sendMessage(ChatColor.GRAY + ChatColor.STRIKETHROUGH.toString() + "---------------------------------------------");

    ManagerHandler.getScoreboardHandler().applyBoard(player);

    for (PlayerBoard board : ManagerHandler.getScoreboardHandler().getPlayerBoards().values()) {
        board.addUpdate(player);
    }

    new BukkitRunnable() {
        public void run() {
            ManagerHandler.getScoreboardHandler().getPlayerBoard(player.getUniqueId()).addUpdates(Bukkit.getOnlinePlayers());
        }
    }.runTaskLater(PracticePlugin.getInstance(), 4L);
}
 
開發者ID:ijoeleoli,項目名稱:ZorahPractice,代碼行數:41,代碼來源:PlayerListener.java

示例5: resetPlayer

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void resetPlayer(Player player) {
    player.setCanPickupItems(false);
    player.getInventory().clear();
    player.getInventory().setArmorContents(new ItemStack[4]);
    player.setHealth(20.0);
    player.setFoodLevel(20);
    player.setFireTicks(1);
    player.getActivePotionEffects().forEach(effect -> player.removePotionEffect(effect.getType()));
}
 
開發者ID:ijoeleoli,項目名稱:ZorahPractice,代碼行數:10,代碼來源:GameUtils.java


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