Rename Castle Siege 2.0 to Castle Assault and re-implement the old game

This commit is contained in:
AlexTheCoder 2017-05-08 17:05:30 -04:00
parent 452eaeeba9
commit d13610251f
40 changed files with 2783 additions and 2746 deletions

View File

@ -373,79 +373,95 @@ public enum Achievement
new String[]{"Win 30 games of Master Builders"}, new String[]{"Win 30 games of Master Builders"},
new int[]{30}, new int[]{30},
AchievementCategory.MASTER_BUILDERS), AchievementCategory.MASTER_BUILDERS),
//Castle Siege //Castle Siege
CASTLE_SIEGE_KILL_STREAK("Kill Streak", 0, CASTLE_SIEGE_WINS("FOR THE KING!", 600,
new String[]{"Castle Siege.KillStreak", "Castle Siege TDM.KillStreak"}, 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 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[][]{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}, new int[]{10, 20, 50, 100, 200, 250, 500, 750, 1000, 2000},
"Novice I", "Novice I",
new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, 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, CASTLE_ASSAULT_FIRST_BLOOD("First Blood", 0,
new String[]{"Castle Siege.FirstBlood", "Castle Siege TDM.FirstBlood"}, new String[]{"Castle Assault.FirstBlood", "Castle Assault TDM.FirstBlood"},
new String[]{"Obtain the first kill in a Match"}, 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[][]{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}, new int[]{2, 5, 10, 25, 50},
"Novice I", "Novice I",
new String[]{"Novice II", "Novice III", "Novice IV", "Novice V"}, new String[]{"Novice II", "Novice III", "Novice IV", "Novice V"},
AchievementCategory.CASTLE_SIEGE), AchievementCategory.CASTLE_ASSAULT),
CASTLE_SIEGE_FIGHTER_KIT("Fighter", 0, CASTLE_ASSAULT_FIGHTER_KIT("Fighter", 0,
new String[]{"Castle Siege.FighterKitKills", "Castle Siege TDM.FighterKitKills"}, new String[]{"Castle Assault.FighterKitKills", "Castle Assault TDM.FighterKitKills"},
new String[]{"Kill opponents while wearing the Fighter Kit"}, 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[][]{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}, new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000},
"Novice I", "Novice I",
new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, 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, CASTLE_ASSAULT_TANK_KIT("Tank", 0,
new String[]{"Castle Siege.TankKitKills", "Castle Siege TDM.TankKitKills"}, new String[]{"Castle Assault.TankKitKills", "Castle Assault TDM.TankKitKills"},
new String[]{"Kill opponents while wearing the Tank Kit"}, 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[][]{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}, new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000},
"Novice I", "Novice I",
new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, 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, CASTLE_ASSAULT_ARCHER_KIT("Archer", 0,
new String[]{"Castle Siege.ArcherKitKills", "Castle Siege TDM.ArcherKitKills"}, new String[]{"Castle Assault.ArcherKitKills", "Castle Assault TDM.ArcherKitKills"},
new String[]{"Kill opponents while wearing the Archer Kit"}, 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[][]{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}, new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000},
"Novice I", "Novice I",
new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, 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, CASTLE_ASSAULT_DEMOLITIONIST_KIT("Demolitionist", 0,
new String[]{"Castle Siege.DemolitionistKitKills", "Castle Siege TDM.DemolitionistKitKills"}, new String[]{"Castle Assault.DemolitionistKitKills", "Castle Assault TDM.DemolitionistKitKills"},
new String[]{"Kill opponents while wearing the Demolitionist Kit"}, 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[][]{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}, new int[]{50, 100, 250, 500, 1000, 1500, 3000, 5000, 10000, 20000},
"Novice I", "Novice I",
new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, 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, CASTLE_ASSAULT_WINNER("Assault", 0,
new String[]{"Castle Siege.Wins", "Castle Siege TDM.Wins"}, new String[]{"Castle Assault.Wins", "Castle Assault TDM.Wins"},
new String[]{"Win games of Castle Siege"}, 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[][]{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}, new int[]{2, 5, 25, 50, 100, 150, 250, 500, 1000, 2000},
"Novice I", "Novice I",
new String[]{"Novice II", "Novice III", "Novice IV", "Novice V", "Master I", "Master II", "Master III", "Master IV", "GRANDMASTER"}, 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_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),
//Champions //Champions
CHAMPIONS_WINS("Champion", 600, CHAMPIONS_WINS("Champion", 600,

View File

@ -84,10 +84,15 @@ public enum AchievementCategory
WIZARDS("Wizards", null, WIZARDS("Wizards", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, 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()), 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 }, 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, BAWK_BAWK_BATTLES("Bawk Bawk Battles", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },

View File

@ -14,8 +14,9 @@ public enum GameDisplay
Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.EXTRA, 2, false), 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), BossBattles("Boss Battles", Material.SKULL_ITEM, (byte) 0, GameCategory.EVENT, 55, false),
Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3, true), Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3, true),
CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 67, true), CastleAssault("Castle Assault", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 67, true),
CastleSiegeTDM("Castle Siege TDM", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 68, false), 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), 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), 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), Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8, false),

