当前位置: 首页>>代码示例>>Java>>正文


Java Player.setExhaustion方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.setExhaustion方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setExhaustion方法的具体用法?Java Player.setExhaustion怎么用?Java Player.setExhaustion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.setExhaustion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resetPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void resetPlayer(Player player) {
    player.setLevel(0);
    player.setExp(0);
    player.setFoodLevel(20);
    player.setHealth(20);
    player.setHealthScale(20);
    player.setExhaustion(0);
    player.getInventory().clear();
    ItemStack blankItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
    ItemMeta blankMeta = blankItem.getItemMeta();
    blankMeta.setDisplayName("" + ChatColor.RED);
    blankItem.setItemMeta(blankMeta);
    for(int i=9; i<=35; i++) {
        player.getInventory().setItem(i, blankItem);
    }
    player.getInventory().setHelmet(new ItemStack(Material.AIR, 1));
    player.getInventory().setChestplate(new ItemStack(Material.AIR, 1));
    player.getInventory().setLeggings(new ItemStack(Material.AIR, 1));
    player.getInventory().setBoots(new ItemStack(Material.AIR, 1));
    for(PotionEffect potionEffect : player.getActivePotionEffects()) {
        player.removePotionEffect(potionEffect.getType());
    }
    player.setFireTicks(0);
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:25,代码来源:Utils.java

示例2: reset

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void reset() {
    final Player bukkit = getBukkit();
    bukkit.closeInventory();
    clearInventory();
    bukkit.setExhaustion(0);
    bukkit.setFallDistance(0);
    bukkit.setFireTicks(0);
    bukkit.setFoodLevel(20); // full
    bukkit.setMaxHealth(20);
    bukkit.setHealth(bukkit.getMaxHealth());
    bukkit.setAbsorption(0);
    bukkit.setLevel(0);
    bukkit.setExp(0); // clear xp
    bukkit.setSaturation(5); // default
    bukkit.setFastNaturalRegeneration(false);
    bukkit.setSlowNaturalRegeneration(true);
    bukkit.setAllowFlight(false);
    bukkit.setFlying(false);
    bukkit.setSneaking(false);
    bukkit.setSprinting(false);
    bukkit.setFlySpeed(0.1f);
    bukkit.setKnockbackReduction(0);
    bukkit.setWalkSpeed(WalkSpeedKit.BUKKIT_DEFAULT);
    AttributeUtils.removeAllModifiers(bukkit);
    resetPotions();

    // we only reset bed spawn here so people don't have to see annoying messages when they respawn
    bukkit.setBedSpawnLocation(null);

    match.callEvent(new PlayerResetEvent(this));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:32,代码来源:MatchPlayer.java

示例3: startGame

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Set SamaGamesAPI
 */
@Override
public void startGame()
{
    this.getInGamePlayers().forEach(((uuid1, survivalPlayer) -> survivalPlayer.getPlayerIfOnline().closeInventory()));
    super.startGame();
    
    Objective displayNameLife = this.scoreboard.registerNewObjective("vie", "health");
    Objective playerListLife = this.scoreboard.registerNewObjective("vieb", "health");

    displayNameLife.setDisplayName(ChatColor.RED + "❤");
    displayNameLife.setDisplaySlot(DisplaySlot.BELOW_NAME);
    playerListLife.setDisplayName(ChatColor.RED + "❤");
    playerListLife.setDisplaySlot(DisplaySlot.PLAYER_LIST);

    for (UUID uuid : this.getInGamePlayers().keySet())
    {
        Player player = this.server.getPlayer(uuid);

        if (player == null)
        {
            this.gamePlayers.remove(uuid);
            continue;
        }

        player.setGameMode(GameMode.SURVIVAL);
        player.setHealth(player.getMaxHealth());
        player.setFoodLevel(80);
        player.setExhaustion(0.0F);
        player.setScoreboard(this.scoreboard);
        player.setLevel(0);
        player.getInventory().clear();

        this.server.getScheduler().runTaskLater(this.plugin, () -> player.setAllowFlight(false), 20L * 5);

        displayNameLife.getScore(player.getName()).setScore((int) player.getHealth());
        playerListLife.getScore(player.getName()).setScore((int) player.getHealth());

        ObjectiveSign sign = new ObjectiveSign("sggameloop", ChatColor.DARK_AQUA + "" + (this.magicSymbol != null ? this.magicSymbol + " " : "") + ChatColor.BOLD + this.getGameName() + ChatColor.RESET + ChatColor.DARK_AQUA + (this.magicSymbol != null ? " " + this.magicSymbol : ""));
        sign.addReceiver(player);

        this.gameLoop.addPlayer(player.getUniqueId(), sign);
    }

    this.lobbyPopulator.remove();

    this.mainTask = this.server.getScheduler().runTaskTimer(this.plugin, this.gameLoop, 20, 20);
    this.teleport();
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:52,代码来源:SurvivalGame.java


注:本文中的org.bukkit.entity.Player.setExhaustion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。