diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 8cb8cff66..3b531316c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -143,12 +143,13 @@ public abstract class SurvivalGames extends Game private int _chestRefillTime = 60 * 7; - public SurvivalGames(ArcadeManager manager, GameType type, String[] description) + public SurvivalGames(ArcadeManager manager, GameType type, + String[] description) { super(manager, type, - new Kit[] - { + new Kit[] + { new KitAxeman(manager), // new KitLooter(manager), @@ -170,25 +171,25 @@ public abstract class SurvivalGames extends Game new KitBarbarian(manager), new KitHorseman(manager), - }, description); + }, description); _help = new String[] - { + { C.cGreen + "Use a Compass to find and kill enemies!", C.cGreen + "You lose Speed 2 at start of game if you attack.", C.cAqua + "Avoid enemies who have better gear than you!" - }; + }; // Manager.GetAntiStack().SetEnabled(false); StrictAntiHack = true; - + AnnounceStay = false; - + HideTeamSheep = true; - + this.ReplaceTeamsWithKits = true; GameTimeout = 1500000; @@ -197,7 +198,7 @@ public abstract class SurvivalGames extends Game WorldTimeSet = 0; WorldBoundaryKill = false; - + DamageSelf = true; DamageTeamSelf = true; @@ -212,14 +213,13 @@ public abstract class SurvivalGames extends Game PlaySoundGameStart = false; PrepareTime = 15000; - + VersionRequire1_8 = true; DeadBodies = true; BlockBreakAllow.add(Material.WEB.getId()); // Web BlockPlaceAllow.add(Material.WEB.getId()); - BlockBreakAllow.add(Material.LEAVES.getId()); // Leaves BlockBreakAllow.add(Material.LEAVES_2.getId()); // Leaves @@ -240,14 +240,17 @@ public abstract class SurvivalGames extends Game BlockBreakAllow.add(Material.VINE.getId()); BlockBreakAllow.add(Material.WATER_LILY.getId()); - // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened"); + // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", + // "chestsOpened"); setupLoot(); try { - _packetTeam = Class.forName("org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam").getDeclaredField("team"); + _packetTeam = Class.forName( + "org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam") + .getDeclaredField("team"); _packetTeam.setAccessible(true); } catch (Exception ex) @@ -255,8 +258,10 @@ public abstract class SurvivalGames extends Game ex.printStackTrace(); } - registerStatTrackers(new WinWithoutWearingArmorStatTracker(this), new KillsWithinTimeLimitStatTracker(this, 3, 60, - "Bloodlust"), new FirstSupplyDropOpenStatTracker(this), new SimultaneousSkeletonStatTracker(this, 5)); + registerStatTrackers(new WinWithoutWearingArmorStatTracker(this), + new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"), + new FirstSupplyDropOpenStatTracker(this), + new SimultaneousSkeletonStatTracker(this, 5)); } @EventHandler @@ -266,7 +271,8 @@ public abstract class SurvivalGames extends Game if (_placedBlocks.remove(block.getLocation())) { - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, + block.getType()); block.setType(Material.AIR); } } @@ -346,7 +352,8 @@ public abstract class SurvivalGames extends Game for (Player player : Bukkit.getOnlinePlayers()) { - player.playSound(player.getEyeLocation(), Sound.IRONGOLEM_DEATH, 1000, 0); + player.playSound(player.getEyeLocation(), + Sound.IRONGOLEM_DEATH, 1000, 0); } refillChests(); @@ -370,14 +377,17 @@ public abstract class SurvivalGames extends Game if (_chestRefillTime >= 60) { - time = (_chestRefillTime / 60) + " minute" + (_chestRefillTime > 60 ? "s" : ""); + time = (_chestRefillTime / 60) + " minute" + + (_chestRefillTime > 60 ? "s" : ""); } else { - time = _chestRefillTime + " second" + (_chestRefillTime != 1 ? "s" : ""); + time = _chestRefillTime + " second" + + (_chestRefillTime != 1 ? "s" : ""); } - Announce(C.cGold + C.Bold + "The chests will be refilled in " + time, false); + Announce(C.cGold + C.Bold + "The chests will be refilled in " + + time, false); break; default: @@ -403,13 +413,16 @@ public abstract class SurvivalGames extends Game while (done < 40) { - Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff), - WorldData.MinZ + UtilMath.r(zDiff), ignore); + Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), + ignore); - if (!UtilBlock.airFoliage(block) || !UtilBlock.solid(block.getRelative(BlockFace.DOWN))) + if (!UtilBlock.airFoliage(block) + || !UtilBlock.solid(block.getRelative(BlockFace.DOWN))) continue; - block.setTypeIdAndData(Material.CHEST.getId(), (byte) UtilMath.r(4), true); + block.setTypeIdAndData(Material.CHEST.getId(), + (byte) UtilMath.r(4), true); done++; } } @@ -451,7 +464,8 @@ public abstract class SurvivalGames extends Game { for (int z = -1; z <= 1; z++) { - Block b = event.getVehicle().getLocation().add(x, y, z).getBlock(); + Block b = event.getVehicle().getLocation().add(x, y, z) + .getBlock(); if (b.isLiquid()) { @@ -517,29 +531,34 @@ public abstract class SurvivalGames extends Game if (!IsAlive(event.getPlayer())) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "You are not in the game.")); + UtilPlayer.message(event.getPlayer(), + F.main("Game", "You are not in the game.")); return; } if (!IsLive() || _deathMatchTime <= 60) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now.")); + UtilPlayer.message(event.getPlayer(), + F.main("Game", "Deathmatch cannot be started now.")); return; } if (_secondsSinceStart < 5 * 60 || GetPlayers(true).size() > 4) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "Deathmatch cannot be started now.")); + UtilPlayer.message(event.getPlayer(), + F.main("Game", "Deathmatch cannot be started now.")); return; } - Announce(C.cGreen + C.Bold + event.getPlayer().getName() + " has initiated Deathmatch!"); + Announce(C.cGreen + C.Bold + event.getPlayer().getName() + + " has initiated Deathmatch!"); Announce(C.cGreen + C.Bold + "Deathmatch starting in 60 seconds..."); _deathMatchTime = 60; for (Player player : UtilServer.getPlayers()) - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, + 1f); } public void deathmatchSecond() @@ -552,8 +571,9 @@ public abstract class SurvivalGames extends Game { for (Player player : GetPlayers(true)) { - Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, 1, false, true, true, "Game End", - "Game End Damage"); + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.CUSTOM, 1, false, true, true, + "Game End", "Game End Damage"); } } @@ -564,16 +584,21 @@ public abstract class SurvivalGames extends Game if (_deathMatchTime > 0 && _deathMatchTime <= 60) { - if (_deathMatchTime % 30 == 0 || _deathMatchTime == 15 || _deathMatchTime == 10 - || (_deathMatchTeleported ? _deathMatchTime <= 10 : _deathMatchTime <= 5)) + if (_deathMatchTime % 30 == 0 + || _deathMatchTime == 15 + || _deathMatchTime == 10 + || (_deathMatchTeleported ? _deathMatchTime <= 10 + : _deathMatchTime <= 5)) { if (_deathMatchTeleported && _deathMatchTime <= 10) { - Announce(C.cRed + C.Bold + "Deathmatch in " + _deathMatchTime + "..."); + Announce(C.cRed + C.Bold + "Deathmatch in " + + _deathMatchTime + "..."); } else { - Announce(C.cGreen + C.Bold + "Deathmatch starting in " + _deathMatchTime + " seconds..."); + Announce(C.cGreen + C.Bold + "Deathmatch starting in " + + _deathMatchTime + " seconds..."); } } } @@ -591,7 +616,8 @@ public abstract class SurvivalGames extends Game { Announce(C.cRed + C.Bold + "Deathmatch has begun!", false); - _spawn.getWorld().playSound(_spawn, Sound.WITHER_DEATH, 1000, 0); + _spawn.getWorld() + .playSound(_spawn, Sound.WITHER_DEATH, 1000, 0); refillChests(); } @@ -614,7 +640,8 @@ public abstract class SurvivalGames extends Game for (double border : buildBorders((2 * 30) - 15, 30.5, 7.5)) { - _borderPositions.put(_secondsSinceStart + 60 + (i++ * 2), border); + _borderPositions.put(_secondsSinceStart + 60 + (i++ * 2), + border); } setBorder(); @@ -635,7 +662,8 @@ public abstract class SurvivalGames extends Game if (_informedDeathmatchCommand) return; - Announce(C.cGreen + C.Bold + "Type " + ChatColor.RESET + C.Bold + "/dm" + C.cGreen + C.Bold + " to start Deathmatch!"); + Announce(C.cGreen + C.Bold + "Type " + ChatColor.RESET + C.Bold + + "/dm" + C.cGreen + C.Bold + " to start Deathmatch!"); _informedDeathmatchCommand = true; } @@ -650,7 +678,8 @@ public abstract class SurvivalGames extends Game @EventHandler public void SnowballEggsDamage(CustomDamageEvent event) { - if (event.GetProjectile() instanceof Snowball || event.GetProjectile() instanceof Egg) + if (event.GetProjectile() instanceof Snowball + || event.GetProjectile() instanceof Egg) { event.AddMod("Projectile", "Projectile", 0.01, false); } @@ -692,7 +721,8 @@ public abstract class SurvivalGames extends Game if (Math.random() > 0.95) items++; - boolean spawnChest = _chestRefillTime > 0 && UtilMath.offset(chest.getLocation(), _spawn) < 8; + boolean spawnChest = _chestRefillTime > 0 + && UtilMath.offset(chest.getLocation(), _spawn) < 8; if (spawnChest) items += 3; @@ -738,7 +768,8 @@ public abstract class SurvivalGames extends Game if (_supplyCrates.contains(block)) { - Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(looter, block)); + Bukkit.getPluginManager().callEvent( + new SupplyChestOpenEvent(looter, block)); } _supplyCrates.remove(block); @@ -757,11 +788,11 @@ public abstract class SurvivalGames extends Game { if (assist) return 3; - else - return 12; + else return 12; } - // If an item spawns and no one is there to see it, does it really spawn? No. + // If an item spawns and no one is there to see it, does it really spawn? + // No. @EventHandler public void ItemSpawn(ItemSpawnEvent event) { @@ -831,11 +862,14 @@ public abstract class SurvivalGames extends Game for (Location loc : GetTeamList().get(0).GetSpawns()) { - Firework firework = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK); + Firework firework = (Firework) loc.getWorld().spawnEntity( + loc, EntityType.FIREWORK); FireworkMeta meta = firework.getFireworkMeta(); - meta.addEffect(FireworkEffect.builder().withColor(Color.AQUA).with(Type.BALL).withTrail().build()); + meta.addEffect(FireworkEffect.builder() + .withColor(Color.AQUA).with(Type.BALL).withTrail() + .build()); firework.setFireworkMeta(meta); } @@ -869,7 +903,6 @@ public abstract class SurvivalGames extends Game return; } - if (!IsLive()) { return; @@ -910,7 +943,8 @@ public abstract class SurvivalGames extends Game if (item == null || item.getType() != Material.COMPASS) return; - int uses = Integer.parseInt(ChatColor.stripColor(item.getItemMeta().getLore().get(0)).replaceAll("\\D+", "")); + int uses = Integer.parseInt(ChatColor.stripColor( + item.getItemMeta().getLore().get(0)).replaceAll("\\D+", "")); if (uses > 0) { @@ -923,9 +957,11 @@ public abstract class SurvivalGames extends Game { if (alive != player) { - double distance = alive.getLocation().distance(player.getLocation()); + double distance = alive.getLocation().distance( + player.getLocation()); - if (distance > 10 && (closestPlayer == null || distance < closestDistance)) + if (distance > 10 + && (closestPlayer == null || distance < closestDistance)) { closestDistance = distance; closestPlayer = alive; @@ -940,29 +976,36 @@ public abstract class SurvivalGames extends Game player.setCompassTarget(closestPlayer.getLocation()); player.setItemInHand(buildCompass(uses)); - player.sendMessage(F.main("Compass", "Located " + closestPlayer.getName() + " " + (int) closestDistance - + " blocks away")); + player.sendMessage(F.main("Compass", + "Located " + closestPlayer.getName() + " " + + (int) closestDistance + " blocks away")); if (uses >= 1) { - player.sendMessage(F.main("Compass", uses + " use" + (uses > 1 ? "s" : "") + " of the compass remaining.")); + player.sendMessage(F.main("Compass", uses + " use" + + (uses > 1 ? "s" : "") + + " of the compass remaining.")); } else { - player.sendMessage(F.main("Compass", "No remaining uses! Next use will break it!")); + player.sendMessage(F.main("Compass", + "No remaining uses! Next use will break it!")); } } else { - player.sendMessage(F.main("Compass", "Can't find anyone! Pointing to spawn!")); + player.sendMessage(F.main("Compass", + "Can't find anyone! Pointing to spawn!")); player.setCompassTarget(_spawn); } } else { - player.sendMessage(F.main("Compass", "The compass breaks! No remaining uses!")); + player.sendMessage(F.main("Compass", + "The compass breaks! No remaining uses!")); - player.getWorld().playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 5); + player.getWorld().playSound(player.getLocation(), Sound.ITEM_BREAK, + 1, 5); player.setItemInHand(new ItemStack(Material.AIR)); } @@ -991,8 +1034,10 @@ public abstract class SurvivalGames extends Game { DoubleChest doubleChest = (DoubleChest) state; - fillChest(event.getPlayer(), ((Chest) doubleChest.getLeftSide()).getBlock()); - fillChest(event.getPlayer(), ((Chest) doubleChest.getRightSide()).getBlock()); + fillChest(event.getPlayer(), + ((Chest) doubleChest.getLeftSide()).getBlock()); + fillChest(event.getPlayer(), + ((Chest) doubleChest.getRightSide()).getBlock()); } else if (state instanceof Chest) { @@ -1012,7 +1057,8 @@ public abstract class SurvivalGames extends Game if (random == 0) { - inv.setFuel(new ItemStack(Material.STICK, new Random().nextInt(2) + 1)); + inv.setFuel(new ItemStack(Material.STICK, new Random() + .nextInt(2) + 1)); } else if (random <= 3) { @@ -1053,62 +1099,69 @@ public abstract class SurvivalGames extends Game double border = (_previousBorder - 0.3D) + distanceMovedSince; - //24 @ 100+ reduced to 0 at 32- - double borderAttackDist = Math.max(8, (Math.min(100, border) - 28d) / 3d); + // 24 @ 100+ reduced to 0 at 32- + double borderAttackDist = Math.max(8, + (Math.min(100, border) - 28d) / 3d); double borderCheckDist = borderAttackDist + 6; - + for (Player player : UtilServer.getPlayers()) { Location loc = player.getLocation(); - //Bump Players Back In - if (loc.getX() > _spawn.getX() + border || - loc.getX() < _spawn.getX() - border || - loc.getZ() > _spawn.getZ() + border || - loc.getZ() < _spawn.getZ() - border) + // Bump Players Back In + if (loc.getX() > _spawn.getX() + border + || loc.getX() < _spawn.getX() - border + || loc.getZ() > _spawn.getZ() + border + || loc.getZ() < _spawn.getZ() - border) { - if (Recharge.Instance.use(player, "Hit by Border", 1000, false, false)) + if (Recharge.Instance.use(player, "Hit by Border", 1000, false, + false)) { Entity bottom = player; while (bottom.getVehicle() != null) bottom = bottom.getVehicle(); - - UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(loc, GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, true); + + UtilAction.velocity(bottom, UtilAlg.getTrajectory2d(loc, + GetSpectatorLocation()), 1.2, true, 0.4, 0, 10, + true); if (Manager.IsAlive(player)) { - Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, 10, false, false, false, "Nether Field", - "Vaporize"); + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.CUSTOM, 10, false, false, false, + "Nether Field", "Vaporize"); - player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); - player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); + player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, + 1f); + player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, + 1f); } } } if (border < 32) continue; - - //Attack Players who are nearby + + // Attack Players who are nearby boolean isX = true; Location attackSource = null; - if (loc.getX() > _spawn.getX() + (border-borderCheckDist)) + if (loc.getX() > _spawn.getX() + (border - borderCheckDist)) { attackSource = player.getLocation(); attackSource.setX(_spawn.getX() + border); } - else if (loc.getX() < _spawn.getX() - (border-borderCheckDist)) + else if (loc.getX() < _spawn.getX() - (border - borderCheckDist)) { attackSource = player.getLocation(); attackSource.setX(_spawn.getX() - border); } - else if (loc.getZ() > _spawn.getZ() + (border-borderCheckDist)) + else if (loc.getZ() > _spawn.getZ() + (border - borderCheckDist)) { attackSource = player.getLocation(); attackSource.setZ(_spawn.getZ() + border); isX = false; } - else if (loc.getZ() < _spawn.getZ() - (border-borderCheckDist)) + else if (loc.getZ() < _spawn.getZ() - (border - borderCheckDist)) { attackSource = player.getLocation(); attackSource.setZ(_spawn.getZ() - border); @@ -1117,51 +1170,68 @@ public abstract class SurvivalGames extends Game if (attackSource != null) { - double dist = UtilMath.offset(player.getLocation(), attackSource); - + double dist = UtilMath.offset(player.getLocation(), + attackSource); + double scale = 1 - (dist / borderAttackDist); - - player.playSound(player.getLocation().add(UtilAlg.getTrajectory(player.getLocation(), attackSource).multiply(8)), - Sound.PORTAL, (float)(1 - (dist / borderCheckDist)) * 2, 2f); + + player.playSound( + player.getLocation().add( + UtilAlg.getTrajectory(player.getLocation(), + attackSource).multiply(8)), + Sound.PORTAL, + (float) (1 - (dist / borderCheckDist)) * 2, 2f); if (!Manager.IsAlive(player)) continue; - - //Shoot more frequently when they get closer + + // Shoot more frequently when they get closer if (dist < borderAttackDist && Math.random() < scale) - { - //Spawn Fireball + { + // Spawn Fireball Location spawn = attackSource.clone(); - spawn.add(isX ? 0 : (Math.random()-0.5)*12, 4 + Math.random() * 2 + (Math.random() * 12 * scale), isX ? (Math.random()-0.5)*12 : 0); - - //Raytrace back - double maxBack = 8; + spawn.add(isX ? 0 : (Math.random() - 0.5) * 12, + 4 + Math.random() * 2 + + (Math.random() * 12 * scale), + isX ? (Math.random() - 0.5) * 12 : 0); + + // Raytrace back + double maxBack = 8; double back = 0; - while (spawn.getBlock().getType() == Material.AIR && back < maxBack) + while (spawn.getBlock().getType() == Material.AIR + && back < maxBack) { - spawn.subtract(UtilAlg.getTrajectory(spawn, player.getLocation()).multiply(0.2)); + spawn.subtract(UtilAlg.getTrajectory(spawn, + player.getLocation()).multiply(0.2)); back += 0.1; } - - //Move out of block - spawn.add(UtilAlg.getTrajectory(spawn, player.getLocation()).multiply(Math.min(back, 1))); - - - Fireball ball = player.getWorld().spawn(spawn, Fireball.class); - //Trajectory - Vector traj = UtilAlg.getTrajectory(spawn, player.getLocation()); - traj.add(new Vector((Math.random()-0.5)*0.2,(Math.random()-0.5)*0.2,(Math.random()-0.5)*0.2)); + // Move out of block + spawn.add(UtilAlg + .getTrajectory(spawn, player.getLocation()) + .multiply(Math.min(back, 1))); - EntityLargeFireball eFireball = ((CraftLargeFireball) ball).getHandle(); + Fireball ball = player.getWorld().spawn(spawn, + Fireball.class); + + // Trajectory + Vector traj = UtilAlg.getTrajectory(spawn, + player.getLocation()); + traj.add(new Vector((Math.random() - 0.5) * 0.2, (Math + .random() - 0.5) * 0.2, (Math.random() - 0.5) * 0.2)); + + EntityLargeFireball eFireball = ((CraftLargeFireball) ball) + .getHandle(); eFireball.dirX = traj.getX() * 0.1; eFireball.dirY = traj.getY() * 0.1; eFireball.dirZ = traj.getZ() * 0.1; - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, spawn, 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - player.getWorld().playSound(attackSource, Sound.GHAST_FIREBALL, 2f, 2f); - } + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, + spawn, 0, 0, 0, 0, 1, ViewDist.MAX, + UtilServer.getPlayers()); + player.getWorld().playSound(attackSource, + Sound.GHAST_FIREBALL, 2f, 2f); + } } } } @@ -1171,26 +1241,32 @@ public abstract class SurvivalGames extends Game { if (!IsLive()) return; - + if (!(event.getEntity() instanceof Fireball)) - return; + return; - Collection blocks = UtilBlock.getInRadius(event.getEntity().getLocation(), 2.4).keySet(); + Collection blocks = UtilBlock.getInRadius( + event.getEntity().getLocation(), 2.4).keySet(); - Manager.GetExplosion().BlockExplosion(blocks, event.getEntity().getLocation(), false); + Manager.GetExplosion().BlockExplosion(blocks, + event.getEntity().getLocation(), false); } public boolean isStableBlock(Block block) { int sides = 0; - if (UtilBlock.solid(block.getRelative(BlockFace.NORTH))) sides++; - if (UtilBlock.solid(block.getRelative(BlockFace.EAST))) sides++; - if (UtilBlock.solid(block.getRelative(BlockFace.SOUTH))) sides++; - if (UtilBlock.solid(block.getRelative(BlockFace.WEST))) sides++; - + if (UtilBlock.solid(block.getRelative(BlockFace.NORTH))) + sides++; + if (UtilBlock.solid(block.getRelative(BlockFace.EAST))) + sides++; + if (UtilBlock.solid(block.getRelative(BlockFace.SOUTH))) + sides++; + if (UtilBlock.solid(block.getRelative(BlockFace.WEST))) + sides++; + return sides >= 3; } - + @EventHandler public void borderDamage(CustomDamageEvent event) { @@ -1205,7 +1281,8 @@ public abstract class SurvivalGames extends Game event.AddKnockback("Fireball", 2); } - private ArrayList buildBorders(int seconds, double border, double leaveRemaining) + private ArrayList buildBorders(int seconds, double border, + double leaveRemaining) { double totalNumber = Math.pow(seconds, 1.9D) + (seconds * 50); @@ -1214,7 +1291,8 @@ public abstract class SurvivalGames extends Game for (int i = 0; i <= seconds; i++) { - borders.add(border - ((border - leaveRemaining) * (((Math.pow(i, 1.9D) + (i * 50))) / totalNumber))); + borders.add(border + - ((border - leaveRemaining) * (((Math.pow(i, 1.9D) + (i * 50))) / totalNumber))); } return borders; @@ -1263,50 +1341,54 @@ public abstract class SurvivalGames extends Game Player player = (Player) event.GetEvent().getEntity(); - FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.RED).with(Type.BALL_LARGE).trail(false) + FireworkEffect effect = FireworkEffect.builder().flicker(false) + .withColor(Color.RED).with(Type.BALL_LARGE).trail(false) .build(); for (int i = 0; i < 3; i++) UtilFirework.launchFirework(player.getLocation(), effect, null, 3); } - + @EventHandler public void killLevelReward(CombatDeathEvent event) { Game game = Manager.GetGame(); - if (game == null) return; + if (game == null) + return; if (!(event.GetEvent().getEntity() instanceof Player)) return; - Player killed = (Player)event.GetEvent().getEntity(); + Player killed = (Player) event.GetEvent().getEntity(); if (event.GetLog().GetKiller() != null) { - Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller() + .GetName()); if (killer != null && !killer.equals(killed)) { - //Kill + // Kill killer.giveExpLevels(2); - + killer.playSound(killer.getLocation(), Sound.LEVEL_UP, 1f, 1f); } } for (CombatComponent log : event.GetLog().GetAttackers()) { - if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller())) + if (event.GetLog().GetKiller() != null + && log.equals(event.GetLog().GetKiller())) continue; Player assist = UtilPlayer.searchExact(log.GetName()); - //Assist + // Assist if (assist != null) { assist.giveExpLevels(1); assist.playSound(assist.getLocation(), Sound.ORB_PICKUP, 1f, 1f); } - + } } @@ -1319,7 +1401,8 @@ public abstract class SurvivalGames extends Game { Material type = result.getType(); - if (type == Material.BUCKET || type == Material.GOLDEN_APPLE || type == Material.FLINT_AND_STEEL || type.isBlock()) + if (type == Material.BUCKET || type == Material.GOLDEN_APPLE + || type == Material.FLINT_AND_STEEL || type.isBlock()) { event.getInventory().setResult(new ItemStack(Material.AIR)); } @@ -1332,7 +1415,8 @@ public abstract class SurvivalGames extends Game _lootedBlocks.clear(); - WorldServer world = list.isEmpty() ? null : ((CraftWorld) list.get(0).getWorld()).getHandle(); + WorldServer world = list.isEmpty() ? null : ((CraftWorld) list.get(0) + .getWorld()).getHandle(); for (Location loc : list) { @@ -1353,7 +1437,8 @@ public abstract class SurvivalGames extends Game if (_landedCrates.contains(loc)) continue; - fillChest((Player) holder.getInventory().getViewers().get(0), block); + fillChest((Player) holder.getInventory().getViewers() + .get(0), block); } } } @@ -1382,7 +1467,7 @@ public abstract class SurvivalGames extends Game WorldBorder border = new WorldBorder(); - border.transitionSizeBetween(_currentBorder * 2, _previousBorder * 2, + border.transitionSizeBetween(_previousBorder * 2, _currentBorder * 2, _currentBorder != _previousBorder ? 1000 : 0); PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border, @@ -1402,15 +1487,14 @@ public abstract class SurvivalGames extends Game WorldBorder border = new WorldBorder(); border.transitionSizeBetween( - _currentBorder * 2, _previousBorder * 2, + _currentBorder * 2, _currentBorder != _previousBorder ? 1000 - Math.min(1000, (System.currentTimeMillis() - _borderStartedMoving)) : 0); border.setCenter(_spawn.getX(), _spawn.getZ()); border.setWarningDistance(-10); border.setWarningTime(-10); - border.a(29999984); PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border, EnumWorldBorderAction.INITIALIZE); @@ -1524,7 +1608,8 @@ public abstract class SurvivalGames extends Game _baseLoot.addLoot(new RandomItem(Material.FLINT, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.FEATHER, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.GOLD_INGOT, 20)); - _baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15)); + _baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack( + Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), 15)); _spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15)); _spawnLoot.cloneLoot(_baseLoot); @@ -1574,7 +1659,8 @@ public abstract class SurvivalGames extends Game // Cooked furnace _cookedFurnace.addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2)); - _cookedFurnace.addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2)); + _cookedFurnace + .addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1)); @@ -1620,8 +1706,14 @@ public abstract class SurvivalGames extends Game { player.playSound(player.getLocation(), Sound.DONKEY_DEATH, 0.8F, 0); - Manager.GetCondition().Factory().Speed("Start Speed", player, player, 30, 1, false, false, false); - Manager.GetCondition().Factory().HealthBoost("Start Health", player, player, 30, 1, false, false, false); + Manager.GetCondition() + .Factory() + .Speed("Start Speed", player, player, 30, 1, false, false, + false); + Manager.GetCondition() + .Factory() + .HealthBoost("Start Health", player, player, 30, 1, false, + false, false); player.setHealth(player.getMaxHealth()); @@ -1653,21 +1745,27 @@ public abstract class SurvivalGames extends Game if (_supplyLocations.isEmpty()) return; - _supplyCurrent = _supplyLocations.remove(UtilMath.r(_supplyLocations.size())); + _supplyCurrent = _supplyLocations.remove(UtilMath + .r(_supplyLocations.size())); // Remove Prior - _supplyCrates.remove(_supplyCurrent.getBlock().getRelative(BlockFace.UP)); - _supplyCurrent.getBlock().getRelative(BlockFace.UP).setType(Material.AIR); + _supplyCrates.remove(_supplyCurrent.getBlock().getRelative( + BlockFace.UP)); + _supplyCurrent.getBlock().getRelative(BlockFace.UP) + .setType(Material.AIR); // Create New _supplyCurrent.getBlock().setType(Material.BEACON); for (int x = -1; x <= 1; x++) for (int z = -1; z <= 1; z++) - _supplyCurrent.getBlock().getRelative(x, -1, z).setType(Material.IRON_BLOCK); + _supplyCurrent.getBlock().getRelative(x, -1, z) + .setType(Material.IRON_BLOCK); // Announce - Announce(C.cYellow + C.Bold + "Supply Drop Incoming (" + ChatColor.RESET - + UtilWorld.locToStrClean(_supplyCurrent) + C.cYellow + C.Bold + ")"); + Announce(C.cYellow + C.Bold + "Supply Drop Incoming (" + + ChatColor.RESET + + UtilWorld.locToStrClean(_supplyCurrent) + C.cYellow + + C.Bold + ")"); } } else @@ -1680,22 +1778,25 @@ public abstract class SurvivalGames extends Game _supplyEffect.setY(250); } - FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BURST) - .trail(false).build(); + FireworkEffect effect = FireworkEffect.builder().flicker(false) + .withColor(Color.YELLOW).with(Type.BURST).trail(false) + .build(); UtilFirework.playFirework(_supplyEffect, effect); _supplyEffect.setY(_supplyEffect.getY() - 2); if (UtilMath.offset(_supplyEffect, _supplyCurrent) < 2) { - effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL_LARGE).trail(true) - .build(); + effect = FireworkEffect.builder().flicker(false) + .withColor(Color.YELLOW).with(Type.BALL_LARGE) + .trail(true).build(); UtilFirework.playFirework(_supplyEffect, effect); // Create Chest _supplyCurrent.getBlock().setType(Material.GLASS); - Block block = _supplyCurrent.getBlock().getRelative(BlockFace.UP); + Block block = _supplyCurrent.getBlock().getRelative( + BlockFace.UP); block.setType(Material.CHEST); _landedCrates.add(block.getLocation()); _supplyCrates.add(block); @@ -1733,8 +1834,9 @@ public abstract class SurvivalGames extends Game continue; } - UtilParticle.PlayParticle(ParticleType.SPELL, block.getLocation().add(0.5, 0.5, 0.5), 0.3f, 0.3f, 0.3f, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.SPELL, block.getLocation() + .add(0.5, 0.5, 0.5), 0.3f, 0.3f, 0.3f, 0, 1, ViewDist.LONG, + UtilServer.getPlayers()); } } @@ -1756,13 +1858,21 @@ public abstract class SurvivalGames extends Game Player player = _tntMap.remove(event.getEntity()); - /*CustomExplosion explosion = new CustomExplosion(getArcadeManager().GetDamage(), event.getEntity().getLocation(), - ((TNTPrimed) event.getEntity()).getYield(), "Throwing TNT"); + /* + * CustomExplosion explosion = new + * CustomExplosion(getArcadeManager().GetDamage(), + * event.getEntity().getLocation(), ((TNTPrimed) + * event.getEntity()).getYield(), "Throwing TNT"); + * + * explosion.setPlayer(player, true); + */ - explosion.setPlayer(player, true);*/ - - for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) - Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + for (Player other : UtilPlayer.getNearby(event.getEntity() + .getLocation(), 14)) + Manager.GetCondition() + .Factory() + .Explosion("Throwing TNT", other, player, 50, 0.1, false, + false); } @EventHandler @@ -1783,26 +1893,35 @@ public abstract class SurvivalGames extends Game if (!Recharge.Instance.use(player, "Throw TNT", 0, true, false)) { - UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throw TNT") + " yet.")); + UtilPlayer.message( + event.getPlayer(), + F.main(GetName(), "You cannot use " + F.item("Throw TNT") + + " yet.")); return; } if (!Manager.GetGame().CanThrowTNT(player.getLocation())) { // Inform - UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throw TNT") + " here.")); + UtilPlayer.message( + event.getPlayer(), + F.main(GetName(), "You cannot use " + F.item("Throw TNT") + + " here.")); return; } UtilInv.remove(player, Material.TNT, (byte) 0, 1); UtilInv.Update(player); - TNTPrimed tnt = player.getWorld() - .spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); + TNTPrimed tnt = player.getWorld().spawn( + player.getEyeLocation() + .add(player.getLocation().getDirection()), + TNTPrimed.class); tnt.setFuseTicks(60); - UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false); + UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, + false, 0, 0.1, 10, false); _tntMap.put(tnt, player); } @@ -1817,11 +1936,13 @@ public abstract class SurvivalGames extends Game if (event.GetLog().GetKiller() != null) { - Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller() + .GetName()); if (killer != null && !killer.equals(killed)) { - // Manager.GetStatsManager().addStat(killer, GetName(), "kills", 1); + // Manager.GetStatsManager().addStat(killer, GetName(), "kills", + // 1); } } @@ -1829,7 +1950,8 @@ public abstract class SurvivalGames extends Game { if (killed != null) { - // Manager.GetStatsManager().addStat(killed, GetName(), "deaths", 1); + // Manager.GetStatsManager().addStat(killed, GetName(), + // "deaths", 1); } } } @@ -1843,7 +1965,8 @@ public abstract class SurvivalGames extends Game if (!IsLive()) return; - ArrayList alivePlayers = new ArrayList(_hiddenNames.keySet()); + ArrayList alivePlayers = new ArrayList( + _hiddenNames.keySet()); HashMap> checkedPlayers = new HashMap>(); for (Player target : alivePlayers) @@ -1853,7 +1976,8 @@ public abstract class SurvivalGames extends Game try { - ScoreboardTeam nmsTeam = (ScoreboardTeam) _packetTeam.get(target.getScoreboard().getTeam(target.getName())); + ScoreboardTeam nmsTeam = (ScoreboardTeam) _packetTeam + .get(target.getScoreboard().getTeam(target.getName())); packet = new PacketPlayOutScoreboardTeam(nmsTeam, 2); } @@ -1868,9 +1992,11 @@ public abstract class SurvivalGames extends Game { boolean hideName = false; - if (!checkedPlayers.containsKey(target) || !checkedPlayers.get(target).containsKey(player)) + if (!checkedPlayers.containsKey(target) + || !checkedPlayers.get(target).containsKey(player)) { - if (player.getLocation().distance(target.getLocation()) > (GetKit(target) instanceof KitAssassin ? 8 : 24)) + if (player.getLocation().distance(target.getLocation()) > (GetKit(target) instanceof KitAssassin ? 8 + : 24)) { hideName = true; } @@ -1881,9 +2007,9 @@ public abstract class SurvivalGames extends Game } Player[] players = new Player[] - { + { target, player - }; + }; if (!(GetKit(player) instanceof KitAssassin || GetKit(target) instanceof KitAssassin)) { @@ -1894,7 +2020,8 @@ public abstract class SurvivalGames extends Game if (!checkedPlayers.containsKey(p1)) { - checkedPlayers.put(p1, new HashMap()); + checkedPlayers.put(p1, + new HashMap()); } checkedPlayers.get(p1).put(p2, hideName); @@ -1907,7 +2034,8 @@ public abstract class SurvivalGames extends Game } // If hiddenNames conta - if (hideName != _hiddenNames.get(player).contains(target.getName())) + if (hideName != _hiddenNames.get(player).contains( + target.getName())) { if (!hideName) { @@ -1926,30 +2054,30 @@ public abstract class SurvivalGames extends Game } } } - - public int getSecondsSinceStart() + + public int getSecondsSinceStart() { return this._secondsSinceStart; } - - public int getChestRefillTime() + + public int getChestRefillTime() { return this._chestRefillTime; } - - public int getDeathMatchTime() + + public int getDeathMatchTime() { return this._deathMatchTime; } - - public boolean isDeathMatchTeleported() + + public boolean isDeathMatchTeleported() { return this._deathMatchTeleported; } - - public int getGameEndTime() + + public int getGameEndTime() { return this._gameEndTime; } - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 5ced53d8d..8f5828a60 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -281,7 +281,7 @@ public class UHC extends TeamGame { WorldBorder border = new WorldBorder(); - border.transitionSizeBetween(_currentBorder * 2, _previousBorder * 2, + border.transitionSizeBetween(_previousBorder * 2, _currentBorder * 2, _currentBorder != _previousBorder ? 1000 : 0); PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border, @@ -376,14 +376,13 @@ public class UHC extends TeamGame WorldBorder border = new WorldBorder(); border.transitionSizeBetween( - _currentBorder * 2, _previousBorder * 2, + _currentBorder * 2, _currentBorder != _previousBorder ? 1000 - Math.min(1000, (System.currentTimeMillis() - _borderStartedMoving)) : 0); border.setWarningDistance(-10); border.setWarningTime(-10); - border.a(29999984); PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border, EnumWorldBorderAction.INITIALIZE);