diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index ff7e2344b..17b03158f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -373,79 +373,95 @@ public enum Achievement new String[]{"Win 30 games of Master Builders"}, new int[]{30}, AchievementCategory.MASTER_BUILDERS), - + //Castle Siege - CASTLE_SIEGE_KILL_STREAK("Kill Streak", 0, - new String[]{"Castle Siege.KillStreak", "Castle Siege TDM.KillStreak"}, + CASTLE_SIEGE_WINS("FOR THE KING!", 600, + new String[]{"Castle Siege.ForTheKing"}, + new String[]{"Win as Defenders 50 times"}, + new int[]{50}, + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_KINGSLAYER("Kingslayer", 800, + new String[]{"Castle Siege.KingSlayer"}, + new String[]{"Get the killing blow on the King"}, + new int[]{1}, + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_BLOOD_THIRSTY("Blood Thirsty", 1200, + new String[]{"Castle Siege.BloodThirsty"}, + new String[]{"Kill 50 Undead in a single game"}, + new int[]{1}, + AchievementCategory.CASTLE_SIEGE), + + CASTLE_SIEGE_ASSASSIN("Assassin", 1000, + new String[]{"Castle Siege.Assassin"}, + new String[]{"Do 50% or more of the damage to the king"}, + new int[]{1}, + AchievementCategory.CASTLE_SIEGE), + + //Castle Assault + CASTLE_ASSAULT_KILL_STREAK("Kill Streak", 0, + new String[]{"Castle Assault.KillStreak", "Castle Assault TDM.KillStreak"}, new String[]{"Earn Kill Streak Rewards"}, new int[][]{new int[]{0, 50, 500}, new int[]{0, 100, 750}, new int[]{0, 150, 1000}, new int[]{0, 200, 1500}, new int[]{0, 400, 2000}, new int[]{0, 500, 2500}, new int[]{0, 1000, 3000}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4000}, new int[]{0, 5000, 100000}}, new int[]{10, 20, 50, 100, 200, 250, 500, 750, 1000, 2000}, "Novice I", new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, - AchievementCategory.CASTLE_SIEGE), + AchievementCategory.CASTLE_ASSAULT), - CASTLE_SIEGE_FIRST_BLOOD("First Blood", 0, - new String[]{"Castle Siege.FirstBlood", "Castle Siege TDM.FirstBlood"}, + CASTLE_ASSAULT_FIRST_BLOOD("First Blood", 0, + new String[]{"Castle Assault.FirstBlood", "Castle Assault TDM.FirstBlood"}, new String[]{"Obtain the first kill in a Match"}, new int[][]{new int[]{0, 100, 100}, new int[]{0, 150, 200}, new int[]{0, 200, 300}, new int[]{0, 250, 400}, new int[]{0, 500, 500}}, new int[]{2, 5, 10, 25, 50}, "Novice I", new String[]{"Novice II", "Novice III", "Novice IV", "Novice V"}, - AchievementCategory.CASTLE_SIEGE), + AchievementCategory.CASTLE_ASSAULT), - CASTLE_SIEGE_FIGHTER_KIT("Fighter", 0, - new String[]{"Castle Siege.FighterKitKills", "Castle Siege TDM.FighterKitKills"}, + CASTLE_ASSAULT_FIGHTER_KIT("Fighter", 0, + new String[]{"Castle Assault.FighterKitKills", "Castle Assault TDM.FighterKitKills"}, new String[]{"Kill opponents while wearing the Fighter Kit"}, new int[][]{new int[]{0, 100, 500}, new int[]{0, 150, 750}, new int[]{0, 250, 1000}, new int[]{0, 500, 1500}, new int[]{0, 1000, 2500}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4500}, new int[]{0, 3000, 6000}, new int[]{0, 5000, 10000}, new int[]{0, 10000, 100000}}, new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000}, "Novice I", new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, - AchievementCategory.CASTLE_SIEGE), + AchievementCategory.CASTLE_ASSAULT), - CASTLE_SIEGE_TANK_KIT("Tank", 0, - new String[]{"Castle Siege.TankKitKills", "Castle Siege TDM.TankKitKills"}, + CASTLE_ASSAULT_TANK_KIT("Tank", 0, + new String[]{"Castle Assault.TankKitKills", "Castle Assault TDM.TankKitKills"}, new String[]{"Kill opponents while wearing the Tank Kit"}, new int[][]{new int[]{0, 100, 500}, new int[]{0, 150, 750}, new int[]{0, 250, 1000}, new int[]{0, 500, 1500}, new int[]{0, 1000, 2500}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4500}, new int[]{0, 3000, 6000}, new int[]{0, 5000, 10000}, new int[]{0, 10000, 100000}}, new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000}, "Novice I", new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, - AchievementCategory.CASTLE_SIEGE), + AchievementCategory.CASTLE_ASSAULT), - CASTLE_SIEGE_ARCHER_KIT("Archer", 0, - new String[]{"Castle Siege.ArcherKitKills", "Castle Siege TDM.ArcherKitKills"}, + CASTLE_ASSAULT_ARCHER_KIT("Archer", 0, + new String[]{"Castle Assault.ArcherKitKills", "Castle Assault TDM.ArcherKitKills"}, new String[]{"Kill opponents while wearing the Archer Kit"}, new int[][]{new int[]{0, 100, 500}, new int[]{0, 150, 750}, new int[]{0, 250, 1000}, new int[]{0, 500, 1500}, new int[]{0, 1000, 2500}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4500}, new int[]{0, 3000, 6000}, new int[]{0, 5000, 10000}, new int[]{0, 10000, 100000}}, new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000}, "Novice I", new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, - AchievementCategory.CASTLE_SIEGE), + AchievementCategory.CASTLE_ASSAULT), - CASTLE_SIEGE_DEMOLITIONIST_KIT("Demolitionist", 0, - new String[]{"Castle Siege.DemolitionistKitKills", "Castle Siege TDM.DemolitionistKitKills"}, + CASTLE_ASSAULT_DEMOLITIONIST_KIT("Demolitionist", 0, + new String[]{"Castle Assault.DemolitionistKitKills", "Castle Assault TDM.DemolitionistKitKills"}, new String[]{"Kill opponents while wearing the Demolitionist Kit"}, new int[][]{new int[]{0, 100, 500}, new int[]{0, 150, 750}, new int[]{0, 250, 1000}, new int[]{0, 500, 1500}, new int[]{0, 1000, 2500}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4500}, new int[]{0, 3000, 6000}, new int[]{0, 5000, 10000}, new int[]{0, 10000, 100000}}, new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000}, "Novice I", new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, - AchievementCategory.CASTLE_SIEGE), + AchievementCategory.CASTLE_ASSAULT), - CASTLE_SIEGE_WINNER("Siege", 0, - new String[]{"Castle Siege.Wins", "Castle Siege TDM.Wins"}, - new String[]{"Win games of Castle Siege"}, + CASTLE_ASSAULT_WINNER("Assault", 0, + new String[]{"Castle Assault.Wins", "Castle Assault TDM.Wins"}, + new String[]{"Win games of Castle Assault"}, new int[][]{new int[]{0, 100, 500}, new int[]{0, 150, 750}, new int[]{0, 250, 1000}, new int[]{0, 500, 1500}, new int[]{0, 1000, 2500}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4500}, new int[]{0, 3000, 6000}, new int[]{0, 5000, 10000}, new int[]{0, 10000, 100000}}, new int[]{2, 5, 25, 50, 100, 150, 250, 500, 1000, 2000}, "Novice I", new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, - AchievementCategory.CASTLE_SIEGE), - - CASTLE_SIEGE_MEDALIST("Medalist", 0, - new String[]{"Castle Siege.MedalsEarned", "Castle Siege TDM.MedalsEarned"}, - new String[]{"Earn Bronze, Silver, or Gold Medals in Castle Siege Matches"}, - new int[][]{new int[]{0, 100, 500}, new int[]{0, 150, 750}, new int[]{0, 250, 1000}, new int[]{0, 500, 1500}, new int[]{0, 1000, 2500}, new int[]{0, 1500, 3500}, new int[]{0, 2000, 4500}, new int[]{0, 3000, 6000}, new int[]{0, 5000, 10000}, new int[]{0, 10000, 100000}}, - new int[]{2, 50, 150, 250, 500, 1000, 1500, 2500, 5000, 10000}, - "Novice I", - new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, - AchievementCategory.CASTLE_SIEGE), + AchievementCategory.CASTLE_ASSAULT), //Champions CHAMPIONS_WINS("Champion", 600, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 63cdf68c0..3a2d752df 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -84,10 +84,15 @@ public enum AchievementCategory WIZARDS("Wizards", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit", false, GameDisplay.Wizards.getGameId()), - - CASTLE_SIEGE("Castle Siege", new String[] {"Castle Siege", "Castle Siege TDM"}, + + CASTLE_ASSAULT("Castle Assault", new String[] {"Castle Assault", "Castle Assault TDM"}, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.CROWNS_EARNED }, - Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleSiege.getGameId(), GameDisplay.CastleSiegeTDM.getGameId()), + Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleAssault.getGameId(), GameDisplay.CastleAssaultTDM.getGameId()), + + CASTLE_SIEGE("Castle Siege", null, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"), + new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED }, + Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleSiege.getGameId()), BAWK_BAWK_BATTLES("Bawk Bawk Battles", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 5a63e6100..8de5d53a7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -14,8 +14,9 @@ public enum GameDisplay Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.EXTRA, 2, false), BossBattles("Boss Battles", Material.SKULL_ITEM, (byte) 0, GameCategory.EVENT, 55, false), Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3, true), - CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 67, true), - CastleSiegeTDM("Castle Siege TDM", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 68, false), + CastleAssault("Castle Assault", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 67, true), + CastleAssaultTDM("Castle Assault TDM", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 68, false), + CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4, true), ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6, true), ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5, true), Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8, false), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/Leaderboard.java b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/Leaderboard.java index 29087eb56..7b717f6ff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/Leaderboard.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/Leaderboard.java @@ -8,23 +8,25 @@ import java.util.Map.Entry; import org.bukkit.Location; import mineplex.core.Managers; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.hologram.Hologram; import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType; public class Leaderboard { - private String _display, _statDisplay; + private String _display; + private Pair _statDisplay; private String[] _statIds; private int _size; private LeaderboardSQLType _type; private Location _loc; private Hologram _holo; - public Leaderboard(String display, String statDisplayName, String[] statIds, LeaderboardSQLType type, Location displayLoc, int size) + public Leaderboard(String display, Pair statDisplayNames, String[] statIds, LeaderboardSQLType type, Location displayLoc, int size) { _display = display; - _statDisplay = statDisplayName; + _statDisplay = statDisplayNames; _statIds = statIds; _type = type; _size = size; @@ -57,7 +59,14 @@ public class Leaderboard int place = 1; for (Entry entry : names.entrySet()) { - display.add(C.cGreen + "#" + place + " " + entry.getKey() + C.cRed + " " + entry.getValue() + " " + _statDisplay); + if (entry.getValue() == 1) + { + display.add(C.cGreen + "#" + place + " " + entry.getKey() + C.cRed + " " + entry.getValue() + " " + _statDisplay.getLeft()); + } + else + { + display.add(C.cGreen + "#" + place + " " + entry.getKey() + C.cRed + " " + entry.getValue() + " " + _statDisplay.getRight()); + } place++; } _holo = new Hologram(Managers.get(LeaderboardManager.class).getHologramManager(), _loc, display.toArray(new String[display.size()])).start(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferenceMainMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferenceMainMenu.java index ab07a6d8f..d8ee17525 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferenceMainMenu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferenceMainMenu.java @@ -30,7 +30,7 @@ public class PreferenceMainMenu extends Menu protected Button[] setUp(Player player) { Rank rank = getPlugin().getClientManager().Get(player).GetRank(); - boolean exclusive = rank.has(Rank.HELPER) || rank == Rank.YOUTUBE_SMALL || rank == Rank.YOUTUBE || rank == Rank.TWITCH; + boolean exclusive = rank.has(Rank.MAPDEV) || rank == Rank.YOUTUBE_SMALL || rank == Rank.YOUTUBE || rank == Rank.TWITCH; Button[] buttons = new Button[exclusive ? INV_SIZE_MAX : INV_SIZE_MIN]; 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 76e5c38bf..dd64be771 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -24,7 +24,8 @@ import nautilus.game.arcade.game.games.build.modes.DukesOfDecoration; import nautilus.game.arcade.game.games.build.modes.TeamBuild; import nautilus.game.arcade.game.games.buildmavericks.BuildMavericks; import nautilus.game.arcade.game.games.cards.Cards; -import nautilus.game.arcade.game.games.castlesiege.CastleSiegeTDM; +import nautilus.game.arcade.game.games.castleassault.CastleAssault; +import nautilus.game.arcade.game.games.castleassault.CastleAssaultTDM; import nautilus.game.arcade.game.games.castlesiege.CastleSiege; import nautilus.game.arcade.game.games.champions.ChampionsCTF; import nautilus.game.arcade.game.games.champions.ChampionsDominate; @@ -130,8 +131,9 @@ public enum GameType Basketball(Basketball.class, GameDisplay.Basketball), BossBattles(BossBattles.class, GameDisplay.BossBattles), Bridge(Bridge.class, GameDisplay.Bridge), + CastleAssault(CastleAssault.class, GameDisplay.CastleAssault), + CastleAssaultTDM(CastleAssaultTDM.class, GameDisplay.CastleAssaultTDM), CastleSiege(CastleSiege.class, GameDisplay.CastleSiege), - CastleSiegeTDM(CastleSiegeTDM.class, GameDisplay.CastleSiegeTDM), ChampionsCTF(ChampionsCTF.class, GameDisplay.ChampionsCTF), ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate), ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java new file mode 100644 index 000000000..d327f19d4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssault.java @@ -0,0 +1,1446 @@ +package nautilus.game.arcade.game.games.castleassault; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.Chest; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.EnderCrystal; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Entity; +import org.bukkit.entity.ItemFrame; +import org.bukkit.entity.Painting; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockDispenseEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.ItemDespawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.hanging.HangingBreakEvent; +import org.bukkit.event.inventory.InventoryAction; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.material.Dispenser; +import org.bukkit.material.MaterialData; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.metadata.MetadataValue; +import org.bukkit.util.Vector; + +import mineplex.core.Managers; +import mineplex.core.common.Pair; +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.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.EnchantedBookBuilder; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.leaderboard.Leaderboard; +import mineplex.core.leaderboard.LeaderboardManager; +import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType; +import mineplex.core.loot.ChestLoot; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.DeathMessageType; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.FirstBloodEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.GemData; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.games.castleassault.data.KillStreakData; +import nautilus.game.arcade.game.games.castleassault.data.ObjectiveTNTSpawner; +import nautilus.game.arcade.game.games.castleassault.data.TeamCrystal; +import nautilus.game.arcade.game.games.castleassault.data.TeamKing; +import nautilus.game.arcade.game.games.castleassault.kits.KitArcher; +import nautilus.game.arcade.game.games.castleassault.kits.KitDemolitionist; +import nautilus.game.arcade.game.games.castleassault.kits.KitFighter; +import nautilus.game.arcade.game.games.castleassault.kits.KitPlayer; +import nautilus.game.arcade.game.games.castleassault.kits.KitTank; +import nautilus.game.arcade.game.modules.compass.CompassModule; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager; + +public class CastleAssault extends TeamGame +{ + private static final int MAX_FLINT_AND_STEEL_USES = 4; + private static final int ITEMS_PER_CHEST = 5; + private static final long TIME_TILL_REFILL = 2 * 60 * 1000; + + private long _lastRefill; + + private ItemBuilder _flintAndSteel; + private ItemBuilder _wearableTnt; + + private Map _streakData = new WeakHashMap<>(); + private Map> _crystals = new HashMap<>(); + private Map _kings = new HashMap<>(); + private List _tntCarry = new ArrayList<>(); + + private List _chests = new ArrayList<>(); + + private ChestLoot _diamondGearCommon = new ChestLoot(true); + private ChestLoot _diamondGearRare = new ChestLoot(true); + private ChestLoot _weaponGearCommon = new ChestLoot(true); + private ChestLoot _weaponGearRare = new ChestLoot(true); + private ChestLoot _rangedGear = new ChestLoot(true); + private ChestLoot _rodsAndGaps = new ChestLoot(true); + private ChestLoot _potionGearCommon = new ChestLoot(true); + private ChestLoot _potionGearRare = new ChestLoot(true); + private ChestLoot _enchantGearCommon = new ChestLoot(true); + private ChestLoot _enchantGearRare = new ChestLoot(true); + private ChestLoot _miscGear = new ChestLoot(); + + private ObjectiveTNTSpawner _tntSpawner; + + private boolean _writeScoreboard = true; + + @SuppressWarnings("deprecation") + public CastleAssault(ArcadeManager manager) + { + super(manager, GameType.CastleAssault, + new Kit[] + { + //new KitAlchemist(manager), + new KitArcher(manager), + new KitDemolitionist(manager), + //new KitEnchanter(manager), + new KitFighter(manager), + //new KitHardline(manager), + //new KitNinja(manager), + new KitTank(manager) + }, + new String[] + { + "Destroy enemy sentry crystals with running TNT", + "After the crystals are destroyed you must slay their king", + "First team to kill the enemy king wins", + "Chests refill every 2 minutes", + "TNT Respawns every 1 minute" + } + ); + + _help = new String[] + { + "Use the TNT spawning platforms to run TNT to the enemy crystals to destroy them!", + "The enemy king is invulnerable until you destroy the two sentry crystals on each sentry tower", + "Go on Kill Streaks to earn Kill Streak Rewards to obtain better armor & weapons!", + "Chests refill every 2 minutes with potions, golden applegates, fishing rods, and other useful PvP items!" + }; + + this.StrictAntiHack = true; + this.HungerSet = 20; + this.DeathOut = false; + this.DeathSpectateSecs = 5; + this.CreatureAllow = false; + this.DeathDropItems = false; + this.WorldWeatherEnabled = false; + this.AllowParticles = false; + this.SoupEnabled = false; + this.InventoryClick = true; + this.InventoryOpenChest = true; + this.InventoryOpenBlock = true; + this.ItemDrop = true; + this.ItemPickup = true; + this.AllowFlintAndSteel = true; + this.BlockPlaceAllow.add(Material.FIRE.getId()); + this.CrownsEnabled = true; + this.Leaderboards = true; + this.FirstKillReward = 20; + this.GemKillDeathRespawn = 1; + + new CompassModule() + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); + + _flintAndSteel = new ItemBuilder(Material.FLINT_AND_STEEL).setData((short) (Material.FLINT_AND_STEEL.getMaxDurability() - MAX_FLINT_AND_STEEL_USES)); + _wearableTnt = new ItemBuilder(Material.TNT).setTitle(C.cRed + "TNT").addLore(C.cRedB + "Right Click with Weapon to " + F.name("Detonate")); + generateLoot(); + + if (manager.IsRewardStats()) + { + if (manager.GetLobby() instanceof NewGameLobbyManager) + { + Map> lobbyCustomLocs = ((NewGameLobbyManager)manager.GetLobby()).getCustomLocs(); + if (lobbyCustomLocs.containsKey("TOP_DAILY_WINS")) + { + Location loc = lobbyCustomLocs.get("TOP_DAILY_WINS").get(0); + Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_DAILY_WINS", new Leaderboard("Top Daily Wins", Pair.create("Win", "Wins"), new String[] {"Castle Assault.Wins"}, LeaderboardSQLType.DAILY, loc, 10)); + } + if (lobbyCustomLocs.containsKey("TOP_DAILY_KILLS")) + { + Location loc = lobbyCustomLocs.get("TOP_DAILY_KILLS").get(0); + Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_DAILY_KILLS", new Leaderboard("Top Daily Kills", Pair.create("Kill", "Kills"), new String[] {"Castle Assault.Kills"}, LeaderboardSQLType.DAILY, loc, 10)); + } + if (lobbyCustomLocs.containsKey("TOP_WINS")) + { + Location loc = lobbyCustomLocs.get("TOP_WINS").get(0); + Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_WINS", new Leaderboard("Top Wins", Pair.create("Win", "Wins"), new String[] {"Castle Assault.Wins"}, LeaderboardSQLType.ALL, loc, 10)); + } + if (lobbyCustomLocs.containsKey("TOP_KILLS")) + { + Location loc = lobbyCustomLocs.get("TOP_KILLS").get(0); + Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLEASSAULT_KILLS", new Leaderboard("Top Kills", Pair.create("Kill", "Kills"), new String[] {"Castle Assault.Kills"}, LeaderboardSQLType.ALL, loc, 10)); + } + } + } + } + + private void generateLoot() + { + { + _diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_HELMET), 2); + _diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_CHESTPLATE), 2); + _diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_LEGGINGS), 2); + _diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_BOOTS), 2); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1); + _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1); + } + { + _diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1); + _diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1); + _diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1); + _diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1); + } + { + _weaponGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).build(), 2); + _weaponGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 1).build(), 2); + } + { + _weaponGearRare.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 2).build(), 1); + } + { + _rangedGear.addLoot(new ItemStack(Material.BOW), 3); + _rangedGear.addLoot(Material.ARROW, 3, 8, 16); + } + { + _rodsAndGaps.addLoot(new ItemStack(Material.FISHING_ROD), 3); + _rodsAndGaps.addLoot(new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cPurple + "Golden Applegate").build(), 3); + } + { + _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)16418).build(), 2); + _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)16417).build(), 2); + } + { + _potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8193).build(), 2); + _potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8195).build(), 2); + } + { + _enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 2); + _enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.DAMAGE_ALL, 1).build(), 2); + _enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build(), 2); + _enchantGearCommon.addLoot(new ItemStack(Material.EXP_BOTTLE, 64), 1); + } + { + _enchantGearRare.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.FIRE_ASPECT, 1).build(), 1); + } + { + _miscGear.addLoot(new ItemStack(Material.ENDER_PEARL), 2); + _miscGear.addLoot(new ItemStack(Material.WATER_BUCKET), 2); + _miscGear.addLoot(_flintAndSteel.build(), 2); + _miscGear.addLoot(new ItemStack(Material.SNOW_BALL, 16), 3); + } + } + + private void fillChest(Block block) + { + if (block.getType() != Material.CHEST && block.getType() != Material.TRAPPED_CHEST) + { + return; + } + Chest chest = (Chest) block.getState(); + + chest.getBlockInventory().clear(); + int[] slots = UtilMath.random.ints(ITEMS_PER_CHEST, 0, chest.getBlockInventory().getSize()).toArray(); + + for (int slot : slots) + { + double chance = UtilMath.random.nextDouble(); + double subChance = UtilMath.random.nextDouble(); + + ChestLoot loot = _miscGear; + if (chance <= 0.6) + { + loot = _rodsAndGaps; + } + if (chance <= 0.5) + { + loot = _potionGearCommon; + if (subChance <= 0.45) + { + loot = _potionGearRare; + } + } + if (chance <= 0.3) + { + loot = _rangedGear; + } + chest.getBlockInventory().setItem(slot, loot.getLoot()); + } + } + + public ItemStack getNewFlintAndSteel(boolean kitItem) + { + if (kitItem) + { + return _flintAndSteel.clone().setLore(C.cGold + "Kit Item").build(); + } + return _flintAndSteel.build(); + } + + public void writeScoreboard() + { + if (!_writeScoreboard) + { + return; + } + Scoreboard.reset(); + Scoreboard.write(C.cDRedB + GetName()); + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGreenB + "Chest Refill"); + long refillTime = _lastRefill + TIME_TILL_REFILL - System.currentTimeMillis(); + if (!IsLive()) + { + refillTime = TIME_TILL_REFILL; + } + Scoreboard.write(UtilTime.MakeStr(refillTime)); + Scoreboard.writeNewLine(); + Scoreboard.write(C.cGreenB + "TNT Spawn"); + long tntTime = _tntSpawner.getNextTNT(); + if (!IsLive()) + { + tntTime = 60000; + } + if (_tntSpawner.isSpawned()) + { + Scoreboard.write("Spawned"); + } + else + { + Scoreboard.write(UtilTime.MakeStr(tntTime)); + } + Scoreboard.writeNewLine(); + GameTeam red = GetTeam(ChatColor.RED); + long redCrystals = _crystals.get(red).stream().filter(TeamCrystal::isActive).count(); + GameTeam blue = GetTeam(ChatColor.AQUA); + long blueCrystals = _crystals.get(blue).stream().filter(TeamCrystal::isActive).count(); + if (redCrystals > 0) + { + Scoreboard.write(_kings.get(red).getName(true)); + Scoreboard.write(redCrystals + "/2 Crystals Active"); + } + else + { + Scoreboard.write(_kings.get(red).getName(true) + " Health"); + Scoreboard.write(_kings.get(red).getHealth() + ""); + } + Scoreboard.writeNewLine(); + if (blueCrystals > 0) + { + Scoreboard.write(_kings.get(blue).getName(true)); + Scoreboard.write(blueCrystals + "/2 Crystals Active"); + } + else + { + Scoreboard.write(_kings.get(blue).getName(true) + " Health"); + Scoreboard.write(_kings.get(blue).getHealth() + ""); + } + Scoreboard.draw(); + } + + public void writeFinalScoreboard(String deadKing, String winKing, String warrior) + { + _writeScoreboard = false; + Scoreboard.reset(); + Scoreboard.writeNewLine(); + Scoreboard.write(deadKing + "'s " + C.cWhite + "castle has been conquered"); + Scoreboard.write(C.cWhite + "by " + winKing + "'s " + C.cWhite + "army with the help of"); + Scoreboard.write(warrior + C.cWhite + "!"); + Scoreboard.writeNewLine(); + + Scoreboard.draw(); + } + + @Override + public void ParseData() + { + for (Location chestLoc : WorldData.GetDataLocs("BROWN")) + { + Block block = chestLoc.getBlock(); + block.setType(Material.CHEST); + fillChest(block); + _chests.add(block); + } + GameTeam red = GetTeam(ChatColor.RED); + GameTeam blue = GetTeam(ChatColor.AQUA); + Location redKing = WorldData.GetDataLocs("RED").get(0); + Location blueKing = WorldData.GetDataLocs("BLUE").get(0); + Vector redBlue = UtilAlg.getTrajectory(redKing, blueKing); + Vector blueRed = UtilAlg.getTrajectory(blueKing, redKing); + redKing.setPitch(UtilAlg.GetPitch(redBlue)); + redKing.setYaw(UtilAlg.GetYaw(redBlue)); + blueKing.setPitch(UtilAlg.GetPitch(blueRed)); + blueKing.setYaw(UtilAlg.GetYaw(blueRed)); + _crystals.put(red, Arrays.asList(new TeamCrystal(red, WorldData.GetDataLocs("PINK").get(0)), new TeamCrystal(red, WorldData.GetDataLocs("PINK").get(1)))); + _crystals.put(blue, Arrays.asList(new TeamCrystal(blue, WorldData.GetDataLocs("LIGHT_BLUE").get(0)), new TeamCrystal(blue, WorldData.GetDataLocs("LIGHT_BLUE").get(1)))); + this.CreatureAllowOverride = true; + _kings.put(red, new TeamKing(red, "King Jon", redKing)); + _kings.put(blue, new TeamKing(blue, "King Ryan", blueKing)); + int kitIndex = 0; + for (int i = 0; i < WorldData.GetDataLocs("WHITE").size(); i++) + { + if (kitIndex >= GetKits().length) + { + kitIndex = 0; + } + Entity ent = GetKits()[kitIndex].SpawnEntity(WorldData.GetDataLocs("WHITE").get(i)); + Manager.GetLobby().addKitLocation(ent, GetKits()[kitIndex], WorldData.GetDataLocs("WHITE").get(i)); + kitIndex++; + } + this.CreatureAllowOverride = false; + _tntSpawner = new ObjectiveTNTSpawner(WorldData.GetDataLocs("BLACK")); + } + + @Override + public void EndCheck() + { + if (!IsLive()) + { + return; + } + + List 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) + { + GameTeam winner = teamsAlive.get(0); + TeamKing king = _kings.get(winner); + TeamKing dead = _kings.values().stream().filter(k -> k.getOwner().GetColor() != king.getOwner().GetColor()).findFirst().get(); + AnnounceEnd(winner); + writeFinalScoreboard(dead.getName(false), king.getName(false), dead.getOwner().GetColor() + "Quitters"); + for (GameTeam team : GetTeamList()) + { + for (Player player : team.GetPlayers(true)) + { + if (team.GetColor() == winner.GetColor()) + { + AddGems(player, 100, "Winning Team", false, false); + } + else + { + AddGems(player, 50, "Losing Team", false, false); + } + if (player.isOnline()) + { + AddGems(player, 10, "Participation", false, false); + } + + { + int crowns = 0; + for (GemData data : GetGems(player).values()) + { + crowns += data.Gems; + } + int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); + if (streak >= 2 && streak < 4) + { + AddGems(player, 0.5 * crowns, streak + " Player Kill Streak", false, false); + } + else if (streak >= 4 && streak < 6) + { + AddGems(player, crowns, streak + " Player Kill Streak", false, false); + } + else if (streak >= 6 && streak < 8) + { + AddGems(player, 1.5 * crowns, streak + " Player Kill Streak", false, false); + } + else if (streak >= 8) + { + AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false); + } + } + + if (GetKit(player) != null) + { + KitPlayer kit = (KitPlayer) GetKit(player); + int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); + if (kitLevel > 0) + { + int crowns = 0; + for (GemData data : GetGems(player).values()) + { + crowns += data.Gems; + } + + AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); + } + } + } + } + SetState(GameState.End); + return; + } + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) {}; + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + if (IsLive()) + { + if (UtilTime.elapsed(_lastRefill, TIME_TILL_REFILL)) + { + _lastRefill = System.currentTimeMillis(); + _chests.forEach(this::fillChest); + Bukkit.broadcastMessage(C.cGreenB + "Chests have refilled!"); + } + + GameTeam red = GetTeam(ChatColor.RED); + GameTeam blue = GetTeam(ChatColor.AQUA); + TeamKing redKing = _kings.get(red); + TeamKing blueKing = _kings.get(blue); + redKing.update(_crystals.get(red).stream().filter(TeamCrystal::isActive).count() > 0); + if (redKing.isDead()) + { + AnnounceEnd(blue); + writeFinalScoreboard(redKing.getName(false), blueKing.getName(false), blue.GetColor() + redKing.getLastDamager()); + for (GameTeam team : GetTeamList()) + { + for (Player player : team.GetPlayers(true)) + { + if (player.getName().equals(redKing.getLastDamager())) + { + AddGems(player, 20, "King Slayer", false, false); + } + if (team.GetColor() == ChatColor.AQUA) + { + AddGems(player, 100, "Winning Team", false, false); + } + else + { + AddGems(player, 50, "Losing Team", false, false); + } + if (player.isOnline()) + { + AddGems(player, 10, "Participation", false, false); + } + + int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); + if (streak > 0) + { + AddGems(player, streak, streak + " Player Kill Streak", false, false); + } + + KitPlayer kit = (KitPlayer) GetKit(player); + int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); + if (kitLevel > 0) + { + int crowns = 0; + for (GemData data : GetGems(player).values()) + { + crowns += data.Gems; + } + + AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); + } + } + } + SetState(GameState.End); + return; + } + blueKing.update(_crystals.get(blue).stream().filter(TeamCrystal::isActive).count() > 0); + if (blueKing.isDead()) + { + AnnounceEnd(red); + writeFinalScoreboard(blueKing.getName(false), redKing.getName(false), red.GetColor() + blueKing.getLastDamager()); + for (GameTeam team : GetTeamList()) + { + for (Player player : team.GetPlayers(true)) + { + if (player.getName().equals(blueKing.getLastDamager())) + { + AddGems(player, 20, "King Slayer", false, false); + } + if (team.GetColor() == ChatColor.RED) + { + AddGems(player, 100, "Winning Team", false, false); + } + else + { + AddGems(player, 50, "Losing Team", false, false); + } + if (player.isOnline()) + { + AddGems(player, 10, "Participation", false, false); + } + + int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); + if (streak > 0) + { + AddGems(player, streak, streak + " Player Kill Streak", false, false); + } + + KitPlayer kit = (KitPlayer) GetKit(player); + int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); + if (kitLevel > 0) + { + int crowns = 0; + for (GemData data : GetGems(player).values()) + { + crowns += data.Gems; + } + + AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); + } + } + } + SetState(GameState.End); + return; + } + + _tntSpawner.update(); + } + if (InProgress()) + { + writeScoreboard(); + } + } + + @EventHandler + public void onEditSettings(GameStateChangeEvent event) + { + if (event.GetGame() != this) + { + return; + } + + if (event.GetState() == GameState.Live) + { + _lastRefill = System.currentTimeMillis(); + _tntSpawner.onStart(); + Manager.GetDamage().SetEnabled(false); + Manager.GetExplosion().setEnabled(false); + Manager.GetCreature().SetDisableCustomDrops(true); + } + + if (event.GetState() == GameState.End) + { + Manager.GetDamage().SetEnabled(true); + Manager.GetExplosion().setEnabled(true); + Manager.GetCreature().SetDisableCustomDrops(false); + Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_DAILY_WINS"); + Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_DAILY_KILLS"); + Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_WINS"); + Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLEASSAULT_KILLS"); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void handleDeath(CombatDeathEvent event) + { + if (!IsLive()) + { + return; + } + + event.SetBroadcastType(DeathMessageType.Detailed); + } + + @EventHandler + public void disableDamageLevel(CustomDamageEvent event) + { + event.SetDamageToLevel(false); + } + + @EventHandler + public void BlockFade(BlockFadeEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void BlockBurn(BlockBurnEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void BlockDecay(LeavesDecayEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void hangingBreak(HangingBreakEvent event) + { + if (event.getEntity() instanceof ItemFrame || event.getEntity() instanceof Painting) + { + event.setCancelled(true); + } + } + + @EventHandler + public void noFlow(BlockFromToEvent event) + { + if (!IsLive()) + { + return; + } + + Block block = event.getBlock(); + if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER || block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA) + { + event.setCancelled(true); + } + if (event.getToBlock().getType() == Material.ICE) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockChange(BlockFormEvent e) + { + if (!IsLive()) + { + return; + } + if (e.getNewState().getType() == Material.ICE) + { + e.setCancelled(true); + } + } + + @SuppressWarnings("deprecation") + @EventHandler(ignoreCancelled=true) + public void onPlayerEmptyBucket(PlayerBucketEmptyEvent event) + { + if (!IsLive()) + { + return; + } + + Player player = event.getPlayer(); + if (player.getItemInHand().getType() == Material.WATER_BUCKET) + { + player.getItemInHand().setType(Material.BUCKET); + Block block = event.getBlockClicked().getRelative(event.getBlockFace()); + if (block.getType().toString().contains("LAVA") || (block.getType().toString().contains("WATER") && block.getType() != Material.WATER_LILY)) + { + event.setCancelled(true); + player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); + return; + } + for (BlockFace bf : BlockFace.values()) + { + Block relative = block.getRelative(bf); + if (relative.getType().toString().contains("LAVA") || (relative.getType().toString().contains("WATER") && relative.getType() != Material.WATER_LILY)) + { + event.setCancelled(true); + player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); + } + } + } + else if (player.getItemInHand().getType() == Material.LAVA_BUCKET) + { + event.setCancelled(true); + Block block = event.getBlockClicked().getRelative(event.getBlockFace()); + player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); + } + } + + @SuppressWarnings("deprecation") + @EventHandler(ignoreCancelled=true) + public void onPlayerEmptyBucket(PlayerBucketFillEvent event) + { + if (!IsLive()) + { + return; + } + + Player player = event.getPlayer(); + if (player.getItemInHand().getType() == Material.LAVA_BUCKET) + { + event.setCancelled(true); + Block block = event.getBlockClicked().getRelative(event.getBlockFace()); + player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); + } + } + + @EventHandler(ignoreCancelled=true) + public void onBlockDispense(BlockDispenseEvent event) + { + if (!IsLive()) + { + return; + } + + if (event.getItem().getType() == Material.WATER_BUCKET) + { + Block dispenser = event.getBlock(); + + MaterialData mat = dispenser.getState().getData(); + Dispenser disp_mat = (Dispenser)mat; + BlockFace face = disp_mat.getFacing(); + Block block = dispenser.getRelative(face); + if (block.getType().toString().contains("LAVA") || (block.getType().toString().contains("WATER") && block.getType() != Material.WATER_LILY)) + { + event.setCancelled(true); + return; + } + for (BlockFace bf : BlockFace.values()) + { + if (block.getRelative(bf).getType().toString().contains("LAVA") || (block.getRelative(bf).getType().toString().contains("WATER") && block.getRelative(bf).getType() != Material.WATER_LILY)) + { + event.setCancelled(true); + } + } + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCombatDeath(CombatDeathEvent event) + { + if (!IsLive()) + { + return; + } + + if (event.GetLog().GetKiller() == null) + { + return; + } + + if (!event.GetLog().GetKiller().IsPlayer()) + { + return; + } + + Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (player == null) + { + return; + } + + AddStat(player, GetKit(player).GetName() + "KitKills", 1, false, false); + + if (UtilPlayer.isSpectator(player)) + { + return; + } + + player.setLevel(player.getLevel() + 1); + player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cPurple + "Golden Applegate").build()); + KillStreakData data = _streakData.computeIfAbsent(player, (key) -> new KillStreakData()); + boolean hardLine = GetKit(player).GetName().equals("Hardline"); + if (data.addKill(hardLine)) + { + AddStat(player, "KillStreak", 1, false, false); + ((KitPlayer)GetKit(player)).awardKillStreak(player, hardLine ? (data.getKills() + 1) : data.getKills()); + } + if (UtilMath.isEven(data.getKills())) + { + Bukkit.broadcastMessage(F.main("Game", C.cGreen + C.Bold + player.getName() + ChatColor.RESET + " is on a " + F.elem(C.cDPurple + data.getKills() + " player Kill Streak") + "!")); + } + } + + @EventHandler + public void TNTExplosion(ExplosionPrimeEvent event) + { + if (!event.getEntity().hasMetadata("THROWER")) + { + return; + } + float radius = event.getRadius(); + event.setRadius(0f); + + Player player = UtilPlayer.searchExact(((MetadataValue)UtilEnt.GetMetadata(event.getEntity(), "THROWER")).asString()); + if (player == null) + { + return; + } + if (GetTeam(player) == null) + { + return; + } + if (GetKit(player).GetName().equals("Demolitionist")) + { + radius += 3; + } + + Map nearby = UtilPlayer.getInRadius(event.getEntity().getLocation(), radius); + for (Player near : nearby.keySet()) + { + if (UtilPlayer.isSpectator(near)) + { + continue; + } + if (near.getEntityId() != player.getEntityId() && GetTeam(near).GetColor() == GetTeam(player).GetColor()) + { + continue; + } + if (near.getEntityId() == player.getEntityId() && event.getEntity().hasMetadata("OBJECTIVE_TNT")) + { + continue; + } + + double mult = nearby.get(near); + + int highestBlastProt = 0; + int blastProtEPF = 0; + for (ItemStack item : near.getInventory().getArmorContents()) + { + if (item != null && item.getEnchantments().containsKey(Enchantment.PROTECTION_EXPLOSIONS)) + { + blastProtEPF += (2 * item.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS)); + if (item.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS) > highestBlastProt) + { + highestBlastProt = item.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS); + } + } + } + blastProtEPF = Math.min(blastProtEPF, 20); + + double damage = 8 * mult; + damage = damage * (1 - (blastProtEPF / 25)); + + double knockbackReduction = 1 - (highestBlastProt * 0.15); + + near.damage(damage, event.getEntity()); + UtilAction.velocity(near, UtilAlg.getTrajectory(event.getEntity().getLocation(), near.getLocation()), 1 * mult * knockbackReduction, false, 0, mult * knockbackReduction, 10, true); + } + + if (event.getEntity().hasMetadata("OBJECTIVE_TNT")) + { + List crystals = new ArrayList<>(); + + for (List c : _crystals.values()) + { + crystals.addAll(c); + } + for (TeamCrystal crystal : crystals) + { + if (crystal.isActive() && !crystal.getOwner().HasPlayer(player) && UtilMath.offset(event.getEntity().getLocation(), crystal.getLocation()) <= radius) + { + crystal.destroy(); + AddGems(player, 40, "Crystal Destruction", false, true); + long remaining = crystals.stream().filter(b -> b.getOwner().GetColor() == crystal.getOwner().GetColor()).filter(TeamCrystal::isActive).count(); + if (remaining > 0) + { + Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(crystal.getOwner().GetFormattedName() + "'s Crystals") + " has been destroyed!")); + } + else + { + Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(crystal.getOwner().GetFormattedName() + "'s Crystals") + " has been destroyed and " + F.elem(_kings.get(crystal.getOwner()).getName(false)) + " is now vulnerable!")); + } + } + } + for (TeamKing king : _kings.values()) + { + if (king.isDead() && !king.getOwner().HasPlayer(player) && UtilMath.offset(event.getEntity().getLocation(), king.getLocation()) <= radius) + { + king.handleDamage(player.getName(), 50); + } + } + } + } + + @EventHandler + public void TNTThrow(PlayerInteractEvent event) + { + if (!IsLive()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.L)) + { + return; + } + + Player player = event.getPlayer(); + + if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0)) + { + return; + } + + if (!IsAlive(player)) + { + return; + } + + event.setCancelled(true); + + if (!Manager.GetGame().CanThrowTNT(player.getLocation())) + { + // Inform + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throwing 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); + + tnt.setFuseTicks(60); + + double throwMult = 1; + + if (GetKit(player).GetName().equals("Demolitionist")) + { + throwMult = ((KitDemolitionist)GetKit(player)).getThrowMultiplier(player); + } + + UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5 * throwMult, false, 0, 0.1, 10, false); + + UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); + } + + @EventHandler + public void onLaunch(ProjectileHitEvent event) + { + if (!IsLive()) + { + return; + } + + if (event.getEntity() instanceof EnderPearl && event.getEntity().getShooter() != null && event.getEntity().getShooter() instanceof Entity) + { + Entity shooter = (Entity) event.getEntity().getShooter(); + if (_tntCarry.contains(shooter)) + { + return; + } + Location teleport = event.getEntity().getLocation(); + teleport.setPitch(shooter.getLocation().getPitch()); + teleport.setYaw(shooter.getLocation().getYaw()); + shooter.teleport(teleport); + } + if (event.getEntity() instanceof Arrow) + { + Manager.runSyncLater(event.getEntity()::remove, 1L); + } + } + + @EventHandler + public void onOpenChest(PlayerInteractEvent event) + { + if (!IsLive()) + { + return; + } + + if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.CHEST) + { + if (UtilPlayer.isSpectator(event.getPlayer())) + { + event.setCancelled(true); + } + } + } + + @EventHandler(ignoreCancelled = true) + public void onDamage(EntityDamageEvent event) + { + if (!IsLive()) + { + return; + } + if (event.getEntity() instanceof EnderCrystal) + { + event.setCancelled(true); + return; + } + if (event.getEntity() instanceof Zombie) + { + event.setCancelled(true); + if (event instanceof EntityDamageByEntityEvent) + { + GameTeam owner = event.getEntity().getCustomName().contains("Ryan") ? GetTeam(ChatColor.AQUA) : GetTeam(ChatColor.RED); + EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event; + if (e.getDamager() instanceof Player) + { + Player p = (Player) e.getDamager(); + if (UtilPlayer.isSpectator(p)) + { + return; + } + if (owner.HasPlayer(p)) + { + return; + } + if (_crystals.get(owner).stream().filter(TeamCrystal::isActive).count() > 0) + { + UtilPlayer.message(p, F.main("Game", "You cannot attack the enemy king until your team has destroyed his protective crystals!")); + return; + } + TeamKing king = _kings.get(owner); + if (king.handleDamage(p.getName(), e.getDamage())) + { + for (Player alert : owner.GetPlayers(true)) + { + if (Recharge.Instance.use(alert, "KingDamageAlert", 5000, false, false)) + { + alert.sendMessage(king.getName(true) + " is under attack!"); + } + } + } + } + } + } + } + + @EventHandler + public void onDrop(PlayerDropItemEvent event) + { + if (!IsLive()) + { + return; + } + + ItemStack drop = event.getItemDrop().getItemStack(); + if (drop.hasItemMeta() && drop.getItemMeta().hasLore() && drop.getItemMeta().getLore().stream().map(ChatColor::stripColor).anyMatch(lore -> lore.equals("Kit Item"))) + { + event.setCancelled(true); + return; + } + + event.getItemDrop().remove(); + } + + @EventHandler + public void craftItem(PrepareItemCraftEvent event) + { + if (!IsLive()) + { + return; + } + + if (event.getInventory().getResult().getType() == Material.FLINT_AND_STEEL) + { + event.getInventory().setResult(_flintAndSteel.build()); + } + } + + @EventHandler + public void onInvClick(InventoryClickEvent event) + { + if (!IsLive()) + { + return; + } + ItemStack current = event.getCurrentItem(); + if (event.getAction() == InventoryAction.HOTBAR_SWAP || event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD) + { + current = event.getWhoClicked().getInventory().getItem(event.getHotbarButton()); + } + if (current == null || !current.hasItemMeta()) + { + return; + } + if (current.getItemMeta().hasDisplayName() && current.getItemMeta().getDisplayName().equals(C.cRed + "TNT")) + { + event.setCancelled(true); + return; + } + if (event.getView().getTopInventory() != null && event.getView().getTopInventory().getType() == InventoryType.CHEST) + { + if (current.getItemMeta().hasLore()) + { + for (String lore : current.getItemMeta().getLore()) + { + if (ChatColor.stripColor(lore).equalsIgnoreCase("Kit Item")) + { + event.setCancelled(true); + break; + } + } + } + + } + } + + @EventHandler + public void onFirstBlood(FirstBloodEvent event) + { + if (!IsLive()) + { + return; + } + + AddStat(event.getPlayer(), "FirstBlood", 1, true, false); + } + + @EventHandler + public void onPearl(PlayerInteractEvent event) + { + if (!IsLive()) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (event.getItem() != null && event.getItem().getType() == Material.ENDER_PEARL) + { + Player player = (Player) event.getPlayer(); + if (!Recharge.Instance.use(player, "Enderpearl", 4000, true, true)) + { + event.setCancelled(true); + player.updateInventory(); + } + } + } + + @EventHandler + public void onItemDespawn(ItemDespawnEvent event) + { + if (!IsLive()) + { + return; + } + + if (_tntSpawner.isSpawned()) + { + if (_tntSpawner.getItem().getEntityId() == event.getEntity().getEntityId()) + { + event.setCancelled(true); + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onPickup(PlayerPickupItemEvent event) + { + if (!IsLive()) + { + return; + } + + if (_tntSpawner.isSpawned() && event.getItem().getEntityId() == _tntSpawner.getItem().getEntityId()) + { + event.setCancelled(true); + if (!_tntCarry.contains(event.getPlayer())) + { + _tntSpawner.pickup(); + _tntCarry.add(event.getPlayer()); + event.getPlayer().setMetadata("OLD_HELM", new FixedMetadataValue(UtilServer.getPlugin(), event.getPlayer().getInventory().getHelmet())); + event.getPlayer().setMetadata("TNT_START", new FixedMetadataValue(UtilServer.getPlugin(), System.currentTimeMillis())); + event.getPlayer().getInventory().setHelmet(_wearableTnt.build()); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You picked up " + F.skill("TNT") + ".")); + UtilPlayer.message(event.getPlayer(), F.main("Game", F.elem("Right-Click") + " to detonate yourself.")); + UtilPlayer.message(event.getPlayer(), F.main("Game", "Run to the enemy Crystal and Detonate to destroy it.")); + } + } + } + + @EventHandler(ignoreCancelled = true) + public void TNTUse(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!_tntCarry.contains(player)) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + event.setCancelled(true); + + player.getInventory().setHelmet((ItemStack) player.getMetadata("OLD_HELM").get(0).value()); + player.removeMetadata("OLD_HELM", UtilServer.getPlugin()); + player.removeMetadata("TNT_START", UtilServer.getPlugin()); + _tntCarry.remove(player); + + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); + UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); + UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true); + tnt.setFuseTicks(0); + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); + } + + @EventHandler + public void TNTExpire(UpdateEvent event) + { + if (!IsLive()) + { + return; + } + + if (event.getType() != UpdateType.FASTER) + { + return; + } + + Iterator tntIterator = _tntCarry.iterator(); + + while (tntIterator.hasNext()) + { + Player player = tntIterator.next(); + + if (player.isDead() || UtilTime.elapsed(player.getMetadata("TNT_START").get(0).asLong(), 60000)) + { + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); + UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); + UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true); + tnt.setFuseTicks(0); + + if (!player.isDead()) + { + player.getInventory().setHelmet((ItemStack) player.getMetadata("OLD_HELM").get(0).value()); + } + player.removeMetadata("OLD_HELM", UtilServer.getPlugin()); + player.removeMetadata("TNT_START", UtilServer.getPlugin()); + + tntIterator.remove(); + continue; + } + + List crystals = new ArrayList<>(); + + for (List c : _crystals.values()) + { + crystals.addAll(c); + } + for (TeamCrystal crystal : crystals) + { + if (crystal.isActive() && !crystal.getOwner().HasPlayer(player) && UtilMath.offset(player.getLocation(), crystal.getLocation()) <= 3) + { + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); + UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); + UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true); + tnt.setFuseTicks(0); + + if (!player.isDead()) + { + player.getInventory().setHelmet((ItemStack) player.getMetadata("OLD_HELM").get(0).value()); + } + player.removeMetadata("OLD_HELM", UtilServer.getPlugin()); + player.removeMetadata("TNT_START", UtilServer.getPlugin()); + + tntIterator.remove(); + } + } + + UtilTextBottom.display(GetTeam(player).GetColor() + player.getName() + " has the TNT!", UtilServer.getPlayers()); + UtilFirework.playFirework(player.getEyeLocation(), Type.BURST, Color.RED, false, false); + } + } + + @EventHandler + public void onDeath(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + _streakData.getOrDefault(player, new KillStreakData()).reset(); + + if (!_tntCarry.contains(player)) + { + return; + } + + player.removeMetadata("OLD_HELM", UtilServer.getPlugin()); + player.removeMetadata("TNT_START", UtilServer.getPlugin()); + _tntCarry.remove(player); + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); + UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); + UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true); + tnt.setFuseTicks(0); + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); + } + + @EventHandler + public void onBlockPlace(BlockPlaceEvent event) + { + if (!_tntSpawner.canPlaceFireAt(event.getBlock())) + { + event.setCancelled(true); + } + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiegeTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiegeTDM.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java index 50e9a7d65..a64fff374 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiegeTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/CastleAssaultTDM.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege; +package nautilus.game.arcade.game.games.castleassault; import java.util.ArrayList; import java.util.HashMap; @@ -72,19 +72,19 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GemData; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.castlesiege.data.KillStreakData; -import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalData; -import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalData.MedalLevel; -import nautilus.game.arcade.game.games.castlesiege.kits.KitArcher; -import nautilus.game.arcade.game.games.castlesiege.kits.KitDemolitionist; -import nautilus.game.arcade.game.games.castlesiege.kits.KitFighter; -import nautilus.game.arcade.game.games.castlesiege.kits.KitPlayer; -import nautilus.game.arcade.game.games.castlesiege.kits.KitTank; -import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalType; +import nautilus.game.arcade.game.games.castleassault.data.KillStreakData; +import nautilus.game.arcade.game.games.castleassault.data.medals.MedalData; +import nautilus.game.arcade.game.games.castleassault.data.medals.MedalData.MedalLevel; +import nautilus.game.arcade.game.games.castleassault.data.medals.MedalType; +import nautilus.game.arcade.game.games.castleassault.kits.KitArcher; +import nautilus.game.arcade.game.games.castleassault.kits.KitDemolitionist; +import nautilus.game.arcade.game.games.castleassault.kits.KitFighter; +import nautilus.game.arcade.game.games.castleassault.kits.KitPlayer; +import nautilus.game.arcade.game.games.castleassault.kits.KitTank; import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; -public class CastleSiegeTDM extends TeamGame +public class CastleAssaultTDM extends TeamGame { private static final int MAX_FLINT_AND_STEEL_USES = 4; private static final int ITEMS_PER_CHEST = 5; @@ -116,9 +116,9 @@ public class CastleSiegeTDM extends TeamGame private boolean _writeScoreboard = true; @SuppressWarnings("deprecation") - public CastleSiegeTDM(ArcadeManager manager) + public CastleAssaultTDM(ArcadeManager manager) { - super(manager, GameType.CastleSiegeTDM, + super(manager, GameType.CastleAssaultTDM, new Kit[] { //new KitAlchemist(manager), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/CapturePoint.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/CapturePoint.java similarity index 90% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/CapturePoint.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/CapturePoint.java index 3952467e6..43709f165 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/CapturePoint.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/CapturePoint.java @@ -1,71 +1,71 @@ -package nautilus.game.arcade.game.games.castlesiege.data; - -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import nautilus.game.arcade.game.GameTeam; - -public class CapturePoint -{ - private static final int POINTS_TO_CAPTURE = 100; - private static final long TIME_PER_POINT = 1000; - private static final int POINTS_PER_TICK = 1; - - private Location _loc; - - private long _lastCap; - private int _points = 0; - private GameTeam _owner = null; - - public CapturePoint(GameTeam owner, Location loc) - { - _owner = owner; - - _loc = loc; - } - - public int getMaxPoints() - { - return POINTS_TO_CAPTURE; - } - - public int getPoints() - { - return _points; - } - - public boolean isCaptured() - { - return _points >= POINTS_TO_CAPTURE; - } - - public void update() - { - if (!UtilTime.elapsed(_lastCap, TIME_PER_POINT)) - { - return; - } - - int capping = 0; - for (Player player : UtilPlayer.getInRadius(_loc, 3.5).keySet()) - { - if (UtilPlayer.isSpectator(player)) - { - continue; - } - if (_owner.HasPlayer(player)) - { - continue; - } - capping++; - } - - if (capping > 0 && _points < POINTS_TO_CAPTURE) - { - _lastCap = System.currentTimeMillis(); - _points += POINTS_PER_TICK; - } - } +package nautilus.game.arcade.game.games.castleassault.data; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import nautilus.game.arcade.game.GameTeam; + +public class CapturePoint +{ + private static final int POINTS_TO_CAPTURE = 100; + private static final long TIME_PER_POINT = 1000; + private static final int POINTS_PER_TICK = 1; + + private Location _loc; + + private long _lastCap; + private int _points = 0; + private GameTeam _owner = null; + + public CapturePoint(GameTeam owner, Location loc) + { + _owner = owner; + + _loc = loc; + } + + public int getMaxPoints() + { + return POINTS_TO_CAPTURE; + } + + public int getPoints() + { + return _points; + } + + public boolean isCaptured() + { + return _points >= POINTS_TO_CAPTURE; + } + + public void update() + { + if (!UtilTime.elapsed(_lastCap, TIME_PER_POINT)) + { + return; + } + + int capping = 0; + for (Player player : UtilPlayer.getInRadius(_loc, 3.5).keySet()) + { + if (UtilPlayer.isSpectator(player)) + { + continue; + } + if (_owner.HasPlayer(player)) + { + continue; + } + capping++; + } + + if (capping > 0 && _points < POINTS_TO_CAPTURE) + { + _lastCap = System.currentTimeMillis(); + _points += POINTS_PER_TICK; + } + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/KillStreakData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/KillStreakData.java similarity index 85% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/KillStreakData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/KillStreakData.java index 2735f5026..1e86d8266 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/KillStreakData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/KillStreakData.java @@ -1,47 +1,47 @@ -package nautilus.game.arcade.game.games.castlesiege.data; - -public class KillStreakData -{ - private static final int[] REWARDED_STREAKS = {2, 4, 6, 8}; - private int _kills; - private int _bestStreak; - - public KillStreakData() - { - _kills = 0; - _bestStreak = 0; - } - - public int getKills() - { - return _kills; - } - - public int getBestStreak() - { - return Math.max(_bestStreak, _kills); - } - - public boolean addKill(boolean hardLine) - { - _kills++; - for (int streak : REWARDED_STREAKS) - { - if ((_kills + (hardLine ? 1 : 0)) == streak) - { - return true; - } - } - - return false; - } - - public void reset() - { - if (_kills > _bestStreak) - { - _bestStreak = _kills; - } - _kills = 0; - } +package nautilus.game.arcade.game.games.castleassault.data; + +public class KillStreakData +{ + private static final int[] REWARDED_STREAKS = {2, 4, 6, 8}; + private int _kills; + private int _bestStreak; + + public KillStreakData() + { + _kills = 0; + _bestStreak = 0; + } + + public int getKills() + { + return _kills; + } + + public int getBestStreak() + { + return Math.max(_bestStreak, _kills); + } + + public boolean addKill(boolean hardLine) + { + _kills++; + for (int streak : REWARDED_STREAKS) + { + if ((_kills + (hardLine ? 1 : 0)) == streak) + { + return true; + } + } + + return false; + } + + public void reset() + { + if (_kills > _bestStreak) + { + _bestStreak = _kills; + } + _kills = 0; + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/ObjectiveTNTSpawner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/ObjectiveTNTSpawner.java similarity index 87% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/ObjectiveTNTSpawner.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/ObjectiveTNTSpawner.java index 18cb00cf5..076913cf1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/ObjectiveTNTSpawner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/ObjectiveTNTSpawner.java @@ -1,97 +1,100 @@ -package nautilus.game.arcade.game.games.castlesiege.data; - -import java.util.List; - -import org.bukkit.Color; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Item; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilTime; - -public class ObjectiveTNTSpawner -{ - private static final long TNT_SPAWN_DELAY = 60000; - private List _locs; - private Location _lastSpawnLoc; - private Item _entity; - private long _lastPickedUp; - - public ObjectiveTNTSpawner(List locs) - { - _locs = locs; - _lastSpawnLoc = null; - _entity = null; - _lastPickedUp = System.currentTimeMillis(); - } - - public Item getItem() - { - return _entity; - } - - public boolean isSpawned() - { - return _entity != null; - } - - public boolean canPlaceFireAt(Block block) - { - if (!isSpawned()) - { - return false; - } - - return UtilMath.offsetSquared(_lastSpawnLoc, block.getLocation()) <= 9; - } - - public long getNextTNT() - { - return (_lastPickedUp + TNT_SPAWN_DELAY) - System.currentTimeMillis(); - } - - public void spawn() - { - Location spawn = _locs.get(UtilMath.r(_locs.size())); - spawn.getBlock().getRelative(BlockFace.DOWN).setType(Material.REDSTONE_BLOCK); - _lastSpawnLoc = spawn.clone(); - _entity = spawn.getWorld().dropItem(spawn, new ItemStack(Material.TNT)); - UtilFirework.playFirework(spawn, Type.BURST, Color.RED, false, false); - } - - public void pickup() - { - _entity.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK); - _entity.remove(); - _entity = null; - _lastSpawnLoc = null; - _lastPickedUp = System.currentTimeMillis(); - } - - public void update() - { - if (!isSpawned() && UtilTime.elapsed(_lastPickedUp, TNT_SPAWN_DELAY)) - { - spawn(); - } - else if (isSpawned()) - { - _entity.teleport(_lastSpawnLoc); - if (!_entity.isValid() || _entity.isDead()) - { - _entity = _lastSpawnLoc.getWorld().dropItem(_lastSpawnLoc, new ItemStack(Material.TNT)); - } - } - } - - public void onStart() - { - _lastPickedUp = System.currentTimeMillis(); - } +package nautilus.game.arcade.game.games.castleassault.data; + +import java.util.List; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Item; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; + +public class ObjectiveTNTSpawner +{ + private static final long TNT_SPAWN_DELAY = 60000; + private List _locs; + private Location _lastSpawnLoc; + private Item _entity; + private long _lastPickedUp; + + public ObjectiveTNTSpawner(List locs) + { + _locs = locs; + _lastSpawnLoc = null; + _entity = null; + _lastPickedUp = System.currentTimeMillis(); + } + + public Item getItem() + { + return _entity; + } + + public boolean isSpawned() + { + return _entity != null; + } + + public boolean canPlaceFireAt(Block block) + { + for (Location loc : _locs) + { + if (UtilMath.offsetSquared(loc, block.getLocation()) <= 9) + { + return false; + } + } + + return true; + } + + public long getNextTNT() + { + return (_lastPickedUp + TNT_SPAWN_DELAY) - System.currentTimeMillis(); + } + + public void spawn() + { + Location spawn = _locs.get(UtilMath.r(_locs.size())); + spawn.getBlock().getRelative(BlockFace.DOWN).setType(Material.REDSTONE_BLOCK); + _lastSpawnLoc = spawn.clone(); + _entity = spawn.getWorld().dropItem(spawn, new ItemStack(Material.TNT)); + UtilFirework.playFirework(spawn, Type.BURST, Color.RED, false, false); + } + + public void pickup() + { + _entity.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK); + _entity.remove(); + _entity = null; + _lastSpawnLoc = null; + _lastPickedUp = System.currentTimeMillis(); + } + + public void update() + { + if (!isSpawned() && UtilTime.elapsed(_lastPickedUp, TNT_SPAWN_DELAY)) + { + spawn(); + } + else if (isSpawned()) + { + _entity.teleport(_lastSpawnLoc); + if (!_entity.isValid() || _entity.isDead()) + { + _entity = _lastSpawnLoc.getWorld().dropItem(_lastSpawnLoc, new ItemStack(Material.TNT)); + } + } + } + + public void onStart() + { + _lastPickedUp = System.currentTimeMillis(); + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/TeamCrystal.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamCrystal.java similarity index 89% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/TeamCrystal.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamCrystal.java index 8c2ebb0af..e44bc9e9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/TeamCrystal.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamCrystal.java @@ -1,54 +1,54 @@ -package nautilus.game.arcade.game.games.castlesiege.data; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.EnderCrystal; - -import nautilus.game.arcade.game.GameTeam; - -public class TeamCrystal -{ - private Location _loc; - private GameTeam _owner; - private EnderCrystal _crystal; - private boolean _destroyed; - - public TeamCrystal(GameTeam owner, Location loc) - { - _owner = owner; - _loc = loc; - - spawn(); - } - - public GameTeam getOwner() - { - return _owner; - } - - public Location getLocation() - { - return _loc; - } - - public boolean isActive() - { - return !_destroyed; - } - - public void spawn() - { - _destroyed = false; - _crystal = _loc.getWorld().spawn(_loc, EnderCrystal.class); - _loc.getBlock().getRelative(0, -2, 0).setType(Material.BEACON); - } - - public void destroy() - { - _destroyed = true; - _crystal.remove(); - _crystal = null; - _loc.getBlock().getRelative(0, -2, 0).setType(Material.SMOOTH_BRICK); - } +package nautilus.game.arcade.game.games.castleassault.data; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.EnderCrystal; + +import nautilus.game.arcade.game.GameTeam; + +public class TeamCrystal +{ + private Location _loc; + private GameTeam _owner; + private EnderCrystal _crystal; + private boolean _destroyed; + + public TeamCrystal(GameTeam owner, Location loc) + { + _owner = owner; + _loc = loc; + + spawn(); + } + + public GameTeam getOwner() + { + return _owner; + } + + public Location getLocation() + { + return _loc; + } + + public boolean isActive() + { + return !_destroyed; + } + + public void spawn() + { + _destroyed = false; + _crystal = _loc.getWorld().spawn(_loc, EnderCrystal.class); + _loc.getBlock().getRelative(0, -2, 0).setType(Material.BEACON); + } + + public void destroy() + { + _destroyed = true; + _crystal.remove(); + _crystal = null; + _loc.getBlock().getRelative(0, -2, 0).setType(Material.SMOOTH_BRICK); + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/TeamKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamKing.java similarity index 93% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/TeamKing.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamKing.java index a925064dd..af9fad64a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/TeamKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/TeamKing.java @@ -1,122 +1,122 @@ -package nautilus.game.arcade.game.games.castlesiege.data; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Zombie; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilTime; -import mineplex.core.itemstack.ItemBuilder; -import nautilus.game.arcade.game.GameTeam; - -public class TeamKing -{ - private static final int MAX_HEALTH = 600; - private Location _loc; - private String _name; - private GameTeam _owner; - private Zombie _entity; - private int _health; - private String _lastDamager; - private long _lastDamage; - - public TeamKing(GameTeam owner, String name, Location loc) - { - _owner = owner; - _loc = loc; - _name = name; - _health = MAX_HEALTH; - _entity = (Zombie) loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE); - UtilEnt.vegetate(_entity, true); - _entity.getEquipment().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setUnbreakable(true).build()); - _entity.getEquipment().setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).setUnbreakable(true).build()); - _entity.getEquipment().setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).setUnbreakable(true).build()); - _entity.getEquipment().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setUnbreakable(true).build()); - _entity.setRemoveWhenFarAway(false); - _entity.setCustomName(owner.GetColor() + name); - } - - public GameTeam getOwner() - { - return _owner; - } - - public Location getLocation() - { - return _loc; - } - - public String getName(boolean bold) - { - return _owner.GetColor() + (bold ? C.Bold : "") + _name; - } - - public String getLastDamager() - { - return _lastDamager; - } - - public int getHealth() - { - return Math.max(_health, 0); - } - - public boolean isDead() - { - return getHealth() <= 0; - } - - public void update(boolean beaconsAlive) - { - _entity.teleport(_loc); - for (int y = 0; y <= 4; y++) - { - for (int x = -4; x <= 4; x++) - { - for (int z = -4; z <= 4; z++) - { - Block block = _loc.clone().add(x, y, z).getBlock(); - if ((block.getType() != Material.IRON_FENCE && block.getType() != Material.IRON_BLOCK) || !beaconsAlive) - { - block.setType(Material.AIR); - } - if (beaconsAlive) - { - if (x == -4 || x == 4 || z == -4 || z == 4) - { - if (y != 4) - { - block.setType(Material.IRON_FENCE); - } - } - if (y == 4) - { - block.setType(Material.IRON_BLOCK); - } - } - } - } - } - } - - public boolean handleDamage(String player, double damage) - { - if (!UtilTime.elapsed(_lastDamage, 400)) - { - return false; - } - _lastDamager = player; - _lastDamage = System.currentTimeMillis(); - - int dmg = (int)Math.ceil(damage); - - _health -= dmg; - - UtilEnt.PlayDamageSound(_entity); - - return true; - } +package nautilus.game.arcade.game.games.castleassault.data; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Zombie; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.game.GameTeam; + +public class TeamKing +{ + private static final int MAX_HEALTH = 600; + private Location _loc; + private String _name; + private GameTeam _owner; + private Zombie _entity; + private int _health; + private String _lastDamager; + private long _lastDamage; + + public TeamKing(GameTeam owner, String name, Location loc) + { + _owner = owner; + _loc = loc; + _name = name; + _health = MAX_HEALTH; + _entity = (Zombie) loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE); + UtilEnt.vegetate(_entity, true); + _entity.getEquipment().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setUnbreakable(true).build()); + _entity.getEquipment().setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).setUnbreakable(true).build()); + _entity.getEquipment().setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).setUnbreakable(true).build()); + _entity.getEquipment().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setUnbreakable(true).build()); + _entity.setRemoveWhenFarAway(false); + _entity.setCustomName(owner.GetColor() + name); + } + + public GameTeam getOwner() + { + return _owner; + } + + public Location getLocation() + { + return _loc; + } + + public String getName(boolean bold) + { + return _owner.GetColor() + (bold ? C.Bold : "") + _name; + } + + public String getLastDamager() + { + return _lastDamager; + } + + public int getHealth() + { + return Math.max(_health, 0); + } + + public boolean isDead() + { + return getHealth() <= 0; + } + + public void update(boolean beaconsAlive) + { + _entity.teleport(_loc); + for (int y = 0; y <= 4; y++) + { + for (int x = -4; x <= 4; x++) + { + for (int z = -4; z <= 4; z++) + { + Block block = _loc.clone().add(x, y, z).getBlock(); + if ((block.getType() != Material.IRON_FENCE && block.getType() != Material.IRON_BLOCK) || !beaconsAlive) + { + block.setType(Material.AIR); + } + if (beaconsAlive) + { + if (x == -4 || x == 4 || z == -4 || z == 4) + { + if (y != 4) + { + block.setType(Material.IRON_FENCE); + } + } + if (y == 4) + { + block.setType(Material.IRON_BLOCK); + } + } + } + } + } + } + + public boolean handleDamage(String player, double damage) + { + if (!UtilTime.elapsed(_lastDamage, 400)) + { + return false; + } + _lastDamager = player; + _lastDamage = System.currentTimeMillis(); + + int dmg = (int)Math.ceil(damage); + + _health -= dmg; + + UtilEnt.PlayDamageSound(_entity); + + return true; + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/medals/MedalData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/medals/MedalData.java similarity index 93% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/medals/MedalData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/medals/MedalData.java index 2943d761a..a64e7f68c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/medals/MedalData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/medals/MedalData.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.data.medals; +package nautilus.game.arcade.game.games.castleassault.data.medals; import java.util.HashMap; import java.util.Map; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/medals/MedalType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/medals/MedalType.java similarity index 78% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/medals/MedalType.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/medals/MedalType.java index e12f1bb36..47abb13c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/data/medals/MedalType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/data/medals/MedalType.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.data.medals; +package nautilus.game.arcade.game.games.castleassault.data.medals; public enum MedalType { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitAlchemist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitAlchemist.java similarity index 95% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitAlchemist.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitAlchemist.java index 50c4f443d..d42c40ae0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitAlchemist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitAlchemist.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitArcher.java similarity index 91% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitArcher.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitArcher.java index 9638a2a60..94efc77d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitArcher.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -120,8 +120,8 @@ public class KitArcher extends KitPlayer } else if (streak == 4) { - player.sendMessage(C.cRedB + "You have received a Power I book as a Kill Streak Reward!"); - player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build()); + player.sendMessage(C.cRedB + "You have received 12 Arrows as a Kill Streak Reward!"); + player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(12).setTitle(F.item("Fletched Arrow")).build()); } else if (streak == 6) { @@ -130,8 +130,8 @@ public class KitArcher extends KitPlayer } else if (streak == 8) { - player.sendMessage(C.cRedB + "You have received a Power I book as a Kill Streak Reward!"); - player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build()); + player.sendMessage(C.cRedB + "You have received 32 Arrows as a Kill Streak Reward!"); + player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(32).setTitle(F.item("Fletched Arrow")).build()); } } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitBuilder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitBuilder.java similarity index 95% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitBuilder.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitBuilder.java index 67d2c8872..9e3134e75 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitBuilder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitBuilder.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitDemolitionist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitDemolitionist.java similarity index 98% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitDemolitionist.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitDemolitionist.java index 16588ff54..5af012192 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitDemolitionist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitDemolitionist.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitEnchanter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitEnchanter.java similarity index 96% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitEnchanter.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitEnchanter.java index d92d12c30..fc15f48ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitEnchanter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitEnchanter.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitFighter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java similarity index 99% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitFighter.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java index abf6ad397..d5b49974d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitFighter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitFighter.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHardline.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitHardline.java similarity index 94% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHardline.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitHardline.java index 9154b7a45..7cb59e5f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHardline.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitHardline.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitNinja.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitNinja.java similarity index 95% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitNinja.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitNinja.java index 898091c80..acb2f4590 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitNinja.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitNinja.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java similarity index 88% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitPlayer.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java index 53cc7b7e1..c9fdaf1c6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitPlayer.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -9,7 +9,7 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.castlesiege.CastleSiege; +import nautilus.game.arcade.game.games.castleassault.CastleAssault; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; @@ -32,9 +32,9 @@ public abstract class KitPlayer extends ProgressingKit public abstract void awardKillStreak(Player player, int streak); - protected CastleSiege getGame() + protected CastleAssault getGame() { - return (CastleSiege) Manager.GetGame(); + return (CastleAssault) Manager.GetGame(); } protected void giveRegeneration(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitTank.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitTank.java similarity index 99% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitTank.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitTank.java index 3549ffb12..710781ebc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitTank.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitTank.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitWorkman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitWorkman.java similarity index 95% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitWorkman.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitWorkman.java index e3359c66d..0cb37d4e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitWorkman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/KitWorkman.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/PerkBloodlust.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/PerkBloodlust.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/PerkBloodlust.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/PerkBloodlust.java index 8c9c84484..9dc21c017 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/PerkBloodlust.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castleassault/kits/PerkBloodlust.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; +package nautilus.game.arcade.game.games.castleassault.kits; import java.util.Map; import java.util.WeakHashMap; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java index e4e1f4620..a5a67d2d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java @@ -1,1445 +1,973 @@ package nautilus.game.arcade.game.games.castlesiege; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.EntityEffect; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.Chest; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.EnderCrystal; -import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; -import org.bukkit.entity.ItemFrame; -import org.bukkit.entity.Painting; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; -import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockDispenseEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockFormEvent; -import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; -import org.bukkit.event.entity.ItemDespawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.hanging.HangingBreakEvent; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerBucketFillEvent; -import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.material.Dispenser; -import org.bukkit.material.MaterialData; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.util.Vector; -import mineplex.core.Managers; 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.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTime; -import mineplex.core.itemstack.EnchantedBookBuilder; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.leaderboard.Leaderboard; -import mineplex.core.leaderboard.LeaderboardManager; -import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType; -import mineplex.core.loot.ChestLoot; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.combat.DeathMessageType; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.FirstBloodEvent; import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.GemData; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.castlesiege.data.KillStreakData; -import nautilus.game.arcade.game.games.castlesiege.data.ObjectiveTNTSpawner; -import nautilus.game.arcade.game.games.castlesiege.data.TeamCrystal; -import nautilus.game.arcade.game.games.castlesiege.data.TeamKing; -import nautilus.game.arcade.game.games.castlesiege.kits.KitArcher; -import nautilus.game.arcade.game.games.castlesiege.kits.KitDemolitionist; -import nautilus.game.arcade.game.games.castlesiege.kits.KitFighter; -import nautilus.game.arcade.game.games.castlesiege.kits.KitPlayer; -import nautilus.game.arcade.game.games.castlesiege.kits.KitTank; +import nautilus.game.arcade.game.games.castlesiege.kits.KitHumanKnight; +import nautilus.game.arcade.game.games.castlesiege.kits.KitHumanMarksman; +import nautilus.game.arcade.game.games.castlesiege.kits.KitHumanPeasant; +import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadArcher; +import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadGhoul; +import nautilus.game.arcade.game.games.castlesiege.kits.KitUndeadZombie; import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager; +import nautilus.game.arcade.kit.NullKit; +import nautilus.game.arcade.stats.BloodThirstyStatTracker; +import nautilus.game.arcade.stats.KingDamageStatTracker; +import nautilus.game.arcade.stats.KingSlayerStatTracker; +import nautilus.game.arcade.stats.TeamDeathsStatTracker; +import nautilus.game.arcade.stats.TeamKillsStatTracker; +import nautilus.game.arcade.stats.WinAsTeamStatTracker; public class CastleSiege extends TeamGame { - private static final int MAX_FLINT_AND_STEEL_USES = 4; - private static final int ITEMS_PER_CHEST = 5; - private static final long TIME_TILL_REFILL = 2 * 60 * 1000; - - private long _lastRefill; - - private ItemBuilder _flintAndSteel; - private ItemBuilder _wearableTnt; - - private Map _streakData = new WeakHashMap<>(); - private Map> _crystals = new HashMap<>(); - private Map _kings = new HashMap<>(); - private List _tntCarry = new ArrayList<>(); - - private List _chests = new ArrayList<>(); - - private ChestLoot _diamondGearCommon = new ChestLoot(true); - private ChestLoot _diamondGearRare = new ChestLoot(true); - private ChestLoot _weaponGearCommon = new ChestLoot(true); - private ChestLoot _weaponGearRare = new ChestLoot(true); - private ChestLoot _rangedGear = new ChestLoot(true); - private ChestLoot _rodsAndGaps = new ChestLoot(true); - private ChestLoot _potionGearCommon = new ChestLoot(true); - private ChestLoot _potionGearRare = new ChestLoot(true); - private ChestLoot _enchantGearCommon = new ChestLoot(true); - private ChestLoot _enchantGearRare = new ChestLoot(true); - private ChestLoot _miscGear = new ChestLoot(); - - private ObjectiveTNTSpawner _tntSpawner; - - private boolean _writeScoreboard = true; - - @SuppressWarnings("deprecation") + public static class KingDamageEvent extends PlayerEvent + { + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private final double _damage; + + public KingDamageEvent(Player who, double damage) + { + super(who); + + _damage = damage; + } + + public double getDamage() + { + return _damage; + } + } + + public static class KingSlaughterEvent extends PlayerEvent + { + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + public KingSlaughterEvent(Player who) + { + super(who); + } + } + + private ArrayList _lastScoreboard = new ArrayList(); + + private long _tntSpawn = 0; + private ArrayList _tntSpawns = new ArrayList(); + private ArrayList _tntWeakness = new ArrayList(); + + private HashMap _tntCarry = new HashMap(); + private HashSet _tntCarryEnd = new HashSet(); + + private ArrayList _kingLocs; + private Creature _king; + private Location _kingLoc; + private String _kingName; + private Player _kingDamager = null; + private int _kingHealth = 40; + + private ArrayList _peasantSpawns; + private ArrayList _horseSpawns; + public CastleSiege(ArcadeManager manager) { super(manager, GameType.CastleSiege, - new Kit[] - { - //new KitAlchemist(manager), - new KitArcher(manager), - new KitDemolitionist(manager), - //new KitEnchanter(manager), - new KitFighter(manager), - //new KitHardline(manager), - //new KitNinja(manager), - new KitTank(manager) - }, - new String[] - { - "Destroy enemy sentry crystals with running TNT", - "After the enemy crystals are destroyed you must slay their king", - "First team to kill the enemy king wins", - "Chests refill every 2 minutes", - "TNT Respawns every 1 minute" - } - ); - + + new Kit[] + { + new KitHumanMarksman(manager), + new KitHumanKnight(manager), + //new KitHumanBrawler(manager), + //new KitHumanAssassin(manager), + new NullKit(manager), + new KitHumanPeasant(manager), + new NullKit(manager), + new KitUndeadGhoul(manager), + new KitUndeadArcher(manager), + new KitUndeadZombie(manager), + }, + + new String[] + { + F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.", + F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.", + F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.", + "", + F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.", + F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.", + + }); + _help = new String[] - { - "Use the TNT spawning platforms to run TNT to the enemy crystals to destroy them!", - "The enemy king is invulnerable until you destroy the two sentry crystals on each sentry tower", - "Go on Kill Streaks to earn Kill Streak Rewards to obtain better armor & weapons!", - "Chests refill every 2 minutes with potions, golden applegates, fishing rods, and other useful PvP items!" - }; - + { + "Marksmen are extremely important to defence!", + "It's recommended 50%+ of defence are Marksmen.", + "Use Barricades to block the Undeads path.", + "Use TNT to destroy weak points in walls.", + "Weak points are marked by cracked stone brick.", + "Undead can break fences with their axes.", + "Undead Archers must pick up arrows from the ground.", + + }; + this.StrictAntiHack = true; + this.HungerSet = 20; this.DeathOut = false; - this.DeathSpectateSecs = 5; - this.CreatureAllow = false; - this.DeathDropItems = false; - this.WorldWeatherEnabled = false; - this.AllowParticles = false; - this.SoupEnabled = false; - this.InventoryClick = true; - this.InventoryOpenChest = true; - this.InventoryOpenBlock = true; - this.ItemDrop = true; - this.ItemPickup = true; - this.AllowFlintAndSteel = true; - this.BlockPlaceAllow.add(Material.FIRE.getId()); - this.CrownsEnabled = true; - this.Leaderboards = true; - this.FirstKillReward = 20; - this.GemKillDeathRespawn = 1; - + this.WorldTimeSet = 14000; //14000 + this.BlockPlaceAllow.add(85); + + _kingName = C.cYellow + C.Bold + "King Sparklez"; + + GameTeam notRedTeam = null; + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() != ChatColor.RED) + { + notRedTeam = team; + break; + } + } + + registerStatTrackers( + new KingSlayerStatTracker(this), + new BloodThirstyStatTracker(this), + new KingDamageStatTracker(this), + + new TeamDeathsStatTracker(this), + new TeamKillsStatTracker(this) + ); + + registerChatStats( + Kills, + Deaths, + KDRatio, + BlankLine, + Assists, + DamageDealt, + DamageTaken + ); + + registerChatStats(); + new CompassModule() - .setGiveCompass(true) - .setGiveCompassToSpecs(true) - .setGiveCompassToAlive(false) - .register(this); - - _flintAndSteel = new ItemBuilder(Material.FLINT_AND_STEEL).setData((short) (Material.FLINT_AND_STEEL.getMaxDurability() - MAX_FLINT_AND_STEEL_USES)); - _wearableTnt = new ItemBuilder(Material.TNT).setTitle(C.cRed + "TNT").addLore(C.cRedB + "Right Click with Weapon to " + F.name("Detonate")); - generateLoot(); - - if (manager.IsRewardStats()) - { - if (manager.GetLobby() instanceof NewGameLobbyManager) - { - Map> lobbyCustomLocs = ((NewGameLobbyManager)manager.GetLobby()).getCustomLocs(); - if (lobbyCustomLocs.containsKey("TOP_DAILY_WINS")) - { - Location loc = lobbyCustomLocs.get("TOP_DAILY_WINS").get(0); - Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLESIEGE_DAILY_WINS", new Leaderboard("Top Daily Wins", "Wins", new String[] {"Castle Siege.Wins"}, LeaderboardSQLType.DAILY, loc, 10)); - } - if (lobbyCustomLocs.containsKey("TOP_DAILY_KILLS")) - { - Location loc = lobbyCustomLocs.get("TOP_DAILY_KILLS").get(0); - Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLESIEGE_DAILY_KILLS", new Leaderboard("Top Daily Kills", "Kills", new String[] {"Castle Siege.Kills"}, LeaderboardSQLType.DAILY, loc, 10)); - } - if (lobbyCustomLocs.containsKey("TOP_WINS")) - { - Location loc = lobbyCustomLocs.get("TOP_WINS").get(0); - Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLESIEGE_WINS", new Leaderboard("Top Wins", "Wins", new String[] {"Castle Siege.Wins"}, LeaderboardSQLType.ALL, loc, 10)); - } - if (lobbyCustomLocs.containsKey("TOP_KILLS")) - { - Location loc = lobbyCustomLocs.get("TOP_KILLS").get(0); - Managers.get(LeaderboardManager.class).registerLeaderboard("TOP_CASTLESIEGE_KILLS", new Leaderboard("Top Kills", "Kills", new String[] {"Castle Siege.Kills"}, LeaderboardSQLType.ALL, loc, 10)); - } - } - } + .setGiveCompass(true) + .setGiveCompassToSpecs(true) + .setGiveCompassToAlive(false) + .register(this); } - - private void generateLoot() - { - { - _diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_HELMET), 2); - _diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_CHESTPLATE), 2); - _diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_LEGGINGS), 2); - _diamondGearCommon.addLoot(new ItemStack(Material.DIAMOND_BOOTS), 2); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1); - _diamondGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3).build(), 1); - } - { - _diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_HELMET).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1); - _diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_CHESTPLATE).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1); - _diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_LEGGINGS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1); - _diamondGearRare.addLoot(new ItemBuilder(Material.DIAMOND_BOOTS).addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build(), 1); - } - { - _weaponGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).build(), 2); - _weaponGearCommon.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 1).build(), 2); - } - { - _weaponGearRare.addLoot(new ItemBuilder(Material.DIAMOND_SWORD).addEnchantment(Enchantment.DAMAGE_ALL, 2).build(), 1); - } - { - _rangedGear.addLoot(new ItemStack(Material.BOW), 3); - _rangedGear.addLoot(Material.ARROW, 3, 8, 16); - } - { - _rodsAndGaps.addLoot(new ItemStack(Material.FISHING_ROD), 3); - _rodsAndGaps.addLoot(new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cPurple + "Golden Applegate").build(), 3); - } - { - _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)16418).build(), 2); - _potionGearCommon.addLoot(new ItemBuilder(Material.POTION).setData((short)16417).build(), 2); - } - { - _potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8193).build(), 2); - _potionGearRare.addLoot(new ItemBuilder(Material.POTION).setData((short)8195).build(), 2); - } - { - _enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.PROTECTION_ENVIRONMENTAL, 1).build(), 2); - _enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.DAMAGE_ALL, 1).build(), 2); - _enchantGearCommon.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build(), 2); - _enchantGearCommon.addLoot(new ItemStack(Material.EXP_BOTTLE, 64), 1); - } - { - _enchantGearRare.addLoot(new EnchantedBookBuilder(1).setLevel(Enchantment.FIRE_ASPECT, 1).build(), 1); - } - { - _miscGear.addLoot(new ItemStack(Material.ENDER_PEARL), 2); - _miscGear.addLoot(new ItemStack(Material.WATER_BUCKET), 2); - _miscGear.addLoot(_flintAndSteel.build(), 2); - _miscGear.addLoot(new ItemStack(Material.SNOW_BALL, 16), 3); - } - } - - private void fillChest(Block block) - { - if (block.getType() != Material.CHEST && block.getType() != Material.TRAPPED_CHEST) - { - return; - } - Chest chest = (Chest) block.getState(); - - chest.getBlockInventory().clear(); - int[] slots = UtilMath.random.ints(ITEMS_PER_CHEST, 0, chest.getBlockInventory().getSize()).toArray(); - - for (int slot : slots) - { - double chance = UtilMath.random.nextDouble(); - double subChance = UtilMath.random.nextDouble(); - - ChestLoot loot = _miscGear; - if (chance <= 0.6) - { - loot = _rodsAndGaps; - } - if (chance <= 0.5) - { - loot = _potionGearCommon; - if (subChance <= 0.45) - { - loot = _potionGearRare; - } - } - if (chance <= 0.3) - { - loot = _rangedGear; - } - chest.getBlockInventory().setItem(slot, loot.getLoot()); - } - } - - public ItemStack getNewFlintAndSteel(boolean kitItem) - { - if (kitItem) - { - return _flintAndSteel.clone().setLore(C.cGold + "Kit Item").build(); - } - return _flintAndSteel.build(); - } - - public void writeScoreboard() - { - if (!_writeScoreboard) - { - return; - } - Scoreboard.reset(); - Scoreboard.write(C.cDRedB + GetName()); - Scoreboard.writeNewLine(); - Scoreboard.write(C.cGreenB + "Chest Refill"); - long refillTime = _lastRefill + TIME_TILL_REFILL - System.currentTimeMillis(); - if (!IsLive()) - { - refillTime = TIME_TILL_REFILL; - } - Scoreboard.write(UtilTime.MakeStr(refillTime)); - Scoreboard.writeNewLine(); - Scoreboard.write(C.cGreenB + "TNT Spawn"); - long tntTime = _tntSpawner.getNextTNT(); - if (!IsLive()) - { - tntTime = 60000; - } - if (_tntSpawner.isSpawned()) - { - Scoreboard.write("Spawned"); - } - else - { - Scoreboard.write(UtilTime.MakeStr(tntTime)); - } - Scoreboard.writeNewLine(); - GameTeam red = GetTeam(ChatColor.RED); - long redCrystals = _crystals.get(red).stream().filter(TeamCrystal::isActive).count(); - GameTeam blue = GetTeam(ChatColor.AQUA); - long blueCrystals = _crystals.get(blue).stream().filter(TeamCrystal::isActive).count(); - if (redCrystals > 0) - { - Scoreboard.write(_kings.get(red).getName(true)); - Scoreboard.write(redCrystals + "/2 Crystals Active"); - } - else - { - Scoreboard.write(_kings.get(red).getName(true) + " Health"); - Scoreboard.write(_kings.get(red).getHealth() + ""); - } - Scoreboard.writeNewLine(); - if (blueCrystals > 0) - { - Scoreboard.write(_kings.get(blue).getName(true)); - Scoreboard.write(blueCrystals + "/2 Crystals Active"); - } - else - { - Scoreboard.write(_kings.get(blue).getName(true) + " Health"); - Scoreboard.write(_kings.get(blue).getHealth() + ""); - } - Scoreboard.draw(); - } - - public void writeFinalScoreboard(String deadKing, String winKing, String warrior) - { - _writeScoreboard = false; - Scoreboard.reset(); - Scoreboard.writeNewLine(); - Scoreboard.write(deadKing + "'s " + C.cWhite + "castle has been conquered"); - Scoreboard.write(C.cWhite + "by " + winKing + "'s " + C.cWhite + "army with the help of"); - Scoreboard.write(warrior + C.cWhite + "!"); - Scoreboard.writeNewLine(); - - Scoreboard.draw(); - } - + @Override public void ParseData() { - for (Location chestLoc : WorldData.GetDataLocs("BROWN")) + _tntSpawns = WorldData.GetDataLocs("RED"); + _tntWeakness = WorldData.GetDataLocs("BLACK"); + + _kingLocs = WorldData.GetDataLocs("YELLOW"); + + _peasantSpawns = WorldData.GetDataLocs("GREEN"); + _horseSpawns = WorldData.GetDataLocs("BROWN"); + } + + @Override + public void RestrictKits() + { + for (Kit kit : GetKits()) { - Block block = chestLoc.getBlock(); - block.setType(Material.CHEST); - fillChest(block); - _chests.add(block); - } - GameTeam red = GetTeam(ChatColor.RED); - GameTeam blue = GetTeam(ChatColor.AQUA); - Location redKing = WorldData.GetDataLocs("RED").get(0); - Location blueKing = WorldData.GetDataLocs("BLUE").get(0); - Vector redBlue = UtilAlg.getTrajectory(redKing, blueKing); - Vector blueRed = UtilAlg.getTrajectory(blueKing, redKing); - redKing.setPitch(UtilAlg.GetPitch(redBlue)); - redKing.setYaw(UtilAlg.GetYaw(redBlue)); - blueKing.setPitch(UtilAlg.GetPitch(blueRed)); - blueKing.setYaw(UtilAlg.GetYaw(blueRed)); - _crystals.put(red, Arrays.asList(new TeamCrystal(red, WorldData.GetDataLocs("PINK").get(0)), new TeamCrystal(red, WorldData.GetDataLocs("PINK").get(1)))); - _crystals.put(blue, Arrays.asList(new TeamCrystal(blue, WorldData.GetDataLocs("LIGHT_BLUE").get(0)), new TeamCrystal(blue, WorldData.GetDataLocs("LIGHT_BLUE").get(1)))); - this.CreatureAllowOverride = true; - _kings.put(red, new TeamKing(red, "King Jon", redKing)); - _kings.put(blue, new TeamKing(blue, "King Ryan", blueKing)); - int kitIndex = 0; - for (int i = 0; i < WorldData.GetDataLocs("WHITE").size(); i++) - { - if (kitIndex >= GetKits().length) + for (GameTeam team : GetTeamList()) { - kitIndex = 0; + if (team.GetColor() == ChatColor.RED) + { + if (kit.GetName().contains("Castle")) + team.GetRestrictedKits().add(kit); + + team.SetName("Undead"); + } + else + { + if (kit.GetName().contains("Undead")) + team.GetRestrictedKits().add(kit); + + team.SetRespawnTime(8); + + team.SetName("Defenders"); + } + } + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void registerTeamTracker(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Recruit) + { + GameTeam notRed = null; + + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() == ChatColor.RED) + continue; + + notRed = team; + break; + } + + if (notRed != null) + { + registerStatTrackers(new WinAsTeamStatTracker(this, notRed, "ForTheKing")); + System.out.println("Successfully registered For the King StatTrak"); } - Entity ent = GetKits()[kitIndex].SpawnEntity(WorldData.GetDataLocs("WHITE").get(i)); - Manager.GetLobby().addKitLocation(ent, GetKits()[kitIndex], WorldData.GetDataLocs("WHITE").get(i)); - kitIndex++; } - this.CreatureAllowOverride = false; - _tntSpawner = new ObjectiveTNTSpawner(WorldData.GetDataLocs("BLACK")); } + @EventHandler + public void MoveKits(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (int i = 0; i < WorldData.GetDataLocs("PINK").size() && i < 3; i++) + { + if (GetKits().length <= 5 + i) + continue; + + this.CreatureAllowOverride = true; + Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); + this.CreatureAllowOverride = false; + + Manager.GetLobby().addKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("PINK").get(i)); + } + } + + @EventHandler + public void HorseSpawn(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (Location loc : _horseSpawns) + { + this.CreatureAllowOverride = true; + Horse horse = loc.getWorld().spawn(loc, Horse.class); + this.CreatureAllowOverride = false; + + horse.setAdult(); + horse.setAgeLock(true); + horse.setColor(org.bukkit.entity.Horse.Color.BLACK); + horse.setStyle(Style.BLACK_DOTS); + horse.setMaxDomestication(1); + horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); + horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING)); + + horse.setMaxHealth(60); + horse.setHealth(horse.getMaxHealth()); + + horse.setCustomName("War Horse"); + } + } + + @EventHandler + public void HorseInteract(PlayerInteractEntityEvent event) + { + if (!(event.getRightClicked() instanceof Horse)) + return; + + Player player = event.getPlayer(); + GameTeam team = GetTeam(player); + + if (team == null || team.GetColor() == ChatColor.RED || !IsAlive(player)) + { + event.setCancelled(true); + } + } + + @EventHandler + public void HorseDamageCancel(CustomDamageEvent event) + { + if (!(event.GetDamageeEntity() instanceof Horse)) + return; + + Player player = event.GetDamagerPlayer(true); + if (player == null) + return; + + if (!IsAlive(player)) + return; + + if (GetTeam(player) == null) + return; + + if (GetTeam(player).GetColor() == ChatColor.RED) + return; + + event.SetCancelled("Horse Team Damage"); + } + + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + //Spawn King + this.CreatureAllowOverride = true; + + _kingLoc = _kingLocs.get(UtilMath.r(_kingLocs.size())); + + _king = (Creature) _kingLoc.getWorld().spawnEntity(_kingLoc, EntityType.ZOMBIE); + + _king.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); + _king.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); + _king.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); + _king.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); + _king.getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); + + _king.setCustomName(_kingName); + _king.setCustomNameVisible(true); + + _king.setRemoveWhenFarAway(false); + + this.CreatureAllowOverride = false; + } + + @EventHandler(priority = EventPriority.HIGH) + public void SetDefenderRespawn(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + //Change to Peasant Spawns + this.GetTeam(ChatColor.AQUA).SetSpawns(_peasantSpawns); + } + + + @EventHandler + public void KingTarget(EntityTargetEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void KingDamage(CustomDamageEvent event) + { + if (_king == null || !_king.isValid()) + return; + + if (!event.GetDamageeEntity().equals(_king)) + return; + + event.SetCancelled("King Damage"); + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + GameTeam team = GetTeam(damager); + + if (team != null && team.GetColor() == ChatColor.RED) + { + if (!Recharge.Instance.use(damager, "Damage King", 400, false, false)) + return; + + if (!IsAlive(damager)) + { + return; + } + + _king.playEffect(EntityEffect.HURT); + + _kingDamager = damager; + _kingHealth--; + + Bukkit.getPluginManager().callEvent(new KingDamageEvent(damager, 1)); + + if (_kingHealth < 0) + _kingHealth = 0; + + WriteScoreboard(); + + if (_kingHealth <= 0) + _king.damage(500); + + EndCheck(); + } + } + + @EventHandler + public void KingUpdate(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (_king == null) + return; + + if (UtilMath.offset(_king.getLocation(), _kingLoc) > 6) + { + _king.teleport(_kingLoc); + } + else + { + UtilEnt.CreatureMove(_king, _kingLoc, 1f); + } + } + + @EventHandler + public void PlayerDeath(PlayerGameRespawnEvent event) + { + if (GetTeam(ChatColor.AQUA).HasPlayer(event.GetPlayer())) + SetKit(event.GetPlayer(), GetKits()[3], true); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + WriteScoreboard(); + } + + public void WriteScoreboard() + { + //Get Values + HashMap _scoreGroup = new HashMap(); + _scoreGroup.put(C.cAqua + "Defenders", 0); + _scoreGroup.put(C.cDAqua + "Wolves", 0); + _scoreGroup.put(C.cRed + "Undead", 0); + + for (Player player : UtilServer.getPlayers()) + { + if (!IsAlive(player)) + continue; + + Kit kit = GetKit(player); + if (kit == null) continue; + + if (kit.GetName().contains("Castle")) + { + if (kit.GetName().contains("Wolf")) + { + _scoreGroup.put(C.cDAqua + "Wolves", 1 + _scoreGroup.get(C.cDAqua + "Wolves")); + } + else + { + _scoreGroup.put(C.cAqua + "Defenders", 1 + _scoreGroup.get(C.cAqua + "Defenders")); + } + } + else if (kit.GetName().contains("Undead")) + { + _scoreGroup.put(C.cRed + "Undead", 1 + _scoreGroup.get(C.cRed + "Undead")); + } + } + + //Wipe Last + Scoreboard.reset(); + + //Teams + for (String group : _scoreGroup.keySet()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(group); + Scoreboard.write(ChatColor.getLastColors(group) + _scoreGroup.get(group) + " Players"); + } + + //King + if (_king != null && _king.isValid()) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellow + C.Bold + "King"); + Scoreboard.write(_kingHealth + " Health"); + } + + long timeLeft = 24000 - WorldTimeSet; + timeLeft = timeLeft / 20 * 1000; + + + if (timeLeft > 0) + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellow + C.Bold + "Sun Rise"); + Scoreboard.write(UtilTime.MakeStr(timeLeft, 0)); + } + else + { + Scoreboard.writeNewLine(); + Scoreboard.write(C.cYellow + C.Bold + "Sun Rise"); + Scoreboard.write("Undead Burning!"); + + for (Player player : GetTeam(ChatColor.RED).GetPlayers(true)) + Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false); + } + + Scoreboard.draw(); + } + @Override public void EndCheck() { if (!IsLive()) - { return; - } - List teamsAlive = new ArrayList<>(); - - for (GameTeam team : GetTeamList()) + if (this.WorldTimeSet > 24100 || GetTeam(ChatColor.RED).GetSize() == 0) { - if (team.GetPlayers(true).size() > 0) - { - teamsAlive.add(team); - } - } + SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the siege!"); - if (teamsAlive.size() <= 1) - { - //Announce - if (teamsAlive.size() > 0) + AnnounceEnd(GetTeam(ChatColor.AQUA)); + + for (GameTeam team : GetTeamList()) { - GameTeam winner = teamsAlive.get(0); - TeamKing king = _kings.get(winner); - TeamKing dead = _kings.values().stream().filter(k -> k.getOwner().GetColor() != king.getOwner().GetColor()).findFirst().get(); - AnnounceEnd(winner); - writeFinalScoreboard(dead.getName(false), king.getName(false), dead.getOwner().GetColor() + "Quitters"); - for (GameTeam team : GetTeamList()) + if (WinnerTeam != null && team.equals(WinnerTeam)) { - for (Player player : team.GetPlayers(true)) + for (Player player : team.GetPlayers(false)) { - if (team.GetColor() == winner.GetColor()) - { - AddGems(player, 100, "Winning Team", false, false); - } - else - { - AddGems(player, 50, "Losing Team", false, false); - } - if (player.isOnline()) - { - AddGems(player, 10, "Participation", false, false); - } - - { - int crowns = 0; - for (GemData data : GetGems(player).values()) - { - crowns += data.Gems; - } - int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); - if (streak >= 2 && streak < 4) - { - AddGems(player, 0.5 * crowns, streak + " Player Kill Streak", false, false); - } - else if (streak >= 4 && streak < 6) - { - AddGems(player, crowns, streak + " Player Kill Streak", false, false); - } - else if (streak >= 6 && streak < 8) - { - AddGems(player, 1.5 * crowns, streak + " Player Kill Streak", false, false); - } - else if (streak >= 8) - { - AddGems(player, 2 * crowns, streak + " Player Kill Streak", false, false); - } - } - - if (GetKit(player) != null) - { - KitPlayer kit = (KitPlayer) GetKit(player); - int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); - if (kitLevel > 0) - { - int crowns = 0; - for (GemData data : GetGems(player).values()) - { - crowns += data.Gems; - } - - AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); - } - } + AddGems(player, 10, "Winning Team", false, false); } } - SetState(GameState.End); - return; + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); } + + SetState(GameState.End); } - } - - @Override - @EventHandler - public void ScoreboardUpdate(UpdateEvent event) {}; - - @EventHandler - public void onUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) + + if (!_king.isValid() || GetTeam(ChatColor.AQUA).GetSize() == 0) { - return; - } - if (IsLive()) - { - if (UtilTime.elapsed(_lastRefill, TIME_TILL_REFILL)) + if (_kingDamager != null) { - _lastRefill = System.currentTimeMillis(); - _chests.forEach(this::fillChest); - Bukkit.broadcastMessage(C.cGreenB + "Chests have refilled!"); + SetCustomWinLine(C.cRed + _kingDamager.getName() + C.cWhite + " slaughtered " + _kingName + ChatColor.RESET + "!"); + AddGems(_kingDamager, 20, "King Slayer", false, false); + + Bukkit.getPluginManager().callEvent(new KingSlaughterEvent(_kingDamager)); } - - GameTeam red = GetTeam(ChatColor.RED); - GameTeam blue = GetTeam(ChatColor.AQUA); - TeamKing redKing = _kings.get(red); - TeamKing blueKing = _kings.get(blue); - redKing.update(_crystals.get(red).stream().filter(TeamCrystal::isActive).count() > 0); - if (redKing.isDead()) + else + SetCustomWinLine(_kingName + ChatColor.RESET + " has died!"); + + AnnounceEnd(GetTeam(ChatColor.RED)); + + for (GameTeam team : GetTeamList()) { - AnnounceEnd(blue); - writeFinalScoreboard(redKing.getName(false), blueKing.getName(false), blue.GetColor() + redKing.getLastDamager()); - for (GameTeam team : GetTeamList()) + if (WinnerTeam != null && team.equals(WinnerTeam)) { - for (Player player : team.GetPlayers(true)) + for (Player player : team.GetPlayers(false)) { - if (player.getName().equals(redKing.getLastDamager())) - { - AddGems(player, 20, "King Slayer", false, false); - } - if (team.GetColor() == ChatColor.AQUA) - { - AddGems(player, 100, "Winning Team", false, false); - } - else - { - AddGems(player, 50, "Losing Team", false, false); - } - if (player.isOnline()) - { - AddGems(player, 10, "Participation", false, false); - } - - int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); - if (streak > 0) - { - AddGems(player, streak, streak + " Player Kill Streak", false, false); - } - - KitPlayer kit = (KitPlayer) GetKit(player); - int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); - if (kitLevel > 0) - { - int crowns = 0; - for (GemData data : GetGems(player).values()) - { - crowns += data.Gems; - } - - AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); - } + AddGems(player, 10, "Winning Team", false, false); } } - SetState(GameState.End); - return; + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); } - blueKing.update(_crystals.get(blue).stream().filter(TeamCrystal::isActive).count() > 0); - if (blueKing.isDead()) - { - AnnounceEnd(red); - writeFinalScoreboard(blueKing.getName(false), redKing.getName(false), red.GetColor() + blueKing.getLastDamager()); - for (GameTeam team : GetTeamList()) - { - for (Player player : team.GetPlayers(true)) - { - if (player.getName().equals(blueKing.getLastDamager())) - { - AddGems(player, 20, "King Slayer", false, false); - } - if (team.GetColor() == ChatColor.RED) - { - AddGems(player, 100, "Winning Team", false, false); - } - else - { - AddGems(player, 50, "Losing Team", false, false); - } - if (player.isOnline()) - { - AddGems(player, 10, "Participation", false, false); - } - - int streak = _streakData.getOrDefault(player, new KillStreakData()).getBestStreak(); - if (streak > 0) - { - AddGems(player, streak, streak + " Player Kill Streak", false, false); - } - - KitPlayer kit = (KitPlayer) GetKit(player); - int kitLevel = kit.getUpgradeLevel(player.getUniqueId()); - if (kitLevel > 0) - { - int crowns = 0; - for (GemData data : GetGems(player).values()) - { - crowns += data.Gems; - } - - AddGems(player, (0.5 * kitLevel) * crowns, kit.GetName() + " Kit Level Bonus", false, false); - } - } - } - SetState(GameState.End); - return; - } - - _tntSpawner.update(); - } - if (InProgress()) - { - writeScoreboard(); + + SetState(GameState.End); } } - + @EventHandler - public void onEditSettings(GameStateChangeEvent event) + public void TNTSpawn(UpdateEvent event) { - if (event.GetGame() != this) - { + if (GetState() != GameState.Live) return; - } - - if (event.GetState() == GameState.Live) - { - _lastRefill = System.currentTimeMillis(); - _tntSpawner.onStart(); - Manager.GetDamage().SetEnabled(false); - Manager.GetExplosion().setEnabled(false); - Manager.GetCreature().SetDisableCustomDrops(true); - } - - if (event.GetState() == GameState.End) - { - Manager.GetDamage().SetEnabled(true); - Manager.GetExplosion().setEnabled(true); - Manager.GetCreature().SetDisableCustomDrops(false); - Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLESIEGE_DAILY_WINS"); - Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLESIEGE_DAILY_KILLS"); - Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLESIEGE_WINS"); - Managers.get(LeaderboardManager.class).unregisterLeaderboard("TOP_CASTLESIEGE_KILLS"); - } - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void handleDeath(CombatDeathEvent event) - { - if (!IsLive()) - { + + if (event.getType() != UpdateType.SEC) return; - } - - event.SetBroadcastType(DeathMessageType.Detailed); + + if (!UtilTime.elapsed(this.GetStateTime(), 20000)) + return; + + if (!UtilTime.elapsed(_tntSpawn, 25000)) + return; + + if (_tntSpawns.isEmpty()) + return; + + Location loc = _tntSpawns.get(UtilMath.r(_tntSpawns.size())); + + if (loc.getBlock().getTypeId() == 46) + return; + + loc.getBlock().setTypeId(46); + _tntSpawn = System.currentTimeMillis(); } - - @EventHandler - public void disableDamageLevel(CustomDamageEvent event) - { - event.SetDamageToLevel(false); - } - - @EventHandler - public void BlockFade(BlockFadeEvent event) + + @EventHandler(priority = EventPriority.LOW) + public void TNTPickup(PlayerInteractEvent event) { + if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK) + return; + + if (event.getClickedBlock().getTypeId() != 46) + return; + event.setCancelled(true); - } - - @EventHandler - public void BlockBurn(BlockBurnEvent event) - { - event.setCancelled(true); - } - - @EventHandler - public void BlockDecay(LeavesDecayEvent event) - { - event.setCancelled(true); - } - - @EventHandler - public void hangingBreak(HangingBreakEvent event) - { - if (event.getEntity() instanceof ItemFrame || event.getEntity() instanceof Painting) - { - event.setCancelled(true); - } - } - - @EventHandler - public void noFlow(BlockFromToEvent event) - { - if (!IsLive()) - { - return; - } - - Block block = event.getBlock(); - if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER || block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA) - { - event.setCancelled(true); - } - if (event.getToBlock().getType() == Material.ICE) - { - event.setCancelled(true); - } - } - - @EventHandler - public void onBlockChange(BlockFormEvent e) - { - if (!IsLive()) - { - return; - } - if (e.getNewState().getType() == Material.ICE) - { - e.setCancelled(true); - } - } - - @SuppressWarnings("deprecation") - @EventHandler(ignoreCancelled=true) - public void onPlayerEmptyBucket(PlayerBucketEmptyEvent event) - { - if (!IsLive()) - { - return; - } - - Player player = event.getPlayer(); - if (player.getItemInHand().getType() == Material.WATER_BUCKET) - { - player.getItemInHand().setType(Material.BUCKET); - Block block = event.getBlockClicked().getRelative(event.getBlockFace()); - if (block.getType().toString().contains("LAVA") || (block.getType().toString().contains("WATER") && block.getType() != Material.WATER_LILY)) - { - event.setCancelled(true); - player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); - return; - } - for (BlockFace bf : BlockFace.values()) - { - Block relative = block.getRelative(bf); - if (relative.getType().toString().contains("LAVA") || (relative.getType().toString().contains("WATER") && relative.getType() != Material.WATER_LILY)) - { - event.setCancelled(true); - player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); - } - } - } - else if (player.getItemInHand().getType() == Material.LAVA_BUCKET) - { - event.setCancelled(true); - Block block = event.getBlockClicked().getRelative(event.getBlockFace()); - player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); - } - } - - @SuppressWarnings("deprecation") - @EventHandler(ignoreCancelled=true) - public void onPlayerEmptyBucket(PlayerBucketFillEvent event) - { - if (!IsLive()) - { - return; - } - - Player player = event.getPlayer(); - if (player.getItemInHand().getType() == Material.LAVA_BUCKET) - { - event.setCancelled(true); - Block block = event.getBlockClicked().getRelative(event.getBlockFace()); - player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); - } - } - - @EventHandler(ignoreCancelled=true) - public void onBlockDispense(BlockDispenseEvent event) - { - if (!IsLive()) - { - return; - } - - if (event.getItem().getType() == Material.WATER_BUCKET) - { - Block dispenser = event.getBlock(); - - MaterialData mat = dispenser.getState().getData(); - Dispenser disp_mat = (Dispenser)mat; - BlockFace face = disp_mat.getFacing(); - Block block = dispenser.getRelative(face); - if (block.getType().toString().contains("LAVA") || (block.getType().toString().contains("WATER") && block.getType() != Material.WATER_LILY)) - { - event.setCancelled(true); - return; - } - for (BlockFace bf : BlockFace.values()) - { - if (block.getRelative(bf).getType().toString().contains("LAVA") || (block.getRelative(bf).getType().toString().contains("WATER") && block.getRelative(bf).getType() != Material.WATER_LILY)) - { - event.setCancelled(true); - } - } - } - } - - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onCombatDeath(CombatDeathEvent event) - { - if (!IsLive()) - { - return; - } - - if (event.GetLog().GetKiller() == null) - { - return; - } - - if (!event.GetLog().GetKiller().IsPlayer()) - { - return; - } - - Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); - if (player == null) - { - return; - } - - AddStat(player, GetKit(player).GetName() + "KitKills", 1, false, false); - - if (UtilPlayer.isSpectator(player)) - { - return; - } - - player.setLevel(player.getLevel() + 1); - player.getInventory().addItem(new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cPurple + "Golden Applegate").build()); - KillStreakData data = _streakData.computeIfAbsent(player, (key) -> new KillStreakData()); - boolean hardLine = GetKit(player).GetName().equals("Hardline"); - if (data.addKill(hardLine)) - { - AddStat(player, "KillStreak", 1, false, false); - ((KitPlayer)GetKit(player)).awardKillStreak(player, hardLine ? (data.getKills() + 1) : data.getKills()); - } - if (UtilMath.isEven(data.getKills())) - { - Bukkit.broadcastMessage(F.main("Game", C.cGreen + C.Bold + player.getName() + ChatColor.RESET + " is on a " + F.elem(C.cDPurple + data.getKills() + " player Kill Streak") + "!")); - } - } - - @EventHandler - public void TNTExplosion(ExplosionPrimeEvent event) - { - if (!event.getEntity().hasMetadata("THROWER")) - { - return; - } - float radius = event.getRadius(); - event.setRadius(0f); - - Player player = UtilPlayer.searchExact(((MetadataValue)UtilEnt.GetMetadata(event.getEntity(), "THROWER")).asString()); - if (player == null) - { - return; - } - if (GetTeam(player) == null) - { - return; - } - if (GetKit(player).GetName().equals("Demolitionist")) - { - radius += 3; - } - - Map nearby = UtilPlayer.getInRadius(event.getEntity().getLocation(), radius); - for (Player near : nearby.keySet()) - { - if (UtilPlayer.isSpectator(near)) - { - continue; - } - if (near.getEntityId() != player.getEntityId() && GetTeam(near).GetColor() == GetTeam(player).GetColor()) - { - continue; - } - if (near.getEntityId() == player.getEntityId() && event.getEntity().hasMetadata("OBJECTIVE_TNT")) - { - continue; - } - - double mult = nearby.get(near); - - int highestBlastProt = 0; - int blastProtEPF = 0; - for (ItemStack item : near.getInventory().getArmorContents()) - { - if (item != null && item.getEnchantments().containsKey(Enchantment.PROTECTION_EXPLOSIONS)) - { - blastProtEPF += (2 * item.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS)); - if (item.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS) > highestBlastProt) - { - highestBlastProt = item.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS); - } - } - } - blastProtEPF = Math.min(blastProtEPF, 20); - - double damage = 8 * mult; - damage = damage * (1 - (blastProtEPF / 25)); - - double knockbackReduction = 1 - (highestBlastProt * 0.15); - - near.damage(damage, event.getEntity()); - UtilAction.velocity(near, UtilAlg.getTrajectory(event.getEntity().getLocation(), near.getLocation()), 1 * mult * knockbackReduction, false, 0, mult * knockbackReduction, 10, true); - } - - if (event.getEntity().hasMetadata("OBJECTIVE_TNT")) - { - List crystals = new ArrayList<>(); - - for (List c : _crystals.values()) - { - crystals.addAll(c); - } - for (TeamCrystal crystal : crystals) - { - if (crystal.isActive() && !crystal.getOwner().HasPlayer(player) && UtilMath.offset(event.getEntity().getLocation(), crystal.getLocation()) <= radius) - { - crystal.destroy(); - AddGems(player, 40, "Crystal Destruction", false, true); - long remaining = crystals.stream().filter(b -> b.getOwner().GetColor() == crystal.getOwner().GetColor()).filter(TeamCrystal::isActive).count(); - if (remaining > 0) - { - Bukkit.broadcastMessage(F.main("Game", "One of " + F.elem(crystal.getOwner().GetFormattedName() + "'s Crystals") + " has been destroyed!")); - } - else - { - Bukkit.broadcastMessage(F.main("Game", "All of " + F.elem(crystal.getOwner().GetFormattedName() + "'s Crystals") + " has been destroyed and " + F.elem(_kings.get(crystal.getOwner()).getName(false)) + " is now vulnerable!")); - } - } - } - for (TeamKing king : _kings.values()) - { - if (king.isDead() && !king.getOwner().HasPlayer(player) && UtilMath.offset(event.getEntity().getLocation(), king.getLocation()) <= radius) - { - king.handleDamage(player.getName(), 50); - } - } - } - } - - @EventHandler - public void TNTThrow(PlayerInteractEvent event) - { - if (!IsLive()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.L)) - { - return; - } Player player = event.getPlayer(); - if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0)) - { - return; - } - if (!IsAlive(player)) - { return; - } - event.setCancelled(true); + if (!GetTeam(ChatColor.RED).HasPlayer(player)) + return; - if (!Manager.GetGame().CanThrowTNT(player.getLocation())) - { - // Inform - UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throwing TNT") + " here.")); + if (_tntCarry.containsKey(player)) return; - } - UtilInv.remove(player, Material.TNT, (byte) 0, 1); - UtilInv.Update(player); + event.getClickedBlock().setTypeId(0); - TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); + FallingBlock tnt = player.getWorld().spawnFallingBlock(player.getEyeLocation(), 46, (byte) 0); - tnt.setFuseTicks(60); - - double throwMult = 1; - - if (GetKit(player).GetName().equals("Demolitionist")) - { - throwMult = ((KitDemolitionist)GetKit(player)).getThrowMultiplier(player); - } - - UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5 * throwMult, false, 0, 0.1, 10, false); - - UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); - } - - @EventHandler - public void onLaunch(ProjectileHitEvent event) - { - if (!IsLive()) - { - return; - } - - if (event.getEntity() instanceof EnderPearl && event.getEntity().getShooter() != null && event.getEntity().getShooter() instanceof Entity) - { - Entity shooter = (Entity) event.getEntity().getShooter(); - if (_tntCarry.contains(shooter)) - { - return; - } - Location teleport = event.getEntity().getLocation(); - teleport.setPitch(shooter.getLocation().getPitch()); - teleport.setYaw(shooter.getLocation().getYaw()); - shooter.teleport(teleport); - } - if (event.getEntity() instanceof Arrow) - { - Manager.runSyncLater(event.getEntity()::remove, 1L); - } - } - - @EventHandler - public void onOpenChest(PlayerInteractEvent event) - { - if (!IsLive()) - { - return; - } - - if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.CHEST) - { - if (UtilPlayer.isSpectator(event.getPlayer())) - { - event.setCancelled(true); - } - } - } - - @EventHandler(ignoreCancelled = true) - public void onDamage(EntityDamageEvent event) - { - if (!IsLive()) - { - return; - } - if (event.getEntity() instanceof EnderCrystal) - { - event.setCancelled(true); - return; - } - if (event.getEntity() instanceof Zombie) - { - event.setCancelled(true); - if (event instanceof EntityDamageByEntityEvent) - { - GameTeam owner = event.getEntity().getCustomName().contains("Ryan") ? GetTeam(ChatColor.AQUA) : GetTeam(ChatColor.RED); - EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event; - if (e.getDamager() instanceof Player) - { - Player p = (Player) e.getDamager(); - if (UtilPlayer.isSpectator(p)) - { - return; - } - if (owner.HasPlayer(p)) - { - return; - } - if (_crystals.get(owner).stream().filter(TeamCrystal::isActive).count() > 0) - { - UtilPlayer.message(p, F.main("Game", "You cannot attack the enemy king until your team has destroyed his protective crystals!")); - return; - } - TeamKing king = _kings.get(owner); - if (king.handleDamage(p.getName(), e.getDamage())) - { - for (Player alert : owner.GetPlayers(true)) - { - if (Recharge.Instance.use(alert, "KingDamageAlert", 5000, false, false)) - { - alert.sendMessage(king.getName(true) + " is under attack!"); - } - } - } - } - } - } - } - - @EventHandler - public void onDrop(PlayerDropItemEvent event) - { - if (!IsLive()) - { - return; - } - - ItemStack drop = event.getItemDrop().getItemStack(); - if (drop.hasItemMeta() && drop.getItemMeta().hasLore() && drop.getItemMeta().getLore().stream().map(ChatColor::stripColor).anyMatch(lore -> lore.equals("Kit Item"))) - { - event.setCancelled(true); - return; - } - - event.getItemDrop().remove(); - } - - @EventHandler - public void craftItem(PrepareItemCraftEvent event) - { - if (!IsLive()) - { - return; - } - - if (event.getInventory().getResult().getType() == Material.FLINT_AND_STEEL) - { - event.getInventory().setResult(_flintAndSteel.build()); - } - } - - @EventHandler - public void onInvClick(InventoryClickEvent event) - { - if (!IsLive()) - { - return; - } - ItemStack current = event.getCurrentItem(); - if (event.getAction() == InventoryAction.HOTBAR_SWAP || event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD) - { - current = event.getWhoClicked().getInventory().getItem(event.getHotbarButton()); - } - if (current == null || !current.hasItemMeta()) - { - return; - } - if (current.getItemMeta().hasDisplayName() && current.getItemMeta().getDisplayName().equals(C.cRed + "TNT")) - { - event.setCancelled(true); - return; - } - if (event.getView().getTopInventory() != null && event.getView().getTopInventory().getType() == InventoryType.CHEST) - { - if (current.getItemMeta().hasLore()) - { - for (String lore : current.getItemMeta().getLore()) - { - if (ChatColor.stripColor(lore).equalsIgnoreCase("Kit Item")) - { - event.setCancelled(true); - break; - } - } - } + player.eject(); + player.setPassenger(tnt); - } + _tntCarry.put(player, tnt); + + UtilPlayer.message(player, F.main("Game", "You picked up " + F.skill("TNT") + ".")); + UtilPlayer.message(player, F.main("Game", F.elem("Right-Click") + " to detonate yourself.")); } - - @EventHandler - public void onFirstBlood(FirstBloodEvent event) - { - if (!IsLive()) - { - return; - } - - AddStat(event.getPlayer(), "FirstBlood", 1, true, false); - } - - @EventHandler - public void onPearl(PlayerInteractEvent event) - { - if (!IsLive()) - { - return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - - if (event.getItem() != null && event.getItem().getType() == Material.ENDER_PEARL) - { - Player player = (Player) event.getPlayer(); - if (!Recharge.Instance.use(player, "Enderpearl", 4000, true, true)) - { - event.setCancelled(true); - player.updateInventory(); - } - } - } - - @EventHandler - public void onItemDespawn(ItemDespawnEvent event) - { - if (!IsLive()) - { - return; - } - - if (_tntSpawner.isSpawned()) - { - if (_tntSpawner.getItem().getEntityId() == event.getEntity().getEntityId()) - { - event.setCancelled(true); - } - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onPickup(PlayerPickupItemEvent event) - { - if (!IsLive()) - { - return; - } - - if (_tntSpawner.isSpawned() && event.getItem().getEntityId() == _tntSpawner.getItem().getEntityId()) - { - event.setCancelled(true); - if (!_tntCarry.contains(event.getPlayer())) - { - _tntSpawner.pickup(); - _tntCarry.add(event.getPlayer()); - event.getPlayer().setMetadata("OLD_HELM", new FixedMetadataValue(UtilServer.getPlugin(), event.getPlayer().getInventory().getHelmet())); - event.getPlayer().setMetadata("TNT_START", new FixedMetadataValue(UtilServer.getPlugin(), System.currentTimeMillis())); - event.getPlayer().getInventory().setHelmet(_wearableTnt.build()); - UtilPlayer.message(event.getPlayer(), F.main("Game", "You picked up " + F.skill("TNT") + ".")); - UtilPlayer.message(event.getPlayer(), F.main("Game", F.elem("Right-Click") + " to detonate yourself.")); - UtilPlayer.message(event.getPlayer(), F.main("Game", "Run to the enemy Crystal and Detonate to destroy it.")); - } - } - } - - @EventHandler(ignoreCancelled = true) + + @EventHandler(priority = EventPriority.NORMAL) public void TNTUse(PlayerInteractEvent event) { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) + return; + Player player = event.getPlayer(); - - if (!_tntCarry.contains(player)) - { + + if (!_tntCarry.containsKey(player)) return; - } - - if (!UtilEvent.isAction(event, ActionType.R)) - { - return; - } - + event.setCancelled(true); - - player.getInventory().setHelmet((ItemStack) player.getMetadata("OLD_HELM").get(0).value()); - player.removeMetadata("OLD_HELM", UtilServer.getPlugin()); - player.removeMetadata("TNT_START", UtilServer.getPlugin()); - _tntCarry.remove(player); + + for (Location loc : _tntSpawns) + { + if (UtilMath.offset(player.getLocation(), loc) < 16) + { + UtilPlayer.message(player, F.main("Game", "You cannot " + F.skill("Detonate") + " so far from the Castle.")); + return; + } + } + + _tntCarry.remove(player).remove(); TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); - UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); - UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true); tnt.setFuseTicks(0); UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); } - + + @EventHandler(priority = EventPriority.LOWEST) + public void TNTDeath(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + if (!_tntCarry.containsKey(player)) + return; + + //Remove the TNT + _tntCarry.get(player).remove(); + + //Flag for Removal + _tntCarryEnd.add(player); + + + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); + tnt.setFuseTicks(0); + UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void TNTDamageDivert(ProjectileHitEvent event) + { + Iterator playerIterator = _tntCarry.keySet().iterator(); + + while (playerIterator.hasNext()) + { + Player player = playerIterator.next(); + + if (player.getPassenger() == null) + continue; + + double dist = UtilMath.offset(player.getPassenger().getLocation(), event.getEntity().getLocation().add(event.getEntity().getVelocity())); + + if (dist < 2) + { + int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d)); + + //Damage Event + Manager.GetDamage().NewDamageEvent(player, (LivingEntity)event.getEntity().getShooter(), event.getEntity(), + DamageCause.CUSTOM, damage, true, false, false, + null, GetName()); + + event.getEntity().remove(); + } + + if (_tntCarryEnd.contains(player)) + { + playerIterator.remove(); + } + } + + _tntCarryEnd.clear(); + } + + @EventHandler public void TNTExpire(UpdateEvent event) { - if (!IsLive()) - { - return; - } - if (event.getType() != UpdateType.FASTER) - { return; - } - Iterator tntIterator = _tntCarry.iterator(); + Iterator tntIterator = _tntCarry.keySet().iterator(); while (tntIterator.hasNext()) { Player player = tntIterator.next(); - - if (player.isDead() || UtilTime.elapsed(player.getMetadata("TNT_START").get(0).asLong(), 60000)) + FallingBlock block = _tntCarry.get(player); + + if (player.isDead() || !block.isValid() || block.getTicksLived() > 1500) { + player.eject(); + block.remove(); + TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); - UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); - UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true); tnt.setFuseTicks(0); - - if (!player.isDead()) - { - player.getInventory().setHelmet((ItemStack) player.getMetadata("OLD_HELM").get(0).value()); - } - player.removeMetadata("OLD_HELM", UtilServer.getPlugin()); - player.removeMetadata("TNT_START", UtilServer.getPlugin()); - + tntIterator.remove(); continue; } - - List crystals = new ArrayList<>(); - - for (List c : _crystals.values()) - { - crystals.addAll(c); - } - for (TeamCrystal crystal : crystals) - { - if (crystal.isActive() && !crystal.getOwner().HasPlayer(player) && UtilMath.offset(player.getLocation(), crystal.getLocation()) <= 3) - { - TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); - UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); - UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true); - tnt.setFuseTicks(0); - - if (!player.isDead()) - { - player.getInventory().setHelmet((ItemStack) player.getMetadata("OLD_HELM").get(0).value()); - } - player.removeMetadata("OLD_HELM", UtilServer.getPlugin()); - player.removeMetadata("TNT_START", UtilServer.getPlugin()); - - tntIterator.remove(); - } - } - - UtilTextBottom.display(GetTeam(player).GetColor() + player.getName() + " has the TNT!", UtilServer.getPlayers()); + + //Firework UtilFirework.playFirework(player.getEyeLocation(), Type.BURST, Color.RED, false, false); } } - + @EventHandler - public void onDeath(PlayerDeathEvent event) + public void TNTWeakness(ExplosionPrimeEvent event) { - Player player = event.getEntity(); - - _streakData.getOrDefault(player, new KillStreakData()).reset(); - - if (!_tntCarry.contains(player)) + Location weakness = null; + for (Location loc : _tntWeakness) { - return; + if (UtilMath.offset(loc, event.getEntity().getLocation()) < 4) + { + weakness = loc; + break; + } } - - player.removeMetadata("OLD_HELM", UtilServer.getPlugin()); - player.removeMetadata("TNT_START", UtilServer.getPlugin()); - _tntCarry.remove(player); - TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); - UtilEnt.SetMetadata(tnt, "THROWER", player.getName()); - UtilEnt.SetMetadata(tnt, "OBJECTIVE_TNT", true); - tnt.setFuseTicks(0); - UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); + + if (weakness == null) + return; + + _tntWeakness.remove(weakness); + + final Location extra = weakness; + + for (int i = 0; i < 10; i++) + { + Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + public void run() + { + TNTPrimed tnt = extra.getWorld().spawn(extra.clone().add(3 - UtilMath.r(6), 5 + UtilMath.r(2), 3 - UtilMath.r(6)), TNTPrimed.class); + tnt.setFuseTicks(0); + tnt.setIsIncendiary(true); + } + }, i * 3); + } + + weakness.getWorld().playSound(weakness, Sound.EXPLODE, 16f, 0.8f); } - - @EventHandler - public void onBlockPlace(BlockPlaceEvent event) + + @EventHandler(priority = EventPriority.HIGH) + public void AttackerBlockBreak(org.bukkit.event.block.BlockBreakEvent event) { - if (_tntSpawner.canPlaceFireAt(event.getBlock())) + GameTeam team = GetTeam(event.getPlayer()); + if (team == null) + return; + + if (team.GetColor() != ChatColor.RED) + return; + + if (event.getBlock().getTypeId() == 85) + event.setCancelled(false); + } + + @EventHandler + public void DefenderBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) + { + GameTeam team = GetTeam(event.getPlayer()); + if (team == null) + return; + + if (team.GetColor() != ChatColor.AQUA) + return; + + if (event.getBlock().getTypeId() != 85) + return; + + for (Block block : UtilBlock.getSurrounding(event.getBlock(), false)) + { + if (block.isLiquid()) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " in water.")); + } + } + + if (event.getBlockAgainst().getTypeId() == 85) { event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " on each other.")); + } + + if (_king != null && UtilMath.offset(_king.getLocation(), event.getBlock().getLocation().add(0.5, 0.5, 0.5)) < 4) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " near " + F.elem(C.cAqua + _kingName) + ".")); } } -} \ No newline at end of file + + @EventHandler + public void DefenderBlockInteract(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + GameTeam team = GetTeam(event.getPlayer()); + if (team == null) + return; + + if (team.GetColor() != ChatColor.AQUA) + return; + + if (event.getClickedBlock() == null || event.getClickedBlock().getTypeId() != 85) + return; + + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, + ViewDist.LONG, UtilServer.getPlayers()); + event.getClickedBlock().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.NOTE_STICKS, 2f, 1f); + Manager.GetBlockRestore().add(event.getClickedBlock(), 0, (byte) 0, 1000); + } + + @EventHandler + public void DayTimer(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.TICK) + return; + + WorldTimeSet = (WorldTimeSet + 1); + } + + @EventHandler + public void SnowDamage(UpdateEvent event) + { + if (GetState() != GameState.Live) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : GetPlayers(true)) + if (player.getLocation().getBlock().getTypeId() == 78) + { + //Damage Event + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.DROWNING, 2, false, true, false, + "Snow", "Snow Damage"); + + player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiegeClassic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiegeClassic.java deleted file mode 100644 index 76e0d0f7c..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiegeClassic.java +++ /dev/null @@ -1,973 +0,0 @@ -package nautilus.game.arcade.game.games.castlesiege; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.Effect; -import org.bukkit.EntityEffect; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Horse; -import org.bukkit.entity.Horse.Style; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.ExplosionPrimeEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -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.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.events.PlayerGameRespawnEvent; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.castlesiege.classickits.KitHumanKnight; -import nautilus.game.arcade.game.games.castlesiege.classickits.KitHumanMarksman; -import nautilus.game.arcade.game.games.castlesiege.classickits.KitHumanPeasant; -import nautilus.game.arcade.game.games.castlesiege.classickits.KitUndeadArcher; -import nautilus.game.arcade.game.games.castlesiege.classickits.KitUndeadGhoul; -import nautilus.game.arcade.game.games.castlesiege.classickits.KitUndeadZombie; -import nautilus.game.arcade.game.modules.compass.CompassModule; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.NullKit; -import nautilus.game.arcade.stats.BloodThirstyStatTracker; -import nautilus.game.arcade.stats.KingDamageStatTracker; -import nautilus.game.arcade.stats.KingSlayerStatTracker; -import nautilus.game.arcade.stats.TeamDeathsStatTracker; -import nautilus.game.arcade.stats.TeamKillsStatTracker; -import nautilus.game.arcade.stats.WinAsTeamStatTracker; - -public class CastleSiegeClassic extends TeamGame -{ - public static class KingDamageEvent extends PlayerEvent - { - private static final HandlerList handlers = new HandlerList(); - - public static HandlerList getHandlerList() - { - return handlers; - } - - @Override - public HandlerList getHandlers() - { - return getHandlerList(); - } - - private final double _damage; - - public KingDamageEvent(Player who, double damage) - { - super(who); - - _damage = damage; - } - - public double getDamage() - { - return _damage; - } - } - - public static class KingSlaughterEvent extends PlayerEvent - { - private static final HandlerList handlers = new HandlerList(); - - public static HandlerList getHandlerList() - { - return handlers; - } - - @Override - public HandlerList getHandlers() - { - return getHandlerList(); - } - - public KingSlaughterEvent(Player who) - { - super(who); - } - } - - private ArrayList _lastScoreboard = new ArrayList(); - - private long _tntSpawn = 0; - private ArrayList _tntSpawns = new ArrayList(); - private ArrayList _tntWeakness = new ArrayList(); - - private HashMap _tntCarry = new HashMap(); - private HashSet _tntCarryEnd = new HashSet(); - - private ArrayList _kingLocs; - private Creature _king; - private Location _kingLoc; - private String _kingName; - private Player _kingDamager = null; - private int _kingHealth = 40; - - private ArrayList _peasantSpawns; - private ArrayList _horseSpawns; - - public CastleSiegeClassic(ArcadeManager manager) - { - super(manager, GameType.CastleSiege, - - new Kit[] - { - new KitHumanMarksman(manager), - new KitHumanKnight(manager), - //new KitHumanBrawler(manager), - //new KitHumanAssassin(manager), - new NullKit(manager), - new KitHumanPeasant(manager), - new NullKit(manager), - new KitUndeadGhoul(manager), - new KitUndeadArcher(manager), - new KitUndeadZombie(manager), - }, - - new String[] - { - F.elem(C.cAqua + "Defenders") + C.cWhite + " must defend the King.", - F.elem(C.cAqua + "Defenders") + C.cWhite + " win when the sun rises.", - F.elem(C.cAqua + "Defenders") + C.cWhite + " respawn as wolves.", - "", - F.elem(C.cRed + "Undead") + C.cWhite + " must kill the King.", - F.elem(C.cRed + "Undead") + C.cWhite + " lose when the sun rises.", - - }); - - _help = new String[] - { - "Marksmen are extremely important to defence!", - "It's recommended 50%+ of defence are Marksmen.", - "Use Barricades to block the Undeads path.", - "Use TNT to destroy weak points in walls.", - "Weak points are marked by cracked stone brick.", - "Undead can break fences with their axes.", - "Undead Archers must pick up arrows from the ground.", - - }; - - this.StrictAntiHack = true; - - this.HungerSet = 20; - this.DeathOut = false; - this.WorldTimeSet = 14000; //14000 - this.BlockPlaceAllow.add(85); - - _kingName = C.cYellow + C.Bold + "King Sparklez"; - - GameTeam notRedTeam = null; - for (GameTeam team : GetTeamList()) - { - if (team.GetColor() != ChatColor.RED) - { - notRedTeam = team; - break; - } - } - - registerStatTrackers( - new KingSlayerStatTracker(this), - new BloodThirstyStatTracker(this), - new KingDamageStatTracker(this), - - new TeamDeathsStatTracker(this), - new TeamKillsStatTracker(this) - ); - - registerChatStats( - Kills, - Deaths, - KDRatio, - BlankLine, - Assists, - DamageDealt, - DamageTaken - ); - - registerChatStats(); - - new CompassModule() - .setGiveCompass(true) - .setGiveCompassToSpecs(true) - .setGiveCompassToAlive(false) - .register(this); - } - - @Override - public void ParseData() - { - _tntSpawns = WorldData.GetDataLocs("RED"); - _tntWeakness = WorldData.GetDataLocs("BLACK"); - - _kingLocs = WorldData.GetDataLocs("YELLOW"); - - _peasantSpawns = WorldData.GetDataLocs("GREEN"); - _horseSpawns = WorldData.GetDataLocs("BROWN"); - } - - @Override - public void RestrictKits() - { - for (Kit kit : GetKits()) - { - for (GameTeam team : GetTeamList()) - { - if (team.GetColor() == ChatColor.RED) - { - if (kit.GetName().contains("Castle")) - team.GetRestrictedKits().add(kit); - - team.SetName("Undead"); - } - else - { - if (kit.GetName().contains("Undead")) - team.GetRestrictedKits().add(kit); - - team.SetRespawnTime(8); - - team.SetName("Defenders"); - } - } - } - } - - @EventHandler(priority = EventPriority.HIGH) - public void registerTeamTracker(GameStateChangeEvent event) - { - if (event.GetState() == GameState.Recruit) - { - GameTeam notRed = null; - - for (GameTeam team : GetTeamList()) - { - if (team.GetColor() == ChatColor.RED) - continue; - - notRed = team; - break; - } - - if (notRed != null) - { - registerStatTrackers(new WinAsTeamStatTracker(this, notRed, "ForTheKing")); - System.out.println("Successfully registered For the King StatTrak"); - } - } - } - - @EventHandler - public void MoveKits(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Prepare) - return; - - for (int i = 0; i < WorldData.GetDataLocs("PINK").size() && i < 3; i++) - { - if (GetKits().length <= 5 + i) - continue; - - this.CreatureAllowOverride = true; - Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); - this.CreatureAllowOverride = false; - - Manager.GetLobby().addKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("PINK").get(i)); - } - } - - @EventHandler - public void HorseSpawn(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Prepare) - return; - - for (Location loc : _horseSpawns) - { - this.CreatureAllowOverride = true; - Horse horse = loc.getWorld().spawn(loc, Horse.class); - this.CreatureAllowOverride = false; - - horse.setAdult(); - horse.setAgeLock(true); - horse.setColor(org.bukkit.entity.Horse.Color.BLACK); - horse.setStyle(Style.BLACK_DOTS); - horse.setMaxDomestication(1); - horse.getInventory().setSaddle(new ItemStack(Material.SADDLE)); - horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING)); - - horse.setMaxHealth(60); - horse.setHealth(horse.getMaxHealth()); - - horse.setCustomName("War Horse"); - } - } - - @EventHandler - public void HorseInteract(PlayerInteractEntityEvent event) - { - if (!(event.getRightClicked() instanceof Horse)) - return; - - Player player = event.getPlayer(); - GameTeam team = GetTeam(player); - - if (team == null || team.GetColor() == ChatColor.RED || !IsAlive(player)) - { - event.setCancelled(true); - } - } - - @EventHandler - public void HorseDamageCancel(CustomDamageEvent event) - { - if (!(event.GetDamageeEntity() instanceof Horse)) - return; - - Player player = event.GetDamagerPlayer(true); - if (player == null) - return; - - if (!IsAlive(player)) - return; - - if (GetTeam(player) == null) - return; - - if (GetTeam(player).GetColor() == ChatColor.RED) - return; - - event.SetCancelled("Horse Team Damage"); - } - - @EventHandler(priority = EventPriority.HIGH) - public void GameStateChange(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Prepare) - return; - - //Spawn King - this.CreatureAllowOverride = true; - - _kingLoc = _kingLocs.get(UtilMath.r(_kingLocs.size())); - - _king = (Creature) _kingLoc.getWorld().spawnEntity(_kingLoc, EntityType.ZOMBIE); - - _king.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - _king.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); - _king.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); - _king.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - _king.getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); - - _king.setCustomName(_kingName); - _king.setCustomNameVisible(true); - - _king.setRemoveWhenFarAway(false); - - this.CreatureAllowOverride = false; - } - - @EventHandler(priority = EventPriority.HIGH) - public void SetDefenderRespawn(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Live) - return; - - //Change to Peasant Spawns - this.GetTeam(ChatColor.AQUA).SetSpawns(_peasantSpawns); - } - - - @EventHandler - public void KingTarget(EntityTargetEvent event) - { - event.setCancelled(true); - } - - @EventHandler - public void KingDamage(CustomDamageEvent event) - { - if (_king == null || !_king.isValid()) - return; - - if (!event.GetDamageeEntity().equals(_king)) - return; - - event.SetCancelled("King Damage"); - - Player damager = event.GetDamagerPlayer(true); - if (damager == null) return; - - GameTeam team = GetTeam(damager); - - if (team != null && team.GetColor() == ChatColor.RED) - { - if (!Recharge.Instance.use(damager, "Damage King", 400, false, false)) - return; - - if (!IsAlive(damager)) - { - return; - } - - _king.playEffect(EntityEffect.HURT); - - _kingDamager = damager; - _kingHealth--; - - Bukkit.getPluginManager().callEvent(new KingDamageEvent(damager, 1)); - - if (_kingHealth < 0) - _kingHealth = 0; - - WriteScoreboard(); - - if (_kingHealth <= 0) - _king.damage(500); - - EndCheck(); - } - } - - @EventHandler - public void KingUpdate(UpdateEvent event) - { - if (GetState() != GameState.Live) - return; - - if (event.getType() != UpdateType.SEC) - return; - - if (_king == null) - return; - - if (UtilMath.offset(_king.getLocation(), _kingLoc) > 6) - { - _king.teleport(_kingLoc); - } - else - { - UtilEnt.CreatureMove(_king, _kingLoc, 1f); - } - } - - @EventHandler - public void PlayerDeath(PlayerGameRespawnEvent event) - { - if (GetTeam(ChatColor.AQUA).HasPlayer(event.GetPlayer())) - SetKit(event.GetPlayer(), GetKits()[3], true); - } - - @Override - @EventHandler - public void ScoreboardUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - WriteScoreboard(); - } - - public void WriteScoreboard() - { - //Get Values - HashMap _scoreGroup = new HashMap(); - _scoreGroup.put(C.cAqua + "Defenders", 0); - _scoreGroup.put(C.cDAqua + "Wolves", 0); - _scoreGroup.put(C.cRed + "Undead", 0); - - for (Player player : UtilServer.getPlayers()) - { - if (!IsAlive(player)) - continue; - - Kit kit = GetKit(player); - if (kit == null) continue; - - if (kit.GetName().contains("Castle")) - { - if (kit.GetName().contains("Wolf")) - { - _scoreGroup.put(C.cDAqua + "Wolves", 1 + _scoreGroup.get(C.cDAqua + "Wolves")); - } - else - { - _scoreGroup.put(C.cAqua + "Defenders", 1 + _scoreGroup.get(C.cAqua + "Defenders")); - } - } - else if (kit.GetName().contains("Undead")) - { - _scoreGroup.put(C.cRed + "Undead", 1 + _scoreGroup.get(C.cRed + "Undead")); - } - } - - //Wipe Last - Scoreboard.reset(); - - //Teams - for (String group : _scoreGroup.keySet()) - { - Scoreboard.writeNewLine(); - Scoreboard.write(group); - Scoreboard.write(ChatColor.getLastColors(group) + _scoreGroup.get(group) + " Players"); - } - - //King - if (_king != null && _king.isValid()) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cYellow + C.Bold + "King"); - Scoreboard.write(_kingHealth + " Health"); - } - - long timeLeft = 24000 - WorldTimeSet; - timeLeft = timeLeft / 20 * 1000; - - - if (timeLeft > 0) - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cYellow + C.Bold + "Sun Rise"); - Scoreboard.write(UtilTime.MakeStr(timeLeft, 0)); - } - else - { - Scoreboard.writeNewLine(); - Scoreboard.write(C.cYellow + C.Bold + "Sun Rise"); - Scoreboard.write("Undead Burning!"); - - for (Player player : GetTeam(ChatColor.RED).GetPlayers(true)) - Manager.GetCondition().Factory().Ignite("Sun Damage", player, player, 5, false, false); - } - - Scoreboard.draw(); - } - - @Override - public void EndCheck() - { - if (!IsLive()) - return; - - if (this.WorldTimeSet > 24100 || GetTeam(ChatColor.RED).GetSize() == 0) - { - SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the siege!"); - - AnnounceEnd(GetTeam(ChatColor.AQUA)); - - 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); - } - - SetState(GameState.End); - } - - if (!_king.isValid() || GetTeam(ChatColor.AQUA).GetSize() == 0) - { - if (_kingDamager != null) - { - SetCustomWinLine(C.cRed + _kingDamager.getName() + C.cWhite + " slaughtered " + _kingName + ChatColor.RESET + "!"); - AddGems(_kingDamager, 20, "King Slayer", false, false); - - Bukkit.getPluginManager().callEvent(new KingSlaughterEvent(_kingDamager)); - } - else - SetCustomWinLine(_kingName + ChatColor.RESET + " has died!"); - - AnnounceEnd(GetTeam(ChatColor.RED)); - - 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); - } - - SetState(GameState.End); - } - } - - @EventHandler - public void TNTSpawn(UpdateEvent event) - { - if (GetState() != GameState.Live) - return; - - if (event.getType() != UpdateType.SEC) - return; - - if (!UtilTime.elapsed(this.GetStateTime(), 20000)) - return; - - if (!UtilTime.elapsed(_tntSpawn, 25000)) - return; - - if (_tntSpawns.isEmpty()) - return; - - Location loc = _tntSpawns.get(UtilMath.r(_tntSpawns.size())); - - if (loc.getBlock().getTypeId() == 46) - return; - - loc.getBlock().setTypeId(46); - _tntSpawn = System.currentTimeMillis(); - } - - @EventHandler(priority = EventPriority.LOW) - public void TNTPickup(PlayerInteractEvent event) - { - if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_BLOCK) - return; - - if (event.getClickedBlock().getTypeId() != 46) - return; - - event.setCancelled(true); - - Player player = event.getPlayer(); - - if (!IsAlive(player)) - return; - - if (!GetTeam(ChatColor.RED).HasPlayer(player)) - return; - - if (_tntCarry.containsKey(player)) - return; - - event.getClickedBlock().setTypeId(0); - - FallingBlock tnt = player.getWorld().spawnFallingBlock(player.getEyeLocation(), 46, (byte) 0); - - player.eject(); - player.setPassenger(tnt); - - _tntCarry.put(player, tnt); - - UtilPlayer.message(player, F.main("Game", "You picked up " + F.skill("TNT") + ".")); - UtilPlayer.message(player, F.main("Game", F.elem("Right-Click") + " to detonate yourself.")); - } - - @EventHandler(priority = EventPriority.NORMAL) - public void TNTUse(PlayerInteractEvent event) - { - if (event.isCancelled()) - return; - - if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) - return; - - Player player = event.getPlayer(); - - if (!_tntCarry.containsKey(player)) - return; - - event.setCancelled(true); - - for (Location loc : _tntSpawns) - { - if (UtilMath.offset(player.getLocation(), loc) < 16) - { - UtilPlayer.message(player, F.main("Game", "You cannot " + F.skill("Detonate") + " so far from the Castle.")); - return; - } - } - - _tntCarry.remove(player).remove(); - - TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); - tnt.setFuseTicks(0); - UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void TNTDeath(PlayerDeathEvent event) - { - Player player = event.getEntity(); - - if (!_tntCarry.containsKey(player)) - return; - - //Remove the TNT - _tntCarry.get(player).remove(); - - //Flag for Removal - _tntCarryEnd.add(player); - - - TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); - tnt.setFuseTicks(0); - UtilPlayer.message(player, F.main("Game", "You used " + F.skill("Detonate") + ".")); - } - - @EventHandler(priority = EventPriority.LOWEST) - public void TNTDamageDivert(ProjectileHitEvent event) - { - Iterator playerIterator = _tntCarry.keySet().iterator(); - - while (playerIterator.hasNext()) - { - Player player = playerIterator.next(); - - if (player.getPassenger() == null) - continue; - - double dist = UtilMath.offset(player.getPassenger().getLocation(), event.getEntity().getLocation().add(event.getEntity().getVelocity())); - - if (dist < 2) - { - int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d)); - - //Damage Event - Manager.GetDamage().NewDamageEvent(player, (LivingEntity)event.getEntity().getShooter(), event.getEntity(), - DamageCause.CUSTOM, damage, true, false, false, - null, GetName()); - - event.getEntity().remove(); - } - - if (_tntCarryEnd.contains(player)) - { - playerIterator.remove(); - } - } - - _tntCarryEnd.clear(); - } - - - @EventHandler - public void TNTExpire(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - Iterator tntIterator = _tntCarry.keySet().iterator(); - - while (tntIterator.hasNext()) - { - Player player = tntIterator.next(); - FallingBlock block = _tntCarry.get(player); - - if (player.isDead() || !block.isValid() || block.getTicksLived() > 1500) - { - player.eject(); - block.remove(); - - TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation(), TNTPrimed.class); - tnt.setFuseTicks(0); - - tntIterator.remove(); - continue; - } - - //Firework - UtilFirework.playFirework(player.getEyeLocation(), Type.BURST, Color.RED, false, false); - } - } - - @EventHandler - public void TNTWeakness(ExplosionPrimeEvent event) - { - Location weakness = null; - for (Location loc : _tntWeakness) - { - if (UtilMath.offset(loc, event.getEntity().getLocation()) < 4) - { - weakness = loc; - break; - } - } - - if (weakness == null) - return; - - _tntWeakness.remove(weakness); - - final Location extra = weakness; - - for (int i = 0; i < 10; i++) - { - Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - public void run() - { - TNTPrimed tnt = extra.getWorld().spawn(extra.clone().add(3 - UtilMath.r(6), 5 + UtilMath.r(2), 3 - UtilMath.r(6)), TNTPrimed.class); - tnt.setFuseTicks(0); - tnt.setIsIncendiary(true); - } - }, i * 3); - } - - weakness.getWorld().playSound(weakness, Sound.EXPLODE, 16f, 0.8f); - } - - @EventHandler(priority = EventPriority.HIGH) - public void AttackerBlockBreak(org.bukkit.event.block.BlockBreakEvent event) - { - GameTeam team = GetTeam(event.getPlayer()); - if (team == null) - return; - - if (team.GetColor() != ChatColor.RED) - return; - - if (event.getBlock().getTypeId() == 85) - event.setCancelled(false); - } - - @EventHandler - public void DefenderBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) - { - GameTeam team = GetTeam(event.getPlayer()); - if (team == null) - return; - - if (team.GetColor() != ChatColor.AQUA) - return; - - if (event.getBlock().getTypeId() != 85) - return; - - for (Block block : UtilBlock.getSurrounding(event.getBlock(), false)) - { - if (block.isLiquid()) - { - event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " in water.")); - } - } - - if (event.getBlockAgainst().getTypeId() == 85) - { - event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " on each other.")); - } - - if (_king != null && UtilMath.offset(_king.getLocation(), event.getBlock().getLocation().add(0.5, 0.5, 0.5)) < 4) - { - event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.elem("Barricade") + " near " + F.elem(C.cAqua + _kingName) + ".")); - } - } - - @EventHandler - public void DefenderBlockInteract(PlayerInteractEvent event) - { - if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) - return; - - GameTeam team = GetTeam(event.getPlayer()); - if (team == null) - return; - - if (team.GetColor() != ChatColor.AQUA) - return; - - if (event.getClickedBlock() == null || event.getClickedBlock().getTypeId() != 85) - return; - - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); - event.getClickedBlock().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.NOTE_STICKS, 2f, 1f); - Manager.GetBlockRestore().add(event.getClickedBlock(), 0, (byte) 0, 1000); - } - - @EventHandler - public void DayTimer(UpdateEvent event) - { - if (GetState() != GameState.Live) - return; - - if (event.getType() != UpdateType.TICK) - return; - - WorldTimeSet = (WorldTimeSet + 1); - } - - @EventHandler - public void SnowDamage(UpdateEvent event) - { - if (GetState() != GameState.Live) - return; - - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : GetPlayers(true)) - if (player.getLocation().getBlock().getTypeId() == 78) - { - //Damage Event - Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.DROWNING, 2, false, true, false, - "Snow", "Snow Damage"); - - player.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, 80); - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHuman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHuman.java similarity index 90% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHuman.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHuman.java index 0adab2c1b..6c4da8994 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHuman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHuman.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.classickits; +package nautilus.game.arcade.game.games.castlesiege.kits; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanKnight.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java index e1387e91f..ec8a3ddbc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.classickits; +package nautilus.game.arcade.game.games.castlesiege.kits; import mineplex.core.common.util.C; import mineplex.core.common.util.F; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanMarksman.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java index d2687a1ea..fcd021465 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.classickits; +package nautilus.game.arcade.game.games.castlesiege.kits; import org.bukkit.Material; import org.bukkit.entity.EntityType; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanPeasant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java similarity index 96% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanPeasant.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java index a59843e3e..c1ec3e24f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitHumanPeasant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.classickits; +package nautilus.game.arcade.game.games.castlesiege.kits; import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.itemstack.ItemStackFactory; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndead.java similarity index 93% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndead.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndead.java index 035385d90..31db5ed38 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndead.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.classickits; +package nautilus.game.arcade.game.games.castlesiege.kits; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadArcher.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadArcher.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadArcher.java index 481b7249e..ebdefc25a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadArcher.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.classickits; +package nautilus.game.arcade.game.games.castlesiege.kits; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadGhoul.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java similarity index 96% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadGhoul.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java index ec56ec3f4..1c893a7a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadGhoul.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.classickits; +package nautilus.game.arcade.game.games.castlesiege.kits; import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguisePigZombie; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java similarity index 96% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadZombie.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java index f45fc539f..9d9eb4b75 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/classickits/KitUndeadZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.castlesiege.classickits; +package nautilus.game.arcade.game.games.castlesiege.kits; import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguiseZombie; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BloodThirstyStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BloodThirstyStatTracker.java index 82ea187e8..c6df42427 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BloodThirstyStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BloodThirstyStatTracker.java @@ -11,7 +11,7 @@ import org.bukkit.event.EventPriority; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.castlesiege.classickits.KitUndead; +import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead; import nautilus.game.arcade.game.games.hideseek.kits.KitSeeker; public class BloodThirstyStatTracker extends StatTracker diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KingDamageStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KingDamageStatTracker.java index bf5053000..5b84ac9af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KingDamageStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KingDamageStatTracker.java @@ -10,20 +10,20 @@ import org.bukkit.event.EventPriority; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.castlesiege.CastleSiegeClassic; +import nautilus.game.arcade.game.games.castlesiege.CastleSiege; -public class KingDamageStatTracker extends StatTracker +public class KingDamageStatTracker extends StatTracker { private final Map _kingDamage = new HashMap<>(); private double _totalKingDamage = 0; - public KingDamageStatTracker(CastleSiegeClassic game) + public KingDamageStatTracker(CastleSiege game) { super(game); } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onKingDamage(CastleSiegeClassic.KingDamageEvent event) + public void onKingDamage(CastleSiege.KingDamageEvent event) { if (getGame().GetState() != Game.GameState.Live) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KingSlayerStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KingSlayerStatTracker.java index 8f3e7f287..c229272e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KingSlayerStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KingSlayerStatTracker.java @@ -3,7 +3,7 @@ package nautilus.game.arcade.stats; import org.bukkit.event.EventHandler; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.castlesiege.CastleSiegeClassic; +import nautilus.game.arcade.game.games.castlesiege.CastleSiege; public class KingSlayerStatTracker extends StatTracker { @@ -13,7 +13,7 @@ public class KingSlayerStatTracker extends StatTracker } @EventHandler - public void onKingSlaughtered(CastleSiegeClassic.KingSlaughterEvent event) + public void onKingSlaughtered(CastleSiege.KingSlaughterEvent event) { if (getGame().GetState() != Game.GameState.Live) return;