View File

@ -8,23 +8,25 @@ import java.util.Map.Entry;
import org.bukkit.Location; import org.bukkit.Location;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram;
import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType; import mineplex.core.leaderboard.LeaderboardRepository.LeaderboardSQLType;
public class Leaderboard public class Leaderboard
{ {
private String _display, _statDisplay; private String _display;
private Pair<String, String> _statDisplay;
private String[] _statIds; private String[] _statIds;
private int _size; private int _size;
private LeaderboardSQLType _type; private LeaderboardSQLType _type;
private Location _loc; private Location _loc;
private Hologram _holo; private Hologram _holo;
public Leaderboard(String display, String statDisplayName, String[] statIds, LeaderboardSQLType type, Location displayLoc, int size) public Leaderboard(String display, Pair<String, String> statDisplayNames, String[] statIds, LeaderboardSQLType type, Location displayLoc, int size)
{ {
_display = display; _display = display;
_statDisplay = statDisplayName; _statDisplay = statDisplayNames;
_statIds = statIds; _statIds = statIds;
_type = type; _type = type;
_size = size; _size = size;
@ -57,7 +59,14 @@ public class Leaderboard
int place = 1; int place = 1;
for (Entry<String, Integer> entry : names.entrySet()) for (Entry<String, Integer> 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++; place++;
} }
_holo = new Hologram(Managers.get(LeaderboardManager.class).getHologramManager(), _loc, display.toArray(new String[display.size()])).start(); _holo = new Hologram(Managers.get(LeaderboardManager.class).getHologramManager(), _loc, display.toArray(new String[display.size()])).start();

View File

@ -30,7 +30,7 @@ public class PreferenceMainMenu extends Menu<PreferencesManager>
protected Button[] setUp(Player player) protected Button[] setUp(Player player)
{ {
Rank rank = getPlugin().getClientManager().Get(player).GetRank(); 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]; Button[] buttons = new Button[exclusive ? INV_SIZE_MAX : INV_SIZE_MIN];

View File

@ -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.build.modes.TeamBuild;
import nautilus.game.arcade.game.games.buildmavericks.BuildMavericks; import nautilus.game.arcade.game.games.buildmavericks.BuildMavericks;
import nautilus.game.arcade.game.games.cards.Cards; 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.castlesiege.CastleSiege;
import nautilus.game.arcade.game.games.champions.ChampionsCTF; import nautilus.game.arcade.game.games.champions.ChampionsCTF;
import nautilus.game.arcade.game.games.champions.ChampionsDominate; import nautilus.game.arcade.game.games.champions.ChampionsDominate;
@ -130,8 +131,9 @@ public enum GameType
Basketball(Basketball.class, GameDisplay.Basketball), Basketball(Basketball.class, GameDisplay.Basketball),
BossBattles(BossBattles.class, GameDisplay.BossBattles), BossBattles(BossBattles.class, GameDisplay.BossBattles),
Bridge(Bridge.class, GameDisplay.Bridge), Bridge(Bridge.class, GameDisplay.Bridge),
CastleAssault(CastleAssault.class, GameDisplay.CastleAssault),
CastleAssaultTDM(CastleAssaultTDM.class, GameDisplay.CastleAssaultTDM),
CastleSiege(CastleSiege.class, GameDisplay.CastleSiege), CastleSiege(CastleSiege.class, GameDisplay.CastleSiege),
CastleSiegeTDM(CastleSiegeTDM.class, GameDisplay.CastleSiegeTDM),
ChampionsCTF(ChampionsCTF.class, GameDisplay.ChampionsCTF), ChampionsCTF(ChampionsCTF.class, GameDisplay.ChampionsCTF),
ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate), ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate),
ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM), ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM),

