下面列出了org.bukkit.entity.Player#getExhaustion ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
PWIPlayer(Player player, Group group, double bankBalance, double balance, boolean useAttributes) {
this.uuid = player.getUniqueId();
this.name = player.getName();
this.location = player.getLocation();
this.group = group;
this.saved = false;
this.armor = player.getInventory().getArmorContents();
this.enderChest = player.getEnderChest().getContents();
this.inventory = player.getInventory().getContents();
this.canFly = player.getAllowFlight();
this.displayName = player.getDisplayName();
this.exhaustion = player.getExhaustion();
this.experience = player.getExp();
this.isFlying = player.isFlying();
this.foodLevel = player.getFoodLevel();
if (useAttributes) {
this.maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
} else {
this.maxHealth = player.getMaxHealth();
}
this.health = player.getHealth();
this.gamemode = player.getGameMode();
this.level = player.getLevel();
this.saturationLevel = player.getSaturation();
this.potionEffects = player.getActivePotionEffects();
this.fallDistance = player.getFallDistance();
this.fireTicks = player.getFireTicks();
this.maxAir = player.getMaximumAir();
this.remainingAir = player.getRemainingAir();
this.bankBalance = bankBalance;
this.balance = balance;
}
@Override
protected void run(Player player) {
// store old values
level = player.getFoodLevel();
saturation = player.getSaturation();
exhaustion = player.getExhaustion();
// max out values
player.setFoodLevel(FULL_FOOD_LEVEL);
player.setSaturation(FULL_SATURATION_LEVEL);
player.setExhaustion(FULL_EXHAUSTION_LEVEL);
}
PWIPlayer(Player player, Group group, double bankBalance, double balance, boolean useAttributes) {
this.uuid = player.getUniqueId();
this.name = player.getName();
this.location = player.getLocation();
this.group = group;
this.saved = false;
this.armor = player.getInventory().getArmorContents();
this.enderChest = player.getEnderChest().getContents();
this.inventory = player.getInventory().getContents();
this.canFly = player.getAllowFlight();
this.displayName = player.getDisplayName();
this.exhaustion = player.getExhaustion();
this.experience = player.getExp();
this.isFlying = player.isFlying();
this.foodLevel = player.getFoodLevel();
if (useAttributes) {
this.maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
} else {
this.maxHealth = player.getMaxHealth();
}
this.health = player.getHealth();
this.gamemode = player.getGameMode();
this.level = player.getLevel();
this.saturationLevel = player.getSaturation();
this.potionEffects = player.getActivePotionEffects();
this.fallDistance = player.getFallDistance();
this.fireTicks = player.getFireTicks();
this.maxAir = player.getMaximumAir();
this.remainingAir = player.getRemainingAir();
this.bankBalance = bankBalance;
this.balance = balance;
}
@Override
@Nullable
public Number convert(Player player) {
return player.getExhaustion();
}