diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index aef40f7c1..c7ae4e7e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -83,6 +83,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 517358bd0..f47271c0f 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; @@ -70,7 +73,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; @@ -108,8 +112,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 @@ -196,7 +198,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/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..c91eb303c 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; 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..b47bea0bd 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,12 +33,21 @@ 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 org.bukkit.scoreboard.Scoreboard; +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; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilFirework; @@ -59,13 +65,14 @@ 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.Game; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.SoloGame; 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 +85,17 @@ 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; +import nautilus.game.arcade.world.WorldData; /** * 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,7 +109,7 @@ 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 @@ -136,15 +143,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 +203,6 @@ public class Skyfall extends SoloGame PrepareFreeze = true; AnnounceStay = false; - HideTeamSheep = true; DeathDropItems = true; QuitDropItems = true; DamageSelf = true; @@ -212,9 +217,9 @@ public class Skyfall extends SoloGame InventoryOpenChest = true; DamageFall = false; SoupEnabled = true; - ReplaceTeamsWithKits = true; StrictAntiHack = false; CompassEnabled = true; + CompassGiveItem = false; SpeedMeasurement = true; @@ -222,63 +227,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 +238,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 +323,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 +477,6 @@ public class Skyfall extends SoloGame Location loc = UtilAlg.getLocationNearPlayers(_deathMatchSpawns, GetPlayers(true), GetPlayers(true)); player.teleport(loc); } - _crumbleRings = true; } @EventHandler @@ -528,9 +485,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 +532,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 +863,9 @@ public class Skyfall extends SoloGame { if (!IsLive()) UtilPlayer.removeWorldBorder(player); + + if (!IsAlive(player)) + UtilPlayer.removeWorldBorder(player); if (player.getInventory().getChestplate() == null) continue; @@ -940,7 +898,7 @@ public class Skyfall extends SoloGame @EventHandler public void TNTExplosion(ExplosionPrimeEvent event) - { + { if (!_tntMap.containsKey(event.getEntity())) return; @@ -952,6 +910,16 @@ public class Skyfall extends SoloGame .Factory() .Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + + Location loc = event.getEntity().getLocation(); + for (Block block : UtilBlock.getSurrounding(loc.getBlock(), true)) + { + if (block.getType() == _boosterRings.get(0).getType()) + { + event.setCancelled(true); + return; + } + } } @EventHandler @@ -1062,7 +1030,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 +1038,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/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..43ce0a4fe 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; + // Bukkit.broadcastMessage("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;