@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (sender instanceof Player) { Player player = (Player) sender; if (label.equalsIgnoreCase("explosion")) { PacketContainer fakeExplosion = protocolManager.createPacket(PacketType.Play.Server.EXPLOSION); // Set the coordinates try { fakeExplosion .getSpecificModifier(double.class) .write(0, player.getLocation().getX()) .write(1, player.getLocation().getY()) .write(2, player.getLocation().getZ()); fakeExplosion.getSpecificModifier(float.class).write(0, 3.0F); protocolManager.sendServerPacket(player, fakeExplosion); } catch (Exception e) { e.printStackTrace(); } } return true; } return false; }
public void switchPlayers() { for (String name : plugin.match.keySet()) { final Player pone = plugin.getServer().getPlayer(name); final Player ptwo = plugin.getServer().getPlayer(plugin.match.get(name)); DeathSwapSwapEvent dsse = new DeathSwapSwapEvent(pone, ptwo); Bukkit.getServer().getPluginManager().callEvent(dsse); // skips the first swap if (!plugin.startgame.contains(name)) { switchUtil(pone); switchUtil(ptwo); final Location locone = pone.getLocation(); final Location loctwo = ptwo.getLocation(); new BukkitRunnable() { @Override public void run() { pone.teleport(loctwo); ptwo.teleport(locone); if (plugin.getConfig().getBoolean("swap_sound")) { plugin.utility.swapEffects(locone); plugin.utility.swapEffects(loctwo); } protect(); } }.runTaskLater(plugin, 1L); } else { plugin.startgame.remove(name); } } }
public void onCommand(CommandSender sender, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("You need to be a player to do this."); return; } if (args.length != 1) { MessageManager.getInstance().msg(sender, MessageManager.MessageType.WARN, super.getUsage()); } Player p = Bukkit.getPlayer(((Player) sender).getUniqueId()); if (args[0] == "s") { cm.set("ht", HubType.SINGLE); String world = p.getWorld().getName(); Double x = p.getLocation().getX(); Double y = p.getLocation().getY(); Double z = p.getLocation().getZ(); Float yaw = p.getLocation().getYaw(); Float pitch = p.getLocation().getPitch(); cm.set("hw", world); cm.set("hx", x); cm.set("hy", y); cm.set("hz", z); cm.set("hyw", yaw); cm.set("hph", pitch); MessageManager.getInstance() .msg(sender, MessageManager.MessageType.INFO, "Hub location set."); } else if (args[0] == "m") { MessageManager.getInstance() .msg(sender, MessageManager.MessageType.WARN, "We dont support multiple mode yet."); // TODO: Add multiple mode. } else { MessageManager.getInstance().msg(sender, MessageManager.MessageType.WARN, super.getUsage()); } }
public void process() { preLogout(); if (!canLogout) return; final Player p = player; BukkitScheduler sched = p.getServer().getScheduler(); PlayerAuth auth = PlayerCache.getInstance().getAuth(name); database.updateSession(auth); auth.setQuitLocX(p.getLocation().getX()); auth.setQuitLocY(p.getLocation().getY()); auth.setQuitLocZ(p.getLocation().getZ()); auth.setWorld(p.getWorld().getName()); database.updateQuitLoc(auth); PlayerCache.getInstance().removePlayer(name); database.setUnlogged(name); sched.scheduleSyncDelayedTask( plugin, new Runnable() { @Override public void run() { Utils.teleportToSpawn(p); } }); if (LimboCache.getInstance().hasLimboPlayer(name)) LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().addLimboPlayer(player); Utils.setGroup(player, GroupType.NOTLOGGEDIN); sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin)); }
public void sendToLocation(Player p, float offset, float offsetVert, int amt) { try { Object packet = Class.forName( "net.minecraft.server." + ReflectionUtil.getVersionString() + ".PacketPlayOutWorldParticles") .getConstructors()[0] .newInstance(); ReflectionUtil.setValue(packet, "a", name); // Particle ID ReflectionUtil.setValue(packet, "b", (float) p.getLocation().getX()); // X Coord ReflectionUtil.setValue(packet, "c", (float) p.getLocation().getY()); // Y Coord ReflectionUtil.setValue(packet, "d", (float) p.getLocation().getZ()); // Z Coord ReflectionUtil.setValue(packet, "e", offset); // X Offset ReflectionUtil.setValue(packet, "f", offsetVert); // Y Offset ReflectionUtil.setValue(packet, "g", offset); // Z Offset ReflectionUtil.setValue(packet, "h", defaultSpeed); // Speed (Data) ReflectionUtil.setValue(packet, "i", amt); // Amount of Particles Spawned Object nmsPlayer = ReflectionUtil.getMethod(p.getClass(), "getHandle").invoke(p); Object con = nmsPlayer.getClass().getField("playerConnection").get(nmsPlayer); ReflectionUtil.getMethod(con.getClass(), "sendPacket").invoke(con, packet); } catch (Exception e) { e.printStackTrace(); } }
@Override public void run() { Collection<? extends Player> players = Bukkit.getOnlinePlayers(); long maxAFKTime; SinCityPlayer thisPlayer; for (Player player : players) { if (!player.isOnline() || player.isDead()) continue; thisPlayer = this.playerManager.getPlayer(player); maxAFKTime = this.dataManager.getMaxAFKTime(thisPlayer.getGroup()); // WHEN AFK TIMER IS REACHED AND (PLAYER HAS NOT MOVED OR IS INSIDE // A VEHICLE) (PREVENT ABUSE!) if (maxAFKTime >= 0) { if (player.isInsideVehicle() || thisPlayer.hasMoved(player.getLocation())) { thisPlayer.setLastLocation(player.getLocation()); return; } if (thisPlayer.isTooLongAFK(maxAFKTime)) { ConsoleUtils.printInfo(Core.NAME, "Kicked '" + player.getName() + "' for being AFK!"); player.kickPlayer("Kicked being AFK!"); } } else { thisPlayer.setLastLocation(player.getLocation()); } } }
protected void checkForGround() { checkCounter = 0; Location playerLocation = player.getLocation(); World world = playerLocation.getWorld(); Block targetBlock = world.getBlockAt(playerLocation); targetBlock = targetBlock.getFace(BlockFace.DOWN); int newGroundHeight = targetBlock.getY(); while (targetBlock.getType() == Material.AIR && newGroundHeight > 1) { newGroundHeight--; targetBlock = targetBlock.getFace(BlockFace.DOWN); } // if the terrain has changed more than the auto-hover tolerance, re-adjust hover height and // keep level. if (groundHeight == 0 || targetHeight == 0) { hoverHeight = player.getLocation().getBlockY() - newGroundHeight; if (hoverHeight < defaultHoverHeight) { hoverHeight = defaultHoverHeight; } } else if (Math.abs(newGroundHeight - groundHeight) > maxTerrainChangeHeight) { hoverHeight = targetHeight - newGroundHeight; } groundHeight = newGroundHeight; updateTargetHeight(); }
private void emailRegister() throws Exception { if (Settings.getmaxRegPerEmail > 0 && !plugin .getPermissionsManager() .hasPermission(player, PlayerPermission.ALLOW_MULTIPLE_ACCOUNTS) && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) { m.send(player, MessageKey.MAX_REGISTER_EXCEEDED); return; } final String hashNew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); final String salt = PasswordSecurity.userSalt.get(name); PlayerAuth auth = PlayerAuth.builder() .name(name) .realName(player.getName()) .hash(hashNew) .ip(ip) .locWorld(player.getLocation().getWorld().getName()) .locX(player.getLocation().getX()) .locY(player.getLocation().getY()) .locZ(player.getLocation().getZ()) .email(email) .salt(salt != null ? salt : "") .build(); if (!database.saveAuth(auth)) { m.send(player, MessageKey.ERROR); return; } database.updateEmail(auth); database.updateSession(auth); plugin.mail.main(auth, password); ProcessSyncEmailRegister sync = new ProcessSyncEmailRegister(player, plugin); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, sync); }
@EventHandler public void onCustomEvent(ToTwoSecondEvent event) { RegionManager rm = effect.rm; for (SuperRegion sr : unfedRegions) { for (String s : sr.getOwners()) { Player p = Bukkit.getPlayer(s); if (p == null || Math.random() > EFFECT_CHANCE || !rm.getContainingSuperRegions(p.getLocation()).contains(sr)) { continue; } forceHunger(p); } for (String s : sr.getMembers().keySet()) { Player p = Bukkit.getPlayer(s); if (Math.random() > EFFECT_CHANCE || p == null || !sr.getMember(s).contains("member") || !rm.getContainingSuperRegions(p.getLocation()).contains(sr)) { continue; } forceHunger(p); } } }
@Override public void Run(Player player, Server server, String[] args) { Location spawnLocation = player.getLocation().add(player.getLocation().getDirection()); Fireball fireball = (Fireball) player.getWorld().spawnEntity(spawnLocation, EntityType.FIREBALL); fireball.setDirection(player.getLocation().getDirection()); }
/** * Does the actual spawn-setting-work. * * @param sender The {@link CommandSender} that's setting the spawn. */ protected void setWorldSpawn(CommandSender sender) { if (sender instanceof Player) { Player p = (Player) sender; Location l = p.getLocation(); World w = p.getWorld(); MultiverseWorld foundWorld = this.plugin.getMVWorldManager().getMVWorld(w.getName()); if (foundWorld != null) { foundWorld.setSpawnLocation(p.getLocation()); BlockSafety bs = new BlockSafety(); if (!bs.playerCanSpawnHereSafely(p.getLocation()) && foundWorld.getAdjustSpawn()) { sender.sendMessage( "It looks like that location would normally be unsafe. But I trust you."); sender.sendMessage("I'm turning off the Safe-T-Teleporter for spawns to this world."); sender.sendMessage("If you want this turned back on just do:"); sender.sendMessage(ChatColor.AQUA + "/mvm set adjustspawn true " + foundWorld.getAlias()); foundWorld.setAdjustSpawn(false); } sender.sendMessage("Spawn was set to: " + LocationManipulation.strCoords(p.getLocation())); } else { w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ()); sender.sendMessage( "Multiverse does not know about this world, only X,Y and Z set. Please import it to set the spawn fully (Pitch/Yaws)."); } } else { sender.sendMessage("You cannot use this command from the console."); } }
public void sendFailedSound(Player p) { if (EnderChest.is19Server == true) { p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 3F, 3F); } else { p.playSound(p.getLocation(), Sound.valueOf("NOTE_PLING"), 3F, 3F); } }
public void sendEnderchestOpenSound(Player p) { if (EnderChest.is19Server == true) { p.playSound(p.getLocation(), Sound.BLOCK_ENDERCHEST_OPEN, 1F, 1F); } else { p.playSound(p.getLocation(), Sound.valueOf("CHEST_OPEN"), 1F, 1F); } }
public void sendCompleteSound(Player p) { if (EnderChest.is19Server == true) { p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 1F); } else { p.playSound(p.getLocation(), Sound.valueOf("LEVEL_UP"), 1F, 1F); } }
public void sendAnvilLandSound(Player p) { if (EnderChest.is19Server == true) { p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 1F, 1F); } else { p.playSound(p.getLocation(), Sound.valueOf("ANVIL_LAND"), 1F, 1F); } }
public void run() { for (String name : lastLoc.keySet()) { Player player = plugin.getServer().getPlayer(name); if (player == null) { removePlayer(name); } else { // workaround for bukkit issue String prevWorld = lastLoc.get(name).getWorld().getName(); String curWorld = player.getLocation().getWorld().getName(); if (prevWorld.equals(curWorld)) { if (player.getLocation().distance(lastLoc.get(name)) < 1) { continue; } } // if distance between player's current location and stored // location is less than 1, this move is not active; if active // and ignore vehicle movement is set and player in vehicle, // then update location, but don't count this move as active addPlayer(player); if (!isIgnoreVehicleMovement || !player.isInsideVehicle()) { afkBooter.getPlayerActivity().recordActivity(name); } } } }
@EventHandler public void onBlockInteractEvent(PlayerInteractEvent event) { if (!(event.getAction().equals(Action.RIGHT_CLICK_AIR)) || !(event.getAction().equals(Action.RIGHT_CLICK_AIR))) { return; } if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { if (event.getClickedBlock().getType().equals(Material.SIGN) || event.getClickedBlock().getType().equals(Material.SIGN_POST) || event.getClickedBlock().getType().equals(Material.WALL_SIGN)) { return; } } Player player = event.getPlayer(); if (plugin.manager.isPlayerInGame(player)) { Game game = plugin.manager.getGame(player); if (!(game.mode == ArenaStatus.INGAME)) { return; } if (game.getPlayersGun(player) != null) { GunManager gunManager = game.getPlayersGun(player); if (gunManager.isGun()) { Gun gun = gunManager.getGun(player.getInventory().getHeldItemSlot()); if (gun.isReloading()) { player.getLocation().getWorld().playSound(player.getLocation(), Sound.CLICK, 1, 1); return; } gun.wasShot(); } } } }
private void placePlayerSafely(final Player player, final Location spawnLoc) { Location loc = null; if (spawnLoc == null) return; if (!Settings.noTeleport) return; if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) return; if (!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) return; Block b = player.getLocation().getBlock(); if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL) { m.send(player, "unsafe_spawn"); if (spawnLoc.getWorld() != null) loc = spawnLoc; } else { Block c = player.getLocation().add(0D, 1D, 0D).getBlock(); if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL) { m.send(player, "unsafe_spawn"); if (spawnLoc.getWorld() != null) loc = spawnLoc; } } if (loc != null) { final Location floc = loc; Bukkit.getScheduler() .scheduleSyncDelayedTask( plugin, new Runnable() { @Override public void run() { player.teleport(floc); } }); } }
private void passwordRegister() throws Exception { final String hashNew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); final String salt = PasswordSecurity.userSalt.get(name); PlayerAuth auth = PlayerAuth.builder() .name(name) .realName(player.getName()) .hash(hashNew) .ip(ip) .locWorld(player.getLocation().getWorld().getName()) .locX(player.getLocation().getX()) .locY(player.getLocation().getY()) .locZ(player.getLocation().getZ()) .salt(salt != null ? salt : "") .build(); if (!database.saveAuth(auth)) { m.send(player, MessageKey.ERROR); return; } if (!Settings.forceRegLogin) { PlayerCache.getInstance().addPlayer(auth); database.setLogged(name); } plugin.otherAccounts.addPlayer(player.getUniqueId()); ProcessSyncronousPasswordRegister sync = new ProcessSyncronousPasswordRegister(player, plugin); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, sync); }
@Override public void click(Player player, ClickType clickType, int i, ItemStack itemStack) { if (i < itemList.size()) { RewardItem item = itemList.get(i); if (item.hasPermission(this.player)) { if (item.canUseReward(this.player)) { player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); item.use(this.player); item.giveReward(this.player, player); update(); } else { player.playSound(player.getLocation(), Sound.BLAZE_HIT, 1f, 1f); player.sendMessage( ChatColor.BLUE + "You need to wait " + ChatColor.AQUA + this.player.getWaitTime(item.getBlankname(), item.getTime()) + ChatColor.BLUE + " till you can use this"); } } else { player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1f, 1f); player.sendMessage(ChatColor.RED + item.getDenymsg()); } } }
public ItemProjectile(Player caster, float power) { this.caster = caster; this.power = power; Location location = caster.getEyeLocation().add(0, yOffset, 0); location.setPitch(0f); if (vertSpeedUsed) { vel = caster.getLocation().getDirection().setY(0).multiply(speed).setY(vertSpeed); } else { vel = caster.getLocation().getDirection().multiply(speed); } entity = caster.getWorld().dropItem(location, item.clone()); MagicSpells.getVolatileCodeHandler().setGravity(entity, projectileHasGravity); playSpellEffects(EffectPosition.PROJECTILE, entity); playTrackingLinePatterns( EffectPosition.DYNAMIC_CASTER_PROJECTILE_LINE, caster.getLocation(), entity.getLocation(), caster, entity); entity.teleport(location); entity.setPickupDelay(1000000); entity.setVelocity(vel); taskId = MagicSpells.scheduleRepeatingTask(this, 3, 3); }
public static boolean hitBox( Location paramLocation, org.bukkit.entity.Entity paramEntity, double paramDouble) { if (UtilMath.offset(paramLocation, paramEntity.getLocation().add(0.0D, 0.4D, 0.0D)) < 0.6D * paramDouble) { return true; } if ((paramEntity instanceof Player)) { Player localPlayer = (Player) paramEntity; if (UtilMath.offset(paramLocation, localPlayer.getEyeLocation()) < 0.4D * paramDouble) { return true; } if (UtilMath.offset2d(paramLocation, localPlayer.getLocation()) < 0.6D * paramDouble) { if ((paramLocation.getY() > localPlayer.getLocation().getY()) && (paramLocation.getY() < localPlayer.getEyeLocation().getY())) { return true; } } } else if ((paramEntity instanceof Giant)) { if ((paramLocation.getY() > paramEntity.getLocation().getY()) && (paramLocation.getY() < paramEntity.getLocation().getY() + 12.0D) && (UtilMath.offset2d(paramLocation, paramEntity.getLocation()) < 4.0D)) { return true; } } else if ((paramLocation.getY() > paramEntity.getLocation().getY()) && (paramLocation.getY() < paramEntity.getLocation().getY() + 2.0D) && (UtilMath.offset2d(paramLocation, paramEntity.getLocation()) < 0.5D * paramDouble)) { return true; } return false; }
public void negativeeffecttype( Player name, Location loc, int dist, int level, PotionEffectType type) { if (name.getLocation().getWorld() != loc.getWorld()) return; if (loc.distance(name.getLocation()) <= dist) { name.addPotionEffect(new PotionEffect(type, config_.getInt("apply_effects"), level), true); } }
@Override public void rightClick(Player player) { long cooldown; if (item.getHasPermission() == true && player.hasPermission(item.getPermission()) == false) { } else { RPGValue value = RPGValue.get(player, item, "tnt.cooldown"); if (value == null) { cooldown = System.currentTimeMillis() / 50; value = new RPGValue(player, item, "tnt.cooldown", cooldown); } else { cooldown = value.asLong(); } if (cooldown <= System.currentTimeMillis() / 50) { value.set(System.currentTimeMillis() / 50 + cooldownTime); player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1.0f, 1.0f); TNTPrimed tnt = player.getWorld().spawn(player.getLocation().add(0, 1.8, 0), TNTPrimed.class); tnt.setVelocity(player.getLocation().getDirection().multiply(2d)); } else { player.sendMessage( ChatColor.AQUA + String.format( Locale.get("message.cooldown", Locale.getPlayerLocale(player)), ((double) (cooldown - System.currentTimeMillis() / 50)) / 20d)); } } }
@EventHandler public void onHit(EntityDamageByEntityEvent e) { if (e.getEntity() instanceof Player) { Player p = (Player) e.getEntity(); if (e.getDamager() instanceof Snowball) { Snowball s = (Snowball) e.getDamager(); Player shooter = (Player) s.getShooter(); if (teamManager.getTeam(p) != teamManager.getTeam((Player) s.getShooter())) { if (s.getCustomName() != null) { if (s.getCustomName().equalsIgnoreCase("stun")) { if (!stunned.contains(p.getName())) { stunned.add(p.getName()); p.playSound(p.getLocation(), Sound.FIREWORK_TWINKLE2, 3F, 1F); shooter.playSound(shooter.getLocation(), Sound.SUCCESSFUL_HIT, 3F, 1F); p.sendMessage(Color.np("&cYou got hit by a stun! You cannot move for 2 seconds!")); new BukkitRunnable() { @Override public void run() { stunned.remove(p.getName()); } }.runTaskLater(Main.getInstance(), 40); } else { shooter.sendMessage(Color.np("&cThat player is already stunned!")); } } } } else { shooter.sendMessage(Color.np("&cYou cannot stun team members!")); } } } }
void lobbySetup(Player player, String arenaName) { int arenaNum = 0; for (int i = 1; i < setup.getConfig().getInt("nextarena"); i++) { if (setup.getConfig().getString("arena." + i + ".name").equals(arenaName)) { arenaNum = i; } } if (arenaNum == 0) { player.sendMessage( prefix + "Arena " + ChatColor.RED + arenaName + ChatColor.GOLD + " doesn't exist!"); } else { setup .getConfig() .set("arena." + arenaNum + ".lobby.y", Math.floor(player.getLocation().getY())); setup .getConfig() .set("arena." + arenaNum + ".lobby.x", Math.floor(player.getLocation().getX())); setup .getConfig() .set("arena." + arenaNum + ".lobby.z", Math.floor(player.getLocation().getZ())); setup.getConfig().set("arena." + arenaNum + ".lobby.world", player.getWorld().getName()); setup.saveConfig(); player.sendMessage( prefix + "Arena " + ChatColor.RED + arenaName + ChatColor.GOLD + "'s lobby location set to your location"); } }
@EventHandler public void onPlayerMove(PlayerMoveEvent event) { final Player player = event.getPlayer(); if (player.hasPermission("VoidSpawn.bypass")) { return; } final List<String> enabledWorlds = Main.getInstance().getConfig().getStringList("worlds.EnabledWorlds"); if (!enabledWorlds.contains(player.getLocation().getWorld().getName())) { return; } if (player.getLocation().getBlockY() <= Main.getInstance() .getConfig() .getInt( MessageFormat.format( "worlds.WorldYLimits.{0}", player.getLocation().getWorld().getName())) && !PlayerMoveListener.inTPProcess.containsKey(player.getName())) { PlayerMoveListener.inTPProcess.put(player.getName(), new TeleportationTask(player)); } else if (player.getLocation().getBlockY() > Main.getInstance() .getConfig() .getInt( MessageFormat.format( "worlds.WorldYLimits.{0}", player.getLocation().getWorld().getName())) && PlayerMoveListener.inTPProcess.containsKey(player.getName())) { TeleportationTask.end(player); } }
/** * Method to write text to the current chatlog * * @param sender Player sending the message * @param msg The message you want to add to chatlog * @param receive Player recieving the message */ public void writeToChatLog(Player sender, String msg, String type) { String date = new SimpleDateFormat("dd-MM HH:mm:ss").format(new Date()); String name = NameAPI.getCurrentName(sender.getUniqueId()); String loc = (int) sender.getLocation().getX() + ", " + (int) sender.getLocation().getY() + ", " + (int) sender.getLocation().getZ(); StringBuilder sb = new StringBuilder(); sb.append("["); sb.append(date); sb.append("] "); sb.append("["); sb.append(loc); sb.append("] "); sb.append("["); sb.append(type); sb.append("] "); sb.append("["); sb.append(name); sb.append("] "); sb.append("["); sb.append(msg); sb.append("] "); sb.append("\n"); String writeMsg = sb.toString(); try { fileWriter.write(writeMsg); } catch (IOException ex) { CivChat2.severeMessage("Could not write to chatlog file " + ex); } }
@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); } } }
@Override protected void doTick() { super.doTick(); if (owner == null) return; this.S = 10F; if (distToOwner() > 3) { if (isRidable()) { this.getNavigation() .a( owner.getLocation().getX(), owner.getLocation().getY(), owner.getLocation().getZ(), 1.5F); } else { this.getNavigation() .a( owner.getLocation().getX(), owner.getLocation().getY(), owner.getLocation().getZ(), 1.3F); } ((Navigation) this.getNavigation()).d(false); } if (distToOwner() > Util.MAX_DISTANCE) this.getBukkitEntity().teleport(owner); }