View File

@ -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.ArrayList;
import java.util.HashMap; 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.GameTeam;
import nautilus.game.arcade.game.GemData; import nautilus.game.arcade.game.GemData;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.castlesiege.data.KillStreakData; import nautilus.game.arcade.game.games.castleassault.data.KillStreakData;
import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalData; import nautilus.game.arcade.game.games.castleassault.data.medals.MedalData;
import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalData.MedalLevel; import nautilus.game.arcade.game.games.castleassault.data.medals.MedalData.MedalLevel;
import nautilus.game.arcade.game.games.castlesiege.kits.KitArcher; import nautilus.game.arcade.game.games.castleassault.data.medals.MedalType;
import nautilus.game.arcade.game.games.castlesiege.kits.KitDemolitionist; import nautilus.game.arcade.game.games.castleassault.kits.KitArcher;
import nautilus.game.arcade.game.games.castlesiege.kits.KitFighter; import nautilus.game.arcade.game.games.castleassault.kits.KitDemolitionist;
import nautilus.game.arcade.game.games.castlesiege.kits.KitPlayer; import nautilus.game.arcade.game.games.castleassault.kits.KitFighter;
import nautilus.game.arcade.game.games.castlesiege.kits.KitTank; import nautilus.game.arcade.game.games.castleassault.kits.KitPlayer;
import nautilus.game.arcade.game.games.castlesiege.data.medals.MedalType; import nautilus.game.arcade.game.games.castleassault.kits.KitTank;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit; 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 MAX_FLINT_AND_STEEL_USES = 4;
private static final int ITEMS_PER_CHEST = 5; private static final int ITEMS_PER_CHEST = 5;
@ -116,9 +116,9 @@ public class CastleSiegeTDM extends TeamGame
private boolean _writeScoreboard = true; private boolean _writeScoreboard = true;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public CastleSiegeTDM(ArcadeManager manager) public CastleAssaultTDM(ArcadeManager manager)
{ {
super(manager, GameType.CastleSiegeTDM, super(manager, GameType.CastleAssaultTDM,
new Kit[] new Kit[]
{ {
//new KitAlchemist(manager), //new KitAlchemist(manager),

View File

@ -1,71 +1,71 @@
package nautilus.game.arcade.game.games.castlesiege.data; package nautilus.game.arcade.game.games.castleassault.data;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
public class CapturePoint public class CapturePoint
{ {
private static final int POINTS_TO_CAPTURE = 100; private static final int POINTS_TO_CAPTURE = 100;
private static final long TIME_PER_POINT = 1000; private static final long TIME_PER_POINT = 1000;
private static final int POINTS_PER_TICK = 1; private static final int POINTS_PER_TICK = 1;
private Location _loc; private Location _loc;
private long _lastCap; private long _lastCap;
private int _points = 0; private int _points = 0;
private GameTeam _owner = null; private GameTeam _owner = null;
public CapturePoint(GameTeam owner, Location loc) public CapturePoint(GameTeam owner, Location loc)
{ {
_owner = owner; _owner = owner;
_loc = loc; _loc = loc;
} }
public int getMaxPoints() public int getMaxPoints()
{ {
return POINTS_TO_CAPTURE; return POINTS_TO_CAPTURE;
} }
public int getPoints() public int getPoints()
{ {
return _points; return _points;
} }
public boolean isCaptured() public boolean isCaptured()
{ {
return _points >= POINTS_TO_CAPTURE; return _points >= POINTS_TO_CAPTURE;
} }
public void update() public void update()
{ {
if (!UtilTime.elapsed(_lastCap, TIME_PER_POINT)) if (!UtilTime.elapsed(_lastCap, TIME_PER_POINT))
{ {
return; return;
} }
int capping = 0; int capping = 0;
for (Player player : UtilPlayer.getInRadius(_loc, 3.5).keySet()) for (Player player : UtilPlayer.getInRadius(_loc, 3.5).keySet())
{ {
if (UtilPlayer.isSpectator(player)) if (UtilPlayer.isSpectator(player))
{ {
continue; continue;
} }
if (_owner.HasPlayer(player)) if (_owner.HasPlayer(player))
{ {
continue; continue;
} }
capping++; capping++;
} }
if (capping > 0 && _points < POINTS_TO_CAPTURE) if (capping > 0 && _points < POINTS_TO_CAPTURE)
{ {
_lastCap = System.currentTimeMillis(); _lastCap = System.currentTimeMillis();
_points += POINTS_PER_TICK; _points += POINTS_PER_TICK;
} }
} }
} }

View File

@ -1,47 +1,47 @@
package nautilus.game.arcade.game.games.castlesiege.data; package nautilus.game.arcade.game.games.castleassault.data;
public class KillStreakData public class KillStreakData
{ {
private static final int[] REWARDED_STREAKS = {2, 4, 6, 8}; private static final int[] REWARDED_STREAKS = {2, 4, 6, 8};
private int _kills; private int _kills;
private int _bestStreak; private int _bestStreak;
public KillStreakData() public KillStreakData()
{ {
_kills = 0; _kills = 0;
_bestStreak = 0; _bestStreak = 0;
} }
public int getKills() public int getKills()
{ {
return _kills; return _kills;
} }
public int getBestStreak() public int getBestStreak()
{ {
return Math.max(_bestStreak, _kills); return Math.max(_bestStreak, _kills);
} }
public boolean addKill(boolean hardLine) public boolean addKill(boolean hardLine)
{ {
_kills++; _kills++;
for (int streak : REWARDED_STREAKS) for (int streak : REWARDED_STREAKS)
{ {
if ((_kills + (hardLine ? 1 : 0)) == streak) if ((_kills + (hardLine ? 1 : 0)) == streak)
{ {
return true; return true;
} }
} }
return false; return false;
} }
public void reset() public void reset()
{ {
if (_kills > _bestStreak) if (_kills > _bestStreak)
{ {
_bestStreak = _kills; _bestStreak = _kills;
} }
_kills = 0; _kills = 0;
} }
} }

View File

@ -1,97 +1,100 @@
package nautilus.game.arcade.game.games.castlesiege.data; package nautilus.game.arcade.game.games.castleassault.data;
import java.util.List; import java.util.List;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
public class ObjectiveTNTSpawner public class ObjectiveTNTSpawner
{ {
private static final long TNT_SPAWN_DELAY = 60000; private static final long TNT_SPAWN_DELAY = 60000;
private List<Location> _locs; private List<Location> _locs;
private Location _lastSpawnLoc; private Location _lastSpawnLoc;
private Item _entity; private Item _entity;
private long _lastPickedUp; private long _lastPickedUp;
public ObjectiveTNTSpawner(List<Location> locs) public ObjectiveTNTSpawner(List<Location> locs)
{ {
_locs = locs; _locs = locs;
_lastSpawnLoc = null; _lastSpawnLoc = null;
_entity = null; _entity = null;
_lastPickedUp = System.currentTimeMillis(); _lastPickedUp = System.currentTimeMillis();
} }
public Item getItem() public Item getItem()
{ {
return _entity; return _entity;
} }
public boolean isSpawned() public boolean isSpawned()
{ {
return _entity != null; return _entity != null;
} }
public boolean canPlaceFireAt(Block block) public boolean canPlaceFireAt(Block block)
{ {
if (!isSpawned()) for (Location loc : _locs)
{ {
return false; if (UtilMath.offsetSquared(loc, block.getLocation()) <= 9)
} {
return false;
return UtilMath.offsetSquared(_lastSpawnLoc, block.getLocation()) <= 9; }
} }
public long getNextTNT() return true;
{ }
return (_lastPickedUp + TNT_SPAWN_DELAY) - System.currentTimeMillis();
} public long getNextTNT()
{
public void spawn() return (_lastPickedUp + TNT_SPAWN_DELAY) - System.currentTimeMillis();
{ }
Location spawn = _locs.get(UtilMath.r(_locs.size()));
spawn.getBlock().getRelative(BlockFace.DOWN).setType(Material.REDSTONE_BLOCK); public void spawn()
_lastSpawnLoc = spawn.clone(); {
_entity = spawn.getWorld().dropItem(spawn, new ItemStack(Material.TNT)); Location spawn = _locs.get(UtilMath.r(_locs.size()));
UtilFirework.playFirework(spawn, Type.BURST, Color.RED, false, false); spawn.getBlock().getRelative(BlockFace.DOWN).setType(Material.REDSTONE_BLOCK);
} _lastSpawnLoc = spawn.clone();
_entity = spawn.getWorld().dropItem(spawn, new ItemStack(Material.TNT));
public void pickup() UtilFirework.playFirework(spawn, Type.BURST, Color.RED, false, false);
{ }
_entity.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
_entity.remove(); public void pickup()
_entity = null; {
_lastSpawnLoc = null; _entity.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
_lastPickedUp = System.currentTimeMillis(); _entity.remove();
} _entity = null;
_lastSpawnLoc = null;
public void update() _lastPickedUp = System.currentTimeMillis();
{ }
if (!isSpawned() && UtilTime.elapsed(_lastPickedUp, TNT_SPAWN_DELAY))
{ public void update()
spawn(); {
} if (!isSpawned() && UtilTime.elapsed(_lastPickedUp, TNT_SPAWN_DELAY))
else if (isSpawned()) {
{ spawn();
_entity.teleport(_lastSpawnLoc); }
if (!_entity.isValid() || _entity.isDead()) else if (isSpawned())
{ {
_entity = _lastSpawnLoc.getWorld().dropItem(_lastSpawnLoc, new ItemStack(Material.TNT)); _entity.teleport(_lastSpawnLoc);
} if (!_entity.isValid() || _entity.isDead())
} {
} _entity = _lastSpawnLoc.getWorld().dropItem(_lastSpawnLoc, new ItemStack(Material.TNT));
}
public void onStart() }
{ }
_lastPickedUp = System.currentTimeMillis();
} public void onStart()
{
_lastPickedUp = System.currentTimeMillis();
}
} }

View File

@ -1,54 +1,54 @@
package nautilus.game.arcade.game.games.castlesiege.data; package nautilus.game.arcade.game.games.castleassault.data;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.EnderCrystal;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
public class TeamCrystal public class TeamCrystal
{ {
private Location _loc; private Location _loc;
private GameTeam _owner; private GameTeam _owner;
private EnderCrystal _crystal; private EnderCrystal _crystal;
private boolean _destroyed; private boolean _destroyed;
public TeamCrystal(GameTeam owner, Location loc) public TeamCrystal(GameTeam owner, Location loc)
{ {
_owner = owner; _owner = owner;
_loc = loc; _loc = loc;
spawn(); spawn();
} }
public GameTeam getOwner() public GameTeam getOwner()
{ {
return _owner; return _owner;
} }
public Location getLocation() public Location getLocation()
{ {
return _loc; return _loc;
} }
public boolean isActive() public boolean isActive()
{ {
return !_destroyed; return !_destroyed;
} }
public void spawn() public void spawn()
{ {
_destroyed = false; _destroyed = false;
_crystal = _loc.getWorld().spawn(_loc, EnderCrystal.class); _crystal = _loc.getWorld().spawn(_loc, EnderCrystal.class);
_loc.getBlock().getRelative(0, -2, 0).setType(Material.BEACON); _loc.getBlock().getRelative(0, -2, 0).setType(Material.BEACON);
} }
public void destroy() public void destroy()
{ {
_destroyed = true; _destroyed = true;
_crystal.remove(); _crystal.remove();
_crystal = null; _crystal = null;
_loc.getBlock().getRelative(0, -2, 0).setType(Material.SMOOTH_BRICK); _loc.getBlock().getRelative(0, -2, 0).setType(Material.SMOOTH_BRICK);
} }
} }

View File

@ -1,122 +1,122 @@
package nautilus.game.arcade.game.games.castlesiege.data; package nautilus.game.arcade.game.games.castleassault.data;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Zombie; import org.bukkit.entity.Zombie;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
public class TeamKing public class TeamKing
{ {
private static final int MAX_HEALTH = 600; private static final int MAX_HEALTH = 600;
private Location _loc; private Location _loc;
private String _name; private String _name;
private GameTeam _owner; private GameTeam _owner;
private Zombie _entity; private Zombie _entity;
private int _health; private int _health;
private String _lastDamager; private String _lastDamager;
private long _lastDamage; private long _lastDamage;
public TeamKing(GameTeam owner, String name, Location loc) public TeamKing(GameTeam owner, String name, Location loc)
{ {
_owner = owner; _owner = owner;
_loc = loc; _loc = loc;
_name = name; _name = name;
_health = MAX_HEALTH; _health = MAX_HEALTH;
_entity = (Zombie) loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE); _entity = (Zombie) loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);
UtilEnt.vegetate(_entity, true); UtilEnt.vegetate(_entity, true);
_entity.getEquipment().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setUnbreakable(true).build()); _entity.getEquipment().setHelmet(new ItemBuilder(Material.DIAMOND_HELMET).setUnbreakable(true).build());
_entity.getEquipment().setChestplate(new ItemBuilder(Material.DIAMOND_CHESTPLATE).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().setLeggings(new ItemBuilder(Material.DIAMOND_LEGGINGS).setUnbreakable(true).build());
_entity.getEquipment().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setUnbreakable(true).build()); _entity.getEquipment().setBoots(new ItemBuilder(Material.DIAMOND_BOOTS).setUnbreakable(true).build());
_entity.setRemoveWhenFarAway(false); _entity.setRemoveWhenFarAway(false);
_entity.setCustomName(owner.GetColor() + name); _entity.setCustomName(owner.GetColor() + name);
} }
public GameTeam getOwner() public GameTeam getOwner()
{ {
return _owner; return _owner;
} }
public Location getLocation() public Location getLocation()
{ {
return _loc; return _loc;
} }
public String getName(boolean bold) public String getName(boolean bold)
{ {
return _owner.GetColor() + (bold ? C.Bold : "") + _name; return _owner.GetColor() + (bold ? C.Bold : "") + _name;
} }
public String getLastDamager() public String getLastDamager()
{ {
return _lastDamager; return _lastDamager;
} }
public int getHealth() public int getHealth()
{ {
return Math.max(_health, 0); return Math.max(_health, 0);
} }
public boolean isDead() public boolean isDead()
{ {
return getHealth() <= 0; return getHealth() <= 0;
} }
public void update(boolean beaconsAlive) public void update(boolean beaconsAlive)
{ {
_entity.teleport(_loc); _entity.teleport(_loc);
for (int y = 0; y <= 4; y++) for (int y = 0; y <= 4; y++)
{ {
for (int x = -4; x <= 4; x++) for (int x = -4; x <= 4; x++)
{ {
for (int z = -4; z <= 4; z++) for (int z = -4; z <= 4; z++)
{ {
Block block = _loc.clone().add(x, y, z).getBlock(); Block block = _loc.clone().add(x, y, z).getBlock();
if ((block.getType() != Material.IRON_FENCE && block.getType() != Material.IRON_BLOCK) || !beaconsAlive) if ((block.getType() != Material.IRON_FENCE && block.getType() != Material.IRON_BLOCK) || !beaconsAlive)
{ {
block.setType(Material.AIR); block.setType(Material.AIR);
} }
if (beaconsAlive) if (beaconsAlive)
{ {
if (x == -4 || x == 4 || z == -4 || z == 4) if (x == -4 || x == 4 || z == -4 || z == 4)
{ {
if (y != 4) if (y != 4)
{ {
block.setType(Material.IRON_FENCE); block.setType(Material.IRON_FENCE);
} }
} }
if (y == 4) if (y == 4)
{ {
block.setType(Material.IRON_BLOCK); block.setType(Material.IRON_BLOCK);
} }
} }
} }
} }
} }
} }
public boolean handleDamage(String player, double damage) public boolean handleDamage(String player, double damage)
{ {
if (!UtilTime.elapsed(_lastDamage, 400)) if (!UtilTime.elapsed(_lastDamage, 400))
{ {
return false; return false;
} }
_lastDamager = player; _lastDamager = player;
_lastDamage = System.currentTimeMillis(); _lastDamage = System.currentTimeMillis();
int dmg = (int)Math.ceil(damage); int dmg = (int)Math.ceil(damage);
_health -= dmg; _health -= dmg;
UtilEnt.PlayDamageSound(_entity); UtilEnt.PlayDamageSound(_entity);
return true; return true;
} }
} }

View File

@ -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.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -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 public enum MedalType
{ {

View File

@ -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.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -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.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
@ -120,8 +120,8 @@ public class KitArcher extends KitPlayer
} }
else if (streak == 4) else if (streak == 4)
{ {
player.sendMessage(C.cRedB + "You have received a Power I book as a Kill Streak Reward!"); player.sendMessage(C.cRedB + "You have received 12 Arrows as a Kill Streak Reward!");
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build()); player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(12).setTitle(F.item("Fletched Arrow")).build());
} }
else if (streak == 6) else if (streak == 6)
{ {
@ -130,8 +130,8 @@ public class KitArcher extends KitPlayer
} }
else if (streak == 8) else if (streak == 8)
{ {
player.sendMessage(C.cRedB + "You have received a Power I book as a Kill Streak Reward!"); player.sendMessage(C.cRedB + "You have received 32 Arrows as a Kill Streak Reward!");
player.getInventory().addItem(new EnchantedBookBuilder(1).setLevel(Enchantment.ARROW_DAMAGE, 1).build()); player.getInventory().addItem(new ItemBuilder(Material.ARROW).setAmount(32).setTitle(F.item("Fletched Arrow")).build());
} }
} }
} }

