Java Code Examples for org.bukkit.entity.Player#getExp()
The following examples show how to use
org.bukkit.entity.Player#getExp() .
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: DoubleJumpKit.java From CardinalPGM with MIT License | 6 votes |
private void update() { int diff = (int) (System.currentTimeMillis() - lastUpdate); lastUpdate = System.currentTimeMillis(); float toAddExp = rechargeTime > 0 ? (float) (diff / (rechargeTime * 1000)) : 1.0f; for(UUID uuid : players) { Player player = Bukkit.getPlayer(uuid); if(player.getExp() < 1.0f && (rechargeBeforeLanding || landed.contains(uuid))) { player.setExp(player.getExp() + toAddExp > 1.0f ? 1.0f : player.getExp() + toAddExp); } else if(player.getExp() > 1.0f) { player.setExp(1.0f); } if(player.getExp() >= 1.0f) { player.setAllowFlight(true); } } }
Example 3
Source File: DoubleJumpKit.java From CardinalPGM with MIT License | 6 votes |
@EventHandler public void onPlayerToggleFly(PlayerToggleFlightEvent event) { if (!enabled) return; Player player = event.getPlayer(); if (!players.contains(player.getUniqueId()) || player.getExp() > 1.0f || !event.isFlying()) return; player.setAllowFlight(false); player.setExp(0.0f); event.setCancelled(true); Vector normal = player.getEyeLocation().getDirection(); normal.setY(0.75 + Math.max(normal.getY() * 0.5, 0)); normal.multiply(power / 2); event.getPlayer().setVelocity(normal); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ZOMBIE_INFECT, 0.5f, 1.8f); update(); }
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: ClearXPAction.java From UHC with MIT License | 5 votes |
@Override protected void run(Player player) { exp = player.getExp(); level = player.getLevel(); total = player.getTotalExperience(); player.setExp(0F); player.setLevel(0); player.setTotalExperience(0); }
Example 6
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 7
Source File: TutorialPlayer.java From ServerTutorial with MIT License | 5 votes |
public TutorialPlayer(Player player) { this.startLoc = player.getLocation(); this.inventory = player.getInventory().getContents(); this.flight = player.isFlying(); this.allowFlight = player.getAllowFlight(); this.exp = player.getExp(); this.level = player.getLevel(); this.hunger = player.getFoodLevel(); this.health = player.getHealth(); this.gameMode = player.getGameMode(); }
Example 8
Source File: ExprLevelProgress.java From Skript with GNU General Public License v3.0 | 4 votes |
@Override public Float convert(final Player p) { return p.getExp(); }
Example 9
Source File: DPlayerData.java From DungeonsXL with GNU General Public License v3.0 | 4 votes |
/** * Saves the player's data to the file. * * @param player the Player to save */ public void savePlayerState(Player player) { oldGameMode = player.getGameMode(); oldFireTicks = player.getFireTicks(); oldFoodLevel = player.getFoodLevel(); if (is1_9) { oldMaxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue(); } oldHealth = player.getHealth(); oldExp = player.getExp(); oldLvl = player.getLevel(); oldArmor = new ArrayList<>(Arrays.asList(player.getInventory().getArmorContents())); oldInventory = new ArrayList<>(Arrays.asList(player.getInventory().getContents())); if (is1_9) { oldOffHand = player.getInventory().getItemInOffHand(); } oldLocation = player.getLocation(); oldPotionEffects = player.getActivePotionEffects(); if (is1_9) { oldCollidabilityState = player.isCollidable(); oldInvulnerabilityState = player.isInvulnerable(); } oldFlyingState = player.getAllowFlight(); config.set(PREFIX_STATE_PERSISTENCE + "oldGameMode", oldGameMode.toString()); config.set(PREFIX_STATE_PERSISTENCE + "oldFireTicks", oldFireTicks); config.set(PREFIX_STATE_PERSISTENCE + "oldFoodLevel", oldFoodLevel); config.set(PREFIX_STATE_PERSISTENCE + "oldMaxHealth", oldMaxHealth); config.set(PREFIX_STATE_PERSISTENCE + "oldHealth", oldHealth); config.set(PREFIX_STATE_PERSISTENCE + "oldExp", oldExp); config.set(PREFIX_STATE_PERSISTENCE + "oldLvl", oldLvl); config.set(PREFIX_STATE_PERSISTENCE + "oldArmor", oldArmor); config.set(PREFIX_STATE_PERSISTENCE + "oldInventory", oldInventory); config.set(PREFIX_STATE_PERSISTENCE + "oldOffHand", oldOffHand); config.set(PREFIX_STATE_PERSISTENCE + "oldLocation", oldLocation); config.set(PREFIX_STATE_PERSISTENCE + "oldPotionEffects", oldPotionEffects); config.set(PREFIX_STATE_PERSISTENCE + "oldCollidabilityState", oldCollidabilityState); config.set(PREFIX_STATE_PERSISTENCE + "oldFlyingState", oldFlyingState); config.set(PREFIX_STATE_PERSISTENCE + "oldInvulnerabilityState", oldInvulnerabilityState); save(); }