public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if ((sender instanceof Player)) { if (args.length < 1) { Player p = (Player) sender; Boolean flying = p.isFlying(); p.setAllowFlight(!flying); p.setFlying(!flying); p.sendMessage("Fly mode changed!"); return true; } else { if (plugin.getServer().getPlayer(args[0]) != null) { Player pl = plugin.getServer().getPlayer(args[0]); boolean flying = pl.isFlying(); pl.setAllowFlight(!flying); pl.setFlying(!flying); pl.sendMessage(sender.getName() + " changed your fly mode to " + !flying); return true; } else { sender.sendMessage("Player not existing"); return false; } } } else { sender.sendMessage("Only a player could execute this command"); return true; } }
@SuppressWarnings("deprecation") @EventHandler public void onMove(PlayerMoveEvent e) { if (!plugin.getConfig().getBoolean("Complete")) return; Player p = e.getPlayer(); if (plugin.spieler != null && plugin.spieler == p) { if (p.getLocation().getWorld().getBlockAt(p.getLocation()).getTypeId() == 147) { if (!plugin.bfinish) { SpeedBuilder.gm.Win(); } } if (p.getLocation().getY() < plugin.spawnloc.getY() - 10) { if (plugin.starttime != 0 && !plugin.bfinish) { p.setAllowFlight(true); p.setFlying(true); p.teleport(plugin.spawnloc.clone().add(0, 1, 0)); SpeedBuilder.gm.Loose(); } else { p.teleport(plugin.spawnloc); } } } if (plugin.spectating.contains(p)) { if (p.getLocation().getY() <= plugin.spawnloc.clone().add(0, 15, 0).getY()) { p.teleport(p.getLocation().add(0, 3, 0)); p.setAllowFlight(true); p.setFlying(true); } } }
@EventHandler public void onMove(PlayerMoveEvent e) { Player p = e.getPlayer(); double x = p.getLocation().getX(); double y = p.getLocation().getY() - 1; double z = p.getLocation().getZ(); Location loc = new Location(p.getWorld(), x, y, z); Block b1 = loc.getBlock(); Block b2 = p.getLocation().getBlock(); if (b1.getType().equals(Material.REDSTONE_BLOCK) && b2.getType().equals(Material.WOOD_PLATE)) { // p.sendMessage("ON " + b1.getType().toString() + " + " + b2.getType().toString()); p.setVelocity(p.getLocation().getDirection().multiply(2).setY(p.getVelocity().getY() + 1)); p.setFallDistance(0f); for (Player all : Bukkit.getOnlinePlayers()) { all.playSound(p.getLocation(), Sound.WITHER_SHOOT, 0.1f, 0.1f); } } p.setSaturation(100f); p.setFoodLevel(20); p.setHealth(20f); if (p.getLocation().getY() <= 80) { p.teleport(p.getWorld().getSpawnLocation()); p.setGameMode(GameMode.ADVENTURE); p.setAllowFlight(true); p.setFlying(false); } }
public static void startGame() { for (int i = 1; i <= 8; i++) { if (i > inqueue.size()) { break; } Player p = Bukkit.getPlayer(inqueue.get(i - 1)); p.setAllowFlight(false); p.setFlying(false); if (p.getGameMode() != GameMode.SURVIVAL) { p.setGameMode(GameMode.SURVIVAL); } Location loc = Game.getLocation("Spawn" + i).add(0.5, 1, 0.5); p.teleport(loc); p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 10, 2)); invs.put(p.getName(), p.getInventory().getContents()); armors.put(p.getName(), p.getInventory().getArmorContents()); p.getInventory().clear(); p.getInventory().setBoots(null); p.getInventory().setLeggings(null); p.getInventory().setChestplate(null); p.getInventory().setHelmet(null); p.updateInventory(); p.setWalkSpeed(0.2f); ParticleEffect.FIREWORKS_SPARK.display(0.5f, 1f, 0.5f, 0.05f, 20, loc, 100); ingame.add(p.getName()); } inqueue.removeAll(ingame); sendToAll(Game.tag + "§eGame starting."); for (int i = 1; i <= inqueue.size(); i++) { int util = i - 1; Player p = Bukkit.getPlayer(inqueue.get(util)); p.sendMessage( Game.tag + "§eA game has started, you have been moved to §b" + i + "§e in queue."); } }
public AirScooter(Player player) { super(player); if (check(player)) return; else if (!player.isSprinting() || GeneralMethods.isSolid(player.getEyeLocation().getBlock()) || player.getEyeLocation().getBlock().isLiquid()) return; else if (GeneralMethods.isSolid(player.getLocation().add(0, -.5, 0).getBlock())) return; else if (bPlayer.isOnCooldown(this)) return; this.speed = getConfig().getDouble("Abilities.Air.AirScooter.Speed"); this.interval = getConfig().getDouble("Abilities.Air.AirScooter.Interval"); this.radius = getConfig().getDouble("Abilities.Air.AirScooter.Radius"); this.cooldown = getConfig().getLong("Abilities.Air.AirScooter.Cooldown"); this.maxHeightFromGround = getConfig().getDouble("Abilities.Air.AirScooter.MaxHeightFromGround"); this.random = new Random(); this.angles = new ArrayList<>(); canFly = player.getAllowFlight(); hadFly = player.isFlying(); new Flight(player); player.setAllowFlight(true); player.setFlying(true); player.setSprinting(false); for (int i = 0; i < 5; i++) { angles.add((double) (60 * i)); } start(); }
public void removeSpectator(Player p) { ArrayList<Player> players = new ArrayList<Player>(); players.addAll(activePlayers); players.addAll(inactivePlayers); if (p.isOnline()) { for (Player pl : Bukkit.getOnlinePlayers()) { pl.showPlayer(p); } } // restoreInv(p); p.setAllowFlight(false); p.setFlying(false); p.setFallDistance(0); p.setHealth(p.getMaxHealth()); p.setFoodLevel(20); p.setSaturation(20); p.teleport(SettingsManager.getInstance().getLobbySpawn()); // Bukkit.getServer().broadcastPrefixType("Removing Spec "+p.getName()+" "+spectators.size()+" // left"); spectators.remove(p.getName()); // Bukkit.getServer().broadcastPrefixType("Removed"); nextspec.remove(p); }
/** * Handles the gamemode for the specified {@link Player}. * * @param player The {@link Player}. * @param world The world the player is in. */ public void handleGameModeAndFlight(final Player player, final MultiverseWorld world) { if (!MVPlayerListener.this.pt.playerCanIgnoreGameModeRestriction(world, player)) { // Check that the player is in the new world and they haven't been teleported elsewhere or the // event cancelled. if (player.getWorld() == world.getCBWorld()) { Logging.fine( "Handling gamemode for player: %s, Changing to %s", player.getName(), world.getGameMode().toString()); Logging.finest("From World: %s", player.getWorld()); Logging.finest("To World: %s", world); player.setGameMode(world.getGameMode()); // Check if their flight mode should change // TODO need a override permission for this if (player.getAllowFlight() && !world.getAllowFlight() && player.getGameMode() != GameMode.CREATIVE) { player.setAllowFlight(false); if (player.isFlying()) { player.setFlying(false); } } else if (world.getAllowFlight()) { if (player.getGameMode() == GameMode.CREATIVE) { player.setAllowFlight(true); } } } else { Logging.fine( "The gamemode/allowfly was NOT changed for player '%s' because he is now in world '%s' instead of world '%s'", player.getName(), player.getWorld().getName(), world.getName()); } } else { MVPlayerListener.this.plugin.log( Level.FINE, "Player: " + player.getName() + " is IMMUNE to gamemode changes!"); } }
public void leaveTeam(CommandSender sender, String[] args) { Player player; if (args.length >= 2) { player = getPlayerByName(args[1]); } else { player = getPlayerFromCommandSender(sender); } TeamManager teamManager = plugin.getTeamManager(); if (teamManager.hasTeam(player)) { teamManager.removePlayer(player); if (plugin.getGameManager().isGameInProgress()) { teamManager.setSpectating(player, 1); player.setAllowFlight(true); player.setFlying(true); player.sendMessage(ChatColor.RED + "You have been set as a spectator"); } notifyAdmins(sender, String.format("Removed %s from their team", player.getName())); } else { throw new CommandException( String.format("Could not remove %s from their team", player.getName())); } }
private void removeFlight(Player p) { if (disableFlight && p.getGameMode() != GameMode.CREATIVE) { if (p.getAllowFlight()) couldFly.add(p.getName()); if (p.isFlying()) hadFlight.add(p.getName()); p.setFlying(false); p.setAllowFlight(false); } }
@EventHandler public void onGamemodeChange(PlayerGameModeChangeEvent e) { if (e.getNewGameMode().equals(GameMode.ADVENTURE)) { Player p = e.getPlayer(); p.setAllowFlight(true); p.setFlying(false); } }
@EventHandler public void onJoin(PlayerJoinEvent e) { Player p = e.getPlayer(); p.sendMessage(ChatColor.GREEN + "Welcome to the server!"); p.teleport(p.getWorld().getSpawnLocation()); p.setGameMode(GameMode.ADVENTURE); p.setAllowFlight(true); p.setFlying(false); }
@EventHandler public void doubleJump(PlayerToggleFlightEvent event) { final Player player = event.getPlayer(); if (event.isFlying() && FOPM_TFM_Util.isDoubleJumper(player)) { player.setFlying(false); Vector jump = player.getLocation().getDirection().multiply(2).setY(1.1); player.setVelocity(player.getVelocity().add(jump)); event.setCancelled(true); } }
private void fixFlying(Player player) { if (couldFly.contains(player.getName())) { couldFly.remove(player.getName()); player.setAllowFlight(true); } if (hadFlight.contains(player.getName())) { hadFlight.remove(player.getName()); player.setFlying(true); } }
@SuppressWarnings("deprecation") public void run() { for (Player p : c.getServer().getOnlinePlayers()) { for (ItemStack is : p.getInventory().getContents()) { if (is == null || is.getType() == Material.AIR || !is.hasItemMeta()) continue; if (!is.getItemMeta().hasLore()) continue; if (!c.hasCustomEnchant(is.getItemMeta().getLore())) continue; boolean b = false; for (String s : is.getItemMeta().getLore()) { if (!c.isCustomEnchant(s)) continue; if (s.startsWith(ChatColor.RESET + "Repair ")) b = true; } if (!b) continue; if (is.getDurability() > 0) is.setDurability((short) (is.getDurability() - 1)); } boolean hasChestplateOn = false; for (ItemStack is : p.getInventory().getArmorContents()) { if (is == null || !is.getType().name().endsWith("CHESTPLATE") || !is.hasItemMeta()) continue; if (!is.getItemMeta().hasLore()) continue; if (!c.hasCustomEnchant(is.getItemMeta().getLore())) continue; boolean b = false; for (String s : is.getItemMeta().getLore()) { if (!c.isCustomEnchant(s)) continue; if (s.startsWith(ChatColor.RESET + "Flying ")) b = true; } if (!b) continue; if (!hasChestplateOn) { if (!p.isFlying()) { p.sendMessage(ChatColor.GOLD + "Flying enabled!"); } p.setAllowFlight(true); p.setFlying(true); hasChestplateOn = true; } } if (!hasChestplateOn && p.getGameMode() != GameMode.CREATIVE && p.isFlying()) { p.setFlying(false); p.setAllowFlight(false); } } }
@EventHandler public void onPlayerStopFlying(PlayerToggleFlightEvent e) { Player p = e.getPlayer(); if (ArenaManager.isPlayerPlaying(p) && ArenaManager.getPlayersArena(p).getState() == Arena.ArenaState.INGAME) { if (!e.isFlying()) { e.setCancelled(true); p.setFlying(true); } } }
@EventHandler public void onFly(PlayerToggleFlightEvent e) { final Player p = e.getPlayer(); Runnable jump2 = new Runnable() { public void run() { p.setLevel(2); p.setFallDistance(-100); } }; Runnable jump1 = new Runnable() { public void run() { p.setLevel(1); p.setFallDistance(-100); } }; Runnable jump = new Runnable() { public void run() { p.setAllowFlight(true); p.setFlying(false); p.setLevel(0); p.setFallDistance(-100); } }; if (p.getGameMode().equals(GameMode.ADVENTURE) && e.isFlying() == true) { p.setFlying(false); p.setAllowFlight(false); p.setLevel(3); for (Player all : Bukkit.getOnlinePlayers()) { all.playSound(p.getLocation(), Sound.WITHER_SHOOT, 0.1f, 0.1f); } p.setVelocity(p.getLocation().getDirection().multiply(3).setY(p.getVelocity().getY() + 1.5)); Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, jump2, 20L); Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, jump1, 40L); Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, jump, 60L); } }
public void joinTeam(CommandSender sender, String[] args) { Player player; if (args.length >= 3) { player = getPlayerByName(args[2]); } else { player = getPlayerFromCommandSender(sender); } TeamManager teamManager = plugin.getTeamManager(); if (teamManager.isTeam(args[1])) { teamManager.addPlayer(player, args[1]); if (plugin.getGameManager().isGameInProgress()) { teamManager.setKills(player, 0); teamManager.setDeaths(player, 0); teamManager.setSpectating(player, 0); if (!player.getGameMode().equals(GameMode.CREATIVE)) { player.setFlying(false); player.setAllowFlight(false); } if (teamManager.hasSpawn(player)) { player.teleport(plugin.getTeamManager().getSpawn(player)); } boolean keepInventory = args.length == 4 ? parseBoolean(args[3]) : false; if (!keepInventory) { teamManager.kitPlayer(player); } } notifyAdmins(sender, String.format("Added %s to team %s", player.getName(), args[1])); } else { throw new CommandException(String.format("No team was found by the name of %s", args[1])); } }
/** * Stops players not in an arena from damaging players in that arena,<br> * players in an arena from damaging players not in that arena,<br> * and players on the same team from damaging each other if the team has friendly fire off.<br> * Calls the game's onEntityDamageByEntity event if the damage is allowed. */ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { Entity entity = event.getEntity(); if (entity instanceof Player) { Player player = (Player) event.getEntity(); String playerName = player.getName(); PlayerManager playerManager = ultimateGames.getPlayerManager(); if (playerManager.isPlayerInArena(playerName)) { Arena arena = playerManager.getPlayerArena(playerName); Entity damagerEntity = event.getDamager(); Player damager = null; if (damagerEntity instanceof Player) { damager = (Player) damagerEntity; } else if (damagerEntity instanceof Projectile) { Projectile projectile = (Projectile) damagerEntity; LivingEntity shooter = projectile.getShooter(); if (shooter instanceof Player) { damager = (Player) shooter; } } if (damager != null) { String damagerName = damager.getName(); if (playerManager.isPlayerInArena(damagerName) && playerManager.getPlayerArena(damagerName).equals(arena)) { TeamManager teamManager = ultimateGames.getTeamManager(); Team playerTeam = teamManager.getPlayerTeam(playerName); Team damagerTeam = teamManager.getPlayerTeam(damagerName); if (playerTeam != null && playerTeam.equals(damagerTeam) && !playerTeam.hasFriendlyFire()) { ultimateGames.getMessenger().sendMessage(damager, "teams.friendlyfire"); event.setCancelled(true); } else { arena.getGame().getGamePlugin().onEntityDamageByEntity(arena, event); } } else { event.setCancelled(true); } } } else if (playerManager.isPlayerSpectatingArena(playerName)) { Entity damagerEntity = event.getDamager(); if (damagerEntity instanceof Projectile) { Projectile projectile = (Projectile) damagerEntity; player.teleport(player.getLocation().add(0, 5, 0)); player.setFlying(true); Projectile newProjectile = projectile.getWorld().spawn(projectile.getLocation(), projectile.getClass()); newProjectile.setShooter(projectile.getShooter()); newProjectile.setVelocity(projectile.getVelocity()); newProjectile.setBounce(false); event.setCancelled(true); projectile.remove(); } } } else { Arena arena = ultimateGames.getArenaManager().getLocationArena(event.getEntity().getLocation()); if (arena != null) { arena.getGame().getGamePlugin().onEntityDamageByEntity(arena, event); } } }
@EventHandler(ignoreCancelled = true) public void onEntityDamageEntity(EntityDamageByEntityEvent e) { if (e.getEntity() instanceof Player) { // Hit player Player damaged = (Player) e.getEntity(); if (e.getDamager() instanceof Player) { // Player Player damager = (Player) e.getDamager(); if (cancelBothIngame(damaged, damager)) { e.setCancelled(true); return; } if (checkForShadowBlade(damager)) { e.setCancelled(true); return; } if (pl.ingameList.get(damager).getAttackType() == 2) { if (damager.getItemInHand().getType().equals(Material.IRON_SWORD) || damager.getItemInHand().getType().equals(Material.DIAMOND_SWORD) || damager.getItemInHand().getType().equals(Material.GOLD_SWORD)) { e.setCancelled(true); return; } } if (!e.isCancelled()) { checkTeleport(damager); } } else if (e.getDamager() instanceof Projectile) { // Arrow Projectile proj = (Projectile) e.getDamager(); if (proj.getShooter() instanceof Player) { Player shooter = (Player) proj.getShooter(); if (cancelBothIngame(damaged, shooter)) { e.setCancelled(true); return; } if (pl.ingameList.get(shooter).getAttackType() == 1) { e.setCancelled(true); return; } if (checkForShadowBlade(shooter)) { e.setCancelled(true); return; } checkTeleport(shooter); if (!e.isCancelled()) { if (!checkIngame(damaged) && checkIngame(shooter)) { // spectator wont get hurt, and the arrow wont stop proj.setBounce(false); Vector vel = proj.getVelocity(); damaged.teleport(damaged.getLocation().add(0, 3, 0)); damaged.setFlying(true); Arrow newArrow = shooter.launchProjectile(Arrow.class); newArrow.setShooter(shooter); newArrow.setVelocity(vel); e.setCancelled(true); proj.remove(); } else if (checkIngame(damaged) && checkIngame(shooter)) { // e.setCancelled(true); // damaged.damage(e.getDamage()); checkTarrasque(damaged); checkTeleport(damaged); checkTeleport(shooter); pl.breakEffect(damaged.getLocation(), 3, 11); } } } } } else { // Hit a non-player if (e.getDamager() instanceof Player) { // Player Player damager = (Player) e.getDamager(); if (checkSpectator(damager)) { e.setCancelled(true); return; } if (checkForShadowBlade(damager)) { e.setCancelled(true); return; } if (pl.ingameList.get(damager).getAttackType() == 2) { if (damager.getItemInHand().getType().equals(Material.IRON_SWORD) || damager.getItemInHand().getType().equals(Material.DIAMOND_SWORD) || damager.getItemInHand().getType().equals(Material.GOLD_SWORD)) { e.setCancelled(true); return; } } checkTeleport(damager); } else if (e.getDamager() instanceof Projectile) { // Arrow Projectile proj = (Projectile) e.getDamager(); if (proj.getShooter() instanceof Player) { Player shooter = (Player) proj.getShooter(); if (!checkIngame(shooter)) { if (checkSpectator(shooter)) { e.setCancelled(true); return; } } else { if (pl.ingameList.get(shooter).getAttackType() == 1) { e.setCancelled(true); return; } if (checkForShadowBlade(shooter)) { e.setCancelled(true); return; } checkTeleport(shooter); } } } if (!e.isCancelled()) { pl.breakEffect(e.getEntity().getLocation(), 2, 55); } } }
public void run(CommandSender sender, String[] args) throws Exception { if (!(sender instanceof Player)) throw new ConsoleSenderException(getName()); if (args.length == 0) { Util.invalidArgCount( sender, "TPA", "Request to teleport to another player, or accept/deny a request.", "/tpa [player]", "/tpa [accept|deny]"); return; } if (args.length == 1) { if (args[0].equalsIgnoreCase("accept")) { if (Request.hasRequest(sender.getName())) { Request accept = Request.getCurrentRequested(sender.getName()); Player player = Bukkit.getPlayer(accept.getRequester().getName()); Player target = Bukkit.getPlayer(accept.getRequestee().getName()); if (target == null || player == null) { sender.sendMessage("§cTPA: §4The requester is not online."); Store.tpa.remove(accept); return; } Location current = player.getLocation(); Location loc = null; World w = target.getWorld(); double x = target.getLocation().getX(); double y = target.getLocation().getY(); double z = target.getLocation().getZ(); float yaw = target.getLocation().getYaw(); float pitch = target.getLocation().getPitch(); boolean playerSolid = false; while (playerSolid == false) { loc = new Location(w, x, y, z, yaw, pitch); if (loc.getBlock().getType() != Material.AIR) { playerSolid = true; } else if (player.getAllowFlight() == true && loc.getBlock().getType() == Material.AIR) { playerSolid = true; player.setFlying(true); } else { y--; } } PlayerData pd = new PlayerData(player.getUniqueId()); pd.setBackLocation(player.getLocation()); player.teleport(loc); sender.sendMessage("§6TPA: §eTeleporting to location..."); target.sendMessage("§6TPA: §eRequest accepted"); if (loc.getY() <= 1) { player.teleport(current); sender.sendMessage( "§cTPA: §4The location was beyond the void, so you'll stay where you are."); return; } Store.tpa.remove(accept); } else { sender.sendMessage("§cTPA: §4You have no pending requests."); } } else if (args[0].equalsIgnoreCase("deny")) { if (Request.hasRequest(sender.getName())) { Request denied = Request.getCurrentRequested(sender.getName()); Player player = Bukkit.getPlayer(denied.getRequester().getName()); Player target = Bukkit.getPlayer(denied.getRequestee().getName()); if (target == null || player == null) { sender.sendMessage("§cTPA: §4The requester is not online."); Store.tpa.remove(denied); return; } if (target != null) target.sendMessage("§cTPA: §4" + sender.getName() + " has denied your request."); Store.tpa.remove(denied); } else { sender.sendMessage("§cTPA: §4You have no pending requests."); } } else { Player player = (Player) sender; Player target = Bukkit.getPlayer(args[0]); if (target == null) { Util.offline(sender, "TPA", args[0]); return; } if (target.getName().equalsIgnoreCase(sender.getName())) { sender.sendMessage("§cTPA: §4You cannot request to tp to yourself!"); return; } if (Store.tptoggle.contains(target.getName())) { sender.sendMessage("§cTPA: §4" + target.getDisplayName() + " §4has a TP Toggle enabled."); return; } Request request = new Request(player, target); sender.sendMessage("§6TPA: §eRequest sent!"); Store.tpa.add(request); } } }
public void disableRocketBoots( Player player, Boolean keepUsage, Boolean keepPower, Boolean keepFlight, Boolean keepVariant, Boolean keepEnhancement) { UUID playerUUID = player.getUniqueId(); if (!keepUsage && RocketInit.rocketUsage.contains(playerUUID)) RocketInit.rocketUsage.remove(playerUUID); if (RocketInit.rocketSprint.containsKey(playerUUID)) RocketInit.rocketSprint.remove(playerUUID); if (!keepPower && RocketInit.rocketPower.containsKey(playerUUID)) RocketInit.rocketPower.remove(playerUUID); if (!RocketInit.rocketFire.isEmpty()) RocketInit.rocketFire.clear(); if (RocketInit.rocketWater.contains(playerUUID)) RocketInit.rocketWater.remove(playerUUID); if (RocketInit.rocketRepair.containsKey(playerUUID)) RocketInit.rocketRepair.remove(playerUUID); if (!keepEnhancement && RocketInit.rocketEnhancement.containsKey(playerUUID)) RocketInit.rocketEnhancement.remove(playerUUID); if (!keepVariant && RocketInit.rocketVariant.containsKey(playerUUID)) { switch (RocketInit.rocketVariant.get(playerUUID)) { case ENDER: player.removePotionEffect(PotionEffectType.NIGHT_VISION); player.removePotionEffect(PotionEffectType.HEALTH_BOOST); break; case ZERO: player.removePotionEffect(PotionEffectType.CONFUSION); player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); player.removePotionEffect(PotionEffectType.INCREASE_DAMAGE); break; case STEALTH: for (Player onlinePlayer : Bukkit.getOnlinePlayers()) onlinePlayer.showPlayer(player); break; case DRUNK: player.removePotionEffect(PotionEffectType.CONFUSION); player.removePotionEffect(PotionEffectType.FAST_DIGGING); break; case BOOST: player.removePotionEffect(PotionEffectType.HEAL); break; case RUNNER: player.removePotionEffect(PotionEffectType.SPEED); break; } RocketInit.rocketVariant.remove(playerUUID); } if (player.isOnline() && gamemodeCheck.check(player, GameMode.SURVIVAL, GameMode.ADVENTURE)) { for (Player onlinePlayer : Bukkit.getOnlinePlayers()) onlinePlayer.showPlayer(player); player.setFlySpeed(0.1f); player.setFlying(false); if (!keepFlight) player.setAllowFlight(false); player.setNoDamageTicks(100); player.setFallDistance(0); } }
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (args.length == 0 || !(sender instanceof Player)) { msg(sender, head); msg(sender, " &lGO TO &b&ohttp://www.diamonddominion.net/vote"); msg(sender, " &a&lVOTE FOR US! -=- YOU WILL GET PRIZES"); msg(sender, "&2|&b/vote redeem&6 to exchange votes prizes."); msg(sender, "&2|&b/vote stats&6 to see what you currently have."); msg(sender, head); // msg(sender, "Visit the website to use up donation credits you earn."); // msg(sender, "Voting helps our server gain popularity on server listing sites."); return true; } else { Player player = (Player) sender; String arg = args[0]; if (arg.equalsIgnoreCase("redeem")) { if (args.length < 3) { msg(player, head); msg( player, "You have &b" + VoteSQL.getVotesNotRewarded(player.getName()) + "&6 votes to buy prizes."); msg(player, "Type &b/vote redeem <prize id> <prize amount>"); msg(player, "| &2PrizeID&6 | &2VoteCost&6 | -- &2Prize Name &6--"); for (int x = 1; x <= VotePrize.prizeAmount; x++) { msg( player, "&6 -- &b" + x + " &6-- | -- &b" + VotePrize.getCost(x) + "&6 --- | &a" + VotePrize.getDescription(x)); } msg(player, head); return true; } else { String strid = args[1]; int id; try { id = Integer.parseInt(strid); } catch (Exception e) { msg(player, "&4Error: &cPrize ID is incorrect."); msg(player, "Type &b/vote redeem <prize id> <prize amount>"); return true; } if (!VotePrize.isValid(id)) { msg(player, "&4Error: &cThere is no such prize id."); msg(player, "Type &b/vote redeem <prize id> <prize amount>"); return true; } String strvotes = args[2]; int votesNum; try { votesNum = Integer.parseInt(strvotes); } catch (Exception e) { msg(player, "&4Error: &cVote number is incorrect."); msg(player, "Type &b/vote redeem <prize id> <prize amount>"); return true; } redeem(player, id, votesNum); return true; } } else if (arg.equalsIgnoreCase("stats")) { msg(player, head); msg(player, "&5Your stats:"); msg(player, "Unredeemed votes: &a" + VoteSQL.getVotesNotRewarded(player.getName())); msg(player, "Donation credits: &a" + DonationCredit.getCredits(player.getName())); msg(player, "Total votes ever: &a" + VoteSQL.getAllPlayerVotes(player.getName())); msg(player, "Votes in last 24 hours: &a" + VoteSQL.getVotesLast24(player.getName())); msg(player, head); return true; } else if (arg.equalsIgnoreCase("complete")) { if (!redeemQueue.containsKey(player.getName())) { msg(player, "&4Error: &cYou do not have a pending prize request."); msg(player, "Type &b/vote redeem <prize id> <prize amount>"); return true; } int id = Integer.parseInt(redeemQueue.get(player.getName()).split(";")[0]); int amount = Integer.parseInt(redeemQueue.get(player.getName()).split(";")[1]); redeemQueue.remove(player.getName()); ArrayList<Vote> votes = VoteSQL.filterVotes(player.getName(), 0, null, true, false); int cost = VotePrize.getCost(id) * amount; int has = votes.size(); if (cost > has) { msg( player, "&4Error: &cYou can't redeem a prize that costs " + cost + " votes, but only have " + has + " votes to spend."); return true; } if (id == 4 || id == 5) { msg(player, "&4Error: &cPrizes 4-5 have not been set up yet."); return true; } String name = VotePrize.getName(id).toLowerCase(); if (name.equals("fly")) { if (player.hasPermission("fly.fly")) { msg( player, "&4Error: &cYou already have Premium! You don't need to pay votes for Fly Mode"); return true; } if (!plugin.detectedServer().equals("survival")) { msg(player, "&4Error: &cFly Mode is only available on the Survival server"); return true; } } if (name.equals("god")) { if (player.hasPermission("fairgod.fair")) { msg( player, "&4Error: &cYou already have Premium! You don't need to pay votes for God Mode"); return true; } if (!plugin.detectedServer().equals("survival")) { msg(player, "&4Error: &cGod Mode is only available on the Survival server"); return true; } } if (name.equals("creative")) { if (player.hasPermission("customplugin.creative")) { msg( player, "&4Error: &cYou already have DemiGod! You don't need to pay votes for Creative"); return true; } if (!plugin.detectedServer().equals("survival")) { msg(player, "&4Error: &cCreative Mode is only available on the Survival server"); return true; } int a = 0; for (ItemStack i : player.getInventory()) { if (i != null) a++; } boolean helm = (player.getInventory().getHelmet() != null); boolean ches = (player.getInventory().getChestplate() != null); boolean legg = (player.getInventory().getLeggings() != null); boolean boot = (player.getInventory().getBoots() != null); if (a > 0 || helm || ches || legg || boot) { msg( player, "&4Error: &cYou must clear your inventory completely to switch to creative mode."); return true; } } // ---- ---- REWARD SCRIPT ---- ---- // Pay Cost int voteCounter = 1; for (Vote vote : votes) { if (voteCounter <= cost) { vote.rewardVote(id); } else { break; } voteCounter++; } // Add to DB the reward int mins = VotePrize.getExtraVar(id) * amount; int expiretime = (int) (System.currentTimeMillis() / 1000) + (60 * mins); try { Statement st = (Statement) SQL.getConnection().createStatement(); ResultSet result = st.executeQuery( "SELECT * FROM `dd-voterewards` WHERE `player` = '" + player.getName() + "' && `expiretime` > '" + System.currentTimeMillis() / 1000 + "';"); while (result.next()) { int qid = result.getInt("prizeid"); int qexpire = result.getInt("expiretime"); if (qid == id) { expiretime = qexpire + (60 * mins); } } } catch (Exception e) { e.printStackTrace(); } SQL.singleQuery( "INSERT INTO `dd-voterewards`(`player`, `prizeid`, `expiretime`) VALUES ('" + player.getName() + "' , '" + id + "', '" + expiretime + "')"); msg(player, head); if (id <= 5) { Map<Integer, Integer> data = new HashMap<Integer, Integer>(); if (rewardCache.containsKey(player)) { data = rewardCache.get(player); } data.put(id, expiretime); rewardCache.put(player.getName(), data); } if (name.equals("healing")) { double health = player.getHealth(); health += VotePrize.getExtraVar(id); if (health > 20) health = 20; player.setFoodLevel((int) health); msg(player, "You have been healed."); } if (name.equals("food")) { int foodLevel = player.getFoodLevel(); foodLevel += VotePrize.getExtraVar(id); if (foodLevel > 20) foodLevel = 20; player.setFoodLevel(foodLevel); msg(player, "You have been fed."); } if (name.equals("xp")) { player.giveExp(VotePrize.getExtraVar(id)); msg(player, "You have been given &b" + VotePrize.getExtraVar(id) + "&6 XP."); } if (name.equals("fly")) { player.setAllowFlight(true); player.setFlying(true); msg(player, "You are now flying."); } if (name.equals("god")) { if (!plugin.fairGod.isGod(player)) { plugin.fairGod.toggleGod(player, true); msg(player, "You now have God mode."); } } if (name.equals("creative")) { player.setGameMode(GameMode.CREATIVE); msg(player, "You are now in creative."); } // ---- ---- END REWARD SCRIPT ---- ---- msg( player, "You now have &b" + VoteSQL.getVotesNotRewarded(player.getName()) + "&6 votes to spend."); msg(player, head); return true; } else { msg(player, "Command not found"); return true; } } }
@EventHandler public void on(PlayerJoinEvent e) { final Player p = e.getPlayer(); Tablist tab = new Tablist(); tab.setFooter("§3OreBattle v1.0"); tab.setHeader("§a" + Bukkit.getServerName()); tab.send(p); if (Devathlon.Status == GameStatus.Lobby) { /*TagManager tm = new TagManager(p); tm.changeTag(tm.getTagByPermissions()); tm.setTag();*/ e.setJoinMessage( "§7> " + p.getDisplayName() + " §3hat das Spiel betreten. (" + Bukkit.getOnlinePlayers().size() + "/" + Bukkit.getMaxPlayers() + ")"); if (Bukkit.getOnlinePlayers().size() == 5 && Devathlon.Timer > 10) { Devathlon.Timer = 10; } clearupperson(p); createPlayerStats(p); p.getInventory() .setItem( 0, createItemstack(Material.COMPASS, "§9Teamauswahl §7<Rechtsklick>", 1, (byte) 0)); p.getInventory() .setItem( 8, createItemstack( Material.SLIME_BALL, "§9Zurück zur Lobby §7<Rechtsklick>", 1, (byte) 0)); if (Devathlon.sql == true) { p.getInventory() .setItem( 4, createItemstack(Material.NETHER_STAR, "§9Kitauswahl §7<Rechtsklick>", 1, (byte) 0)); } p.getInventory().setHeldItemSlot(0); p.teleport(OreBattle_Command.getLocation("Lobby", true)); p.sendMessage(Devathlon.prefix + "§3Willkommen bei OreBattle v1.0"); } else { e.setJoinMessage(""); p.getInventory().clear(); p.getInventory() .setItem( 0, createItemstack(Material.REDSTONE_BLOCK, "§cTeam Rot §7<Rechtsklick>", 1, (byte) 0)); p.getInventory() .setItem( 1, createItemstack(Material.LAPIS_BLOCK, "§9Team Blau §7<Rechtsklick>", 1, (byte) 0)); p.getInventory() .setItem( 8, createItemstack( Material.SLIME_BALL, "§9Zurück zur Lobby §7<Rechtsklick>", 1, (byte) 0)); TagManager tm = new TagManager(p); tm.changeTag("7"); tm.setTag(); p.setPlayerListName("§7[§cX§7] §8| §7" + p.getName()); p.setDisplayName("§7[§cX§7] " + p.getName()); Global.spectator.add(p); for (Player all : Bukkit.getOnlinePlayers()) { all.hidePlayer(p); for (Player spec : Global.spectator) { spec.showPlayer(p); p.showPlayer(spec); } } p.setAllowFlight(true); p.setFlying(true); p.sendMessage(Devathlon.prefix + "§3Du bist jetzt Spectator."); p.teleport(OreBattle_Command.getLocation("Spectator", true)); } }
@SuppressWarnings("deprecation") public boolean addPlayer(final Player p) { if (SettingsManager.getInstance().getLobbySpawn() == null) { msgmgr.sendFMessage(PrefixType.WARNING, "error.nolobbyspawn", p); return false; } if (!p.hasPermission("sg.arena.join." + gameID)) { debug("permission needed to join arena: " + "sg.arena.join." + gameID); msgmgr.sendFMessage(PrefixType.WARNING, "game.nopermission", p, "arena-" + gameID); return false; } HookManager.getInstance() .runHook( "GAME_PRE_ADDPLAYER", "arena-" + gameID, "player-" + p.getName(), "maxplayers-" + spawns.size(), "players-" + activePlayers.size()); GameManager.getInstance().removeFromOtherQueues(p, gameID); if (GameManager.getInstance().getPlayerGameId(p) != -1) { if (GameManager.getInstance().isPlayerActive(p)) { msgmgr.sendMessage(PrefixType.ERROR, "Cannot join multiple games!", p); return false; } } if (p.isInsideVehicle()) { p.leaveVehicle(); } if (spectators.contains(p)) removeSpectator(p); if (mode == GameMode.WAITING || mode == GameMode.STARTING) { if (activePlayers.size() < SettingsManager.getInstance().getSpawnCount(gameID)) { msgmgr.sendMessage(PrefixType.INFO, "Joining Arena '" + name + "'", p); PlayerJoinArenaEvent joinarena = new PlayerJoinArenaEvent(p, GameManager.getInstance().getGame(gameID)); Bukkit.getServer().getPluginManager().callEvent(joinarena); if (joinarena.isCancelled()) return false; boolean placed = false; int spawnCount = SettingsManager.getInstance().getSpawnCount(gameID); for (int a = 1; a <= spawnCount; a++) { if (spawns.get(a) == null) { placed = true; spawns.put(a, p); p.setGameMode(org.bukkit.GameMode.SURVIVAL); // p.teleport(SettingsManager.getInstance().getLobbySpawn()); p.teleport(SettingsManager.getInstance().getSpawnPoint(gameID, a)); p.setHealth(p.getMaxHealth()); p.setFoodLevel(20); p.getInventory().clear(); p.getEquipment().setArmorContents(null); p.updateInventory(); p.setFlying(false); p.setAllowFlight(false); p.setWalkSpeed(0.2F); p.setFireTicks(0); activePlayers.add(p); sm.addPlayer(p, gameID); scoreBoard.addPlayer(p); hookvars.put("activeplayers", activePlayers.size() + ""); LobbyManager.getInstance().updateWall(gameID); HookManager.getInstance() .runHook("GAME_POST_ADDPLAYER", "activePlayers-" + activePlayers.size()); if (spawnCount == activePlayers.size()) { countdown(5); } Bukkit.getServer() .getScheduler() .scheduleSyncDelayedTask( GameManager.getInstance().getPlugin(), new Runnable() { public void run() { p.setFlying(false); p.setAllowFlight(false); p.setWalkSpeed(0.2F); p.setFireTicks(0); p.getInventory().clear(); p.getEquipment().setArmorContents(null); p.updateInventory(); showMenu(p); for (PotionEffect effect : p.getActivePotionEffects()) { p.removePotionEffect(effect.getType()); } } }, 1L); break; } } if (!placed) { msgmgr.sendFMessage(PrefixType.ERROR, "error.gamefull", p, "arena-" + gameID); return false; } } else if (SettingsManager.getInstance().getSpawnCount(gameID) == 0) { msgmgr.sendMessage(PrefixType.WARNING, "No spawns set for Arena " + gameID + "!", p); return false; } else { msgmgr.sendFMessage(PrefixType.WARNING, "error.gamefull", p, "arena-" + gameID); return false; } msgFall( PrefixType.INFO, "game.playerjoingame", "player-" + p.getName(), "activeplayers-" + getActivePlayers(), "maxplayers-" + SettingsManager.getInstance().getSpawnCount(gameID)); if (activePlayers.size() >= config.getInt("auto-start-players") && !countdownRunning) countdown(config.getInt("auto-start-time")); return true; } else { if (config.getBoolean("enable-player-queue")) { if (!queue.contains(p)) { queue.add(p); msgmgr.sendFMessage( PrefixType.INFO, "game.playerjoinqueue", p, "queuesize-" + queue.size()); } int a = 1; for (Player qp : queue) { if (qp == p) { msgmgr.sendFMessage(PrefixType.INFO, "game.playercheckqueue", p, "queuepos-" + a); break; } a++; } } } if (mode == GameMode.INGAME) msgmgr.sendFMessage(PrefixType.WARNING, "error.alreadyingame", p); else if (mode == GameMode.DISABLED) msgmgr.sendFMessage(PrefixType.WARNING, "error.gamedisabled", p, "arena-" + gameID); else if (mode == GameMode.RESETING) msgmgr.sendFMessage(PrefixType.WARNING, "error.gamereseting", p); else msgmgr.sendMessage(PrefixType.INFO, "Cannot join game!", p); LobbyManager.getInstance().updateWall(gameID); return false; }
private Results action(Player p_player) { switch (type) { case ALWAYSFLY: if (p_player.hasMetadata("ZeltCmds_Player_AlwaysFly")) { p_player.removeMetadata("ZeltCmds_Player_AlwaysFly", this.getPlugin()); p_player.setAllowFlight(p_player.getGameMode().equals(GameMode.CREATIVE)); return Results.OFF; } else { p_player.setMetadata( "ZeltCmds_Player_AlwaysFly", new FixedMetadataValue(this.getPlugin(), "true")); p_player.setAllowFlight(true); p_player.setFlying(true); return Results.ON; } case BUILD: if (p_player.hasMetadata("ZeltCmds_Player_Build")) { p_player.removeMetadata("ZeltCmds_Player_Build", this.getPlugin()); return Results.OFF; } else { p_player.setMetadata( "ZeltCmds_Player_Build", new FixedMetadataValue(this.getPlugin(), "true")); return Results.ON; } case FLY: if (p_player.getAllowFlight()) { p_player.setAllowFlight(false); return Results.OFF; } else { p_player.setAllowFlight(true); return Results.ON; } case FREEZE: if (p_player.hasMetadata("ZeltCmds_Player_Freeze")) { p_player.removeMetadata("ZeltCmds_Player_Freeze", this.getPlugin()); return Results.OFF; } else { p_player.setMetadata( "ZeltCmds_Player_Freeze", new FixedMetadataValue(this.getPlugin(), "true")); return Results.ON; } case HIDE: if (p_player.hasMetadata("ZeltCmds_Player_Hide")) { p_player.removeMetadata("ZeltCmds_Player_Hide", this.getPlugin()); for (Player player : p_player.getServer().getOnlinePlayers()) { if (!player.equals(p_player)) { player.hidePlayer(p_player); } } return Results.OFF; } else { p_player.setMetadata( "ZeltCmds_Player_Hide", new FixedMetadataValue(this.getPlugin(), "true")); for (Player player : p_player.getServer().getOnlinePlayers()) { if (!player.equals(p_player)) { player.showPlayer(p_player); } } return Results.ON; } case MUTE: if (p_player.hasMetadata("ZeltCmds_Player_Mute")) { p_player.removeMetadata("ZeltCmds_Player_Mute", this.getPlugin()); return Results.OFF; } else { p_player.setMetadata( "ZeltCmds_Player_Mute", new FixedMetadataValue(this.getPlugin(), "true")); return Results.ON; } } return Results.ERROR; }
@SuppressWarnings("deprecation") public void updatePlayerRewardStatus(Map<String, Map<Integer, Integer>> tempSet) { Map<String, Integer> tempData = generateData(tempSet); Map<String, Integer> prevData = generateData(rewardCache); int now = (int) (System.currentTimeMillis() / 1000); String server = plugin.detectedServer(); for (String data : tempData.keySet()) { Player player = Bukkit.getPlayer(data.split(";")[0]); int prizeId = Integer.parseInt(data.split(";")[1]); String name = VotePrize.getName(prizeId).toLowerCase(); if (player != null) { if (server.equals("survival")) { if (name.equals("fly")) { player.setAllowFlight(true); } if (name.equals("god")) { if (!plugin.fairGod.isGod(player)) { plugin.fairGod.toggleGod(player, true); } } if (name.equals("creative")) { player.setGameMode(GameMode.CREATIVE); } int prizeTime = tempData.get(data) - now; // if (prizeTime <= 10) { // msg(player, "You have 10 secs remaining for: " + VotePrize.getName(prizeId)); // } else if (prizeTime <= 60) { // msg(player, "You have 1 min remaining for: " + VotePrize.getName(prizeId)); // } else if (prizeTime <= 120) { // msg(player, "You have 2 mins remaining for: " + VotePrize.getName(prizeId)); // } else if (prizeTime <= 300) { // msg(player, "You have 5 mins remaining for: " + VotePrize.getName(prizeId)); // } if (prizeTime >= 60) msg( player, "You have &e" + (int) prizeTime / 60 + "&6 mins remaining for: &a" + VotePrize.getName(prizeId)); if (prizeTime < 60) msg( player, "You have &e" + ((int) prizeTime / 5) * 5 + "&6 secs remaining for: &a" + VotePrize.getName(prizeId)); // Set player to be doing what their reward requests // Send reminders of when their reward will run out } } else { msg( player, "Go back to SV! Vote prize time is running out! (And you can't use those prizes in this world)"); } } for (String data : prevData.keySet()) { if (!tempData.containsKey(data)) { Player player = Bukkit.getPlayer(data.split(";")[0]); int prizeId = Integer.parseInt(data.split(";")[1]); String name = VotePrize.getName(prizeId).toLowerCase(); msg(player, "Your prize: &a" + VotePrize.getName(prizeId) + " &6has expired."); if (name.equals("fly")) { player.setFlying(false); player.setAllowFlight(false); } if (name.equals("god")) { if (!plugin.fairGod.isGod(player)) plugin.fairGod.toggleGod(player, true); } if (name.equals("creative")) { player.getInventory().clear(); player.getInventory().setHelmet(new ItemStack(0)); player.getInventory().setChestplate(new ItemStack(0)); player.getInventory().setLeggings(new ItemStack(0)); player.getInventory().setBoots(new ItemStack(0)); player.setGameMode(GameMode.SURVIVAL); } // If players not in tempData, set expired & msg } } }
@EventHandler public void crouch(PlayerToggleSneakEvent e) { if (e.isSneaking()) { final Player p = e.getPlayer(); if (Util.getKit(p) instanceof Poseidon) { if (p.getLevel() >= 1) { if (p.getLocation().getBlock().getType() == Material.WATER || p.getLocation().getBlock().getType() == Material.STATIONARY_WATER) { p.setLevel(0); Vector v = p.getLocation().getDirection(); p.setVelocity(new Vector(0, v.getY() + 4, 0)); p.setAllowFlight(true); p.setFlying(true); p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20 * 5, 0)); p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 20 * 5, 1)); p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20 * 5, 0)); p.playSound(p.getLocation(), Sound.ZOMBIE_REMEDY, 1F, 1F); p.sendMessage(ChatColor.GREEN + "Poseidon pounce!"); BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.scheduleSyncDelayedTask( plugin, new Runnable() { public void run() { // TODO Auto-generated method stub if (Util.getKit(p) instanceof Poseidon) { p.setFlying(false); p.setAllowFlight(false); } } }, 20 * 3L); scheduler.scheduleSyncDelayedTask( plugin, new Runnable() { public void run() { // TODO Auto-generated method stub if (Util.getKit(p) instanceof Poseidon) { p.setLevel(1); } } }, 20 * 10); /*p.setLevel(0); WaterSprite(p); BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.scheduleSyncDelayedTask(plugin, new Runnable() { public void run() { // TODO Auto-generated method stub if(Util.getKit(p) instanceof Poseidon) { p.setLevel(1); } } }, 20* 7);*/ } } else { p.sendMessage(ChatColor.GRAY + "Poseidon pounce is recharging please wait 10 seconds."); } } } }
public void unload() { final Player player = Bukkit.getPlayerExact(name); if (player == null) { final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(name); PVPArena.instance.getAgm().disconnect(aPlayer.getArena(), aPlayer); return; } debug.i("restoring PlayerState of " + name, player); player.setFireTicks(fireticks); player.setFoodLevel(foodlevel); player.setGameMode(GameMode.getByValue(gamemode)); final ArenaPlayer aPlayer = ArenaPlayer.parsePlayer(player.getName()); player.setFoodLevel(foodlevel); if (player.getMaxHealth() != maxhealth) { final double newHealth = player.getMaxHealth() * health / maxhealth; if (newHealth > player.getMaxHealth()) { player.setHealth(player.getMaxHealth()); } else { player.setHealth(newHealth); } } else { player.setHealth(health); } player.setSaturation(saturation); player.setGameMode(GameMode.getByValue(gamemode)); player.setLevel(explevel); player.setExp(experience); player.setExhaustion(exhaustion); player.setFallDistance(0); player.setVelocity(new Vector()); if (aPlayer.getArena() != null && aPlayer.getArena().getArenaConfig().getBoolean(CFG.CHAT_COLORNICK)) { player.setDisplayName(displayname); } if (aPlayer.getArena() != null) { ArenaModuleManager.unload(aPlayer.getArena(), player); PVPArena.instance.getAgm().unload(aPlayer.getArena(), player); } removeEffects(player); player.addPotionEffects(potionEffects); aPlayer.setTelePass(false); player.setFireTicks(fireticks); if (aPlayer.getArena() != null) { player.setNoDamageTicks( aPlayer.getArena().getArenaConfig().getInt(CFG.TIME_TELEPORTPROTECT) * 20); } player.resetPlayerTime(); if (flying && !player.getAllowFlight()) { player.setAllowFlight(true); } player.setFlying(flying); }
public static void setFlying(Player player, boolean flying) { player.setAllowFlight(true); player.setFlying(flying); }