Java Code Examples for org.bukkit.entity.Player#setFlySpeed()
The following examples show how to use
org.bukkit.entity.Player#setFlySpeed() .
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: RespawnModule.java From CardinalPGM with MIT License | 6 votes |
public static void giveObserversKit(Player player) { Match match = GameHandler.getGameHandler().getMatch(); if (match.getModules().getModule(TitleRespawn.class).isDeadUUID(player.getUniqueId())) return; player.getInventory().setItem(0, Items.createItem(Material.COMPASS, 1, (short) 0, ChatColor.BLUE + "" + ChatColor.BOLD + ChatConstant.UI_COMPASS.getMessage(player.getLocale()))); player.getInventory().setItem(1, CardinalNotifications.book); if (!match.hasEnded() && !(Blitz.matchIsBlitz() && match.isRunning())) { player.getInventory().setItem(2, TeamPicker.getTeamPicker(player.getLocale())); } player.getInventory().setItem(3, Tutorial.getEmerald(player)); if (player.hasPermission("tnt.defuse")) { player.getInventory().setItem(5, Items.createItem(Material.SHEARS, 1, (short) 0, ChatColor.RED + ChatConstant.UI_TNT_DEFUSER.getMessage(player.getLocale()))); } if (player.hasPermission("cardinal.punish.freeze")) { player.getInventory().setItem(6, Items.createItem(Material.ICE, 1, (short) 0, ChatColor.AQUA + ChatConstant.UI_FREEZE_ITEM.getMessage(player.getLocale()))); } player.getInventory().setItem(8, SpectatorTools.getSpectatorItem(player.getLocale())); player.setFlySpeed(0.1f * Float.parseFloat(Settings.getSettingByName("Speed").getValueByPlayer(player).getValue())); if (Settings.getSettingByName("Elytra").getValueByPlayer(player).getValue().equals("on")) { player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); } }
Example 2
Source File: MatchPlayer.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
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)); }
Example 3
Source File: Utils.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
public static void resetPlayer(Player player) { player.getInventory().clear(); player.getInventory().setChestplate(new ItemBuilder().material(Material.ELYTRA).unbreakable(true).get()); player.setGameMode(GameMode.ADVENTURE); player.setAllowFlight(player.hasPermission("lobby.fly")); player.setWalkSpeed(0.2f); player.setFlySpeed(0.1f); player.setPotionParticles(false); player.hideTitle(); player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 15, 0.5, 0.5, 0.5, 0); }
Example 4
Source File: ExprSpeed.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public void change(final Event e, final @Nullable Object[] delta, final ChangeMode mode) throws UnsupportedOperationException { float input = delta == null ? 0 : ((Number) delta[0]).floatValue(); for (final Player p : getExpr().getArray(e)) { float oldSpeed = walk ? p.getWalkSpeed() : p.getFlySpeed(); float newSpeed; switch (mode) { case SET: newSpeed = input; break; case ADD: newSpeed = oldSpeed + input; break; case REMOVE: newSpeed = oldSpeed - input; break; //$CASES-OMITTED$ default: newSpeed = walk ? 0.2f : 0.1f; break; } final float d = Math2.fit(-1, newSpeed, 1); if (walk) p.setWalkSpeed(d); else p.setFlySpeed(d); } }
Example 5
Source File: Players.java From CardinalPGM with MIT License | 5 votes |
public static void resetPlayer(Player player, boolean heal) { if (heal) player.setHealth(player.getMaxHealth()); 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)}); for (PotionEffect effect : player.getActivePotionEffects()) { try { player.removePotionEffect(effect.getType()); } catch (NullPointerException ignored) { } } player.setTotalExperience(0); player.setExp(0); player.setLevel(0); player.setPotionParticles(false); player.setWalkSpeed(0.2F); player.setFlySpeed(0.1F); player.setKnockbackReduction(0); player.setArrowsStuck(0); player.hideTitle(); player.setFastNaturalRegeneration(false); 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", 4.001D, AttributeModifier.Operation.ADD_SCALAR)); player.getAttribute(Attribute.ARROW_ACCURACY).addModifier(new AttributeModifier(UUID.randomUUID(), "sportbukkit.arrowAccuracy", -1D, AttributeModifier.Operation.ADD_NUMBER)); player.getAttribute(Attribute.ARROW_VELOCITY_TRANSFER).addModifier(new AttributeModifier(UUID.randomUUID(), "sportbukkit.arrowVelocityTransfer", -1D, AttributeModifier.Operation.ADD_NUMBER)); }
Example 6
Source File: LimboServiceHelper.java From AuthMeReloaded with GNU General Public License v3.0 | 5 votes |
/** * Removes the data that is saved in a LimboPlayer from the player. * <p> * Note that teleportation on the player is performed by {@link fr.xephi.authme.service.TeleportationService} and * changing the permission group is handled by {@link fr.xephi.authme.data.limbo.AuthGroupHandler}. * * @param player the player to set defaults to */ void revokeLimboStates(Player player) { player.setOp(false); settings.getProperty(LimboSettings.RESTORE_ALLOW_FLIGHT) .processPlayer(player); if (!settings.getProperty(RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT)) { player.setFlySpeed(0.0f); player.setWalkSpeed(0.0f); } }
Example 7
Source File: MatchPlayerImpl.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@Override public void reset() { getMatch().callEvent(new PlayerResetEvent(this)); setFrozen(false); Player bukkit = getBukkit(); bukkit.closeInventory(); resetInventory(); bukkit.setArrowsStuck(0); bukkit.setExhaustion(0); bukkit.setFallDistance(0); bukkit.setFireTicks(0); bukkit.setFoodLevel(20); // full bukkit.setHealth(bukkit.getMaxHealth()); bukkit.setLevel(0); bukkit.setExp(0); // clear xp bukkit.setSaturation(5); // default bukkit.setAllowFlight(false); bukkit.setFlying(false); bukkit.setSneaking(false); bukkit.setSprinting(false); bukkit.setFlySpeed(0.1f); bukkit.setKnockbackReduction(0); bukkit.setWalkSpeed(WalkSpeedKit.BUKKIT_DEFAULT); for (PotionEffect effect : bukkit.getActivePotionEffects()) { if (effect.getType() != null) { bukkit.removePotionEffect(effect.getType()); } } for (Attribute attribute : ATTRIBUTES) { AttributeInstance attributes = bukkit.getAttribute(attribute); if (attributes == null) continue; for (AttributeModifier modifier : attributes.getModifiers()) { attributes.removeModifier(modifier); } } NMSHacks.setAbsorption(bukkit, 0); // we only reset bed spawn here so people don't have to see annoying messages when they respawn bukkit.setBedSpawnLocation(null); }
Example 8
Source File: Players.java From helper with MIT License | 4 votes |
public static void resetFlySpeed(Player player) { player.setFlySpeed(0.1f); }
Example 9
Source File: FlyKit.java From CardinalPGM with MIT License | 4 votes |
@Override public void apply(Player player, Boolean force) { player.setAllowFlight(canFly); if (flying != null) player.setFlying(flying); player.setFlySpeed(flySpeed); }
Example 10
Source File: FlyKit.java From CardinalPGM with MIT License | 4 votes |
@Override public void remove(Player player) { player.setAllowFlight(false); player.setFlying(false); player.setFlySpeed(0.1f); }