View File

@ -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.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -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.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;

View File

@ -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.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;

View File

@ -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.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;

View File

@ -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.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -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.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -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.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -9,7 +9,7 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import nautilus.game.arcade.ArcadeManager; 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.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.ProgressingKit;
@ -32,9 +32,9 @@ public abstract class KitPlayer extends ProgressingKit
public abstract void awardKillStreak(Player player, int streak); 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) protected void giveRegeneration(Player player)

View File

@ -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.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;

View File

@ -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.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;

View File

@ -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.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;

View File

@ -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<String> _lastScoreboard = new ArrayList<String>();
private long _tntSpawn = 0;
private ArrayList<Location> _tntSpawns = new ArrayList<Location>();
private ArrayList<Location> _tntWeakness = new ArrayList<Location>();
private HashMap<Player, FallingBlock> _tntCarry = new HashMap<Player, FallingBlock>();
private HashSet<Player> _tntCarryEnd = new HashSet<Player>();
private ArrayList<Location> _kingLocs;
private Creature _king;
private Location _kingLoc;
private String _kingName;
private Player _kingDamager = null;
private int _kingHealth = 40;
private ArrayList<Location> _peasantSpawns;
private ArrayList<Location> _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<String, Integer> _scoreGroup = new HashMap<String, Integer>();
_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<Player> 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<Player> 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);
}
}
}

