Java Code Examples for org.bukkit.entity.Player#getSaturation()
The following examples show how to use
org.bukkit.entity.Player#getSaturation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerData.java From SkyWarsReloaded with GNU General Public License v3.0 | 6 votes |
public PlayerData(final Player p) { if (SkyWarsReloaded.getCfg().debugEnabled()) { Util.get().logToFile(ChatColor.RED + "[skywars] " + ChatColor.YELLOW + "Creating " + p.getName() + "'s Datafile"); } this.beingRestored = false; this.uuid = p.getUniqueId(); this.sb = p.getScoreboard(); this.health = p.getHealth(); this.food = p.getFoodLevel(); this.sat = p.getSaturation(); if (!SkyWarsReloaded.getCfg().displayPlayerExeperience()) { xp = p.getExp(); } inv = Bukkit.createInventory(null, InventoryType.PLAYER, p.getName()); inv.setContents(p.getInventory().getContents()); if (SkyWarsReloaded.getCfg().debugEnabled()) { Util.get().logToFile(ChatColor.RED + "[skywars] " + ChatColor.YELLOW + p.getName() + "'s Datafile has been created"); } }
Example 2
Source File: PWIPlayer.java From PerWorldInventory with GNU General Public License v3.0 | 5 votes |
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; }
Example 3
Source File: FullHungerAction.java From UHC with MIT License | 5 votes |
@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); }
Example 4
Source File: PWIPlayer.java From PerWorldInventory with GNU General Public License v3.0 | 5 votes |
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; }
Example 5
Source File: HealthKit.java From CardinalPGM with MIT License | 4 votes |
@Override public void apply(Player player, Boolean force) { if(health != -1 && (force || health > player.getHealth())) player.setHealth(health); if(hunger != -1 && (force || hunger > player.getFoodLevel())) player.setFoodLevel(hunger); if(saturation != 0 && (force || saturation > player.getSaturation())) player.setSaturation(saturation); }
Example 6
Source File: SaturationMultiplierRunnable.java From UHC with MIT License | 3 votes |
@Override public void run() { final Player player = Bukkit.getPlayer(uuid); if (player == null) return; final float change = player.getSaturation() - pre; player.setSaturation(pre + (change * ((float) multiplier))); }