diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 136d324ab..8038a84e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -84,6 +84,7 @@ public enum GameDisplay Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 61), Skyfall("Skyfall", Material.DIAMOND_BOOTS, (byte)0, GameCategory.SURVIVAL, 62), + SkyfallTeams("Skyfall Teams", Material.DIAMOND_BOOTS, (byte)0, GameCategory.SURVIVAL, 65), Basketball("Hoops", Material.SLIME_BALL, (byte)0, GameCategory.EXTRA, 63), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 41613e265..6473d5118 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -1,9 +1,12 @@ package nautilus.game.arcade; +import org.bukkit.Material; + import mineplex.core.common.MinecraftVersion; import mineplex.core.common.Pair; import mineplex.core.game.GameCategory; import mineplex.core.game.GameDisplay; + import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl; import nautilus.game.arcade.game.games.barbarians.Barbarians; @@ -71,7 +74,8 @@ import nautilus.game.arcade.game.games.sheep.SheepGame; import nautilus.game.arcade.game.games.sheep.modes.EweHeroes; import nautilus.game.arcade.game.games.sheep.modes.OverpoweredSheepQuest; import nautilus.game.arcade.game.games.sheep.modes.SmashSheep; -import nautilus.game.arcade.game.games.skyfall.Skyfall; +import nautilus.game.arcade.game.games.skyfall.SoloSkyfall; +import nautilus.game.arcade.game.games.skyfall.TeamSkyfall; import nautilus.game.arcade.game.games.skywars.SoloSkywars; import nautilus.game.arcade.game.games.skywars.TeamSkywars; import nautilus.game.arcade.game.games.skywars.modes.OverpoweredSkywars; @@ -109,8 +113,6 @@ import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; -import org.bukkit.Material; - public enum GameType { //Mini @@ -198,7 +200,8 @@ public enum GameType MonsterMaze(MonsterMaze.class, GameDisplay.MonsterMaze), MonsterLeague(MonsterLeague.class, GameDisplay.MonsterLeague), Gladiators(Gladiators.class, GameDisplay.Gladiators), - Skyfall(Skyfall.class, GameDisplay.Skyfall), + Skyfall(SoloSkyfall.class, GameDisplay.Skyfall), + SkyfallTeams(TeamSkyfall.class, GameDisplay.SkyfallTeams, new GameType[]{GameType.Skyfall}, false), BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index f1739e81a..43b77f75c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -813,11 +813,35 @@ public abstract class Game implements Listener HandlerList.unregisterAll(kit); - for (Perk perk : kit.GetPerks()) + if (kit instanceof ProgressingKit) { - HandlerList.unregisterAll(perk); - perk.unregisteredEvents(); + if (((ProgressingKit) kit).hasUpgrades()) + { + ProgressingKit pKit = (ProgressingKit) kit; + for (Perk[] perks : pKit.getPerks()) + { + for (Perk perk : perks) + { + if (perk == null) + { + continue; + } + HandlerList.unregisterAll(perk); + perk.unregisteredEvents(); + } + } + } } + else + { + for (Perk perk : kit.GetPerks()) + { + HandlerList.unregisterAll(perk); + perk.unregisteredEvents(); + } + } + + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/BoosterRing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/BoosterRing.java index 2778cd34d..0dbd22383 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/BoosterRing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/BoosterRing.java @@ -27,6 +27,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.hologram.Hologram; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; @@ -353,7 +354,12 @@ public class BoosterRing extends Crumbleable implements Listener if (i >= _sortedBorder.size()) return; - _sortedBorder.get(i).getBlock().setTypeIdAndData(_material.getType().getId(), _material.getData().getData(), true); + Block block = _sortedBorder.get(i).getBlock(); + + if (block.getType() == _material.getType() && block.getData() == _material.getData().getData()) + continue; + + block.setTypeIdAndData(_material.getType().getId(), _material.getData().getData(), true); } } @@ -469,6 +475,11 @@ public class BoosterRing extends Crumbleable implements Listener return false; } + public Material getType() + { + return _material.getType(); + } + @Override public void crumbledAway() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/HomingArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/HomingArrow.java index 4018a7c90..9131c9c0e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/HomingArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/HomingArrow.java @@ -68,6 +68,9 @@ public class HomingArrow { if (_shooter == player) continue; + + if (_host.TeamMode && _host.GetTeam(_shooter) == _host.GetTeam(player)) + continue; if (!UtilPlayer.isGliding(player)) continue; @@ -111,6 +114,7 @@ public class HomingArrow arrowToPlayer.multiply(1.9); UtilAction.velocity(_arrow, arrowToPlayer); + if (_updates % firework == 0) UtilFirework.playFirework(_arrow.getLocation(), Type.BALL, Color.RED, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/LootTable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/LootTable.java index b4c15a185..5958180b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/LootTable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/LootTable.java @@ -25,30 +25,30 @@ public class LootTable new RandomItem(Material.PORK, 30, 1, 4), new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6), - new RandomItem(Material.WOOD_AXE, 80), - new RandomItem(Material.WOOD_SWORD, 70), - new RandomItem(Material.STONE_AXE, 60), - new RandomItem(Material.STONE_SWORD, 30), + new RandomItem(Material.WOOD_AXE, 100), + new RandomItem(Material.WOOD_SWORD, 80), + new RandomItem(Material.STONE_AXE, 70), + new RandomItem(Material.STONE_SWORD, 50), + new RandomItem(Material.IRON_AXE, 40), - new RandomItem(Material.LEATHER_BOOTS, 30), - new RandomItem(Material.LEATHER_HELMET, 30), - new RandomItem(Material.LEATHER_LEGGINGS, 30), + new RandomItem(Material.LEATHER_BOOTS, 40), + new RandomItem(Material.LEATHER_HELMET, 40), + new RandomItem(Material.LEATHER_LEGGINGS, 40), - new RandomItem(Material.GOLD_BOOTS, 25), - new RandomItem(Material.GOLD_HELMET, 25), - new RandomItem(Material.GOLD_LEGGINGS, 25), + new RandomItem(Material.GOLD_BOOTS, 35), + new RandomItem(Material.GOLD_HELMET, 35), + new RandomItem(Material.GOLD_LEGGINGS, 35), - new RandomItem(Material.CHAINMAIL_BOOTS, 20), - new RandomItem(Material.CHAINMAIL_HELMET, 20), - new RandomItem(Material.CHAINMAIL_LEGGINGS, 20), + new RandomItem(Material.CHAINMAIL_BOOTS, 30), + new RandomItem(Material.CHAINMAIL_HELMET, 30), + new RandomItem(Material.CHAINMAIL_LEGGINGS, 30), new RandomItem(Material.FISHING_ROD, 30), - new RandomItem(Material.BOW, 20), - new RandomItem(Material.ARROW, 20, 1, 3), + new RandomItem(Material.BOW, 50), + new RandomItem(Material.ARROW, 50, 1, 3), new RandomItem(Material.SNOW_BALL, 30, 1, 2), new RandomItem(Material.EGG, 30, 1, 2), - new RandomItem(Material.COMPASS, 20), new RandomItem(Material.STICK, 30, 1, 2), new RandomItem(Material.FLINT, 30, 1, 2), new RandomItem(Material.FEATHER, 30, 1, 2), @@ -57,33 +57,26 @@ public class LootTable Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), 15), new RandomItem(Material.MUSHROOM_SOUP, 15), - new RandomItem(Material.BAKED_POTATO, 30, 1, 5), - new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1), + new RandomItem(Material.BAKED_POTATO, 20, 1, 5), + new RandomItem(Material.MUSHROOM_SOUP, 20, 1, 1), new RandomItem(Material.COOKED_BEEF, 30, 1, 3), new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3), new RandomItem(Material.COOKED_FISH, 30, 1, 6), - new RandomItem(Material.GRILLED_PORK, 30, 1, 3), + new RandomItem(Material.GRILLED_PORK, 20, 1, 3), new RandomItem(Material.COOKIE, 30), - new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3), - new RandomItem(Material.APPLE, 30, 2, 6), + new RandomItem(Material.PUMPKIN_PIE, 20, 1, 3), + new RandomItem(Material.APPLE, 20, 2, 6), - new RandomItem(Material.STONE_SWORD, 30), - new RandomItem(Material.IRON_AXE, 30), new RandomItem(Material.IRON_INGOT, 30, 1, 2), new RandomItem(Material.DIAMOND, 30) ); - public final static LootTable SUPPLY_DROP = new LootTable( - new RandomItem(Material.DIAMOND_HELMET, 10), - new RandomItem(Material.DIAMOND_LEGGINGS, 8), - new RandomItem(Material.DIAMOND_BOOTS, 10), - - new RandomItem(Material.IRON_HELMET, 30), - new RandomItem(Material.IRON_LEGGINGS, 27), - new RandomItem(Material.IRON_BOOTS, 30), - new RandomItem(Material.IRON_SWORD, 24), - new RandomItem(Material.DIAMOND_SWORD, 8), - new RandomItem(Material.DIAMOND_AXE, 16) + public final static LootTable SUPPLY_DROP = new LootTable( + new RandomItem(Material.DIAMOND_HELMET, 30), + new RandomItem(Material.DIAMOND_LEGGINGS, 27), + new RandomItem(Material.DIAMOND_BOOTS, 30), + new RandomItem(Material.DIAMOND_SWORD, 16), + new RandomItem(Material.DIAMOND_AXE, 24) // new RandomItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, 1, Enchantment.DAMAGE_ALL), 8), // new RandomItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, 1, Enchantment.DAMAGE_ALL), 4), // diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java index 374fa3cc0..5a82b318a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/Skyfall.java @@ -8,11 +8,8 @@ import java.util.Iterator; import java.util.TreeMap; import java.util.UUID; -import com.mineplex.anticheat.checks.move.Glide; -import com.mineplex.anticheat.checks.move.HeadRoll; -import com.mineplex.anticheat.checks.move.Speed; -import mineplex.core.Managers; -import mineplex.core.antihack.AntiHack; +import net.md_5.bungee.api.ChatColor; + import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; @@ -36,7 +33,14 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import com.mineplex.anticheat.checks.move.Glide; +import com.mineplex.anticheat.checks.move.HeadRoll; +import com.mineplex.anticheat.checks.move.Speed; + +import mineplex.core.Managers; +import mineplex.core.antihack.AntiHack; import mineplex.core.common.MinecraftVersion; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -54,18 +58,16 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.skyfall.kits.KitAeronaught; -import nautilus.game.arcade.game.games.skyfall.kits.KitBooster; import nautilus.game.arcade.game.games.skyfall.kits.KitDeadeye; import nautilus.game.arcade.game.games.skyfall.kits.KitJouster; import nautilus.game.arcade.game.games.skyfall.kits.KitSpeeder; @@ -78,17 +80,16 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker; import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker; import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker; -import net.md_5.bungee.api.ChatColor; /** * GameObject of the game Skyfall * * @author xXVevzZXx */ -public class Skyfall extends SoloGame +public abstract class Skyfall extends Game { private static final long MAP_CRUMBLE_DELAY = 1000*30; // 30 Seconds - private static final long CHEST_REFILL_TIME = 1000*60*6; // 5 minutes + private static final long CHEST_REFILL_TIME = 1000*60*3; // 3 minutes private static final long CHEST_REFILL_ANNOUNCE_TIME = 1000*60*3; // 3 minutes private static final int BIG_ISLAND_BOUNDS = 30; private static final int BIG_ISLAND_HEIGHT = 40; @@ -102,9 +103,11 @@ public class Skyfall extends SoloGame private static final long BOOSTER_COOLDOWN_TIME = 1000*20; // 20 Seconds - private static final long SUPPLY_DROP_TIME = 1000*60*4; // 5 Minutes + private static final long SUPPLY_DROP_TIME = 1000*60*5; // 5 Minutes private static final long DEATHMATCH_START_TIME = 1000*30; // 30 Seconds private static final long DEATHMATCH_WAIT_TIME = 1000*10; // 10 Seconds + + private static final int TNT_EXPLOSION_RADIUS = 14; private static final long EAT_RECHARGE = 500; // 0.5 Second @@ -136,15 +139,14 @@ public class Skyfall extends SoloGame private boolean _teleportedDeathmatch; private long _deathMatchStartTime; - private boolean _crumbleRings; private boolean _refillAnnounced; private int _currentCrumble = 300; private boolean _supplyOpened; - public Skyfall(ArcadeManager manager) + public Skyfall(ArcadeManager manager, GameType type) { - super(manager, GameType.Skyfall, + super(manager, type, new Kit[] { @@ -197,7 +199,6 @@ public class Skyfall extends SoloGame PrepareFreeze = true; AnnounceStay = false; - HideTeamSheep = true; DeathDropItems = true; QuitDropItems = true; DamageSelf = true; @@ -212,9 +213,9 @@ public class Skyfall extends SoloGame InventoryOpenChest = true; DamageFall = false; SoupEnabled = true; - ReplaceTeamsWithKits = true; StrictAntiHack = false; CompassEnabled = true; + CompassGiveItem = false; SpeedMeasurement = true; @@ -222,63 +223,6 @@ public class Skyfall extends SoloGame _islandHeight = 15; } - @Override - @EventHandler - public void ScoreboardUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - if (GetTeamList().isEmpty()) - return; - - Scoreboard.reset(); - - GameTeam team = GetTeamList().get(0); - - if (IsLive()) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cGreen + C.Bold + "Time"); - Scoreboard.write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT)); - Scoreboard.writeNewLine(); - } - - Scoreboard.write(C.cYellow + C.Bold + "Players"); - if (team.GetPlayers(true).size() > 7) - { - Scoreboard.write("" + team.GetPlayers(true).size()); - } - else - { - for (Player player : team.GetPlayers(true)) - { - Scoreboard.write(C.cWhite + player.getName()); - } - } - - if (IsLive() && !_deathmatch) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cGold + C.Bold + "Chest Refill"); - Scoreboard.write(C.cWhite + UtilTime.MakeStr((_chestsRefilled + CHEST_REFILL_TIME) - System.currentTimeMillis())); - } - else if (_deathmatch && !_deathMatchStarted) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cRed + C.Bold + "Deathmatch"); - Scoreboard.write(F.time(UtilTime.MakeStr(_teleportedDeathmatch ? (_deathMatchStartTime + DEATHMATCH_START_TIME + DEATHMATCH_WAIT_TIME) - System.currentTimeMillis() : (_deathMatchStartTime + DEATHMATCH_START_TIME) - System.currentTimeMillis()))); - } - else if (_deathMatchStarted) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cRed + C.Bold + "Game End"); - Scoreboard.write(UtilTime.convertString(Math.max(0, (GetStateTime() + GameTimeout) - System.currentTimeMillis()), 0, TimeUnit.FIT)); - } - - Scoreboard.draw(); - } - @EventHandler public void gameStart(GameStateChangeEvent event) { @@ -290,6 +234,17 @@ public class Skyfall extends SoloGame { spawn.clone().subtract(0, 1, 0).getBlock().setType(Material.AIR); } + + for (Player player : GetPlayers(true)) + { + ItemStack stack = new ItemStack(Material.COMPASS); + + ItemMeta itemMeta = stack.getItemMeta(); + itemMeta.setDisplayName(C.cGreen + C.Bold + "Tracking Compass"); + stack.setItemMeta(itemMeta); + + player.getInventory().addItem(stack); + } } } @@ -364,7 +319,6 @@ public class Skyfall extends SoloGame { Announce(C.cGreenB + "As time passes, the world begins to rot...", true); _crumbleAnnounced = true; - _crumbleRings = true; } for (Island island : islandCrumble()) @@ -519,7 +473,6 @@ public class Skyfall extends SoloGame Location loc = UtilAlg.getLocationNearPlayers(_deathMatchSpawns, GetPlayers(true), GetPlayers(true)); player.teleport(loc); } - _crumbleRings = true; } @EventHandler @@ -528,9 +481,6 @@ public class Skyfall extends SoloGame if (event.getType() != UpdateType.FASTER) return; - if (!_crumbleRings) - return; - for (BoosterRing ring : _boosterRings) { if (ring.getMiddle().getBlockY() < _currentCrumble) @@ -578,6 +528,7 @@ public class Skyfall extends SoloGame Announce(C.cYellow + C.Bold + "Supply Drop Incoming"); _supplyEffect = _supplyDrop.clone(); _supplyEffect.setY(250); + _supplyDrop.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS); _supplyDrop.getBlock().getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).setType(Material.BEACON); for (int x = -1; x <= 1; x++) for (int z = -1; z <= 1; z++) @@ -908,6 +859,9 @@ public class Skyfall extends SoloGame { if (!IsLive()) UtilPlayer.removeWorldBorder(player); + + if (!IsAlive(player)) + UtilPlayer.removeWorldBorder(player); if (player.getInventory().getChestplate() == null) continue; @@ -940,18 +894,16 @@ public class Skyfall extends SoloGame @EventHandler public void TNTExplosion(ExplosionPrimeEvent event) - { + { if (!_tntMap.containsKey(event.getEntity())) return; Player player = _tntMap.remove(event.getEntity()); - 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(), TNT_EXPLOSION_RADIUS)) + Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + + event.setCancelled(true); } @EventHandler @@ -1062,7 +1014,7 @@ public class Skyfall extends SoloGame { if (player.getInventory().getChestplate() != null) { - UtilPlayer.message(player, F.main("Game", C.cRed + "You're Elytra is disabled!")); + UtilPlayer.message(player, F.main("Game", C.cRed + "Your Elytra is disabled!")); } player.getInventory().setChestplate(null); } @@ -1070,6 +1022,46 @@ public class Skyfall extends SoloGame } } + public boolean isDeathMatch() + { + return _deathmatch; + } + + public boolean isDeathMatchStarted() + { + return _deathMatchStarted; + } + + public boolean isTeleportedDeathmatch() + { + return _teleportedDeathmatch; + } + + public long getDeathmatchStartTime() + { + return _deathMatchStartTime; + } + + public long getChestsRefilled() + { + return _chestsRefilled; + } + + public long getChestRefillTime() + { + return CHEST_REFILL_TIME; + } + + public long getDeathmatchStartingTime() + { + return DEATHMATCH_START_TIME; + } + + public long getDeathmatchWaitTime() + { + return DEATHMATCH_WAIT_TIME; + } + private class IslandSorter implements Comparator { private HashMap _map; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/SoloSkyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/SoloSkyfall.java new file mode 100644 index 000000000..9d26f1c34 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/SoloSkyfall.java @@ -0,0 +1,178 @@ +package nautilus.game.arcade.game.games.skyfall; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; + +/** + * SoloSkyfall + * + * @author xXVevzZXx + */ +public class SoloSkyfall extends Skyfall +{ + private GameTeam _players; + + public SoloSkyfall(ArcadeManager manager) + { + super(manager, GameType.Skyfall); + + this.DamageTeamSelf = true; + } + + @EventHandler + public void CustomTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + _players = GetTeamList().get(0); + _players.SetColor(ChatColor.YELLOW); + _players.SetName("Players"); + _players.setDisplayName(C.cYellow + C.Bold + "Players"); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + Scoreboard.reset(); + + GameTeam team = GetTeamList().get(0); + + if (IsLive()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGreen + C.Bold + "Time"); + Scoreboard.write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT)); + Scoreboard.writeNewLine(); + } + + Scoreboard.write(C.cYellow + C.Bold + "Players"); + if (team.GetPlayers(true).size() > 7) + { + Scoreboard.write("" + team.GetPlayers(true).size()); + } + else + { + for (Player player : team.GetPlayers(true)) + { + Scoreboard.write(C.cWhite + player.getName()); + } + } + + if (IsLive() && !isDeathMatch()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGold + C.Bold + "Chest Refill"); + Scoreboard.write(C.cWhite + UtilTime.MakeStr((getChestsRefilled() + getChestRefillTime()) - System.currentTimeMillis())); + } + else if (isDeathMatch() && !isDeathMatchStarted()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cRed + C.Bold + "Deathmatch"); + Scoreboard.write(F.time(UtilTime.MakeStr(isTeleportedDeathmatch() ? (getDeathmatchStartTime() + getDeathmatchStartingTime() + getDeathmatchWaitTime()) - System.currentTimeMillis() : (getDeathmatchStartTime() + getDeathmatchStartingTime()) - System.currentTimeMillis()))); + } + else if (isDeathMatchStarted()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cRed + C.Bold + "Game End"); + Scoreboard.write(UtilTime.convertString(Math.max(0, (GetStateTime() + GameTimeout) - System.currentTimeMillis()), 0, TimeUnit.FIT)); + } + + Scoreboard.draw(); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (GetPlayers(true).size() <= 1) + { + ArrayList places = GetTeamList().get(0).GetPlacements(true); + + //Announce + AnnounceEnd(places); + + //Gems + if (places.size() >= 1) + AddGems(places.get(0), 20, "1st Place", false, false); + + if (places.size() >= 2) + AddGems(places.get(1), 15, "2nd Place", false, false); + + if (places.size() >= 3) + AddGems(places.get(2), 10, "3rd Place", false, false); + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + + //End + SetState(GameState.End); + } + } + + @Override + public List getWinners() + { + if (GetState().ordinal() >= GameState.End.ordinal()) + { + List places = GetTeamList().get(0).GetPlacements(true); + + if (places.isEmpty() || !places.get(0).isOnline()) + return Arrays.asList(); + else + return Arrays.asList(places.get(0)); + } + else + return null; + } + + @Override + public List getLosers() + { + List winners = getWinners(); + + if (winners == null) + return null; + + List losers = GetTeamList().get(0).GetPlayers(false); + + losers.removeAll(winners); + + return losers; + } + + @Override + public String GetMode() + { + return "Solo Mode"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/TeamSkyfall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/TeamSkyfall.java new file mode 100644 index 000000000..ef02c6deb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/TeamSkyfall.java @@ -0,0 +1,190 @@ +package nautilus.game.arcade.game.games.skyfall; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.modules.TeamModule; + +/** + * TeamSkyfall + * + * @author xXVevzZXx + */ +public class TeamSkyfall extends Skyfall +{ + + public TeamSkyfall(ArcadeManager manager) + { + super(manager, GameType.SkyfallTeams); + + PlayersPerTeam = 2; + FillTeamsInOrderToCount = 2; + + SpawnNearAllies = true; + SpawnNearEnemies = true; + + DamageTeamSelf = false; + + DontAllowOverfill = true; + TeamMode = true; + + HideTeamSheep = true; + + registerModule(new TeamModule()); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + Scoreboard.reset(); + + if (IsLive()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGreen + C.Bold + "Time"); + Scoreboard.write(UtilTime.convertString(System.currentTimeMillis() - GetStateTime(), 0, TimeUnit.FIT)); + Scoreboard.writeNewLine(); + } + + Scoreboard.write(C.cYellow + C.Bold + "Teams"); + + ArrayList alive = new ArrayList(); + for (GameTeam team : GetTeamList()) + { + if (team.IsTeamAlive()) + alive.add(team); + } + + if (GetPlayers(true).size() <= 7) + { + for (GameTeam team : GetTeamList()) + { + for (Player player : team.GetPlayers(true)) + { + Scoreboard.write(team.GetColor() + player.getName()); + } + } + } + else if (alive.size() <= 7) + { + for (GameTeam team : alive) + { + Scoreboard.write(C.cWhite + team.GetPlayers(true).size() + " " + team.GetColor() + team.GetName()); + } + } + else + { + Scoreboard.write(C.cWhite + alive.size() + " Alive"); + } + + if (IsLive() && !isDeathMatch()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGold + C.Bold + "Chest Refill"); + Scoreboard.write(C.cWhite + UtilTime.MakeStr((getChestsRefilled() + getChestRefillTime()) - System.currentTimeMillis())); + } + else if (isDeathMatch() && !isDeathMatchStarted()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cRed + C.Bold + "Deathmatch"); + Scoreboard.write(F.time(UtilTime.MakeStr(isTeleportedDeathmatch() ? (getDeathmatchStartTime() + getDeathmatchStartingTime() + getDeathmatchWaitTime()) - System.currentTimeMillis() : (getDeathmatchStartTime() + getDeathmatchStartingTime()) - System.currentTimeMillis()))); + } + else if (isDeathMatchStarted()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cRed + C.Bold + "Game End"); + Scoreboard.write(UtilTime.convertString(Math.max(0, (GetStateTime() + GameTimeout) - System.currentTimeMillis()), 0, TimeUnit.FIT)); + } + + Scoreboard.draw(); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + ArrayList teamsAlive = new ArrayList(); + + for (GameTeam team : GetTeamList()) + if (team.GetPlayers(true).size() > 0) + teamsAlive.add(team); + + if (teamsAlive.size() <= 1) + { + //Announce + if (teamsAlive.size() > 0) + AnnounceEnd(teamsAlive.get(0)); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + AddGems(player, 10, "Winning Team", false, false); + } + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + } + + //End + SetState(GameState.End); + } + } + + @Override + public List getWinners() + { + if (WinnerTeam == null) + return null; + + return WinnerTeam.GetPlayers(false); + } + + @Override + public List getLosers() + { + if (WinnerTeam == null) + return null; + + List players = new ArrayList<>(); + + for (GameTeam team : GetTeamList()) + { + if (team != WinnerTeam) + players.addAll(team.GetPlayers(false)); + } + + return players; + } + + @Override + public String GetMode() + { + return "Team Mode"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkAeronaught.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkAeronaught.java index 3a12689ab..bce38d3de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkAeronaught.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkAeronaught.java @@ -6,6 +6,7 @@ import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; /** diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java index 4876a6506..3c205e87c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkDeadeye.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.game.games.skyfall.HomingArrow; import nautilus.game.arcade.kit.Perk; @@ -53,7 +54,7 @@ public class PerkDeadeye extends Perk return; Player shooter = (Player) event.getEntity(); - + if (!hasPerk(shooter)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraKnockback.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraKnockback.java index 3e9b02494..0398f438d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraKnockback.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkElytraKnockback.java @@ -45,6 +45,9 @@ public class PerkElytraKnockback extends Perk if (!UtilPlayer.isGliding(player)) return; + if (Manager.GetGame().TeamMode && Manager.GetGame().GetTeam(player) == Manager.GetGame().GetTeam(event.GetDamageePlayer())) + return; + event.AddKnockback("Kit Effect", event.getKnockbackValue()*2); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkIncreaseBoosters.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkIncreaseBoosters.java index 391277b7d..a4fe39dff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkIncreaseBoosters.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkIncreaseBoosters.java @@ -4,6 +4,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; + import nautilus.game.arcade.game.games.skyfall.BoosterRing; import nautilus.game.arcade.game.games.skyfall.PlayerBoostRingEvent; import nautilus.game.arcade.kit.Perk; @@ -36,6 +37,8 @@ public class PerkIncreaseBoosters extends Perk if (!hasPerk(player)) return; + player.sendMessage("Increasing strength of booster ring to " + _strength + " for " + player.getName()); + event.multiplyStrength(_strength); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java index 8ee1863fe..a14655a2d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skyfall/kits/perks/PerkRemoveElytra.java @@ -15,6 +15,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; /** @@ -59,7 +60,10 @@ public class PerkRemoveElytra extends Perk if (!hasPerk(player)) return; - Recharge.Instance.useForce(player, "Elytra Removal", _duration, true); + if (Manager.GetGame().TeamMode && Manager.GetGame().GetTeam(player) == Manager.GetGame().GetTeam(event.GetDamageePlayer())) + return; + + Recharge.Instance.useForce(event.GetDamageePlayer(), "Elytra Removal", _duration, true); _disabled.put(event.GetDamageePlayer().getUniqueId(), System.currentTimeMillis() + _duration); } @@ -84,7 +88,7 @@ public class PerkRemoveElytra extends Perk { if (player.getInventory().getChestplate() != null) { - UtilPlayer.message(player, F.main("Game", C.cRed + "You're Elytra is disabled!")); + UtilPlayer.message(player, F.main("Game", C.cRed + "Your Elytra is disabled!")); } player.getInventory().setChestplate(null); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java index 5f2626d06..a5e66c3f7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java @@ -4,17 +4,18 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; - import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.inventory.ItemStack; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; + public class WinWithoutWearingArmorStatTracker extends StatTracker { private final Set _wearing = new HashSet(); @@ -41,7 +42,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker for (ItemStack armor : player.getInventory().getArmorContents()) { - if (armor != null && armor.getType() != Material.AIR) + if (armor != null && armor.getType() != Material.AIR && armor.getType() != Material.ELYTRA) { _wearing.add(player.getUniqueId().toString()); break;