View File

@ -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.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;

View File

@ -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.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;

View File

@ -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.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;

View File

@ -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.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;

View File

@ -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.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;

View File

@ -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.C;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;

View File

@ -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.C;
import mineplex.core.disguise.disguises.DisguisePigZombie; import mineplex.core.disguise.disguises.DisguisePigZombie;

View File

@ -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.C;
import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.disguise.disguises.DisguiseZombie;

View File

@ -11,7 +11,7 @@ import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game; 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; import nautilus.game.arcade.game.games.hideseek.kits.KitSeeker;
public class BloodThirstyStatTracker extends StatTracker<Game> public class BloodThirstyStatTracker extends StatTracker<Game>

View File

@ -10,20 +10,20 @@ import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game; 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<CastleSiegeClassic> public class KingDamageStatTracker extends StatTracker<CastleSiege>
{ {
private final Map<UUID, Double> _kingDamage = new HashMap<>(); private final Map<UUID, Double> _kingDamage = new HashMap<>();
private double _totalKingDamage = 0; private double _totalKingDamage = 0;
public KingDamageStatTracker(CastleSiegeClassic game) public KingDamageStatTracker(CastleSiege game)
{ {
super(game); super(game);
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onKingDamage(CastleSiegeClassic.KingDamageEvent event) public void onKingDamage(CastleSiege.KingDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live) if (getGame().GetState() != Game.GameState.Live)
return; return;

View File

@ -3,7 +3,7 @@ package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import nautilus.game.arcade.game.Game; 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<Game> public class KingSlayerStatTracker extends StatTracker<Game>
{ {
@ -13,7 +13,7 @@ public class KingSlayerStatTracker extends StatTracker<Game>
} }
@EventHandler @EventHandler
public void onKingSlaughtered(CastleSiegeClassic.KingSlaughterEvent event) public void onKingSlaughtered(CastleSiege.KingSlaughterEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live) if (getGame().GetState() != Game.GameState.Live)
return; return;