From 4e02258124cddb050876c5d94d66961ec17780e4 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Thu, 24 Mar 2016 16:32:33 -0400 Subject: [PATCH 01/34] Merge branch 'clans/beta' of github.com:Mineplex-LLC/Minecraft-PC into clans/beta Conflicts: Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java --- .../nautilus/game/arcade/game/GameOption.java | 37 +++++++++++++++++++ .../game/arcade/game/GameOptionBoolean.java | 26 +++++++++++++ .../game/arcade/game/GameOptionDouble.java | 25 +++++++++++++ .../game/arcade/game/GameOptionHashInt.java | 27 ++++++++++++++ .../game/arcade/game/GameOptionInteger.java | 25 +++++++++++++ .../game/arcade/game/GameOptionLong.java | 25 +++++++++++++ 6 files changed, 165 insertions(+) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java new file mode 100644 index 000000000..13a2541ad --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game; + +public class GameOption +{ + //Store the name and Description of each option - Literally every GameOption should have these + private String _optionName; + private String _optionDescription; + + public GameOption(String optName, String optDesc) + { + _optionName = optName; + _optionDescription = optDesc; + } + + //Get methods for name of option and description + public String GetOptionName() + { + return _optionName; + } + + public String GetOptionDescription() + { + return _optionDescription; + } + + //Every GameOption will have a SetOption method of some sort + public void SetOption() + { + + } + + /*Every GameOption will have a GetOptionSetting method, as well + * However, since each GameOption class will have a different return type, + * there isn't much need to create one here at this time + */ + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java new file mode 100644 index 000000000..fc7898335 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java @@ -0,0 +1,26 @@ +package nautilus.game.arcade.game; + +public class GameOptionBoolean extends GameOption +{ + + //Set boolean to true by default for ease of use + private Boolean _optionSetting; + + public GameOptionBoolean(Boolean optOnOff, String optName, String optType) + { + super(optName, optType); + // TODO Auto-generated constructor stub + _optionSetting = optOnOff; + } + + public Boolean GetOptionSetting() + { + return _optionSetting; + } + + public void SetOption(Boolean newOptionSetting) + { + _optionSetting = newOptionSetting; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java new file mode 100644 index 000000000..4ed652ee6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java @@ -0,0 +1,25 @@ +package nautilus.game.arcade.game; + +public class GameOptionDouble extends GameOption +{ + + private double _optionDouble; + + public GameOptionDouble(double optDouble, String optName, String optDesc) + { + super(optName, optDesc); + // TODO Auto-generated constructor stub + _optionDouble = optDouble; + } + + public double GetOptionSetting() + { + return _optionDouble; + } + + public void SetOptionSetting(double newOptionSetting) + { + _optionDouble = newOptionSetting; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java new file mode 100644 index 000000000..52b0046c4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java @@ -0,0 +1,27 @@ +package nautilus.game.arcade.game; + +import java.util.HashSet; + +public class GameOptionHashInt extends GameOption +{ + + private HashSet _optionHash; + + public GameOptionHashInt(HashSet optHash, String optName, String optDesc) + { + super(optName, optDesc); + // TODO Auto-generated constructor stub + _optionHash = optHash; + } + + public HashSet GetOptionSetting() + { + return _optionHash; + } + + public void SetOptionSetting(HashSet optHash) + { + _optionHash = optHash; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java new file mode 100644 index 000000000..f433dd481 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java @@ -0,0 +1,25 @@ +package nautilus.game.arcade.game; + +public class GameOptionInteger extends GameOption +{ + + private int _optionInt; + + public GameOptionInteger(int optInt, String optName, String optType) + { + super(optName, optType); + // TODO Auto-generated constructor stub + _optionInt = optInt; + } + + public int GetOptionSetting() + { + return _optionInt; + } + + public void SetOptionSetting(int newOptionSetting) + { + _optionInt = newOptionSetting; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java new file mode 100644 index 000000000..e6e28ff31 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java @@ -0,0 +1,25 @@ +package nautilus.game.arcade.game; + +public class GameOptionLong extends GameOption +{ + + private long _optionLong; + + public GameOptionLong(long optLong, String optName, String optDesc) + { + super(optName, optDesc); + // TODO Auto-generated constructor stub + _optionLong = optLong; + } + + public long GetOptionSetting() + { + return _optionLong; + } + + public void SetOptionSetting(long newOptionSetting) + { + _optionLong = newOptionSetting; + } + +} From b5d3a6b8c31657c91836a37762896823081ce040 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Thu, 24 Mar 2016 16:34:16 -0400 Subject: [PATCH 02/34] Small fix to last commit so that everything works while I continue working on getting GameOptions working --- .../Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 49a018726..43ffe0d1e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -162,6 +162,7 @@ public abstract class Game implements Listener // Gameplay Flags public long GameTimeout = 1200000; + //public GameOptionLong GameTimeout = new GameOptionLong(1200000, "Game Timeout", "Allotted time for game mode"); public boolean Damage = true; public boolean DamagePvP = true; From 0246ec275ed49d24840104aac2f07c4b334978a4 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Thu, 24 Mar 2016 17:47:07 -0400 Subject: [PATCH 03/34] More flags have been changed to use the new Game Options. WHY IS NOTHING BREAKING!? Not that I'm complaining. Just really confused... --- .../src/nautilus/game/arcade/game/Game.java | 38 ++++++++++--------- .../game/arcade/game/GameOptionDouble.java | 4 +- .../game/arcade/game/GameOptionHashInt.java | 4 +- .../game/arcade/game/GameOptionInteger.java | 4 +- .../game/arcade/game/GameOptionLong.java | 4 +- .../game/arcade/game/games/bridge/Bridge.java | 2 +- .../arcade/game/games/skywars/Skywars.java | 2 +- .../games/survivalgames/SurvivalGames.java | 2 +- .../survivalgames/SurvivalGamesTeams.java | 2 +- .../game/arcade/managers/GameManager.java | 2 +- 10 files changed, 33 insertions(+), 31 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 43ffe0d1e..6ea8c08cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -161,27 +161,29 @@ public abstract class Game implements Listener protected String[] _help; // Gameplay Flags - public long GameTimeout = 1200000; - //public GameOptionLong GameTimeout = new GameOptionLong(1200000, "Game Timeout", "Allotted time for game mode"); + + //Note: If any descriptions are inaccurate, feel free to let me know and/or fix them. Thanks. ~Joe Prezioso + public GameOptionLong GameTimeout = new GameOptionLong(1200000, "Game Timeout", "Allotted time for game mode"); - public boolean Damage = true; - public boolean DamagePvP = true; - public boolean DamagePvE = true; - public boolean DamageEvP = true; - public boolean DamageSelf = true; - public boolean DamageFall = true; - public boolean DamageTeamSelf = false; - public boolean DamageTeamOther = true; + public GameOptionBoolean Damage new GameOptionBoolean(true, "Damage", "Does damage matter in this game mode?"); + public GameOptionBoolean DamagePvP = new GameOptionBoolean(true, "Damage PVP", "Players allowed to damage other players?"); + public GameOptionBoolean DamagePvE = new GameOptionBoolean(true, "Damage PVE", "Players allowed to damage monsters?"); + public GameOptionBoolean DamageEvP = new GameOptionBoolean(true, "Damage EVP", "Monsters allowed to damage players?"); + public GameOptionBoolean DamageSelf = new GameOptionBoolean(true, "Damage Self", "Players allowed to harm themselves?"); + public GameOptionBoolean DamageFall = new GameOptionBoolean(true, "Damage Fall", "Can players be harmed by falling?"); + public GameOptionBoolean DamageTeamSelf = new GameOptionBoolean(false, "Damage Team, Self", "Can players damage teammates?"); + public GameOptionBoolean DamageTeamOther = new GameOptionBoolean(true, "Damage Team, Other", "Can players damage opposing team's players?"); - public boolean BlockBreak = false; - public boolean BlockBreakCreative = false; - public HashSet BlockBreakAllow = new HashSet(); - public HashSet BlockBreakDeny = new HashSet(); + public GameOptionBoolean BlockBreak = new GameOptionBoolean(false, "Block Break", "Can players break blocks?"); + //Really not sure about the description for this one... + public GameOptionBoolean BlockBreakCreative = newGameOptionBoolean(false, "Block Break, Creative", "Can players break blocks in creative mode?"); + public GameOptionHashInt BlockBreakAllow = new GameOptionHashInt(new HashSet(), "Block Break Allow", "Set of blocks players can break"); + public GameOptionHashInt BlockBreakDeny = new GameOptionHashInt(new HashSet(), "Block Break Deny", "Set of blocks players can't break"); - public boolean BlockPlace = false; - public boolean BlockPlaceCreative = false; - public HashSet BlockPlaceAllow = new HashSet(); - public HashSet BlockPlaceDeny = new HashSet(); + public GameOptionBoolean BlockPlace = new GameOptionBoolean(false, "Block Place", "Can players place blocks?"); + public GameOptionBoolean BlockPlaceCreative = new GameOptionBoolean(false, "Block Place, Creative", "Can players place blocks in creative mode?"); + public GameOptionHashInt BlockPlaceAllow = new GameOptionHashInt(new HashSet(), "Block Place Allow", "Set of blocks players can place"); + public GameOptionHashInt BlockPlaceDeny = new GameOptionHashInt(new HashSet(), "Block Place Deny", "Set of blocks players cannot place"); public boolean ItemPickup = false; public HashSet ItemPickupAllow = new HashSet(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java index 4ed652ee6..0c47b927b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java @@ -12,12 +12,12 @@ public class GameOptionDouble extends GameOption _optionDouble = optDouble; } - public double GetOptionSetting() + public double GetOption() { return _optionDouble; } - public void SetOptionSetting(double newOptionSetting) + public void SetOption(double newOptionSetting) { _optionDouble = newOptionSetting; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java index 52b0046c4..0e835da4c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java @@ -14,12 +14,12 @@ public class GameOptionHashInt extends GameOption _optionHash = optHash; } - public HashSet GetOptionSetting() + public HashSet GetOption() { return _optionHash; } - public void SetOptionSetting(HashSet optHash) + public void SetOption(HashSet optHash) { _optionHash = optHash; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java index f433dd481..778e898de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java @@ -12,12 +12,12 @@ public class GameOptionInteger extends GameOption _optionInt = optInt; } - public int GetOptionSetting() + public int GetOption() { return _optionInt; } - public void SetOptionSetting(int newOptionSetting) + public void SetOption(int newOptionSetting) { _optionInt = newOptionSetting; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java index e6e28ff31..2ac3a9c69 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java @@ -12,12 +12,12 @@ public class GameOptionLong extends GameOption _optionLong = optLong; } - public long GetOptionSetting() + public long GetOption() { return _optionLong; } - public void SetOptionSetting(long newOptionSetting) + public void SetOption(long newOptionSetting) { _optionLong = newOptionSetting; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index d19dc43e7..6b97ab4f0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -175,7 +175,7 @@ public class Bridge extends TeamGame implements OreObsfucation _ore = new OreHider(); // Flags - GameTimeout = Manager.IsTournamentServer() ? 5400000 : 3600000; + GameTimeout.setOption(Manager.IsTournamentServer() ? 5400000 : 3600000); Manager.GetExplosion().SetLiquidDamage(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 70cb11fd8..b67e10b1e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -155,7 +155,7 @@ public abstract class Skywars extends Game StrictAntiHack = true; - GameTimeout = 1500000L; + GameTimeout.SetOption(1500000L); DeathDropItems = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index b39c25164..1e141e5de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -192,7 +192,7 @@ public abstract class SurvivalGames extends Game this.ReplaceTeamsWithKits = true; - GameTimeout = 1500000; + GameTimeout.setOption(1500000); QuitDropItems = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index 9222cd907..01dfc0706 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -172,7 +172,7 @@ public class SurvivalGamesTeams extends TeamGame setItemMerge(true); // Manager.GetAntiStack().SetEnabled(false); - this.GameTimeout = 9600000; + this.GameTimeout.setOption(9600000); this.WorldTimeSet = 0; this.WorldBoundaryKill = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index be185ed2b..eade25252 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -388,7 +388,7 @@ public class GameManager implements Listener } else if (game.GetState() == GameState.Live) { - if (game.GameTimeout != -1 && UtilTime.elapsed(game.GetStateTime(), game.GameTimeout) && Manager.IsGameTimeout()) + if (game.GameTimeout.GetOption() != -1 && UtilTime.elapsed(game.GetStateTime(), game.GameTimeout.GetOption()) && Manager.IsGameTimeout()) { game.HandleTimeout(); } From eb6c38593627f55500bc9af12b57bb9b62c37396 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Thu, 24 Mar 2016 17:52:02 -0400 Subject: [PATCH 04/34] More flags changed --- .../src/nautilus/game/arcade/game/Game.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 6ea8c08cd..2faf9dcd5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -185,7 +185,7 @@ public abstract class Game implements Listener public GameOptionHashInt BlockPlaceAllow = new GameOptionHashInt(new HashSet(), "Block Place Allow", "Set of blocks players can place"); public GameOptionHashInt BlockPlaceDeny = new GameOptionHashInt(new HashSet(), "Block Place Deny", "Set of blocks players cannot place"); - public boolean ItemPickup = false; + public GameOptionBoolean ItemPickup = new GameOptionBoolean(false, "Item Pickup", "Are there items to pickup?"); public HashSet ItemPickupAllow = new HashSet(); public HashSet ItemPickupDeny = new HashSet(); From 667ec03f06b670914c1dfe763a673bb2f66239d2 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Thu, 24 Mar 2016 18:43:02 -0400 Subject: [PATCH 05/34] Still a few more flags to go. I'll get to them tomorrow. Hopefully, I'll also figure out where/if I need to change things elsewhere in the code. --- .../src/nautilus/game/arcade/game/Game.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 2faf9dcd5..a7cf0b500 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -186,31 +186,31 @@ public abstract class Game implements Listener public GameOptionHashInt BlockPlaceDeny = new GameOptionHashInt(new HashSet(), "Block Place Deny", "Set of blocks players cannot place"); public GameOptionBoolean ItemPickup = new GameOptionBoolean(false, "Item Pickup", "Are there items to pickup?"); - public HashSet ItemPickupAllow = new HashSet(); - public HashSet ItemPickupDeny = new HashSet(); + public GameOptionHashInt ItemPickupAllow = new GameOptionHashInt(new HashSet(), "Item Pickup, Allow", "Items players can pick up"); + public GameOptionHashInt ItemPickupDeny = new GameOptionHashInt(new HashSet(), "Item Pickup, Deny", "Items players cannot pick up"); - public boolean ItemDrop = false; - public HashSet ItemDropAllow = new HashSet(); - public HashSet ItemDropDeny = new HashSet(); + public GameOptionBoolean ItemDrop = new GameOptionBoolean(false, "Item Drop", "Can items drop?"); + public GameOptionHashInt ItemDropAllow = new GameOptionHashInt(new HashSet(), "Item Drop Allow", "Set of items that can drop"); + public GameOptionHashInt ItemDropDeny = new GameOptionHashInt(new HashSet(), "Item Drop Deny", "Set of items that cannot drop"); - public boolean InventoryOpenBlock = false; - public boolean InventoryOpenChest = false; - public boolean InventoryClick = false; + public GameOptionBoolean InventoryOpenBlock = new GameOptionBoolean(false, "Inventory Open Block", "Can players open inventory from a block?"); + public GameOptionBoolean InventoryOpenChest = new GameOptionBoolean(false, "Inventory Open Chest", "Can players open inventory from a chest?"); + public GameOptionBoolean InventoryClick = new GameOptionBoolean(false, "Inventory Click", "Can players click on their inventory?"); - public boolean PrivateBlocks = false; + public GameOptionBoolean PrivateBlocks = new GameOptionBoolean(false, "Private Blocks", "Can private blocks exist?"); - public boolean DeathOut = true; - public boolean DeathDropItems = false; - public boolean DeathMessages = true; - public boolean AutomaticRespawn = true; + public GameOptionBoolean DeathOut = new GameOptionBoolean(true, "Death Out", "Are players out of the game upon death?"); + public GameOptionBoolean DeathDropItems = new GameOptionBoolean(false, "Death Drop Items", "Do players drop items upon death?"); + public GameOptionBoolean DeathMessages = new GameOptionBoolean(true, "Death Messages", "Display message upon death?"); + public GameOptionBoolean AutomaticRespawn = new GameOptionBoolean(true, "Automatic Respawn", "Do players automatically respawn on death?"); - public double DeathSpectateSecs = 0; - public boolean DeathTeleport = true; + public GameOptionDouble DeathSpectateSecs = new GameOptionDouble(0, "Death Spectate Secs", "How many seconds players may spectate match while dead"); + public GameOptionBoolean DeathTeleport = new GameOptionBoolean(true, "Death Teleport", "Do players teleport upon death?"); - public boolean QuitOut = true; - public boolean QuitDropItems = false; + public GameOptionBoolean QuitOut = new GameOptionBoolean(true, "Quit Out", "Are players considered out if they quit?"); + public GameOptionBoolean QuitDropItems = new GameOptionBoolean(false, "Quit Drop Items", "Do players drop items if they quit?"); - public boolean IdleKickz = true; + public GameOptionBoolean IdleKickz = new GameOptionBoolean(true, "Idle Kickz", "Are idle players kicked?"); public boolean CreatureAllow = false; public boolean CreatureAllowOverride = false; From c1ef185e821052e00fee92e4d31fa9ed9e77b927 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Fri, 25 Mar 2016 12:48:39 -0400 Subject: [PATCH 06/34] Flags have been changed and I have started to get rid of the errors that have started cropping up. --- .../nautilus/game/arcade/ArcadeManager.java | 18 ++--- .../src/nautilus/game/arcade/game/Game.java | 72 ++++++++++--------- .../nautilus/game/arcade/game/GameOption.java | 12 +--- .../game/arcade/game/GameOptionBoolean.java | 2 +- .../game/arcade/game/GameOptionGameState.java | 25 +++++++ .../game/games/baconbrawl/BaconBrawl.java | 6 +- .../arcade/game/games/bouncyballs/Ball.java | 4 +- .../arcade/game/games/event/EventModule.java | 6 +- .../games/halloween/waves/WaveVictory.java | 6 +- .../game/games/minestrike/MineStrike.java | 8 +-- .../arcade/game/games/monsterleague/Ball.java | 4 +- .../arcade/kit/perks/PerkNightLivingDead.java | 8 +-- .../game/arcade/managers/GameFlagManager.java | 12 ++-- .../game/arcade/managers/GameManager.java | 2 +- 14 files changed, 103 insertions(+), 82 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionGameState.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 600b7a1dd..c453f1be5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -571,15 +571,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (pA == null || pB == null) return false; - if (!_game.Damage) + if (!_game.Damage.GetOption()) return false; - if (!_game.DamagePvP) + if (!_game.DamagePvP.GetOption()) return false; // Self Damage if (pA.equals(pB)) - return _game.DamageSelf; + return _game.DamageSelf.GetOption(); GameTeam tA = _game.GetTeam(pA); if (tA == null) @@ -589,10 +589,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (tB == null) return false; - if (tA.equals(tB) && !_game.DamageTeamSelf) + if (tA.equals(tB) && !_game.DamageTeamSelf.GetOption()) return false; - if (!tA.equals(tB) && !_game.DamageTeamOther) + if (!tA.equals(tB) && !_game.DamageTeamOther.GetOption()) return false; return true; @@ -703,7 +703,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (event.getJoinMessage() == null) return; - if (_game != null && _game.AnnounceJoinQuit) + if (_game != null && _game.AnnounceJoinQuit.GetOption()) event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + name)); else @@ -724,7 +724,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (event.getQuitMessage() == null) return; - if (_game == null || _game.AnnounceJoinQuit) + if (_game == null || _game.AnnounceJoinQuit.GetOption()) event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + name)); else event.setQuitMessage(null); @@ -850,7 +850,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation || _donationManager.Get(event.getPlayer().getName()).OwnsUnknownPackage(_serverConfig.ServerType + " ULTRA")) { - if (GetGame() != null && GetGame().DontAllowOverfill) + if (GetGame() != null && GetGame().DontAllowOverfill.GetOption()) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes."); return; @@ -1230,7 +1230,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation } else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead) { - if (event.GetGame().GadgetsDisabled) + if (event.GetGame().GadgetsDisabled.GetOption()) { if (getCosmeticManager().isShowingInterface()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index a7cf0b500..a64e2271d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -212,53 +212,55 @@ public abstract class Game implements Listener public GameOptionBoolean IdleKickz = new GameOptionBoolean(true, "Idle Kickz", "Are idle players kicked?"); - public boolean CreatureAllow = false; - public boolean CreatureAllowOverride = false; + public GameOptionBoolean CreatureAllow = new GameOptionBoolean(false, "Creature Allow", "Allow creatures to spawn?"); + public GameOptionBoolean CreatureAllowOverride = new GameOptionBoolean(false, "Creature Allow Override", "Can creatures spawn where they normally wouldn't?"); + + //Still not quite sure what the descriptions for 'World Block Burn' and 'World Water Damage' should be + public GameOptionInteger WorldTimeSet = new GameOptionInteger(12000, "World Time Set", "Set time in the world"); + public GameOptionBoolean WorldWeatherEnabled = new GameOptionBoolean(false, "Weather Enabled", "Is there weather in this game world?"); + public GameOptionInteger WorldWaterDamage = new GameOptionInteger(0, "Water Damage", "Can water hurt players?"); + public GameOptionBoolean WorldBoundaryKill = new GameOptionBoolean(true, "Boundary Kill", "Do players die when leaving the game's boundaries?"); + public GameOptionBoolean WorldBlockBurn = new GameOptionBoolean(false, "Block Burn", "Can world blocks burn?"); + public GameOptionBoolean WorldBlockGrow = new GameOptionBoolean(false, "Block Grow", "Do world blocks grow?"); + public GameOptionBoolean WorldFireSpread = new GameOptionBoolean(false, "Fire Spread", "Does fire spread to world blocks?"); + public GameOptionBoolean WorldLeavesDecay = new GameOptionBoolean(false, "Leaves Decay", "Do leaves decay?"); + public GameOptionBoolean WorldSoilTrample = new GameOptionBoolean(false, "Soil Trample", "Can soil be trampled?"); + public GameOptionBoolean WorldBoneMeal = new GameOptionBoolean(false, "Bone Meal", "Allow using bone meal?"); - public int WorldTimeSet = 12000; - public boolean WorldWeatherEnabled = false; - public int WorldWaterDamage = 0; - public boolean WorldBoundaryKill = true; - public boolean WorldBlockBurn = false; - public boolean WorldBlockGrow = false; - public boolean WorldFireSpread = false; - public boolean WorldLeavesDecay = false; - public boolean WorldSoilTrample = false; - public boolean WorldBoneMeal = false; + public GameOptionInteger HungerSet = new GameOptionInteger(-1, "Hunger Set", "Default hunger for players"); + public GameOptionInteger HealthSet = new GameOptionInteger(-1, "Health Set", "Default Health for players"); - public int HungerSet = -1; - public int HealthSet = -1; + public GameOptionBoolean PrepareFreeze = new GameOptionBoolean(true, "Prepare Freeze", "Freeze game while preparations are made?"); - public boolean PrepareFreeze = true; + private GameOptionDouble _itemMergeRadius = new GameOptionBoolean(0, "Item Merge Radius", "Distance at which items merge"); - private double _itemMergeRadius = 0; + //really not sure what the descriptions should be for announcements ~JP + public GameOptionBoolean AnnounceStay = new GameOptionBoolean(true, "Announce Stay", "Send message to announce player is staying?"); + public GameOptionBoolean AnnounceJoinQuit = new GameOptionBoolean(true, "Announce Join Quit", "Send message to announce player has quit?"); + public GameOptionBoolean AnnounceSilence = new GameOptionBoolean(true, "Announce Silence", "Silence all announcements?"; - public boolean AnnounceStay = true; - public boolean AnnounceJoinQuit = true; - public boolean AnnounceSilence = true; + public GameOptionBoolean DisplayLobbySide = new GameOptionBoolean(true, "Display Lobby Side", "Show which side players are on in lobby?"); - public boolean DisplayLobbySide = true; + public GameOptionGameState KitRegisterState = new GameOptionGameState(GameState.Live, "Kit Register State", "State of registered kits"); - public GameState KitRegisterState = GameState.Live; + public GameOptionBoolean JoinInProgress = new GameOptionBoolean(false, "Join In Progress", "Allow players to join a game in progress?"); - public boolean JoinInProgress = false; + public GameOptionInteger TickPerTeleport = new GameOptionInteger(1, "Tick Per Teleport", "Number of ticks between teleports"); - public int TickPerTeleport = 1; + public GameOptionInteger FillTeamsInOrderToCount = new GameOptionInteger(-1, "Fill Teams In Order To Count", "Number to fill teams to in order to count players"); - public int FillTeamsInOrderToCount = -1; + public GameOptionBoolean SpawnNearAllies = new GameOptionBoolean(false, "Spawn Near Allies", "Allow players to spawn near their allies?"); + public GameOptionBoolean SpawnNearEnemies = new GameOptionBoolean(false, "Spawn Near Enemies", "Allow players to spawn near their enemies?"); - public boolean SpawnNearAllies = false; - public boolean SpawnNearEnemies = false; + public GameOptionBoolean StrictAntiHack = new GameOptionBoolean(false, "Strict Anti-Hack", "Turn on Strict Anti-Hack?"); - public boolean StrictAntiHack = false; + public GameOptionBoolean DisableKillCommand = new GameOptionBoolean(true, "Disable Kill Command", "Turn off kill command"); - public boolean DisableKillCommand = true; + public GameOptionBoolean GadgetsDisabled = new GameOptionBoolean(true, "Gadgets Disabled", "Disable gadgets?"); - public boolean GadgetsDisabled = true; + public GameOptionBoolean TeleportsDisqualify = new GameOptionBoolean(true, "Teleports Disqualify", "Teleporting disqualifies player?"); - public boolean TeleportsDisqualify = true; - - public boolean DontAllowOverfill = false; + public GameOptionBoolean DontAllowOverfill = new GameOptionBoolean(false, "Don't Allow Overfill", "Don't let players overfill teams?"); // Addons public boolean CompassEnabled = false; @@ -710,11 +712,11 @@ public abstract class Game implements Listener public GameTeam ChooseTeam(Player player) { - if (FillTeamsInOrderToCount != -1) + if (FillTeamsInOrderToCount.GetOption() != -1) { for (int i = 0; i < _teamList.size(); i++) { - if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount) + if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount.GetOption()) { return _teamList.get(i); } @@ -737,7 +739,7 @@ public abstract class Game implements Listener public double GetKillsGems(Player killer, Player killed, boolean assist) { - if (DeathOut) + if (DeathOut.GetOption()) { if (!assist) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java index 13a2541ad..0630d0bed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java @@ -23,15 +23,9 @@ public class GameOption return _optionDescription; } - //Every GameOption will have a SetOption method of some sort - public void SetOption() - { - - } - - /*Every GameOption will have a GetOptionSetting method, as well - * However, since each GameOption class will have a different return type, - * there isn't much need to create one here at this time + /*Every GameOption will have SetOption and GetOption methods + * However, since each GameOption class will have a different return type + * and take different parameters, there isn't much need to create any here at this time */ } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java index fc7898335..02ae04f3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java @@ -13,7 +13,7 @@ public class GameOptionBoolean extends GameOption _optionSetting = optOnOff; } - public Boolean GetOptionSetting() + public Boolean GetOption() { return _optionSetting; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionGameState.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionGameState.java new file mode 100644 index 000000000..93aa3d2d3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionGameState.java @@ -0,0 +1,25 @@ +package nautilus.game.arcade.game; + +import nautilus.game.arcade.game.Game.GameState; + +public class GameOptionGameState extends GameOption { + + GameState _optionGameState; + + public GameOptionGameState(GameState optGS,String optName, String optDesc) { + super(optName, optDesc); + // TODO Auto-generated constructor stub + _optionGameState = optGS; + } + + public GameState GetOption() + { + return _optionGameState; + } + + public void SetOption(GameState newOptionSetting) + { + _optionGameState = newOptionSetting; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java index adc29452f..3bfeeaac6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java @@ -35,9 +35,9 @@ public class BaconBrawl extends SoloGame "Last pig in the arena wins!" }); - DamageTeamSelf = true; - HungerSet = 20; - PrepareFreeze = false; + DamageTeamSelf.SetOption(true); + HungerSet.SetOption(20); + PrepareFreeze.SetOption(false); registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java index c8ab8f459..3a864b997 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java @@ -104,13 +104,13 @@ public class Ball _ball.remove(); //Spawn - _host.CreatureAllowOverride = true; + _host.CreatureAllowOverride.SetOption(true); _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); _ball.setSize(2); UtilEnt.Vegetate(_ball); UtilEnt.ghost(_ball, false, false); - _host.CreatureAllowOverride = false; + _host.CreatureAllowOverride.SetOption(false); _lastParticle = _ball.getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 31508193d..7f217d1e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -662,7 +662,7 @@ public class EventModule extends MiniPlugin Manager.GetGame().HealthSet = health; - if (Manager.GetGame().HealthSet == -1) + if (Manager.GetGame().HealthSet.GetOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", Manager.GetGame().HealthSet + ""))); @@ -693,7 +693,7 @@ public class EventModule extends MiniPlugin Manager.GetGame().HungerSet = hunger; - if (Manager.GetGame().HungerSet == -1) + if (Manager.GetGame().HungerSet.GetOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", Manager.GetGame().HungerSet + ""))); @@ -724,7 +724,7 @@ public class EventModule extends MiniPlugin Manager.GetGame().WorldTimeSet = time; - if (Manager.GetGame().WorldTimeSet == -1) + if (Manager.GetGame().WorldTimeSet.GetOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", Manager.GetGame().WorldTimeSet + ""))); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java index 618658947..622166e2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/waves/WaveVictory.java @@ -32,10 +32,10 @@ public class WaveVictory extends WaveBase mob.GetEntity().damage(5); //Time - if (Host.WorldTimeSet != 6000) + if (Host.WorldTimeSet.GetOption() != 6000) { - Host.WorldTimeSet = (Host.WorldTimeSet + 50)%24000; - Host.WorldData.World.setTime(Host.WorldTimeSet); + Host.WorldTimeSet.SetOption((Host.WorldTimeSet.GetOption() + 50)%24000); + Host.WorldData.World.setTime(Host.WorldTimeSet.GetOption()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index c4cbf7053..cdb5c7b29 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -2923,12 +2923,12 @@ public class MineStrike extends TeamGame if (event.getMessage().contains("god")) { - if (HealthSet == 20) - HealthSet = -1; + if (HealthSet.GetOption() == 20) + HealthSet.SetOption(-1); else - HealthSet = 20; + HealthSet.SetOption(20); - Announce(C.cPurple + C.Bold + "God Mode: " + ChatColor.RESET + (HealthSet == 20)); + Announce(C.cPurple + C.Bold + "God Mode: " + ChatColor.RESET + (HealthSet.GetOption() == 20)); event.setCancelled(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java index 65af10219..892ef6ffe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java @@ -155,13 +155,13 @@ public class Ball if (_ballDeadTime > 0 && (_firstSpawn || UtilTime.elapsed(_ballDeadTime, 6000))) { //Spawn - _host.CreatureAllowOverride = true; + _host.CreatureAllowOverride.SetOption(true); _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); _ball.setSize(2); UtilEnt.Vegetate(_ball); UtilEnt.ghost(_ball, false, false); - _host.CreatureAllowOverride = false; + _host.CreatureAllowOverride.SetOption(false); _lastParticle = _ball.getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java index 64dcdc9b7..5179f0e34 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java @@ -50,13 +50,13 @@ public class PerkNightLivingDead extends SmashPerk if (event.getType() != UpdateType.TICK) return; - if (_night.isEmpty() && Manager.GetGame().WorldTimeSet != 12000) + if (_night.isEmpty() && Manager.GetGame().WorldTimeSet.GetOption() != 12000) { - Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; + Manager.GetGame().WorldTimeSet.SetOption((Manager.GetGame().WorldTimeSet.GetOption() + 50)%24000); } - else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet != 18000) + else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet.GetOption() != 18000) { - Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; + Manager.GetGame().WorldTimeSet.SetOption((Manager.GetGame().WorldTimeSet.GetOption() + 50)%24000); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index ff47122fb..660797c97 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -858,20 +858,20 @@ public class GameFlagManager implements Listener if (game == null || !game.IsLive()) return; - if (game.HungerSet != -1) + if (game.HungerSet.GetOption() != -1) for (Player player : game.GetPlayers(true)) { if (Manager.GetCondition().HasCondition(player, ConditionType.ARCADE_HUNGER_DISABLE, null)) continue; - player.setFoodLevel(game.HungerSet); + player.setFoodLevel(game.HungerSet.GetOption()); player.setSaturation(1F); } - if (game.HealthSet != -1) + if (game.HealthSet.GetOption() != -1) for (Player player : game.GetPlayers(true)) { - player.setHealth(game.HealthSet); + player.setHealth(game.HealthSet.GetOption()); } } @@ -1000,13 +1000,13 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldTimeSet != -1) + if (game.WorldTimeSet.GetOption() != -1) { if (game.WorldData != null) { if (game.WorldData.World != null) { - game.WorldData.World.setTime(game.WorldTimeSet); + game.WorldData.World.setTime(game.WorldTimeSet.GetOption()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index eade25252..34a778feb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -484,7 +484,7 @@ public class GameManager implements Listener @EventHandler public void KitRegister(GameStateChangeEvent event) { - if (event.GetState() != event.GetGame().KitRegisterState) + if (event.GetState() != event.GetGame().KitRegisterState.GetOption()) return; event.GetGame().RegisterKits(); From 262c6c2fa68bead5883a1f9024193ad59c6ec2cc Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Fri, 25 Mar 2016 13:53:20 -0400 Subject: [PATCH 07/34] Quick Lunch-time bug-squashing update. Still have tons of errors to go through, but I want to make sure everything is backed up, should the weather turn foul(er) and a power outage should occur --- .../src/nautilus/game/arcade/game/Game.java | 2 +- .../game/games/barbarians/Barbarians.java | 38 ++++++------ .../game/games/bossbattles/BossBattles.java | 6 +- .../game/games/bouncyballs/BouncyBalls.java | 2 +- .../game/arcade/game/games/bridge/Bridge.java | 48 +++++++-------- .../game/arcade/game/games/build/Build.java | 42 +++++++------- .../game/arcade/game/games/cards/Cards.java | 12 ++-- .../game/games/castlesiege/CastleSiege.java | 28 ++++----- .../game/games/champions/ChampionsCTF.java | 8 +-- .../games/champions/ChampionsDominate.java | 8 +-- .../game/games/champions/ChampionsTDM.java | 8 +-- .../game/games/christmas/Christmas.java | 12 ++-- .../games/christmas/content/BossMobs.java | 4 +- .../christmas/content/BossSnowmanPattern.java | 4 +- .../games/christmas/content/CaveGiant.java | 4 +- .../game/games/common/CaptureTheFlag.java | 16 ++--- .../arcade/game/games/common/Domination.java | 14 ++--- .../arcade/game/games/deathtag/DeathTag.java | 8 +-- .../game/games/dragonescape/DragonEscape.java | 14 ++--- .../games/dragonescape/DragonEscapeTeams.java | 10 ++-- .../game/games/dragonriders/DragonData.java | 4 +- .../game/games/dragonriders/DragonRiders.java | 4 +- .../arcade/game/games/dragons/Dragons.java | 10 ++-- .../game/games/dragons/DragonsTeams.java | 12 ++-- .../game/arcade/game/games/draw/Draw.java | 8 +-- .../arcade/game/games/event/EventGame.java | 54 ++++++++--------- .../arcade/game/games/event/EventModule.java | 58 +++++++++---------- .../halloween/creatures/CreatureBase.java | 4 +- .../game/games/lobbers/BombLobbers.java | 22 +++---- .../challenges/ChallengeDragonEgg.java | 4 +- .../challenges/ChallengeHitTargets.java | 4 +- .../challenges/ChallengeMilkACow.java | 4 +- .../challenges/ChallengeNameThatSound.java | 4 +- .../challenges/ChallengeShootChickens.java | 8 +-- .../mineware/challenges/ChallengeSkyFall.java | 4 +- .../challenges/ChallengeSmashOff.java | 4 +- .../challenges/ChallengeTntLauncher.java | 2 +- .../challenges/ChallengeVolleyPig.java | 8 +-- 38 files changed, 253 insertions(+), 253 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index a64e2271d..872430213 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -207,7 +207,7 @@ public abstract class Game implements Listener public GameOptionDouble DeathSpectateSecs = new GameOptionDouble(0, "Death Spectate Secs", "How many seconds players may spectate match while dead"); public GameOptionBoolean DeathTeleport = new GameOptionBoolean(true, "Death Teleport", "Do players teleport upon death?"); - public GameOptionBoolean QuitOut = new GameOptionBoolean(true, "Quit Out", "Are players considered out if they quit?"); + public GameOptionBoolean QuitOut = new GameOptionBoolean(true, "Quit Out", "Are players allowed to quit?"); public GameOptionBoolean QuitDropItems = new GameOptionBoolean(false, "Quit Drop Items", "Do players drop items if they quit?"); public GameOptionBoolean IdleKickz = new GameOptionBoolean(true, "Idle Kickz", "Are idle players kicked?"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java index c48e919eb..fe767cbb1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java @@ -39,27 +39,27 @@ public class Barbarians extends SoloGame "Last player alive wins!" }); - this.DamageTeamSelf = true; + this.DamageTeamSelf.SetOption(true); this.CompassEnabled = true; - this.BlockBreakAllow.add(5); - this.BlockBreakAllow.add(17); - this.BlockBreakAllow.add(18); - this.BlockBreakAllow.add(20); - this.BlockBreakAllow.add(30); - this.BlockBreakAllow.add(47); - this.BlockBreakAllow.add(53); - this.BlockBreakAllow.add(54); - this.BlockBreakAllow.add(58); - this.BlockBreakAllow.add(64); - this.BlockBreakAllow.add(83); - this.BlockBreakAllow.add(85); - this.BlockBreakAllow.add(96); - this.BlockBreakAllow.add(125); - this.BlockBreakAllow.add(126); - this.BlockBreakAllow.add(134); - this.BlockBreakAllow.add(135); - this.BlockBreakAllow.add(136); + this.BlockBreakAllow.GetOption().add(5); + this.BlockBreakAllow.GetOption().add(17); + this.BlockBreakAllow.GetOption().add(18); + this.BlockBreakAllow.GetOption().add(20); + this.BlockBreakAllow.GetOption().add(30); + this.BlockBreakAllow.GetOption().add(47); + this.BlockBreakAllow.GetOption().add(53); + this.BlockBreakAllow.GetOption().add(54); + this.BlockBreakAllow.GetOption().add(58); + this.BlockBreakAllow.GetOption().add(64); + this.BlockBreakAllow.GetOption().add(83); + this.BlockBreakAllow.GetOption().add(85); + this.BlockBreakAllow.GetOption().add(96); + this.BlockBreakAllow.GetOption().add(125); + this.BlockBreakAllow.GetOption().add(126); + this.BlockBreakAllow.GetOption().add(134); + this.BlockBreakAllow.GetOption().add(135); + this.BlockBreakAllow.GetOption().add(136); registerStatTrackers( new BlockBreakStatTracker(this, true) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java index 0ecfe91f4..539c53c79 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java @@ -55,9 +55,9 @@ public class BossBattles extends TeamGame "Fight some bosses" }); - HungerSet = 20; - CreatureAllowOverride = true; - PrepareFreeze = false; + HungerSet.SetOption(20); + CreatureAllowOverride.SetOption(true); + PrepareFreeze.SetOption(false); // registerChatStats(Kills); // Game giving constant errors when loading. diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java index ce464297f..18ad27ab4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java @@ -35,7 +35,7 @@ public class BouncyBalls extends SoloGame "BOUNCE" }); - this.HungerSet = 20; + this.HungerSet.SetOption(20); // registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index 6b97ab4f0..3233c00f7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -175,45 +175,45 @@ public class Bridge extends TeamGame implements OreObsfucation _ore = new OreHider(); // Flags - GameTimeout.setOption(Manager.IsTournamentServer() ? 5400000 : 3600000); + GameTimeout.SetOption(Manager.IsTournamentServer() ? 5400000 : 3600000); Manager.GetExplosion().SetLiquidDamage(false); - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - DamageSelf = true; + DamageSelf.SetOption(true); - ItemDrop = true; - ItemPickup = true; + ItemDrop.SetOption(true); + ItemPickup.SetOption(true); - InventoryClick = true; + InventoryClick.SetOption(true); - AnnounceStay = false; + AnnounceStay.SetOption(false); - PrivateBlocks = true; - BlockBreak = true; - BlockPlace = true; + PrivateBlocks.SetOption(true); + BlockBreak.SetOption(true); + BlockPlace.SetOption(true); - InventoryOpenBlock = true; - InventoryOpenChest = true; + InventoryOpenBlock.SetOption(true); + InventoryOpenChest.SetOption(true); - WorldTimeSet = 2000; + WorldTimeSet.SetOption(2000); - WorldWaterDamage = 0; - WorldBoundaryKill = false; + WorldWaterDamage.SetOption(0); + WorldBoundaryKill.SetOption(false); CompassEnabled = true; - DeathDropItems = true; + DeathDropItems.SetOption(true); GemMultiplier = 2.5; - PrepareFreeze = false; + PrepareFreeze.SetOption(false); //Tournament if (Manager.IsTournamentServer()) { - QuitOut = false; + QuitOut.SetOption(false); _gameDesc = new String[] { @@ -273,10 +273,10 @@ public class Bridge extends TeamGame implements OreObsfucation if (!WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty()) { - WorldWaterDamage = 4; + WorldWaterDamage.SetOption(4); } - if (WorldWaterDamage > 0) + if (WorldWaterDamage.GetOption() > 0) { if (WorldData.MapName.equals("Volcanic Islands")) UtilTextMiddle.display(C.cRed + "Warning", "Water is Boiling Hot", 10, 60, 20); @@ -1084,14 +1084,14 @@ public class Bridge extends TeamGame implements OreObsfucation Entity ent; - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); if (rand > 0.66) ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Cow.class); else if (rand > 0.33) ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Pig.class); else ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Chicken.class); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); _animalSet.get(team).add(ent); } @@ -1395,7 +1395,7 @@ public class Bridge extends TeamGame implements OreObsfucation if (event.getBucket() != Material.WATER_BUCKET) return; - if (WorldWaterDamage > 0) + if (WorldWaterDamage.GetOption() > 0) { UtilPlayer.message( event.getPlayer(), @@ -1597,7 +1597,7 @@ public class Bridge extends TeamGame implements OreObsfucation if (team.GetPlayers(true).size() > 0) teamsAlive.add(team); - if (!QuitOut) + if (!QuitOut.GetOption()) { //Offline Player Team for (GameTeam team : RejoinTeam.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 5828ce042..826be9ca4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -165,29 +165,29 @@ public class Build extends SoloGame "based on the build theme!" }); - this.StrictAntiHack = true; - this.Damage = false; - this.HungerSet = 20; - this.HealthSet = 20; + this.StrictAntiHack.SetOption(true); + this.Damage.SetOption(false); + this.HungerSet.SetOption(20); + this.HealthSet.SetOption(20); - this.BlockBreak = true; - this.BlockPlace = true; + this.BlockBreak.SetOption(true); + this.BlockPlace.SetOption(true); - this.ItemDrop = true; - this.ItemPickup = true; + this.ItemDrop.SetOption(true); + this.ItemPickup.SetOption(true); - this.InventoryClick = true; + this.InventoryClick.SetOption(true); - this.WorldTimeSet = 6000; + this.WorldTimeSet.SetOption(6000); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); - this.CreatureAllow = true; + this.CreatureAllow.SetOption(true); - this.WorldFireSpread = true; - this.WorldBoneMeal = true; + this.WorldFireSpread.SetOption(true); + this.WorldBoneMeal.SetOption(true); - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); UtilServer.getServer().spigot().getConfig().set("view-distance", 4); @@ -275,7 +275,7 @@ public class Build extends SoloGame UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5); - this.WorldTimeSet = -1; + this.WorldTimeSet.SetOption(-1); } } @@ -353,13 +353,13 @@ public class Build extends SoloGame _buildStateTime = System.currentTimeMillis(); //Flags - this.BlockBreak = false; - this.BlockPlace = false; + this.BlockBreak.SetOption(false); + this.BlockPlace.SetOption(false); - this.ItemDrop = false; - this.ItemPickup = false; + this.ItemDrop.SetOption(false); + this.ItemPickup.SetOption(false); - this.InventoryClick = false; + this.InventoryClick.SetOption(false); UtilTextMiddle.display(null, C.cYellow + "TIME IS UP!", 0, 60, 5); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java index e890a34a2..b6571ba79 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java @@ -60,14 +60,14 @@ public class Cards extends SoloGame "based on the build theme!" }); - this.StrictAntiHack = true; - this.Damage = false; - this.HungerSet = 20; - this.HealthSet = 20; + this.StrictAntiHack.SetOption(true); + this.Damage.SetOption(false); + this.HungerSet.SetOption(20); + this.HealthSet.SetOption(20); - this.WorldTimeSet = 6000; + this.WorldTimeSet.SetOption(6000); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); _cardFactory = new CardFactory(); 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 2aced88d1..7f68a616e 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 @@ -192,12 +192,12 @@ public class CastleSiege extends TeamGame }; - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - this.HungerSet = 20; - this.DeathOut = false; - this.WorldTimeSet = 14000; //14000 - this.BlockPlaceAllow.add(85); + this.HungerSet.SetOption(20); + this.DeathOut.SetOption(false); + this.WorldTimeSet.SetOption(14000); //14000 + this.BlockPlaceAllow.GetOption().add(85); _kingName = C.cYellow + C.Bold + "King Sparklez"; @@ -307,9 +307,9 @@ public class CastleSiege extends TeamGame if (GetKits().length <= 5 + i) continue; - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); Manager.GetLobby().AddKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("PINK").get(i)); } @@ -323,9 +323,9 @@ public class CastleSiege extends TeamGame for (Location loc : _horseSpawns) { - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Horse horse = loc.getWorld().spawn(loc, Horse.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); horse.setAdult(); horse.setAgeLock(true); @@ -387,7 +387,7 @@ public class CastleSiege extends TeamGame return; //Spawn King - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); _kingLoc = _kingLocs.get(UtilMath.r(_kingLocs.size())); @@ -404,7 +404,7 @@ public class CastleSiege extends TeamGame _king.setRemoveWhenFarAway(false); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } @EventHandler(priority = EventPriority.HIGH) @@ -555,7 +555,7 @@ public class CastleSiege extends TeamGame Scoreboard.Write(_kingHealth + " Health"); } - long timeLeft = 24000 - WorldTimeSet; + long timeLeft = 24000 - WorldTimeSet.GetOption(); timeLeft = timeLeft / 20 * 1000; @@ -584,7 +584,7 @@ public class CastleSiege extends TeamGame if (!IsLive()) return; - if (this.WorldTimeSet > 24100) + if (this.WorldTimeSet.GetOption() > 24100) { SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the siege!"); @@ -937,7 +937,7 @@ public class CastleSiege extends TeamGame if (event.getType() != UpdateType.TICK) return; - WorldTimeSet = (WorldTimeSet + 1); + WorldTimeSet.SetOption(WorldTimeSet.GetOption() + 1); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java index c2633e3b4..7551da2e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java @@ -67,16 +67,16 @@ public class ChampionsCTF extends CaptureTheFlag Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - InventoryOpenChest = true; + InventoryOpenChest.SetOption(true); EloRanking = false; EloStart = 1000; - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); - this.DisableKillCommand = false; + this.DisableKillCommand.SetOption(false); registerStatTrackers( new KillReasonStatTracker(this, "Backstab", "Assassination", false), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java index 83b44d9de..975c7928c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java @@ -62,16 +62,16 @@ public class ChampionsDominate extends Domination Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - InventoryOpenChest = true; + InventoryOpenChest.SetOption(true); EloRanking = false; EloStart = 1000; - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); - this.DisableKillCommand = false; + this.DisableKillCommand.SetOption(false); registerStatTrackers( new KillReasonStatTracker(this, "Backstab", "Assassination", false), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java index 73bbb3812..b89d8b19f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java @@ -63,13 +63,13 @@ public class ChampionsTDM extends TeamDeathmatch Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - InventoryOpenChest = true; + InventoryOpenChest.SetOption(true); - this.DisableKillCommand = false; + this.DisableKillCommand.SetOption(false); - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); registerStatTrackers( new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java index 5e68140ee..48df41bf9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java @@ -148,10 +148,10 @@ public class Christmas extends SoloGame "Defeat the Thief who stole the Presents!" }); - BlockBreakAllow.add(4); - HungerSet = 20; - WorldTimeSet = 2000; - PrepareFreeze = false; + BlockBreakAllow.GetOption().add(4); + HungerSet.SetOption(20); + WorldTimeSet.SetOption(2000); + PrepareFreeze.SetOption(false); registerChatStats( DamageDealt, @@ -332,7 +332,7 @@ public class Christmas extends SoloGame Location loc = christmas.GetSleigh().GetLocation(); - christmas.CreatureAllowOverride = true; + christmas.CreatureAllowOverride.SetOption(true); for (int i=0 ; i<20 ; i++) { Location elfLoc = UtilBlock.getHighest(loc.getWorld(), (int)(loc.getX() + 20 - Math.random()*40), (int)(loc.getZ() + 20 - Math.random()*40)).getLocation().add(0.5, 0.5, 0.5); @@ -345,7 +345,7 @@ public class Christmas extends SoloGame elf.setCustomName("Elf"); } - christmas.CreatureAllowOverride = false; + christmas.CreatureAllowOverride.SetOption(false); } }, 20); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java index 39cce1f42..fcf9760b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java @@ -55,9 +55,9 @@ public class BossMobs _lastSpawn = System.currentTimeMillis(); //Spawn - Host.Host.CreatureAllowOverride = true; + Host.Host.CreatureAllowOverride.SetOption(true); Creature ent = UtilAlg.Random(_spawns).getWorld().spawn(UtilAlg.Random(_spawns), Skeleton.class); - Host.Host.CreatureAllowOverride = false; + Host.Host.CreatureAllowOverride.SetOption(false); //Weapon double r = Math.random(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java index 0b0909fd9..8ebb2395d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java @@ -106,7 +106,7 @@ public class BossSnowmanPattern _lastSpawn = System.currentTimeMillis(); - Host.Host.CreatureAllowOverride = true; + Host.Host.CreatureAllowOverride.SetOption(true); //Spawn A for (int i=0 ; i<_spawnA.size() ; i++) @@ -134,7 +134,7 @@ public class BossSnowmanPattern _ents.add(new BossSnowman(ent, loc, _bDir)); } - Host.Host.CreatureAllowOverride = false; + Host.Host.CreatureAllowOverride.SetOption(false); } private void MoveDieHit() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java index 65c5b40d1..38412db30 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java @@ -27,9 +27,9 @@ public class CaveGiant { Host = host; - Host.Host.CreatureAllowOverride = true; + Host.Host.CreatureAllowOverride.SetOption(true); _ent = loc.getWorld().spawn(loc, Giant.class); - Host.Host.CreatureAllowOverride = false; + Host.Host.CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(_ent); _ent.setMaxHealth(300); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java index d2d8dd2e8..fe48fdf18 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java @@ -98,12 +98,12 @@ public class CaptureTheFlag extends TeamGame }); - this.DeathOut = false; - this.PrepareFreeze = true; - this.HungerSet = 20; - this.WorldTimeSet = 2000; + this.DeathOut.SetOption(false); + this.PrepareFreeze.SetOption(true); + this.HungerSet.SetOption(20); + this.WorldTimeSet.SetOption(2000); - this.DeathSpectateSecs = 10; + this.DeathSpectateSecs.SetOption(10); } @Override @@ -129,7 +129,7 @@ public class CaptureTheFlag extends TeamGame if (this instanceof ChampionsCTF) { - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("LIGHT_BLUE").size() && i < WorldData.GetDataLocs("PINK").size(); i++) { Entity ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); @@ -138,7 +138,7 @@ public class CaptureTheFlag extends TeamGame ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("LIGHT_BLUE").get(i)); Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("LIGHT_BLUE").get(i)); } - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); } //End kit spawning @@ -247,7 +247,7 @@ public class CaptureTheFlag extends TeamGame else { _suddenDeath = true; - this.DeathOut = true; + this.DeathOut.SetOption(true); UtilTextMiddle.display(C.cYellow + "Sudden Death", "Next Capture Wins! No Respawns!"); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index c92af3e1f..547cb424a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -80,12 +80,12 @@ public class Domination extends TeamGame }); - this.DeathOut = false; - this.PrepareFreeze = true; - this.HungerSet = 20; - this.WorldTimeSet = 2000; + this.DeathOut.SetOption(false); + this.PrepareFreeze.SetOption(true); + this.HungerSet.SetOption(20); + this.WorldTimeSet.SetOption(2000); - this.DeathSpectateSecs = 10; + this.DeathSpectateSecs.SetOption(10); //this.QuitOut = false; } @@ -113,7 +113,7 @@ public class Domination extends TeamGame //Spawn Kits if (this instanceof ChampionsDominate) { - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("RED").size() && i < WorldData.GetDataLocs("BLUE").size(); i++) { @@ -124,7 +124,7 @@ public class Domination extends TeamGame Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("BLUE").get(i)); } - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index 859257fcb..c7299df4c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -63,14 +63,14 @@ public class DeathTag extends SoloGame "The last Runner alive wins!" }); - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - this.DeathOut = false; - this.HungerSet = 20; + this.DeathOut.SetOption(false); + this.HungerSet.SetOption(20); this.CompassEnabled = true; - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); registerStatTrackers(new ComeAtMeBroStatTracker(this)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 3cbd0c28d..447ebe3b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -114,9 +114,9 @@ public class DragonEscape extends SoloGame "Last player alive wins!" }); - this.DamagePvP = false; - this.HungerSet = 20; - this.BlockPlace = true; + this.DamagePvP.SetOption(false); + this.HungerSet.SetOption(20); + this.BlockPlace.SetOption(true); registerStatTrackers( new ParalympicsStatTracker(this), @@ -176,10 +176,10 @@ public class DragonEscape extends SoloGame _speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d; if (WorldData.MapName.contains("Hell")) - this.WorldTimeSet = 16000; + this.WorldTimeSet.SetOption(16000); if (WorldData.MapName.contains("Pirate")) - this.WorldWaterDamage = 2; + this.WorldWaterDamage.SetOption(2); } @EventHandler @@ -191,9 +191,9 @@ public class DragonEscape extends SoloGame for (Team team : GetScoreboard().GetScoreboard().getTeams()) team.setCanSeeFriendlyInvisibles(true); - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java index 0b6764bb5..07777fef5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java @@ -81,8 +81,8 @@ public class DragonEscapeTeams extends TeamGame "Last player alive wins!" }); - this.DamagePvP = false; - this.HungerSet = 20; + this.DamagePvP.SetOption(false); + this.HungerSet.SetOption(20); this.TeamArmorHotbar = true; @@ -159,7 +159,7 @@ public class DragonEscapeTeams extends TeamGame _speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d; if (WorldData.MapName.contains("Hell")) - this.WorldTimeSet = 16000; + this.WorldTimeSet.SetOption(16000); } @EventHandler @@ -174,9 +174,9 @@ public class DragonEscapeTeams extends TeamGame if (event.GetState() != GameState.Prepare) return; - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java index 50df5fe35..8c8cd4e0b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java @@ -39,10 +39,10 @@ public class DragonData Location = rider.getLocation(); //Spawn Dragon - manager.GetGame().CreatureAllowOverride = true; + manager.GetGame().CreatureAllowOverride.SetOption(true); Dragon = rider.getWorld().spawn(rider.getLocation(), EnderDragon.class); UtilEnt.Vegetate(Dragon); - manager.GetGame().CreatureAllowOverride = false; + manager.GetGame().CreatureAllowOverride.SetOption(false); rider.getWorld().playSound(rider.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java index bccf6f3a1..3470056e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java @@ -22,8 +22,8 @@ public class DragonRiders extends SoloGame }); - this.Damage = false; - this.HungerSet = 20; + this.Damage.SetOption(false); + this.HungerSet.SetOption(20); //Chat stats registerChatStats(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java index 2ec7e7daa..68eabad10 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java @@ -59,9 +59,9 @@ public class Dragons extends SoloGame "Last player alive wins!" }); - this.DamagePvP = false; - this.HungerSet = 20; - this.WorldWaterDamage = 4; + this.DamagePvP.SetOption(false); + this.HungerSet.SetOption(20); + this.WorldWaterDamage.SetOption(4); registerStatTrackers( new SparklezStatTracker(this) @@ -153,10 +153,10 @@ public class Dragons extends SoloGame if (_dragons.size() < 7) { - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); UtilEnt.Vegetate(ent); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java index 9743a5aaf..66ff4f708 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java @@ -66,10 +66,10 @@ public class DragonsTeams extends TeamGame "Team with longest time survived wins!" }); - this.DamagePvP = false; - this.HungerSet = 20; - this.WorldWaterDamage = 4; - this.PrepareFreeze = false; + this.DamagePvP.SetOption(false); + this.HungerSet.SetOption(20); + this.WorldWaterDamage.SetOption(4); + this.PrepareFreeze.SetOption(false); this.TeamArmor = true; this.TeamArmorHotbar = true; @@ -157,10 +157,10 @@ public class DragonsTeams extends TeamGame if (_dragons.size() < 7) { - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); UtilEnt.Vegetate(ent); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index cc87cc712..465ec1f06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -111,10 +111,10 @@ public class Draw extends SoloGame "Hints are given at top of screen", }); - this.StrictAntiHack = true; - this.Damage = false; - this.HungerSet = 20; - this.WorldTimeSet = 8000; + this.StrictAntiHack.SetOption(true); + this.Damage.SetOption(false); + this.HungerSet.SetOption(20); + this.WorldTimeSet.SetOption(8000); _words = new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index f90b48ed1..f64756d4c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -113,41 +113,41 @@ public class EventGame extends Game "" }); - this.JoinInProgress = true; + this.JoinInProgress.SetOption(true); - this.DamageTeamSelf = true; - this.DamagePvP = false; - this.DamageEvP = false; - this.DamagePvE = false; + this.DamageTeamSelf.SetOption(true); + this.DamagePvP.SetOption(false); + this.DamageEvP.SetOption(false); + this.DamagePvE.SetOption(false); - this.DeathMessages = false; - this.DeathOut = false; + this.DeathMessages.SetOption(false); + this.DeathOut.SetOption(false); this.CanAddStats = false; this.CanGiveLoot = false; - this.GadgetsDisabled = false; + this.GadgetsDisabled.SetOption(false); - this.TeleportsDisqualify = false; + this.TeleportsDisqualify.SetOption(false); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); - this.BlockPlaceCreative = true; - this.BlockBreakCreative = true; + this.BlockPlaceCreative.SetOption(true); + this.BlockBreakCreative.SetOption(true); - this.InventoryClick = true; - this.InventoryOpenBlock = true; - this.InventoryOpenChest = true; + this.InventoryClick.SetOption(true); + this.InventoryOpenBlock.SetOption(true); + this.InventoryOpenChest.SetOption(true); //Dont timeout - this.GameTimeout = -1; + this.GameTimeout.SetOption(-1); _mps = manager.GetGameHostManager(); _functionSigns = new HashMap<>(); _powerdedSigns = new ArrayList<>(); - this.CreatureAllow = true; + this.CreatureAllow.SetOption(true); _customAreas = new HashMap<>(); } @@ -989,13 +989,13 @@ public class EventGame extends Game if(Manager.GetEventModule().getDamagePlayers().contains(event.GetDamagerPlayer(true))) { - if(!Manager.GetGame().DamagePvP) + if(!Manager.GetGame().DamagePvP.GetOption()) { - Manager.GetGame().Damage = true; - Manager.GetGame().DamagePvP = true; + Manager.GetGame().Damage.SetOption(true); + Manager.GetGame().DamagePvP.SetOption(true); Bukkit.getPluginManager().callEvent(event); - Manager.GetGame().DamagePvP = false; - Manager.GetGame().Damage = false; + Manager.GetGame().DamagePvP.SetOption(false); + Manager.GetGame().Damage.SetOption(false); } return; } @@ -1032,13 +1032,13 @@ public class EventGame extends Game continue; } } - if(!Manager.GetGame().DamagePvP) + if(!Manager.GetGame().DamagePvP.GetOption()) { - Manager.GetGame().Damage = true; - Manager.GetGame().DamagePvP = true; + Manager.GetGame().Damage.SetOption(true); + Manager.GetGame().DamagePvP.SetOption(true); Bukkit.getPluginManager().callEvent(event); - Manager.GetGame().DamagePvP = false; - Manager.GetGame().Damage = false; + Manager.GetGame().DamagePvP.SetOption(false); + Manager.GetGame().Damage.SetOption(false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 7f217d1e8..3b4843c60 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -456,11 +456,11 @@ public class EventModule extends MiniPlugin public void listSettings(Player player) { - UtilPlayer.message(player, F.value("Damage All", F.tf(Manager.GetGame().Damage))); - UtilPlayer.message(player, F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP))); - UtilPlayer.message(player, F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE))); - UtilPlayer.message(player, F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP))); - UtilPlayer.message(player, F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall))); + UtilPlayer.message(player, F.value("Damage All", F.tf(Manager.GetGame().Damage.GetOption()))); + UtilPlayer.message(player, F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP.GetOption()))); + UtilPlayer.message(player, F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE.GetOption()))); + UtilPlayer.message(player, F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP.GetOption()))); + UtilPlayer.message(player, F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.GetOption()))); UtilPlayer.message(player, F.value("Health Set", Manager.GetGame().HealthSet+"")); UtilPlayer.message(player, F.value("Hunger Set", Manager.GetGame().HungerSet+"")); UtilPlayer.message(player, F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup))); @@ -468,11 +468,11 @@ public class EventModule extends MiniPlugin UtilPlayer.message(player, F.value("Block Place Creative", F.tf(Manager.GetGame().BlockPlaceCreative))); UtilPlayer.message(player, F.value("Block Break Creative", F.tf(Manager.GetGame().BlockBreakCreative))); UtilPlayer.message(player, F.value("Block Place", F.tf(Manager.GetGame().BlockPlace))); - UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow, true))); - UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny, true))); - UtilPlayer.message(player, F.value("Block Break", F.tf(Manager.GetGame().BlockPlace))); - UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow, true))); - UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny, true))); + UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.GetOption(), true))); + UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.GetOption(), true))); + UtilPlayer.message(player, F.value("Block Break", F.tf(Manager.GetGame().BlockPlace.GetOption()))); + UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.GetOption(), true))); + UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.G, true))); UtilPlayer.message(player, F.value("Time Set", Manager.GetGame().WorldTimeSet+"")); UtilPlayer.message(player, F.value("Mob griefing", F.tf(_mobGriefing))); } @@ -535,44 +535,44 @@ public class EventModule extends MiniPlugin { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockPlaceAllow.add(blockId); + Manager.GetGame().BlockPlaceAllow.GetOption().add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockPlaceAllow.remove(blockId); + Manager.GetGame().BlockPlaceAllow.GetOption().remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockPlaceAllow.clear(); + Manager.GetGame().BlockPlaceAllow.GetOption().clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow, true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.GetOption(), true)))); } } else { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockPlaceDeny.add(blockId); + Manager.GetGame().BlockPlaceDeny.GetOption().add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockPlaceDeny.remove(blockId); + Manager.GetGame().BlockPlaceDeny.GetOption().remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockPlaceDeny.clear(); + Manager.GetGame().BlockPlaceDeny.GetOption().clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny, true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.GetOption(), true)))); } } @@ -596,44 +596,44 @@ public class EventModule extends MiniPlugin { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockBreakAllow.add(blockId); + Manager.GetGame().BlockBreakAllow.GetOption().add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockBreakAllow.remove(blockId); + Manager.GetGame().BlockBreakAllow.GetOption().remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockBreakAllow.clear(); + Manager.GetGame().BlockBreakAllow.GetOption().clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow, true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.GetOption(), true)))); } } else { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockBreakDeny.add(blockId); + Manager.GetGame().BlockBreakDeny.GetOption().add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockBreakDeny.remove(blockId); + Manager.GetGame().BlockBreakDeny.GetOption().remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockBreakDeny.clear(); + Manager.GetGame().BlockBreakDeny.GetOption().clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny, true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.GetOption(), true)))); } } @@ -660,7 +660,7 @@ public class EventModule extends MiniPlugin if (health > 20) health = 20; - Manager.GetGame().HealthSet = health; + Manager.GetGame().HealthSet.SetOption(health); if (Manager.GetGame().HealthSet.GetOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", "Disabled"))); @@ -691,7 +691,7 @@ public class EventModule extends MiniPlugin if (hunger > 20) hunger = 20; - Manager.GetGame().HungerSet = hunger; + Manager.GetGame().HungerSet.SetOption(hunger); if (Manager.GetGame().HungerSet.GetOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", "Disabled"))); @@ -722,7 +722,7 @@ public class EventModule extends MiniPlugin if (time > 24000) time = 24000; - Manager.GetGame().WorldTimeSet = time; + Manager.GetGame().WorldTimeSet.SetOption(time); if (Manager.GetGame().WorldTimeSet.GetOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", "Disabled"))); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java index fb4b3232c..da4bc9547 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java @@ -28,7 +28,7 @@ public abstract class CreatureBase Host = game; _name = name; - game.CreatureAllowOverride = true; + game.CreatureAllowOverride.SetOption(true); _ent = loc.getWorld().spawn(loc, mobClass); @@ -40,7 +40,7 @@ public abstract class CreatureBase SpawnCustom(_ent); - game.CreatureAllowOverride = false; + game.CreatureAllowOverride.SetOption(false); } public abstract void SpawnCustom(T ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 93d9bb2bd..3c4e6a2fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -92,28 +92,28 @@ public class BombLobbers extends TeamGame implements IThrown "Last team alive wins!" }); - DamageFall = true; - DamageEvP = true; + DamageFall.SetOption(true); + DamageEvP.SetOption(true); - WorldWaterDamage = 5; + WorldWaterDamage.SetOption(5); - PrepareFreeze = false; + PrepareFreeze.SetOption(false); TeamArmor = true; TeamArmorHotbar = true; - InventoryOpenChest = false; - InventoryOpenBlock = false; + InventoryOpenChest.SetOption(false); + InventoryOpenBlock.SetOption(false); - ItemDrop = false; + ItemDrop.SetOption(false); - BlockPlace = false; + BlockPlace.SetOption(false); Manager.GetExplosion().SetLiquidDamage(false); - HungerSet = 20; + HungerSet.SetOption(20); - WorldTimeSet = 6000; + WorldTimeSet.SetOption(6000); registerStatTrackers( new Tracker6Kill(this), @@ -140,7 +140,7 @@ public class BombLobbers extends TeamGame implements IThrown if (WorldData.MapName.equalsIgnoreCase("Intergalactic")) { - WorldTimeSet = 18000; + WorldTimeSet.SetOption(18000); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java index c472b72f3..8a460e007 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java @@ -81,7 +81,7 @@ public class ChallengeDragonEgg extends Challenge block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0, 11, ViewDist.MAX, UtilServer.getPlayers()); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); for (int i = 0; i < 10; i++) { @@ -106,7 +106,7 @@ public class ChallengeDragonEgg extends Challenge } } - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java index fbb0f7dd4..265262f79 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java @@ -100,13 +100,13 @@ public class ChallengeHitTargets extends Challenge @Override public void cleanupRoom() { - Host.DamagePvP = false; + Host.DamagePvP.SetOption(false); } @Override public void setupPlayers() { - Host.DamagePvP = true; + Host.DamagePvP.SetOption(true); ArrayList players = getChallengers(); for (Player player : players) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java index 2ce37789a..69d03e553 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java @@ -126,7 +126,7 @@ public class ChallengeMilkACow extends Challenge } } - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); _villager = (Villager) getCenter().getWorld().spawnEntity(getCenter().clone().add(0, 1, 0), EntityType.VILLAGER); _villager.setProfession(Profession.FARMER); _villager.setCustomName(C.Bold + "Farmer Joe"); @@ -156,7 +156,7 @@ public class ChallengeMilkACow extends Challenge _milked.put(cow, new ArrayList()); } - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java index 1b84f183d..2c5b97c65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java @@ -184,7 +184,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms Collections.shuffle(entityType); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); int i = 0; @@ -205,7 +205,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms } } - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java index 5bf0b4bab..18daa31ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java @@ -52,7 +52,7 @@ public class ChallengeShootChickens extends Challenge arrow.remove(); } - Host.DamagePvE = false; + Host.DamagePvE.SetOption(false); } @EventHandler @@ -140,9 +140,9 @@ public class ChallengeShootChickens extends Challenge { Location loc = getCenter().clone().add(UtilMath.r(20) - 10, 15, UtilMath.r(20) - 10); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Chicken chicken = (Chicken) loc.getWorld().spawnEntity(loc, EntityType.CHICKEN); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); chicken.setMaxHealth(0.1); chicken.setHealth(0.1); @@ -164,7 +164,7 @@ public class ChallengeShootChickens extends Challenge _killedChickens.put(player.getName(), 0); } - Host.DamagePvE = true; + Host.DamagePvE.SetOption(true); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java index 1408f1d2d..921cf46d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java @@ -42,7 +42,7 @@ public class ChallengeSkyFall extends Challenge @Override public void cleanupRoom() { - Host.DamageEvP = false; + Host.DamageEvP.SetOption(false); } @EventHandler @@ -66,7 +66,7 @@ public class ChallengeSkyFall extends Challenge { setBorder(-50, 50, 0, 254, -50, 50); - Host.DamageEvP = true; + Host.DamageEvP.SetOption(true); for (Player player : getChallengers()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java index 7527e633b..709380e3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java @@ -29,7 +29,7 @@ public class ChallengeSmashOff extends Challenge @Override public void cleanupRoom() { - Host.DamagePvP = false; + Host.DamagePvP.SetOption(false); for (Player player : getChallengers()) { @@ -40,7 +40,7 @@ public class ChallengeSmashOff extends Challenge @Override public void setupPlayers() { - Host.DamagePvP = true; + Host.DamagePvP.SetOption(true); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java index d7879a713..1bb879edb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java @@ -46,7 +46,7 @@ public class ChallengeTntLauncher extends Challenge @Override public void cleanupRoom() { - Host.Damage = true; + Host.Damage.SetOption(true); for (Entity tnt : _tnt) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java index ce69eba1f..c8353412f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java @@ -62,7 +62,7 @@ public class ChallengeVolleyPig extends Challenge public void cleanupRoom() { _pig.remove(); - Host.DamagePvE = false; + Host.DamagePvE.SetOption(false); } @Override @@ -73,7 +73,7 @@ public class ChallengeVolleyPig extends Challenge player.getInventory().setItem(0, new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 1).build()); } - Host.DamagePvE = true; + Host.DamagePvE.SetOption(true); } @EventHandler(priority = EventPriority.LOW) @@ -203,12 +203,12 @@ public class ChallengeVolleyPig extends Challenge @Override public void generateRoom() { - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); _pig = getCenter().getWorld().spawnEntity(getCenter().add(0, 1, 0), EntityType.PIG); UtilEnt.Vegetate(_pig); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); for (int x = -6; x <= 6; x++) { From 05ede7910e9a83f3dd4aa5dd458cb36b01b10356 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Fri, 25 Mar 2016 15:27:11 -0400 Subject: [PATCH 08/34] All errors have been fixed. --- .../src/nautilus/game/arcade/game/Game.java | 28 ++--- .../nautilus/game/arcade/game/GameTeam.java | 6 +- .../nautilus/game/arcade/game/TeamGame.java | 12 +- .../games/baconbrawl/kits/KitMamaPig.java | 4 +- .../arcade/game/games/christmas/Sleigh.java | 2 +- .../games/christmas/content/PumpkinKing.java | 4 +- .../games/christmas/content/SnowmanBoss.java | 4 +- .../games/christmas/content/SnowmanMaze.java | 4 +- .../games/christmas/content/SnowmanWaveA.java | 4 +- .../games/christmas/content/SnowmanWaveB.java | 4 +- .../game/games/christmas/parts/Part.java | 4 +- .../game/games/christmas/parts/Part1.java | 4 +- .../game/games/christmas/parts/Part2.java | 4 +- .../game/games/christmas/parts/Part4.java | 4 +- .../game/games/common/TeamDeathmatch.java | 6 +- .../arcade/game/games/event/EventModule.java | 72 ++++++------ .../game/games/evolution/Evolution.java | 18 +-- .../game/games/gladiators/Gladiators.java | 24 ++-- .../arcade/game/games/gravity/Gravity.java | 12 +- .../game/games/gravity/GravityObject.java | 4 +- .../game/games/halloween/Halloween.java | 14 +-- .../halloween/creatures/PumpkinKing.java | 8 +- .../game/games/halloween/waves/WaveBase.java | 4 +- .../arcade/game/games/hideseek/HideSeek.java | 16 +-- .../game/games/holeinwall/HoleInTheWall.java | 14 +-- .../game/arcade/game/games/micro/Micro.java | 12 +- .../arcade/game/games/milkcow/MilkCow.java | 18 +-- .../game/games/minestrike/MineStrike.java | 16 +-- .../arcade/game/games/mineware/MineWare.java | 22 ++-- .../game/arcade/game/games/moba/Moba.java | 6 +- .../games/monsterleague/MonsterLeague.java | 10 +- .../arcade/game/games/monstermaze/Maze.java | 8 +- .../game/games/monstermaze/MonsterMaze.java | 12 +- .../game/games/oldmineware/OldMineWare.java | 26 ++--- .../game/games/oldmineware/order/Order.java | 8 +- .../games/oldmineware/order/OrderGather.java | 4 +- .../games/oldmineware/order/OrderPlace.java | 2 +- .../game/games/paintball/Paintball.java | 6 +- .../games/paintball/PlayerCopyPaintball.java | 4 +- .../game/arcade/game/games/quiver/Quiver.java | 20 ++-- .../arcade/game/games/quiver/QuiverTeams.java | 16 +-- .../game/arcade/game/games/runner/Runner.java | 8 +- .../searchanddestroy/SearchAndDestroy.java | 18 +-- .../game/games/searchanddestroy/TeamBomb.java | 4 +- .../arcade/game/games/sheep/SheepGame.java | 12 +- .../arcade/game/games/skywars/Skywars.java | 48 ++++---- .../game/games/skywars/SoloSkywars.java | 2 +- .../game/games/skywars/TeamSkywars.java | 8 +- .../game/games/smash/SoloSuperSmash.java | 2 +- .../arcade/game/games/smash/SuperSmash.java | 10 +- .../game/games/smash/TeamSuperSmash.java | 8 +- .../game/games/smash/kits/KitKnight.java | 4 +- .../game/games/smash/kits/KitSkySquid.java | 4 +- .../games/smash/perks/PerkCowAngryHerd.java | 4 +- .../game/arcade/game/games/snake/Snake.java | 16 +-- .../sneakyassassins/SneakyAssassins.java | 8 +- .../games/sneakyassassins/npc/NpcManager.java | 4 +- .../sneakyassassins/powerups/PowerUpItem.java | 4 +- .../game/games/snowfight/SnowFight.java | 4 +- .../games/speedbuilders/SpeedBuilders.java | 36 +++--- .../speedbuilders/data/RecreationData.java | 4 +- .../game/arcade/game/games/spleef/Spleef.java | 6 +- .../arcade/game/games/spleef/SpleefTeams.java | 6 +- .../game/games/squidshooter/SquidShooter.java | 10 +- .../arcade/game/games/stacker/Stacker.java | 4 +- .../survivalgames/SoloSurvivalGames.java | 2 +- .../games/survivalgames/SurvivalGames.java | 74 ++++++------- .../survivalgames/SurvivalGamesTeams.java | 64 +++++------ .../survivalgames/TeamSurvivalGames.java | 10 +- .../game/arcade/game/games/tug/Tug.java | 14 +-- .../game/games/turfforts/TurfForts.java | 18 +-- .../arcade/game/games/typewars/TypeWars.java | 50 ++++----- .../typewars/tutorial/TutorialTypeWars.java | 4 +- .../game/arcade/game/games/uhc/UHC.java | 60 +++++----- .../game/games/valentines/Valentines.java | 14 +-- .../tutorial/TutorialValentines.java | 8 +- .../game/games/wither/PlayerCopyWither.java | 4 +- .../arcade/game/games/wither/WitherGame.java | 24 ++-- .../arcade/game/games/wizards/Wizards.java | 22 ++-- .../wizards/spells/SpellSummonWolves.java | 4 +- .../games/zombiesurvival/ZombieSurvival.java | 8 +- .../game/arcade/kit/perks/PerkBatWave.java | 4 +- .../game/arcade/kit/perks/PerkChicken.java | 4 +- .../arcade/kit/perks/PerkChickenRocket.java | 4 +- .../game/arcade/kit/perks/PerkCowBomb.java | 4 +- .../arcade/kit/perks/PerkEndermanDragon.java | 4 +- .../game/arcade/kit/perks/PerkHorsePet.java | 4 +- .../arcade/kit/perks/PerkMadScientist.java | 4 +- .../arcade/kit/perks/PerkNightLivingDead.java | 4 +- .../arcade/kit/perks/PerkPigBaconBomb.java | 4 +- .../arcade/kit/perks/PerkSheepHoming.java | 4 +- .../game/arcade/kit/perks/PerkSkeletons.java | 4 +- .../arcade/kit/perks/PerkSlimeRocket.java | 4 +- .../game/arcade/kit/perks/PerkSnowTurret.java | 4 +- .../arcade/kit/perks/PerkWitherImage.java | 4 +- .../arcade/kit/perks/PerkWitherMinion.java | 4 +- .../game/arcade/kit/perks/PerkWolf.java | 4 +- .../game/arcade/kit/perks/PerkWolfPack.java | 4 +- .../game/arcade/kit/perks/PerkWolfPet.java | 4 +- .../game/arcade/managers/GameFlagManager.java | 104 +++++++++--------- .../arcade/managers/GameLobbyManager.java | 4 +- .../game/arcade/managers/GameManager.java | 6 +- .../game/arcade/managers/MiscManager.java | 2 +- 103 files changed, 636 insertions(+), 636 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 872430213..0903a9d54 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -165,7 +165,7 @@ public abstract class Game implements Listener //Note: If any descriptions are inaccurate, feel free to let me know and/or fix them. Thanks. ~Joe Prezioso public GameOptionLong GameTimeout = new GameOptionLong(1200000, "Game Timeout", "Allotted time for game mode"); - public GameOptionBoolean Damage new GameOptionBoolean(true, "Damage", "Does damage matter in this game mode?"); + public GameOptionBoolean Damage = new GameOptionBoolean(true, "Damage", "Does damage matter in this game mode?"); public GameOptionBoolean DamagePvP = new GameOptionBoolean(true, "Damage PVP", "Players allowed to damage other players?"); public GameOptionBoolean DamagePvE = new GameOptionBoolean(true, "Damage PVE", "Players allowed to damage monsters?"); public GameOptionBoolean DamageEvP = new GameOptionBoolean(true, "Damage EVP", "Monsters allowed to damage players?"); @@ -176,7 +176,7 @@ public abstract class Game implements Listener public GameOptionBoolean BlockBreak = new GameOptionBoolean(false, "Block Break", "Can players break blocks?"); //Really not sure about the description for this one... - public GameOptionBoolean BlockBreakCreative = newGameOptionBoolean(false, "Block Break, Creative", "Can players break blocks in creative mode?"); + public GameOptionBoolean BlockBreakCreative = new GameOptionBoolean(false, "Block Break, Creative", "Can players break blocks in creative mode?"); public GameOptionHashInt BlockBreakAllow = new GameOptionHashInt(new HashSet(), "Block Break Allow", "Set of blocks players can break"); public GameOptionHashInt BlockBreakDeny = new GameOptionHashInt(new HashSet(), "Block Break Deny", "Set of blocks players can't break"); @@ -232,12 +232,12 @@ public abstract class Game implements Listener public GameOptionBoolean PrepareFreeze = new GameOptionBoolean(true, "Prepare Freeze", "Freeze game while preparations are made?"); - private GameOptionDouble _itemMergeRadius = new GameOptionBoolean(0, "Item Merge Radius", "Distance at which items merge"); + private GameOptionDouble _itemMergeRadius = new GameOptionDouble(0, "Item Merge Radius", "Distance at which items merge"); //really not sure what the descriptions should be for announcements ~JP public GameOptionBoolean AnnounceStay = new GameOptionBoolean(true, "Announce Stay", "Send message to announce player is staying?"); public GameOptionBoolean AnnounceJoinQuit = new GameOptionBoolean(true, "Announce Join Quit", "Send message to announce player has quit?"); - public GameOptionBoolean AnnounceSilence = new GameOptionBoolean(true, "Announce Silence", "Silence all announcements?"; + public GameOptionBoolean AnnounceSilence = new GameOptionBoolean(true, "Announce Silence", "Silence all announcements?"); public GameOptionBoolean DisplayLobbySide = new GameOptionBoolean(true, "Display Lobby Side", "Show which side players are on in lobby?"); @@ -1054,10 +1054,10 @@ public abstract class Game implements Listener public DeathMessageType GetDeathMessageType() { - if (!DeathMessages) + if (!DeathMessages.GetOption()) return DeathMessageType.None; - if (this.DeathOut) + if (this.DeathOut.GetOption()) return DeathMessageType.Detailed; return DeathMessageType.Simple; @@ -1127,7 +1127,7 @@ public abstract class Game implements Listener for (Player player : UtilServer.getPlayers()) AnnounceGame(player); - if (AnnounceSilence) + if (AnnounceSilence.GetOption()) Manager.GetChat().Silence(PrepareTime, false); } @@ -1212,7 +1212,7 @@ public abstract class Game implements Listener UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); - if (AnnounceSilence) + if (AnnounceSilence.GetOption()) Manager.GetChat().Silence(5000, false); } @@ -1269,7 +1269,7 @@ public abstract class Game implements Listener UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); - if (AnnounceSilence) + if (AnnounceSilence.GetOption()) Manager.GetChat().Silence(5000, false); } @@ -1490,7 +1490,7 @@ public abstract class Game implements Listener @EventHandler public void classCombatCreatureAllow(ClassCombatCreatureAllowSpawnEvent event) { - CreatureAllowOverride = event.getAllowed(); + CreatureAllowOverride.SetOption(event.getAllowed()); } public boolean isInsideMap(Player player) @@ -1511,17 +1511,17 @@ public abstract class Game implements Listener public void setItemMergeRadius(double mergeRadius) { - _itemMergeRadius = mergeRadius; + _itemMergeRadius.SetOption(mergeRadius); if (WorldData.World != null) { - ((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius; + ((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius.GetOption(); } } public double getItemMergeRadius() { - return _itemMergeRadius; + return _itemMergeRadius.GetOption(); } @EventHandler @@ -1530,7 +1530,7 @@ public abstract class Game implements Listener if (event.getWorld().getName().equals(WorldData.GetFolder())) { System.out.println("Setting item merge radius for game to " + _itemMergeRadius); - ((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius; + ((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius.GetOption(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index 256771fdb..ce24b3425 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -132,7 +132,7 @@ public class GameTeam public Location GetSpawn() { //Keep allies together - if (!Host.IsLive() && Host.SpawnNearAllies) + if (!Host.IsLive() && Host.SpawnNearAllies.GetOption()) { //Find Location Nearest Ally Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true)); @@ -142,7 +142,7 @@ public class GameTeam //No allies existed spawned yet //Spawn near enemies (used for SG) - if (Host.SpawnNearEnemies) + if (Host.SpawnNearEnemies.GetOption()) { loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); if (loc != null) @@ -159,7 +159,7 @@ public class GameTeam else { //Spawn near players - if (Host.SpawnNearEnemies) + if (Host.SpawnNearEnemies.GetOption()) { Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); if (loc != null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java index 48ae4e9de..4fb1bc90d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -76,7 +76,7 @@ public abstract class TeamGame extends Game if (player.getWorld().getName().equalsIgnoreCase("world")) return; - if (!QuitOut) + if (!QuitOut.GetOption()) { //Store _rejoinTime.put(player.getName(), System.currentTimeMillis()); @@ -97,7 +97,7 @@ public abstract class TeamGame extends Game @EventHandler(priority = EventPriority.LOWEST) public void PlayerLoginAllow(PlayerLoginEvent event) { - if (!InProgress() || QuitOut) + if (!InProgress() || QuitOut.GetOption()) return; //Rejoined @@ -135,7 +135,7 @@ public abstract class TeamGame extends Game @EventHandler public void playerRejoinGame(PlayerJoinEvent event) { - if (!InProgress() || QuitOut) + if (!InProgress() || QuitOut.GetOption()) return; Player player = event.getPlayer(); @@ -150,7 +150,7 @@ public abstract class TeamGame extends Game @EventHandler public void PlayerRejoinExpire(UpdateEvent event) { - if (event.getType() != UpdateType.SEC || QuitOut) + if (event.getType() != UpdateType.SEC || QuitOut.GetOption()) return; Iterator rejoinIterator = _rejoinTime.keySet().iterator(); @@ -177,7 +177,7 @@ public abstract class TeamGame extends Game @EventHandler public void RejoinCommand(PlayerCommandPreprocessEvent event) { - if (!QuitOut && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin")) + if (!QuitOut.GetOption() && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin")) { String[] toks = event.getMessage().split(" "); @@ -206,7 +206,7 @@ public abstract class TeamGame extends Game if (team.GetPlayers(true).size() > 0) teamsAlive.add(team); - if (!QuitOut) + if (!QuitOut.GetOption()) { //Offline Player Team for (GameTeam team : RejoinTeam.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java index c285f9c53..95c89247b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java @@ -54,13 +54,13 @@ public class KitMamaPig extends Kit disguise.setCustomNameVisible(false); Manager.GetDisguise().disguise(disguise); - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); pig.setBaby(); pig.setAgeLock(true); pig.setCustomName(C.cYellow + player.getName()); pig.setCustomNameVisible(false); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); player.setPassenger(pig); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java index 26ef62540..9be9f4d2a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java @@ -46,7 +46,7 @@ public class Sleigh { Host = host; - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Target = loc.clone(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java index 1397465e1..42f0b5a05 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java @@ -44,9 +44,9 @@ public class PumpkinKing _grid = grid; - Host.Host.CreatureAllowOverride = true; + Host.Host.CreatureAllowOverride.SetOption(true); _ent = loc.getWorld().spawn(loc, Skeleton.class); - Host.Host.CreatureAllowOverride = false; + Host.Host.CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(_ent); UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java index 82b334134..62581c57d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java @@ -43,7 +43,7 @@ public class SnowmanBoss _minions = new ArrayList(); //Spawn - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); for (int i=0 ; i<14 ; i++) _minions.add(new SnowmanMinion(_spawn.getWorld().spawn(_spawn, Snowman.class))); @@ -53,7 +53,7 @@ public class SnowmanBoss _heart.setHealth(1400); UtilEnt.Vegetate(_heart); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); //Stack Entity base = null; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java index e65212177..8848fefd5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java @@ -258,9 +258,9 @@ public class SnowmanMaze { Location loc = UtilAlg.Random(_spawns); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java index db9a10f0d..a32869329 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java @@ -93,9 +93,9 @@ public class SnowmanWaveA continue; Location loc = _spawns.get(i); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java index 0e2568a54..7a1685db7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java @@ -90,9 +90,9 @@ public class SnowmanWaveB _lastPositions.add(i); Location loc = _spawns.get(i); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java index 80c3a276e..4822fb771 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java @@ -71,9 +71,9 @@ public abstract class Part implements Listener Location standLoc = loc.clone().add(0, -1.45, 0); standLoc.setYaw(UtilMath.r(100)); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); ArmorStand stand = loc.getWorld().spawn(standLoc, ArmorStand.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); stand.setVisible(false); stand.setGravity(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java index 6839ff135..ada7c6d0e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java @@ -118,11 +118,11 @@ public class Part1 extends Part //Create Location loc = UtilAlg.Random(_skeletons); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Skeleton skel = loc.getWorld().spawn(loc, Skeleton.class); skel.getEquipment().setItemInHand(new ItemStack(Material.WOOD_HOE)); skel.setHealth(4); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); this.AddCreature(skel); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java index debb76643..717fd8b78 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java @@ -127,9 +127,9 @@ public class Part2 extends Part //Create Location loc = UtilAlg.Random(_spiders); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Skeleton ent = loc.getWorld().spawn(loc, Skeleton.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); DisguiseSpider disguise = new DisguiseSpider(ent); Host.Manager.GetDisguise().disguise(disguise); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java index 26b282b57..f851ad316 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java @@ -179,9 +179,9 @@ public class Part4 extends Part //Create Location loc = UtilAlg.Random(_mobSpawns); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Zombie ent = loc.getWorld().spawn(loc, Zombie.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); ent.getEquipment().setItemInHand(new ItemStack(Material.WOOD_PICKAXE)); ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java index 1e26628f7..1116a4a33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java @@ -74,9 +74,9 @@ public class TeamDeathmatch extends TeamGame }); - this.DeathOut = true; - this.HungerSet = 20; - this.WorldTimeSet = 2000; + this.DeathOut.SetOption(true); + this.HungerSet.SetOption(20); + this.WorldTimeSet.SetOption(2000); this.CompassEnabled = true; this.Manager.GetDamage().UseSimpleWeaponDamage = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 3b4843c60..78cdf0785 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -303,28 +303,28 @@ public class EventModule extends MiniPlugin //XXX Settings else if (event.getMessage().toLowerCase().equals("/e damage all")) { - Manager.GetGame().Damage = !Manager.GetGame().Damage; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage All", F.tf(Manager.GetGame().Damage)))); + Manager.GetGame().Damage.SetOption(!Manager.GetGame().Damage.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage All", F.tf(Manager.GetGame().Damage.GetOption())))); } else if (event.getMessage().toLowerCase().equals("/e damage pvp")) { - Manager.GetGame().DamagePvP = !Manager.GetGame().DamagePvP; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP)))); + Manager.GetGame().DamagePvP.SetOption(!Manager.GetGame().DamagePvP.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP.GetOption())))); } else if (event.getMessage().toLowerCase().equals("/e damage pve")) { - Manager.GetGame().DamagePvE = !Manager.GetGame().DamagePvE; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE)))); + Manager.GetGame().DamagePvE.SetOption(!Manager.GetGame().DamagePvE.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE.GetOption())))); } else if (event.getMessage().toLowerCase().equals("/e damage evp")) { - Manager.GetGame().DamageEvP = !Manager.GetGame().DamageEvP; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP)))); + Manager.GetGame().DamageEvP.SetOption(!Manager.GetGame().DamageEvP.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP.GetOption())))); } else if (event.getMessage().toLowerCase().equals("/e damage fall")) { - Manager.GetGame().DamageFall = !Manager.GetGame().DamageFall; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall)))); + Manager.GetGame().DamageFall.SetOption(!Manager.GetGame().DamageFall.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.GetOption())))); } else if (args[0].equalsIgnoreCase("health")) { @@ -336,18 +336,18 @@ public class EventModule extends MiniPlugin } else if (event.getMessage().toLowerCase().equals("/e item drop")) { - Manager.GetGame().ItemDrop = !Manager.GetGame().ItemDrop; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop)))); + Manager.GetGame().ItemDrop.SetOption(!Manager.GetGame().ItemDrop.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop.GetOption())))); } else if (event.getMessage().toLowerCase().equals("/e item pickup")) { - Manager.GetGame().ItemPickup = !Manager.GetGame().ItemPickup; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup)))); + Manager.GetGame().ItemPickup.SetOption(!Manager.GetGame().ItemPickup.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup.GetOption())))); } else if (event.getMessage().toLowerCase().equals("/e blockplace")) { - Manager.GetGame().BlockPlace = !Manager.GetGame().BlockPlace; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Place", F.tf(Manager.GetGame().BlockPlace)))); + Manager.GetGame().BlockPlace.SetOption(!Manager.GetGame().BlockPlace.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Place", F.tf(Manager.GetGame().BlockPlace.GetOption())))); } else if (args.length >= 4 && args[0].equalsIgnoreCase("blockplace") && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist"))) @@ -356,8 +356,8 @@ public class EventModule extends MiniPlugin } else if (event.getMessage().toLowerCase().equals("/e blockbreak")) { - Manager.GetGame().BlockBreak = !Manager.GetGame().BlockBreak; - Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Break", F.tf(Manager.GetGame().BlockBreak)))); + Manager.GetGame().BlockBreak.SetOption(!Manager.GetGame().BlockBreak.GetOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Break", F.tf(Manager.GetGame().BlockBreak.GetOption())))); } else if (args.length >= 4 && args[0].equalsIgnoreCase("blockbreak") && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist"))) @@ -463,25 +463,25 @@ public class EventModule extends MiniPlugin UtilPlayer.message(player, F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.GetOption()))); UtilPlayer.message(player, F.value("Health Set", Manager.GetGame().HealthSet+"")); UtilPlayer.message(player, F.value("Hunger Set", Manager.GetGame().HungerSet+"")); - UtilPlayer.message(player, F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup))); - UtilPlayer.message(player, F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop))); - UtilPlayer.message(player, F.value("Block Place Creative", F.tf(Manager.GetGame().BlockPlaceCreative))); - UtilPlayer.message(player, F.value("Block Break Creative", F.tf(Manager.GetGame().BlockBreakCreative))); - UtilPlayer.message(player, F.value("Block Place", F.tf(Manager.GetGame().BlockPlace))); + UtilPlayer.message(player, F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup.GetOption()))); + UtilPlayer.message(player, F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop.GetOption()))); + UtilPlayer.message(player, F.value("Block Place Creative", F.tf(Manager.GetGame().BlockPlaceCreative.GetOption()))); + UtilPlayer.message(player, F.value("Block Break Creative", F.tf(Manager.GetGame().BlockBreakCreative.GetOption()))); + UtilPlayer.message(player, F.value("Block Place", F.tf(Manager.GetGame().BlockPlace.GetOption()))); UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.GetOption(), true))); UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.GetOption(), true))); UtilPlayer.message(player, F.value("Block Break", F.tf(Manager.GetGame().BlockPlace.GetOption()))); UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.GetOption(), true))); - UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.G, true))); + UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.GetOption(), true))); UtilPlayer.message(player, F.value("Time Set", Manager.GetGame().WorldTimeSet+"")); UtilPlayer.message(player, F.value("Mob griefing", F.tf(_mobGriefing))); } public void commandBlockBreakInCreative(Player player, String[] args) { - Manager.GetGame().BlockBreakCreative = !Manager.GetGame().BlockBreakCreative; + Manager.GetGame().BlockBreakCreative.SetOption(!Manager.GetGame().BlockBreakCreative.GetOption()); - UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative))); + UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative.GetOption()))); } public void commandStacker(Player player, String[] args) @@ -513,9 +513,9 @@ public class EventModule extends MiniPlugin public void commandBlockPlaceInCreative(Player player, String[] args) { - Manager.GetGame().BlockPlaceCreative = !Manager.GetGame().BlockPlaceCreative; + Manager.GetGame().BlockPlaceCreative.SetOption(!Manager.GetGame().BlockPlaceCreative.GetOption()); - UtilPlayer.message(player, F.main("Settings", "BlockPlaceCreative: " + F.tf(Manager.GetGame().BlockPlaceCreative))); + UtilPlayer.message(player, F.main("Settings", "BlockPlaceCreative: " + F.tf(Manager.GetGame().BlockPlaceCreative.GetOption()))); } public void commandMobGriefing(Player player, String[] args) @@ -1017,25 +1017,25 @@ public class EventModule extends MiniPlugin //Spec public void commandSpectators(Player player, String[] args) { - Manager.GetGame().JoinInProgress = !Manager.GetGame().JoinInProgress; + Manager.GetGame().JoinInProgress.SetOption(!Manager.GetGame().JoinInProgress.GetOption()); - UtilPlayer.message(player, F.main("Settings", "Spectator Join: " + F.tf(Manager.GetGame().JoinInProgress))); + UtilPlayer.message(player, F.main("Settings", "Spectator Join: " + F.tf(Manager.GetGame().JoinInProgress.GetOption()))); } //Deathout public void commandDeathout(Player player, String[] args) { - Manager.GetGame().DeathOut = !Manager.GetGame().DeathOut; + Manager.GetGame().DeathOut.SetOption(!Manager.GetGame().DeathOut.GetOption()); - UtilPlayer.message(player, F.main("Settings", "Deathout: " + F.tf(Manager.GetGame().DeathOut))); + UtilPlayer.message(player, F.main("Settings", "Deathout: " + F.tf(Manager.GetGame().DeathOut.GetOption()))); } //QuitOut public void commandQuitOut(Player player, String[] args) { - Manager.GetGame().QuitOut = !Manager.GetGame().QuitOut; + Manager.GetGame().QuitOut.SetOption(!Manager.GetGame().QuitOut.GetOption()); - UtilPlayer.message(player, F.main("Settings", "QuitOut: " + F.tf(Manager.GetGame().QuitOut))); + UtilPlayer.message(player, F.main("Settings", "QuitOut: " + F.tf(Manager.GetGame().QuitOut.GetOption()))); } //Double Jump @@ -1246,9 +1246,9 @@ public class EventModule extends MiniPlugin HashSet entSet = new HashSet(); for (int i = 0 ; i < count ; i++) { - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock((HashSet)null, 150).getLocation().add(0.5, 1, 0.5), type)); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); } //Search Vars diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index e8b4ead2e..d5cc56300 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -130,13 +130,13 @@ public class Evolution extends SoloGame "First to get through " + _mobKits.size() + " evolutions wins!" }; - DamageTeamSelf = true; + DamageTeamSelf.SetOption(true); - HungerSet = 20; + HungerSet.SetOption(20); - DeathOut = false; + DeathOut.SetOption(false); - PrepareFreeze = false; + PrepareFreeze.SetOption(false); GemKillDeathRespawn = 2; GemAssistDeathRespawn = .5; @@ -144,13 +144,13 @@ public class Evolution extends SoloGame CompassEnabled = true; CompassGiveItem = false; - AutomaticRespawn = false; - DeathSpectateSecs = 4.0; + AutomaticRespawn.SetOption(false); + DeathSpectateSecs.SetOption(4.0); - CreatureAllow = false; - InventoryClick = false; + CreatureAllow.SetOption(false); + InventoryClick.SetOption(false); - InventoryOpenBlock = false; + InventoryOpenBlock.SetOption(false); Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.Attack); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index fbf5edc54..7013c46ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -103,18 +103,18 @@ public class Gladiators extends SoloGame "There is only one victor!" }); - Damage = true; - DamageFall = false; - DamagePvP = true; - DamageSelf = true; - DamageTeamSelf = true; - HungerSet = 20; - DontAllowOverfill = true; + Damage.SetOption(true); + DamageFall.SetOption(false); + DamagePvP.SetOption(true); + DamageSelf.SetOption(true); + DamageTeamSelf.SetOption(true); + HungerSet.SetOption(20); + DontAllowOverfill.SetOption(true); EnableTutorials = false; - BlockBreakAllow.add(Material.SUGAR_CANE_BLOCK.getId()); - BlockBreakAllow.add(Material.DEAD_BUSH.getId()); - BlockBreakAllow.add(Material.LONG_GRASS.getId()); + BlockBreakAllow.GetOption().add(Material.SUGAR_CANE_BLOCK.getId()); + BlockBreakAllow.GetOption().add(Material.DEAD_BUSH.getId()); + BlockBreakAllow.GetOption().add(Material.LONG_GRASS.getId()); registerStatTrackers( new BrawlerTracker(this), @@ -156,10 +156,10 @@ public class Gladiators extends SoloGame e.getTutorial().getPhase(1).setLocation(white); e.getTutorial().getPhase(1).setTarget(orange); - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); Zombie zombie1 = (Zombie) WorldData.World.spawnEntity(spawn1, EntityType.ZOMBIE); Zombie zombie2 = (Zombie) WorldData.World.spawnEntity(spawn2, EntityType.ZOMBIE); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); for (Zombie zombie : Arrays.asList(zombie1, zombie2)) { GameProfile tiger = new ProfileLoader(UUIDFetcher.getUUIDOf("WilliamTiger").toString(), "WilliamTiger").loadProfile(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index 6178db711..ab9766157 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -107,14 +107,14 @@ public class Gravity extends SoloGame "Restore Oxygen at the Emerald Blocks", }; - this.DamagePvP = false; - this.HungerSet = 10; + this.DamagePvP.SetOption(false); + this.HungerSet.SetOption(10); - this.WorldTimeSet = 18000; + this.WorldTimeSet.SetOption(18000); this.CompassEnabled = true; - this.WorldBoundaryKill = false; + this.WorldBoundaryKill.SetOption(false); registerChatStats( Kills, @@ -327,9 +327,9 @@ public class Gravity extends SoloGame //Projectile Vector velocity = player.getLocation().getDirection().multiply(0.4); - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Slime slime = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection().multiply(2)), Slime.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); slime.setSize(1); UtilEnt.Vegetate(slime, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java index 34c83e330..981f6f808 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java @@ -47,9 +47,9 @@ public abstract class GravityObject else Vel = new Vector(0,0,0); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Base = ent.getWorld().spawn(ent.getLocation().subtract(0, 0, 0), Zombie.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); Base.setMaxHealth(60); Base.setHealth(60); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index 4ccc70136..06371896b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -123,20 +123,20 @@ public class Halloween extends SoloGame "Kill the Pumpkin King" }); - this.DamagePvP = false; + this.DamagePvP.SetOption(false); - this.WorldTimeSet = 16000; + this.WorldTimeSet.SetOption(16000); - this.ItemDrop = false; - this.ItemPickup = false; + this.ItemDrop.SetOption(false); + this.ItemPickup.SetOption(false); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); //this.HungerSet = 20; - this.WorldBoundaryKill = false; + this.WorldBoundaryKill.SetOption(false); - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); registerChatStats( DamageDealt, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java index cff83a8df..2626450aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java @@ -377,9 +377,9 @@ public class PumpkinKing extends CreatureBase for (int i=0 ; i<_minionsMax ; i++) { - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); Skeleton skel = GetEntity().getWorld().spawn(GetEntity().getLocation(), Skeleton.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); Host.Manager.GetCondition().Factory().Invisible("Cloak", skel, skel, 999999, 0, false, false, false); @@ -642,13 +642,13 @@ public class PumpkinKing extends CreatureBase for (int i=0 ; i(); _allowedBlocks.add(Material.TNT); @@ -456,9 +456,9 @@ public class HideSeek extends TeamGame if (GetKits().length <= 5 + i) continue; - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("RED").get(i)); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); Manager.GetLobby().AddKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("RED").get(i)); } @@ -761,7 +761,7 @@ public class HideSeek extends TeamGame if (event.GetState() != GameState.Prepare) return; - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); for (Location loc : WorldData.GetDataLocs("WHITE")) _mobs.put(loc.getWorld().spawn(loc, Sheep.class), loc); @@ -775,7 +775,7 @@ public class HideSeek extends TeamGame for (Location loc : WorldData.GetDataLocs("BROWN")) _mobs.put(loc.getWorld().spawn(loc, Cow.class), loc); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } @EventHandler(priority = EventPriority.LOW) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java index 29abe0ef7..fa5e1e6c3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java @@ -50,13 +50,13 @@ public class HoleInTheWall extends SoloGame "Hole in wall" }); - DamagePvP = false; - DamagePvE = false; - DamageEvP = false; - DamageSelf = false; - DamageFall = false; - HungerSet = 20; - WorldTimeSet = 8000; + DamagePvP.SetOption(false); + DamagePvE.SetOption(false); + DamageEvP.SetOption(false); + DamageSelf.SetOption(false); + DamageFall.SetOption(false); + HungerSet.SetOption(20); + WorldTimeSet.SetOption(8000); registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java index 3fea362b0..f27802b56 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -46,18 +46,18 @@ public class Micro extends TeamGame "Small game, big strategy!", }); - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); this.TeamArmor = true; this.TeamArmorHotbar = true; - this.InventoryClick = true; + this.InventoryClick.SetOption(true); - this.ItemDrop = true; - this.ItemPickup = true; + this.ItemDrop.SetOption(true); + this.ItemPickup.SetOption(true); - this.BlockBreak = true; - this.BlockPlace = true; + this.BlockBreak.SetOption(true); + this.BlockPlace.SetOption(true); registerStatTrackers( new KillsWithinGameStatTracker(this, 8, "Annihilation") diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index d4c95961f..dd1d8a171 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -93,7 +93,7 @@ public class MilkCow extends SoloGame }); this.CompassEnabled = true; - this.DeathOut = false; + this.DeathOut.SetOption(false); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Milk", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); @@ -163,7 +163,7 @@ public class MilkCow extends SoloGame for (Location loc : _chickens) { - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Chicken ent = loc.getWorld().spawn(loc, Chicken.class); if (Math.random() > 0.75) { @@ -171,12 +171,12 @@ public class MilkCow extends SoloGame ent.setAgeLock(true); } - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } for (Location loc : _pigs) { - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Pig ent = loc.getWorld().spawn(loc, Pig.class); if (Math.random() > 0.75) { @@ -184,12 +184,12 @@ public class MilkCow extends SoloGame ent.setAgeLock(true); } - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } for (Location loc : _villager) { - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Villager ent = loc.getWorld().spawn(loc, Villager.class); if (Math.random() > 0.75) { @@ -197,7 +197,7 @@ public class MilkCow extends SoloGame ent.setCustomNameVisible(true); } - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } } @@ -249,7 +249,7 @@ public class MilkCow extends SoloGame while (_herd.size() < 5) { - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Cow cow = host.getWorld().spawn(host.getLocation(), Cow.class); if (Math.random() > 0.5) { @@ -258,7 +258,7 @@ public class MilkCow extends SoloGame } _herd.add(cow); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index cdb5c7b29..d233a6e3f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -260,21 +260,21 @@ public class MineStrike extends TeamGame _shopManager = new ShopManager(this); - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - AnnounceStay = false; + AnnounceStay.SetOption(false); - this.HungerSet = 20; + this.HungerSet.SetOption(20); - this.ItemDrop = true; + this.ItemDrop.SetOption(true); - this.DeathTeleport = false; + this.DeathTeleport.SetOption(false); - this.InventoryClick = true; + this.InventoryClick.SetOption(true); - this.JoinInProgress = true; + this.JoinInProgress.SetOption(true); - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java index ca74c8d3a..7788be444 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java @@ -70,16 +70,16 @@ public class MineWare extends SoloGame "Other players lose one life.", "Last player with lives wins!" }); - DamageTeamSelf = true; - DamagePvP = false; - DamagePvE = false; - DamageEvP = false; - DamageFall = false; - InventoryClick = true; - DamageSelf = false; - DeathOut = false; - AutomaticRespawn = false; - DeathMessages = false; + DamageTeamSelf.SetOption(true); + DamagePvP.SetOption(false); + DamagePvE.SetOption(false); + DamageEvP.SetOption(false); + DamageFall.SetOption(false); + InventoryClick.SetOption(true); + DamageSelf.SetOption(false); + DeathOut.SetOption(false); + AutomaticRespawn.SetOption(false); + DeathMessages.SetOption(false); Manager.GetCreature().SetDisableCustomDrops(true); @@ -298,7 +298,7 @@ public class MineWare extends SoloGame @EventHandler public void PlayerMoveCancel(PlayerMoveEvent event) { - if (!PrepareFreeze) + if (!PrepareFreeze.GetOption()) return; if (!_orderWaiting) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index 3879c4b3b..576c6a94b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -27,10 +27,10 @@ public class Moba extends TeamGame "..." }); - this.DeathOut = false; - this.DeathSpectateSecs = 8; + this.DeathOut.SetOption(false); + this.DeathSpectateSecs.SetOption(8); - this.HungerSet = 20; + this.HungerSet.SetOption(20); registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java index bc413c4da..65ec59c6a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java @@ -54,12 +54,12 @@ public class MonsterLeague extends TeamGame "CHEESE IZ DELISH" }); - this.PrepareFreeze = false; - this.DamagePvP = false; - this.HungerSet = 20; - this.HealthSet = 20; + this.PrepareFreeze.SetOption(false); + this.DamagePvP.SetOption(false); + this.HungerSet.SetOption(20); + this.HealthSet.SetOption(20); - this.DeathOut = false; + this.DeathOut.SetOption(false); this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java index 3d1d29c40..6dd593d4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java @@ -513,7 +513,7 @@ public class Maze implements Listener } Location loc = UtilAlg.Random(validSpawns); - _host.CreatureAllowOverride = true; + _host.CreatureAllowOverride.SetOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); DisguiseBase disguise = DisguiseFactory.createDisguise(ent, _host.getMonsterType()); @@ -528,7 +528,7 @@ public class Maze implements Listener ((DisguiseMagmaCube) disguise).SetSize(3); } - _host.CreatureAllowOverride = false; + _host.CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(ent, true); UtilEnt.ghost(ent, true, false); @@ -551,7 +551,7 @@ public class Maze implements Listener while (spawned <= numToSpawn) { - _host.CreatureAllowOverride = true; + _host.CreatureAllowOverride.SetOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); DisguiseBase disguise = DisguiseFactory.createDisguise(ent, _host.getMonsterType()); @@ -566,7 +566,7 @@ public class Maze implements Listener ((DisguiseMagmaCube) disguise).SetSize(3); } - _host.CreatureAllowOverride = false; + _host.CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(ent, true); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index d52c5039b..e7ae6ad50 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -81,16 +81,16 @@ public class MonsterMaze extends SoloGame "Make it to a Safe Pad or be killed!" }); - DamagePvP = false; - DamagePvE = false; + DamagePvP.SetOption(false); + DamagePvE.SetOption(false); - DamageFall = false; + DamageFall.SetOption(false); - HungerSet = 20; + HungerSet.SetOption(20); - PrepareFreeze = false; + PrepareFreeze.SetOption(false); - HungerSet = 20; + HungerSet.SetOption(20); CompassEnabled = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java index e127ed2aa..1345fca93 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java @@ -73,19 +73,19 @@ public class OldMineWare extends SoloGame "Last player with lives wins!" }); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); - this.DamagePvP = false; + this.DamagePvP.SetOption(false); - this.BlockPlace = true; - this.BlockBreak = true; + this.BlockPlace.SetOption(true); + this.BlockBreak.SetOption(true); - this.ItemDrop = true; - this.ItemPickup = true; + this.ItemDrop.SetOption(true); + this.ItemPickup.SetOption(true); - InventoryOpenBlock = true; - InventoryOpenChest = true; - InventoryClick = true; + InventoryOpenBlock.SetOption(true); + InventoryOpenChest.SetOption(true); + InventoryClick.SetOption(true); PopulateOrders(); @@ -299,14 +299,14 @@ public class OldMineWare extends SoloGame Location loc = _mobLocs.get(UtilMath.r(_mobLocs.size())).clone().add(new Vector(0.5,1,0.5)); double r = Math.random(); - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Pig.class)); else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Cow.class)); else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Chicken.class)); else _mobs.add(loc.getWorld().spawn(loc, Sheep.class)); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } if (_ghast == null || !_ghast.isValid()) @@ -314,9 +314,9 @@ public class OldMineWare extends SoloGame if (_ghast != null) _ghast.remove(); - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); _ghast = _ghastLoc.getWorld().spawn(_ghastLoc, Ghast.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); _ghast.setMaxHealth(10000); _ghast.setHealth(_ghast.getMaxHealth()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java index a3bc65606..820649b8b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java @@ -48,10 +48,10 @@ public abstract class Order implements Listener public void EndOrder() { - Host.BlockBreakAllow.clear(); - Host.BlockPlaceAllow.clear(); - Host.ItemDropAllow.clear(); - Host.ItemPickupAllow.clear(); + Host.BlockBreakAllow.GetOption().clear(); + Host.BlockPlaceAllow.GetOption().clear(); + Host.ItemDropAllow.GetOption().clear(); + Host.ItemPickupAllow.GetOption().clear(); Uninitialize(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java index 1ed1a32fc..59d3fccfe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java @@ -32,8 +32,8 @@ public abstract class OrderGather extends Order public void SubInitialize() { _counter.clear(); - Host.BlockBreakAllow.add(_id); - Host.ItemPickupAllow.add(_id); + Host.BlockBreakAllow.GetOption().add(_id); + Host.ItemPickupAllow.GetOption().add(_id); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java index 89e24c25f..5a87f36da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java @@ -30,7 +30,7 @@ public abstract class OrderPlace extends Order public void SubInitialize() { _counter.clear(); - Host.BlockPlaceAllow.add(_id); + Host.BlockPlaceAllow.GetOption().add(_id); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 0d51c64a0..041172ec1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -100,11 +100,11 @@ public class Paintball extends TeamGame "Last team alive wins!" }); - StrictAntiHack = true; + StrictAntiHack.SetOption(true); - HungerSet = 20; + HungerSet.SetOption(20); - InventoryClick = false; + InventoryClick.SetOption(false); TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java index a42d2592b..d7e876cf0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java @@ -39,9 +39,9 @@ public class PlayerCopyPaintball Location entLoc = owner.getLocation(); entLoc.setPitch(0F); - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); _ent = owner.getWorld().spawn(owner.getLocation(), ArmorStand.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java index e3a2bf311..205f0e9be 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java @@ -72,17 +72,17 @@ public class Quiver extends SoloGame "First player to 20 kills wins." }); - this.HungerSet = 20; - this.DeathOut = false; - this.DamageSelf = false; - this.DamageTeamSelf = true; - this.PrepareFreeze = false; - this.BlockBreakAllow.add(102); - this.BlockBreakAllow.add(20); - this.BlockBreakAllow.add(Material.STAINED_GLASS_PANE.getId()); - this.BlockBreakAllow.add(Material.STAINED_GLASS.getId()); + this.HungerSet.SetOption(20); + this.DeathOut.SetOption(false); + this.DamageSelf.SetOption(false); + this.DamageTeamSelf.SetOption(true); + this.PrepareFreeze.SetOption(false); + this.BlockBreakAllow.GetOption().add(102); + this.BlockBreakAllow.GetOption().add(20); + this.BlockBreakAllow.GetOption().add(Material.STAINED_GLASS_PANE.getId()); + this.BlockBreakAllow.GetOption().add(Material.STAINED_GLASS.getId()); - this.DeathSpectateSecs = 1; + this.DeathSpectateSecs.SetOption(1); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java index 4626d4f24..d2da9c1ff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java @@ -54,14 +54,14 @@ public class QuiverTeams extends TeamGame "First team to 60 kills wins." }); - this.HungerSet = 20; - this.DeathOut = false; - this.DamageSelf = false; - this.DamageTeamSelf = false; - this.PrepareFreeze = false; - this.BlockBreakAllow.add(102); - this.BlockBreakAllow.add(20); - this.BlockBreakAllow.add(18); + this.HungerSet.SetOption(20); + this.DeathOut.SetOption(false); + this.DamageSelf.SetOption(false); + this.DamageTeamSelf.SetOption(false); + this.PrepareFreeze.SetOption(false); + this.BlockBreakAllow.GetOption().add(102); + this.BlockBreakAllow.GetOption().add(20); + this.BlockBreakAllow.GetOption().add(18); this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 10f901cd1..dee6620dc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -60,11 +60,11 @@ public class Runner extends SoloGame implements IThrown "Last player alive wins!" }); - this.DamagePvP = false; - this.HungerSet = 20; - this.WorldWaterDamage = 4; + this.DamagePvP.SetOption(false); + this.HungerSet.SetOption(20); + this.WorldWaterDamage.SetOption(4); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); registerStatTrackers(new DistanceTraveledStatTracker(this, "MarathonRunner")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java index ebb419815..55e47dc20 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java @@ -62,14 +62,14 @@ public class SearchAndDestroy extends TeamGame setKits(_kitManager.get_kits()); _evolve = new KitEvolve(manager.getPlugin(), this, _kitManager.getUpgradeKits()); - InventoryClick = true; - WorldTimeSet = -1; - WorldBoundaryKill = false; - HungerSet = 20; - AnnounceJoinQuit = false; - DisableKillCommand = false; + InventoryClick.SetOption(true); + WorldTimeSet.SetOption(-1); + WorldBoundaryKill.SetOption(false); + HungerSet.SetOption(20); + AnnounceJoinQuit.SetOption(false); + DisableKillCommand.SetOption(false); AllowParticles = false; - DamageSelf = false; + DamageSelf.SetOption(false); Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName); @@ -194,7 +194,7 @@ public class SearchAndDestroy extends TeamGame bomb.getBlockLocation().getWorld().playSound(bomb.getBlockLocation(), Sound.EXPLODE, 1000, 0); bomb.getBlockLocation().getWorld().playEffect(bomb.getBomb().getLocation(), Effect.EXPLOSION_HUGE, 0); bomb.removeBomb(); - DeathMessages = false; + DeathMessages.SetOption(false); for (Player player : this.GetPlayers(true)) { GameTeam pTeam = GetTeam(player); @@ -208,7 +208,7 @@ public class SearchAndDestroy extends TeamGame } } } - DeathMessages = true; + DeathMessages.SetOption(true); // TODO The code below could be used when a team is defeated. /* if (getBombs().size() == 1) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java index 3c22b71c4..a4cd49c56 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java @@ -107,9 +107,9 @@ class TeamBomb implements Comparable _bombEntity.remove(); loc = _bombEntity.getLocation(); } - _game.CreatureAllowOverride = true; + _game.CreatureAllowOverride.SetOption(true); EntityTNTPrimed entity = new EntityTNTPrimed(((CraftWorld) getBlockLocation().getWorld()).getHandle()); - _game.CreatureAllowOverride = false; + _game.CreatureAllowOverride.SetOption(false); double x = loc.getX(); double y = loc.getY() + 0.2; double z = loc.getZ(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java index 09c03515c..79d092cc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java @@ -141,12 +141,12 @@ public class SheepGame extends TeamGame "Most sheep at 5 minutes wins!" }); - this.DeathOut = false; - this.DeathSpectateSecs = 6; + this.DeathOut.SetOption(false); + this.DeathSpectateSecs.SetOption(6); - this.HungerSet = 20; + this.HungerSet.SetOption(20); - this.WorldTimeSet = 2000; + this.WorldTimeSet.SetOption(2000); this.TeamArmor = true; this.TeamArmorHotbar = true; @@ -225,12 +225,12 @@ public class SheepGame extends TeamGame public void SheepSpawn() { //Spawn Sheep - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Sheep sheep = _sheepSpawns.get(0).getWorld().spawn(UtilAlg.Random(_sheepSpawns), Sheep.class); sheep.setAdult(); sheep.setMaxHealth(2048); sheep.setHealth(2048); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); _sheep.put(sheep, new SheepData(this, sheep)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index b67e10b1e..3a5b6ea8f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -145,46 +145,46 @@ public abstract class Skywars extends Game }, description); - PrepareFreeze = true; + PrepareFreeze.SetOption(true); - AnnounceStay = false; + AnnounceStay.SetOption(false); HideTeamSheep = true; CompassEnabled = true; - StrictAntiHack = true; + StrictAntiHack.SetOption(true); GameTimeout.SetOption(1500000L); - DeathDropItems = true; + DeathDropItems.SetOption(true); - QuitDropItems = true; + QuitDropItems.SetOption(true); - WorldTimeSet = 0; - WorldBoundaryKill = false; + WorldTimeSet.SetOption(0); + WorldBoundaryKill.SetOption(false); - DamageSelf = true; - DamageTeamSelf = true; - DamageEvP = true; - Damage = true; + DamageSelf.SetOption(true); + DamageTeamSelf.SetOption(true); + DamageEvP.SetOption(true); + Damage.SetOption(true); - DeathDropItems = true; + DeathDropItems.SetOption(true); - ItemDrop = true; - ItemPickup = true; + ItemDrop.SetOption(true); + ItemPickup.SetOption(true); - BlockBreak = true; - BlockPlace = true; + BlockBreak.SetOption(true); + BlockPlace.SetOption(true); - InventoryClick = true; - InventoryOpenBlock = true; - InventoryOpenChest = true; + InventoryClick.SetOption(true); + InventoryOpenBlock.SetOption(true); + InventoryOpenChest.SetOption(true); PlaySoundGameStart = true; PrepareTime = 10000L; - DontAllowOverfill = true; + DontAllowOverfill.SetOption(true); _oreHider = new OreHider(); @@ -265,14 +265,14 @@ public abstract class Skywars extends Game for (Location loc : WorldData.GetDataLocs("RED")) { //Spawn - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); Zombie zombie = (Zombie) loc.getWorld().spawn(loc, Zombie.class); zombie.setRemoveWhenFarAway(false); zombie.setCustomName(C.cDRed + "Zombie Guardian"); zombie.setCustomNameVisible(true); zombie.setMaxHealth(15); zombie.setHealth(15); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); // Armor - Make sure the player can't get it! zombie.getEquipment().setHelmet( @@ -474,7 +474,7 @@ public abstract class Skywars extends Game if (!UtilTime.elapsed(this.GetStateTime(), 5000)) return; - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); for (Location loc : GetTeamList().get(0).GetSpawns()) { Chicken chicken = loc.getWorld().spawn(loc.clone().add(0, 1, 0), Chicken.class); @@ -485,7 +485,7 @@ public abstract class Skywars extends Game chicken.setMaxHealth(4); chicken.setHealth(4); } - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); _lastChicken = System.currentTimeMillis(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java index d5262599d..123bc41f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java @@ -34,7 +34,7 @@ public class SoloSkywars extends Skywars "Last player alive wins!" }); - this.DamageTeamSelf = true; + this.DamageTeamSelf.SetOption(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java index 7eb916b53..9108dbb06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java @@ -46,13 +46,13 @@ public class TeamSkywars extends Skywars "Last team alive wins!" }); - this.FillTeamsInOrderToCount = 2; + this.FillTeamsInOrderToCount.SetOption(2); - this.SpawnNearAllies = true; + this.SpawnNearAllies.SetOption(true); - this.DamageTeamSelf = false; + this.DamageTeamSelf.SetOption(false); - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java index c8c1a5082..273560f04 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java @@ -32,7 +32,7 @@ public class SoloSuperSmash extends SuperSmash "Last player alive wins!" }); - this.DamageTeamSelf = true; + this.DamageTeamSelf.SetOption(true); registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 23c7ff8a7..8294f0a3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -116,13 +116,13 @@ public abstract class SuperSmash extends Game },description); - this.DeathOut = false; + this.DeathOut.SetOption(false); this.CompassEnabled = true; - this.DeathSpectateSecs = 4; + this.DeathSpectateSecs.SetOption(4); - this.WorldWaterDamage = 1000; + this.WorldWaterDamage.SetOption(1000); this.HideTeamSheep = true; @@ -241,9 +241,9 @@ public abstract class SuperSmash extends Game } else { - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); _powerup = _powerupTarget.getWorld().spawn(_powerupTarget, EnderCrystal.class); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); _powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 8ae71d3b9..59569bcca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -46,14 +46,14 @@ public class TeamSuperSmash extends SuperSmash }); this.PlayersPerTeam = 2; - this.FillTeamsInOrderToCount = 2; + this.FillTeamsInOrderToCount.SetOption(2); - this.SpawnNearAllies = true; - this.DamageTeamSelf = false; + this.SpawnNearAllies.SetOption(true); + this.DamageTeamSelf.SetOption(false); this.TeamArmorHotbar = true; - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java index 5981b1303..618efef23 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java @@ -116,9 +116,9 @@ public class KitKnight extends SmashKit Manager.GetDisguise().disguise(disguise); //Horse - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); final Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); //Owner horse.setTamed(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index 0a403c85e..ccd8b05ad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -132,7 +132,7 @@ public class KitSkySquid extends SmashKit @Override public void activateSuperCustom(Player player) { - Manager.GetGame().WorldWeatherEnabled = true; + Manager.GetGame().WorldWeatherEnabled.SetOption(true); Manager.GetGame().WorldData.World.setStorm(true); Manager.GetGame().WorldData.World.setThundering(true); Manager.GetGame().WorldData.World.setThunderDuration(9999); @@ -141,6 +141,6 @@ public class KitSkySquid extends SmashKit @Override public void deactivateSuperCustom(Player player) { - Manager.GetGame().WorldWeatherEnabled = false; + Manager.GetGame().WorldWeatherEnabled.SetOption(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java index d398bba74..3a8cac7d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java @@ -86,10 +86,10 @@ public class PerkCowAngryHerd extends SmashPerk loc.add(dir); loc.add(UtilAlg.getLeft(dir).multiply(i*1.5)); - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Class clazz = isSuperActive(player) ? MushroomCow.class : Cow.class; Cow cow = player.getWorld().spawn(loc, clazz); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); _active.add(new DataCowCharge(player, cow)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java index 4fc2b6043..e22fe5911 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java @@ -147,9 +147,9 @@ public class Snake extends SoloGame "Last one alive wins!" }); - this.DamageTeamSelf = true; + this.DamageTeamSelf.SetOption(true); - this.HungerSet = 2; + this.HungerSet.SetOption(2); this.GemMultiplier = 0.5; @@ -177,9 +177,9 @@ public class Snake extends SoloGame Player player = GetPlayers(true).get(i); _color.put(player, DyeColor.getByDyeData((byte) (i % 16))); - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Sheep sheep = player.getWorld().spawn(player.getLocation(), Sheep.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); sheep.setColor(DyeColor.getByDyeData((byte) (i % 16))); sheep.setPassenger(player); @@ -427,9 +427,9 @@ public class Snake extends SoloGame return; //Spawn - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Slime pig = loc.getWorld().spawn(loc, Slime.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); pig.setSize(2); UtilEnt.Vegetate(pig); @@ -491,9 +491,9 @@ public class Snake extends SoloGame loc.subtract(player.getLocation().getDirection().setY(0)); //Spawn - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Sheep tail = loc.getWorld().spawn(loc, Sheep.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); tail.setRemoveWhenFarAway(false); tail.setColor(_color.get(player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java index 0c19539cf..52ff00399 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java @@ -72,12 +72,12 @@ public class SneakyAssassins extends SoloGame this._npcManager = new NpcManager(this, UtilMath.random); - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - this.DamageTeamSelf = true; - this.PrepareFreeze = false; + this.DamageTeamSelf.SetOption(true); + this.PrepareFreeze.SetOption(false); - this.HungerSet = 20; + this.HungerSet.SetOption(20); this.CompassEnabled = true; this.CompassGiveItem = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java index f491bfa88..43fdb64f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java @@ -48,12 +48,12 @@ public class NpcManager implements Listener { Location spawn = getNpcSpawn(); - getGame().CreatureAllowOverride = true; + getGame().CreatureAllowOverride.SetOption(true); LivingEntity npc = (LivingEntity) spawn.getWorld().spawn(spawn, getDisguiseType().getEntityClass()); npc.setCanPickupItems(false); npc.setRemoveWhenFarAway(false); UtilEnt.Vegetate(npc); - getGame().CreatureAllowOverride = false; + getGame().CreatureAllowOverride.SetOption(false); return npc; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java index 70cce7b1c..d61bcb053 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java @@ -103,9 +103,9 @@ public class PowerUpItem UtilFirework.playFirework(itemLocation, effect); - _powerUpManager.getGame().CreatureAllowOverride = true; + _powerUpManager.getGame().CreatureAllowOverride.SetOption(true); _npc = itemLocation.getWorld().spawn(itemLocation, Skeleton.class); - _powerUpManager.getGame().CreatureAllowOverride = false; + _powerUpManager.getGame().CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(_npc); UtilEnt.ghost(_npc, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index 9aaf3396d..7b15a109b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -95,9 +95,9 @@ public class SnowFight extends TeamGame "Last team alive wins!" }); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); - this.HungerSet = 20; + this.HungerSet.SetOption(20); this.CompassEnabled = true; this.CompassGiveItem = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index ea2b2960e..6a92acc76 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -166,20 +166,20 @@ public class SpeedBuilders extends SoloGame "Last person left wins!" }); - Damage = false; + Damage.SetOption(false); - HungerSet = 20; - HealthSet = 20; + HungerSet.SetOption(20); + HealthSet.SetOption(20); - DontAllowOverfill = true; + DontAllowOverfill.SetOption(true); - DeathMessages = false; + DeathMessages.SetOption(false); FixSpawnFacing = false; AllowParticles = false; - InventoryClick = true; + InventoryClick.SetOption(true); registerStatTrackers( new DependableTracker(this), @@ -323,7 +323,7 @@ public class SpeedBuilders extends SoloGame } } - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); for (MobData mobData : buildData.Mobs) { @@ -337,16 +337,16 @@ public class SpeedBuilders extends SoloGame _middleMobs.add(entity); } - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); } public void spawnJudge() { - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); _judgeEntity = _judgeSpawn.getWorld().spawn(_judgeSpawn, ArmorStand.class); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); _judgeEntity.setVisible(false); _judgeEntity.setGravity(false); @@ -391,11 +391,11 @@ public class SpeedBuilders extends SoloGame if (_judgeLaserTarget != null) judgeTargetLocation(null); - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); _judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); _judgeLaserTarget.setVisible(false); _judgeLaserTarget.setGravity(false); @@ -787,8 +787,8 @@ public class SpeedBuilders extends SoloGame recreation.breakAndDropItems(); } - ItemPickup = true; - BlockPlace = true; + ItemPickup.SetOption(true); + BlockPlace.SetOption(true); _buildCountStage = 0; @@ -855,8 +855,8 @@ public class SpeedBuilders extends SoloGame _perfectBuild.clear(); - ItemPickup = false; - BlockPlace = false; + ItemPickup.SetOption(false); + BlockPlace.SetOption(false); RecreationData lowest = null; int lowestScore = -1; @@ -1589,14 +1589,14 @@ public class SpeedBuilders extends SoloGame if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block)) return; - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); Entity entity = block.getWorld().spawnEntity(block.getLocation().add(0.5, 0, 0.5), type); UtilEnt.Vegetate(entity, true); UtilEnt.ghost(entity, true, false); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); _buildRecreations.get(event.getPlayer()).Mobs.add(entity); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 268434338..79f5ddb3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -183,7 +183,7 @@ public class RecreationData } } - Game.CreatureAllowOverride = true; + Game.CreatureAllowOverride.SetOption(true); for (MobData mobData : buildData.Mobs) { @@ -197,7 +197,7 @@ public class RecreationData Mobs.add(entity); } - Game.CreatureAllowOverride = false; + Game.CreatureAllowOverride.SetOption(false); } public void breakAndDropItems() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index a06235e88..85552c568 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -57,10 +57,10 @@ public class Spleef extends SoloGame "Last player alive wins!" }); - this.DamagePvP = false; - this.WorldWaterDamage = 4; + this.DamagePvP.SetOption(false); + this.WorldWaterDamage.SetOption(4); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); registerStatTrackers(new SpleefBlockDestroyStatTracker(this)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java index 47ea38230..b7972a822 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java @@ -53,10 +53,10 @@ public class SpleefTeams extends TeamGame "Last team alive wins!" }); - this.DamagePvP = false; - this.WorldWaterDamage = 4; + this.DamagePvP.SetOption(false); + this.WorldWaterDamage.SetOption(4); - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java index a77b8817b..5ee506997 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java @@ -44,12 +44,12 @@ public class SquidShooter extends SoloGame "First player to 20 kills wins." }); - this.DeathOut = false; - this.DamageSelf = false; - this.DamageTeamSelf = true; - this.PrepareFreeze = false; + this.DeathOut.SetOption(false); + this.DamageSelf.SetOption(false); + this.DamageTeamSelf.SetOption(true); + this.PrepareFreeze.SetOption(false); this.CompassEnabled = true; - this.KitRegisterState = GameState.Prepare; + this.KitRegisterState.SetOption(GameState.Prepare); registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java index 93fd43c1e..5a02afea4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java @@ -70,9 +70,9 @@ public class Stacker extends SoloGame implements IThrown Location loc = GetTeamList().get(0).GetSpawns().get(UtilMath.r(GetTeamList().get(0).GetSpawns().size())); //Spawn - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Pig pig = loc.getWorld().spawn(loc, Pig.class); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java index 2c71759e9..155de9049 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java @@ -39,7 +39,7 @@ public class SoloSurvivalGames extends SurvivalGames "Last tribute alive wins!" }); - this.DamageTeamSelf = true; + this.DamageTeamSelf.SetOption(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 1e141e5de..5a4d6c47b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -184,60 +184,60 @@ public abstract class SurvivalGames extends Game // Manager.GetAntiStack().SetEnabled(false); - StrictAntiHack = true; + StrictAntiHack.SetOption(true); - AnnounceStay = false; + AnnounceStay.SetOption(false); HideTeamSheep = true; this.ReplaceTeamsWithKits = true; - GameTimeout.setOption(1500000); + GameTimeout.SetOption(1500000); - QuitDropItems = true; + QuitDropItems.SetOption(true); - WorldTimeSet = 0; - WorldBoundaryKill = false; + WorldTimeSet.SetOption(0); + WorldBoundaryKill.SetOption(false); - DamageSelf = true; - DamageTeamSelf = true; + DamageSelf.SetOption(true); + DamageTeamSelf.SetOption(true); - DeathDropItems = true; + DeathDropItems.SetOption(true); - ItemDrop = true; - ItemPickup = true; + ItemDrop.SetOption(true); + ItemPickup.SetOption(true); - InventoryClick = true; - InventoryOpenBlock = true; - InventoryOpenChest = true; + InventoryClick.SetOption(true); + InventoryOpenBlock.SetOption(true); + InventoryOpenChest.SetOption(true); PlaySoundGameStart = false; PrepareTime = 15000; DeadBodies = true; - BlockBreakAllow.add(Material.WEB.getId()); // Web - BlockPlaceAllow.add(Material.WEB.getId()); + BlockBreakAllow.GetOption().add(Material.WEB.getId()); // Web + BlockPlaceAllow.GetOption().add(Material.WEB.getId()); - BlockBreakAllow.add(Material.LEAVES.getId()); // Leaves - BlockBreakAllow.add(Material.LEAVES_2.getId()); // Leaves + BlockBreakAllow.GetOption().add(Material.LEAVES.getId()); // Leaves + BlockBreakAllow.GetOption().add(Material.LEAVES_2.getId()); // Leaves - BlockPlaceAllow.add(Material.CAKE_BLOCK.getId()); - BlockBreakAllow.add(Material.CAKE_BLOCK.getId()); + BlockPlaceAllow.GetOption().add(Material.CAKE_BLOCK.getId()); + BlockBreakAllow.GetOption().add(Material.CAKE_BLOCK.getId()); - BlockBreakAllow.add(Material.LONG_GRASS.getId()); - BlockBreakAllow.add(Material.RED_ROSE.getId()); - BlockBreakAllow.add(Material.YELLOW_FLOWER.getId()); - BlockBreakAllow.add(Material.BROWN_MUSHROOM.getId()); - BlockBreakAllow.add(Material.RED_MUSHROOM.getId()); - BlockBreakAllow.add(Material.DEAD_BUSH.getId()); - BlockBreakAllow.add(Material.CARROT.getId()); - BlockBreakAllow.add(Material.POTATO.getId()); - BlockBreakAllow.add(Material.DOUBLE_PLANT.getId()); - BlockBreakAllow.add(Material.CROPS.getId()); - BlockBreakAllow.add(Material.SAPLING.getId()); - BlockBreakAllow.add(Material.VINE.getId()); - BlockBreakAllow.add(Material.WATER_LILY.getId()); + BlockBreakAllow.GetOption().add(Material.LONG_GRASS.getId()); + BlockBreakAllow.GetOption().add(Material.RED_ROSE.getId()); + BlockBreakAllow.GetOption().add(Material.YELLOW_FLOWER.getId()); + BlockBreakAllow.GetOption().add(Material.BROWN_MUSHROOM.getId()); + BlockBreakAllow.GetOption().add(Material.RED_MUSHROOM.getId()); + BlockBreakAllow.GetOption().add(Material.DEAD_BUSH.getId()); + BlockBreakAllow.GetOption().add(Material.CARROT.getId()); + BlockBreakAllow.GetOption().add(Material.POTATO.getId()); + BlockBreakAllow.GetOption().add(Material.DOUBLE_PLANT.getId()); + BlockBreakAllow.GetOption().add(Material.CROPS.getId()); + BlockBreakAllow.GetOption().add(Material.SAPLING.getId()); + BlockBreakAllow.GetOption().add(Material.VINE.getId()); + BlockBreakAllow.GetOption().add(Material.WATER_LILY.getId()); // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", // "chestsOpened"); @@ -452,14 +452,14 @@ public abstract class SurvivalGames extends Game if (time > 22000 || time < 14000) { - WorldTimeSet = (WorldTimeSet + 4) % 24000; + WorldTimeSet.SetOption((WorldTimeSet.GetOption() + 4) % 24000); } else { - WorldTimeSet = (WorldTimeSet + 16) % 24000; + WorldTimeSet.SetOption((WorldTimeSet.GetOption() + 16) % 24000); } - WorldData.World.setTime(WorldTimeSet); + WorldData.World.setTime(WorldTimeSet.GetOption()); } @EventHandler @@ -635,7 +635,7 @@ public abstract class SurvivalGames extends Game { _deathMatchTeleported = true; - WorldTimeSet = 0; + WorldTimeSet.SetOption(0); WorldData.World.setTime(15000); for (GameTeam team : GetTeamList()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index 01dfc0706..7966a98e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -172,51 +172,51 @@ public class SurvivalGamesTeams extends TeamGame setItemMerge(true); // Manager.GetAntiStack().SetEnabled(false); - this.GameTimeout.setOption(9600000); + this.GameTimeout.SetOption(9600000); - this.WorldTimeSet = 0; - this.WorldBoundaryKill = false; + this.WorldTimeSet.SetOption(0); + this.WorldBoundaryKill.SetOption(false); - SpawnNearAllies = true; - SpawnNearEnemies = true; //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split. + SpawnNearAllies.SetOption(true); + SpawnNearEnemies.SetOption(true); //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split. - this.DamageSelf = true; - this.DamageTeamSelf = false; + this.DamageSelf.SetOption(true); + this.DamageTeamSelf.SetOption(false); - this.DeathDropItems = true; + this.DeathDropItems.SetOption(true); - this.ItemDrop = true; - this.ItemPickup = true; + this.ItemDrop.SetOption(true); + this.ItemPickup.SetOption(true); this.CompassEnabled = false; //XXX - this.InventoryClick = true; - this.InventoryOpenBlock = true; - this.InventoryOpenChest = true; + this.InventoryClick.SetOption(true); + this.InventoryOpenBlock.SetOption(true); + this.InventoryOpenChest.SetOption(true); //Blocks - this.BlockBreakAllow.add(46); //TNT - this.BlockPlaceAllow.add(46); + this.BlockBreakAllow.GetOption().add(46); //TNT + this.BlockPlaceAllow.GetOption().add(46); - this.BlockBreakAllow.add(30); //Web - this.BlockPlaceAllow.add(30); + this.BlockBreakAllow.GetOption().add(30); //Web + this.BlockPlaceAllow.GetOption().add(30); - this.BlockBreakAllow.add(132); //Tripwire - this.BlockPlaceAllow.add(132); + this.BlockBreakAllow.GetOption().add(132); //Tripwire + this.BlockPlaceAllow.GetOption().add(132); - this.BlockBreakAllow.add(131); //Wire Hook - this.BlockPlaceAllow.add(131); + this.BlockBreakAllow.GetOption().add(131); //Wire Hook + this.BlockPlaceAllow.GetOption().add(131); - this.BlockBreakAllow.add(55); //Redstone Dust - this.BlockPlaceAllow.add(55); + this.BlockBreakAllow.GetOption().add(55); //Redstone Dust + this.BlockPlaceAllow.GetOption().add(55); - this.BlockBreakAllow.add(72); //Wood Pressure Plate - this.BlockPlaceAllow.add(72); + this.BlockBreakAllow.GetOption().add(72); //Wood Pressure Plate + this.BlockPlaceAllow.GetOption().add(72); - this.BlockBreakAllow.add(69); //Lever - this.BlockPlaceAllow.add(69); + this.BlockBreakAllow.GetOption().add(69); //Lever + this.BlockPlaceAllow.GetOption().add(69); - this.BlockBreakAllow.add(18); //Leaves + this.BlockBreakAllow.GetOption().add(18); //Leaves //SPREAD _spreadType = 1;//UtilMath.r(3); @@ -255,7 +255,7 @@ public class SurvivalGamesTeams extends TeamGame //Tournament if (Manager.IsTournamentServer()) - QuitOut = false; + QuitOut.SetOption(false); } @Override @@ -1093,14 +1093,14 @@ public class SurvivalGamesTeams extends TeamGame if (time > 22000 || time < 14000) { - WorldTimeSet = (WorldTimeSet + 4)%24000; + WorldTimeSet.SetOption((WorldTimeSet.GetOption() + 4)%24000); } else { - WorldTimeSet = (WorldTimeSet + 16)%24000; + WorldTimeSet.SetOption((WorldTimeSet.GetOption() + 16)%24000); } - WorldData.World.setTime(WorldTimeSet); + WorldData.World.setTime(WorldTimeSet.GetOption()); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java index 6b3c717da..20d0d68cc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java @@ -52,14 +52,14 @@ public class TeamSurvivalGames extends SurvivalGames }); this.PlayersPerTeam = 2; - this.FillTeamsInOrderToCount = 2; + this.FillTeamsInOrderToCount.SetOption(2); - this.SpawnNearAllies = true; - this.SpawnNearEnemies = true; + this.SpawnNearAllies.SetOption(true); + this.SpawnNearEnemies.SetOption(true); - this.DamageTeamSelf = false; + this.DamageTeamSelf.SetOption(false); - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java index 30a7e7a17..b1f625615 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java @@ -71,10 +71,10 @@ public class Tug extends TeamGame }); - this.HungerSet = 20; - this.DeathOut = false; + this.HungerSet.SetOption(20); + this.DeathOut.SetOption(false); - this.DeathSpectateSecs = 20; + this.DeathSpectateSecs.SetOption(20); registerChatStats(); } @@ -146,24 +146,24 @@ public class Tug extends TeamGame { if (_redCreatures.size() < 30) { - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Location loc = UtilAlg.Random(_redMobs); Creature ent = loc.getWorld().spawn(loc, Pig.class); ent.setMaxHealth(10); ent.setHealth(10); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); _redCreatures.add(new TugCreature(this, ent, _blueLives)); } if (_blueCreatures.size() < 30) { - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Location loc = UtilAlg.Random(_blueMobs); Creature ent = loc.getWorld().spawn(loc, Sheep.class); ent.setMaxHealth(10); ent.setHealth(10); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); _blueCreatures.add(new TugCreature(this, ent, _redLives)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 7b5a20b00..02c9a6ee7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -141,15 +141,15 @@ public class TurfForts extends TeamGame "Take over all the turf to win!" }); - this.StrictAntiHack = true; - this.HungerSet = 20; - this.DeathOut = false; - this.BlockPlaceAllow.add(35); - this.BlockBreakAllow.add(35); - this.ItemDrop = false; - this.ItemPickup = false; - this.DamageSelf = false; - this.DeathSpectateSecs = 4; + this.StrictAntiHack.SetOption(true); + this.HungerSet.SetOption(20); + this.DeathOut.SetOption(false); + this.BlockPlaceAllow.GetOption().add(35); + this.BlockBreakAllow.GetOption().add(35); + this.ItemDrop.SetOption(false); + this.ItemPickup.SetOption(false); + this.DamageSelf.SetOption(false); + this.DeathSpectateSecs.SetOption(4); _breakStatTracker = new BlockBreakStatTracker(this, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index fd5ad26b4..742bc0783 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -116,28 +116,28 @@ public class TypeWars extends TeamGame new StaffKillMonitorManager(this); - this.DeathOut = false; - this.DamageTeamSelf = false; - this.DamageSelf = false; - this.DamageTeamOther = false; - this.DeathSpectateSecs = 0; - this.HungerSet = 20; - this.WorldBoundaryKill = true; + this.DeathOut.SetOption(false); + this.DamageTeamSelf.SetOption(false); + this.DamageSelf.SetOption(false); + this.DamageTeamOther.SetOption(false); + this.DeathSpectateSecs.SetOption(0); + this.HungerSet.SetOption(20); + this.WorldBoundaryKill.SetOption(true); this.CompassEnabled = false; this.TeamArmor = true; this.TeamArmorHotbar = false; - this.WorldTimeSet = 6000; - this.DamageEvP = false; - this.DamagePvE = false; - this.DamagePvP = false; + this.WorldTimeSet.SetOption(6000); + this.DamageEvP.SetOption(false); + this.DamagePvE.SetOption(false); + this.DamagePvP.SetOption(false); this.TeamArmorHotbar = true; - this.Damage = false; - this.CreatureAllow = false; + this.Damage.SetOption(false); + this.CreatureAllow.SetOption(false); this.PrepareTime = 50000; - this.PrepareFreeze = false; + this.PrepareFreeze.SetOption(false); this.PlaySoundGameStart = false; this.EnableTutorials = true; - this.PrepareFreeze = true; + this.PrepareFreeze.SetOption(true); this.AllowParticles = false; _activeMinions = new ArrayList<>(); @@ -231,10 +231,10 @@ public class TypeWars extends TeamGame if(i == 1) loc = blue; - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Giant giant = loc.getWorld().spawn(loc, Giant.class); _giantLocs.put(giant, loc.clone()); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); giant.setRemoveWhenFarAway(false); UtilEnt.Vegetate(giant, true); UtilEnt.ghost(giant, true, false); @@ -492,10 +492,10 @@ public class TypeWars extends TeamGame continue; int rdm = UtilMath.r(_minionSpawns.get(teams).size()); - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, MinionSize.BOSS.getRandomType(), rdm); _activeMinions.add(minion); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); UtilPlayer.message(event.getPlayer(), F.main("Boss", "You have spawned a Boss")); } } @@ -531,14 +531,14 @@ public class TypeWars extends TeamGame return; } - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) - type.getCost()); UtilTextMiddle.display("", ChatColor.GRAY + "You bought a Minion.", event.getPlayer()); int rdm = UtilMath.r(_minionSpawns.get(teams).size()); Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type.getRandomType(), rdm); Bukkit.getPluginManager().callEvent(new SummonMinionEvent(event.getPlayer(), minion)); _activeMinions.add(minion); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } } return; @@ -576,7 +576,7 @@ public class TypeWars extends TeamGame { _lastSpawnedRed = System.currentTimeMillis(); - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(0)).size()); Minion minion = null; @@ -592,7 +592,7 @@ public class TypeWars extends TeamGame } _activeMinions.add(minion); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); if(_timeToSpawnRed > 5000 / (GetTeamList().get(1).GetPlayers(true).size() > 0 ? GetTeamList().get(1).GetPlayers(true).size() : 1)) _timeToSpawnRed = _timeToSpawnRed - 75; @@ -605,7 +605,7 @@ public class TypeWars extends TeamGame { _lastSpawnedBlue = System.currentTimeMillis(); - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(1)).size()); Minion minion = null; if(_minionsSpawned.get(GetTeamList().get(1)) >= 100) @@ -619,7 +619,7 @@ public class TypeWars extends TeamGame minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1), rdm); } _activeMinions.add(minion); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); if(_timeToSpawnBlue > 5000 / (GetTeamList().get(0).GetPlayers(true).size() > 0 ? GetTeamList().get(0).GetPlayers(true).size() : 1)) _timeToSpawnBlue = _timeToSpawnRed - 75; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index 6c4cd2600..e4d7abbc9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -36,11 +36,11 @@ public class TutorialTypeWars extends GameTutorial { ArrayList locations = UtilShapes.getLinesDistancedPoints(_typeWars.getMinionSpawns().get(getTeam()).get(4), _typeWars.getMinionSpawns().get(team).get(4), 1); _manager.GetCreature().SetForce(true); - _manager.GetGame().CreatureAllowOverride = true; + _manager.GetGame().CreatureAllowOverride.SetOption(true); Minion minion = new Minion(_manager, locations.get(locations.size() - 35), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); minion.changeName("Fishing"); ((TypeWars) _manager.GetGame()).getActiveMinions().add(minion); - _manager.GetGame().CreatureAllowOverride = false; + _manager.GetGame().CreatureAllowOverride.SetOption(false); _manager.GetCreature().SetForce(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index d543c505a..6349d2595 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -139,57 +139,57 @@ public class UHC extends TeamGame this.HideTeamSheep = true; - this.StrictAntiHack = true; + this.StrictAntiHack.SetOption(true); - AnnounceStay = false; + AnnounceStay.SetOption(false); - this.GameTimeout = 10800000; + this.GameTimeout.SetOption(10800000); - this.DamagePvP = false; + this.DamagePvP.SetOption(false); - this.DeathDropItems = true; + this.DeathDropItems.SetOption(true); - this.ItemDrop = true; - this.ItemPickup = true; + this.ItemDrop.SetOption(true); + this.ItemPickup.SetOption(true); - this.BlockBreak = true; - this.BlockPlace = true; + this.BlockBreak.SetOption(true); + this.BlockPlace.SetOption(true); - this.InventoryOpenBlock = true; - this.InventoryOpenChest = true; - this.InventoryClick = true; + this.InventoryOpenBlock.SetOption(true); + this.InventoryOpenChest.SetOption(true); + this.InventoryClick.SetOption(true); - this.DeathOut = true; - this.QuitOut = false; + this.DeathOut.SetOption(true); + this.QuitOut.SetOption(false); - this.CreatureAllow = true; + this.CreatureAllow.SetOption(true); - this.AnnounceStay = false; + this.AnnounceStay.SetOption(false); - this.DisplayLobbySide = true; + this.DisplayLobbySide.SetOption(true); - this.DeathMessages = false; + this.DeathMessages.SetOption(false); this.SoupEnabled = false; this.CompassEnabled = true; this.CompassGiveItem = false; - this.WorldBoundaryKill = false; + this.WorldBoundaryKill.SetOption(false); - this.TickPerTeleport = 3; + this.TickPerTeleport.SetOption(3); this.GemBoosterEnabled = false; this.GemDoubleEnabled = false; this.GemHunterEnabled = false; - this.WorldBoneMeal = true; + this.WorldBoneMeal.SetOption(true); - this.DontAllowOverfill = true; + this.DontAllowOverfill.SetOption(true); - this.GadgetsDisabled = true; + this.GadgetsDisabled.SetOption(true); - WorldTimeSet = -1; + WorldTimeSet.SetOption(-1); CraftRecipes(); @@ -564,9 +564,9 @@ public class UHC extends TeamGame for (Player player : UtilServer.getPlayers()) player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); - this.DamagePvP = true; + this.DamagePvP.SetOption(true); this.CompassGiveItem = true; - this.QuitOut = true; + this.QuitOut.SetOption(true); } } @@ -579,7 +579,7 @@ public class UHC extends TeamGame if (event.getType() != UpdateType.FAST) return; - if (DamagePvP) + if (DamagePvP.GetOption()) return; WorldData.World.setTime(2000); @@ -748,7 +748,7 @@ public class UHC extends TeamGame if (!IsAlive(player)) return; - if (!QuitOut) + if (!QuitOut.GetOption()) return; // Drop Items @@ -1216,7 +1216,7 @@ public class UHC extends TeamGame teamsAlive.add(team); // Offline Player Team - if (!QuitOut) + if (!QuitOut.GetOption()) for (GameTeam team : RejoinTeam.values()) teamsAlive.add(team); @@ -1411,7 +1411,7 @@ public class UHC extends TeamGame if (damagerEnt instanceof Player) { // PvP - if (!DamagePvP && damagee != null) + if (!DamagePvP.GetOption() && damagee != null) event.setCancelled(true); Player damager = (Player) damagerEnt; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java index e902d5f44..d608eb873 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java @@ -122,9 +122,9 @@ public class Valentines extends SoloGame "Slowest players are eliminated!" }); - this.DamageTeamSelf = true; - this.HungerSet = 20; - this.HealthSet = 20; + this.DamageTeamSelf.SetOption(true); + this.HungerSet.SetOption(20); + this.HealthSet.SetOption(20); EnableTutorials = true; @@ -170,14 +170,14 @@ public class Valentines extends SoloGame { _playersOutPerRound = Math.max(1, (int)(GetPlayers(true).size()/8d)); - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); _cow = GetSpectatorLocation().getWorld().spawn(GetSpectatorLocation(), Cow.class); _cow.setCustomName(C.cGreen + C.Bold + _cowName); _cow.setCustomNameVisible(true); UtilEnt.Vegetate(_cow); UtilEnt.ghost(_cow, true, false); - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); } if (event.GetState() == GameState.End || event.GetState() == GameState.Dead) _music.cancel(); @@ -404,7 +404,7 @@ public class Valentines extends SoloGame public void pigSpawn() { - CreatureAllowOverride = true; + CreatureAllowOverride.SetOption(true); int toSpawn = Math.max(1, GetPlayers(true).size()-_playersOutPerRound); @@ -432,7 +432,7 @@ public class Valentines extends SoloGame } } - CreatureAllowOverride = false; + CreatureAllowOverride.SetOption(false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java index 386bc5fe1..f9130465c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java @@ -106,7 +106,7 @@ public class TutorialValentines extends GameTutorial //Spawn if (_pigs.size() < 5 && tick % 15 == 0) { - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); //Spawn Pig pig = _pigSpawn.getWorld().spawn(_pigSpawn, Pig.class); @@ -119,7 +119,7 @@ public class TutorialValentines extends GameTutorial _pigs.put(pig, 0);; - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); } //Move @@ -178,7 +178,7 @@ public class TutorialValentines extends GameTutorial } //Spawn Cows - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); _cowBoy = _pigSpawn.getWorld().spawn(Host.WorldData.GetDataLocs("BROWN").get(0), Cow.class); _cowBoy.setCustomName(C.cGreenB + "Calvin"); @@ -190,7 +190,7 @@ public class TutorialValentines extends GameTutorial _cowGirl.setCustomNameVisible(true); UtilEnt.Vegetate(_cowGirl); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); //Player Data diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java index d1348569e..707e02d7f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java @@ -22,9 +22,9 @@ public class PlayerCopyWither _owner = owner; - Host.CreatureAllowOverride = true; + Host.CreatureAllowOverride.SetOption(true); _ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class); - Host.CreatureAllowOverride = false; + Host.CreatureAllowOverride.SetOption(false); UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index 6a6749d96..198367b12 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -116,26 +116,26 @@ public class WitherGame extends TeamGame implements IBlockRestorer C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes", }); - this.DeathOut = true; - this.DamageTeamSelf = false; - this.DamageSelf = false; - this.DeathSpectateSecs = 4; - this.HungerSet = 20; - this.WorldBoundaryKill = false; + this.DeathOut.SetOption(true); + this.DamageTeamSelf.SetOption(false); + this.DamageSelf.SetOption(false); + this.DeathSpectateSecs.SetOption(4); + this.HungerSet.SetOption(20); + this.WorldBoundaryKill.SetOption(false); this.CompassEnabled = false; //Customizing for the Editor kit - this.BlockBreak = true; - this.BlockPlace = true; - this.ItemPickup = true; + this.BlockBreak.SetOption(true); + this.BlockPlace.SetOption(true); + this.ItemPickup.SetOption(true); - this.KitRegisterState = GameState.Prepare; + this.KitRegisterState.SetOption(GameState.Prepare); this.TeamArmor = true; this.TeamArmorHotbar = false; - this.InventoryClick = false; - this.InventoryOpenBlock = false; + this.InventoryClick.SetOption(false); + this.InventoryOpenBlock.SetOption(false); _help = new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index 9ab574b9b..19a12edfa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -155,17 +155,17 @@ public class Wizards extends SoloGame _wizard = new WizardSpellMenu("Wizard Spell Menu", getArcadeManager().getPlugin(), this); - AnnounceStay = false; - BlockBreak = true; - BlockPlace = true; - ItemPickup = true; - ItemDrop = true; - InventoryOpenBlock = true; - InventoryOpenChest = true; - InventoryClick = true; - DisableKillCommand = false; + AnnounceStay.SetOption(false); + BlockBreak.SetOption(true); + BlockPlace.SetOption(true); + ItemPickup.SetOption(true); + ItemDrop.SetOption(true); + InventoryOpenBlock.SetOption(true); + InventoryOpenChest.SetOption(true); + InventoryClick.SetOption(true); + DisableKillCommand.SetOption(false); SoupEnabled = false; - DamageTeamSelf = true; + DamageTeamSelf.SetOption(true); registerChatStats( Kills, @@ -1716,7 +1716,7 @@ public class Wizards extends SoloGame if (_endgameMessageCounter == 6) { - WorldTimeSet = 0; + WorldTimeSet.SetOption(0); WorldData.World.setTime(15000); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java index cdfbe7b97..778070942 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java @@ -48,12 +48,12 @@ public class SpellSummonWolves extends Spell implements SpellClick, SpellClickBl for (int i = 0; i < getSpellLevel(player); i++) { - Wizards.CreatureAllowOverride = true; + Wizards.CreatureAllowOverride.SetOption(true); Wolf wolf = (Wolf) player.getWorld().spawnEntity( loc.clone().add(new Random().nextFloat() - 0.5F, 0, new Random().nextFloat() - 0.5F), EntityType.WOLF); - Wizards.CreatureAllowOverride = false; + Wizards.CreatureAllowOverride.SetOption(false); wolf.setCollarColor(DyeColor.YELLOW); wolf.setTamed(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java index 3f118fbb9..f1710f6ad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java @@ -67,8 +67,8 @@ public class ZombieSurvival extends SoloGame "The last Survivor alive wins!" }); - this.DeathOut = false; - this.HungerSet = 20; + this.DeathOut.SetOption(false); + this.HungerSet.SetOption(20); this.CompassEnabled = true; @@ -230,10 +230,10 @@ public class ZombieSurvival extends SoloGame if (_mobs.size() < 50) { - this.CreatureAllowOverride = true; + this.CreatureAllowOverride.SetOption(true); Zombie zombie = _undead.GetSpawn().getWorld().spawn(_undead.GetSpawn(), Zombie.class); _mobs.put(zombie, new ZombieData(GetTargetLocation())); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride.SetOption(false); } mobIterator = _mobs.keySet().iterator(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java index b0366e539..ccf6595f0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java @@ -127,10 +127,10 @@ public class PerkBatWave extends SmashPerk for (int i=0 ; i<32 ; i++) { - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class); _bats.get(player).add(bat); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); } //Inform diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java index eb840ba27..289042c6b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java @@ -52,7 +52,7 @@ public class PerkChicken extends Perk return; } - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Location loc = player.getLocation(); Chicken c = loc.getWorld().spawn(loc.add(0, 1, 0), Chicken.class); @@ -67,7 +67,7 @@ public class PerkChicken extends Perk _activeKitHolders.put(player.getName(), c); _failedAttempts.put(player.getName(), 0); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java index 5b34be0b8..22ecf10d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java @@ -80,14 +80,14 @@ public class PerkChickenRocket extends SmashPerk if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) return; - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Chicken ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Chicken.class); ent.getLocation().setPitch(0); ent.getLocation().setYaw(player.getLocation().getYaw()); ent.setBaby(); ent.setAgeLock(true); UtilEnt.Vegetate(ent); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); _data.add(new ChickenMissileData(player, ent)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java index e3461cd2f..7e548190e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java @@ -65,9 +65,9 @@ public class PerkCowBomb extends Perk implements IThrown UtilInv.Update(player); - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Cow ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Cow.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); ent.setBaby(); ent.setAgeLock(true); ent.setMaxHealth(100); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java index 4d430ad0b..807d4fb6c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java @@ -41,10 +41,10 @@ public class PerkEndermanDragon extends SmashPerk @Override public void addSuperCustom(Player player) { - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); EnderDragon dragon = player.getWorld().spawn(player.getLocation().add(0, 5, 0), EnderDragon.class); UtilEnt.Vegetate(dragon); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); dragon.setCustomName(C.cYellow + player.getName() + "'s Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java index 19133d9b3..1910ea8c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java @@ -55,9 +55,9 @@ public class PerkHorsePet extends Perk if (!Manager.GetGame().IsAlive(player)) return; - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); horse.setAdult(); horse.setAgeLock(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java index 2edeb706a..a50ad1aa1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java @@ -221,7 +221,7 @@ public class PerkMadScientist extends Perk implements IThrown data.GetThrown().remove(); - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Zombie zombie = (Zombie) data.GetThrown().getWorld() .spawn(data.GetThrown().getLocation(), Zombie.class); @@ -275,7 +275,7 @@ public class PerkMadScientist extends Perk implements IThrown // // Manager.GetDisguise().disguise(disguise); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java index 5179f0e34..c2d63e2d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java @@ -101,9 +101,9 @@ public class PerkNightLivingDead extends SmashPerk loc.subtract(0, 1, 0); //Spawn - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Zombie zombie = loc.getWorld().spawn(loc, Zombie.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); data.Zombies.add(zombie); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java index ba3a225c8..49daa4385 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java @@ -96,11 +96,11 @@ public class PerkPigBaconBomb extends SmashPerk player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f); //Pig - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Pig pig = player.getWorld().spawn(player.getLocation(), Pig.class); pig.setHealth(5); pig.setVelocity(new Vector(0, -0.4, 0)); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); pig.setBaby(); UtilEnt.Vegetate(pig); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java index eea416543..fe06341eb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java @@ -42,9 +42,9 @@ public class PerkSheepHoming extends SmashPerk if (target.equals(player)) continue; - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Sheep sheep = player.getWorld().spawn(player.getEyeLocation(), Sheep.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); sheep.setBaby(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index 3533cc8be..d9ef70386 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -85,9 +85,9 @@ public class PerkSkeletons extends Perk Player killed = (Player) event.GetEvent().getEntity(); - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Skeleton skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); UtilEnt.removeGoalSelectors(skel); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index 1b16508b9..c74659ad3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -174,10 +174,10 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown double charge = Math.min(3, (double)(System.currentTimeMillis() - _charge.get(player))/1000d); //Spawn Slime - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class); slime.setSize(1); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); //Size slime.setSize(Math.max(1, (int)charge)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java index 710589904..213a260a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java @@ -50,9 +50,9 @@ public class PerkSnowTurret extends SmashPerk @Override public void addSuperCustom(Player player) { - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Snowman ent = player.getWorld().spawn(player.getEyeLocation(), Snowman.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index 5a7fccc01..1b56d1484 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -73,9 +73,9 @@ public class PerkWitherImage extends SmashPerk return; //Spawn - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Skeleton skel = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Skeleton.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); skel.setSkeletonType(SkeletonType.WITHER); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java index c0131bc41..fc2ed29d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java @@ -74,7 +74,7 @@ public class PerkWitherMinion extends Perk event.setCancelled(true); - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); for (int i=0 ; i<2 ; i++) { @@ -99,7 +99,7 @@ public class PerkWitherMinion extends Perk UtilAction.velocity(skel, player.getLocation().getDirection().add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false); } - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java index febca2e0a..fdf529255 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java @@ -87,9 +87,9 @@ public class PerkWolf extends SmashPerk return; //Get Nearest Wolf - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Wolf wolf = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Wolf.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); wolf.setBaby(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java index ccebfc71c..2f08d7a59 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java @@ -197,9 +197,9 @@ public class PerkWolfPack extends Perk public void MinionSpawn(Player cur) { - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); //wolf.setOwner(cur); //wolf.setCollarColor(DyeColor.GREEN); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index 027066090..c6bd4602d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -95,9 +95,9 @@ public class PerkWolfPet extends Perk if (_wolfMap.get(cur).size() >= _max) continue; - Manager.GetGame().CreatureAllowOverride = true; + Manager.GetGame().CreatureAllowOverride.SetOption(true); Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); - Manager.GetGame().CreatureAllowOverride = false; + Manager.GetGame().CreatureAllowOverride.SetOption(false); wolf.setOwner(cur); wolf.setCollarColor(DyeColor.GREEN); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 660797c97..554f59222 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -123,7 +123,7 @@ public class GameFlagManager implements Listener return; } - if (!game.Damage) + if (!game.Damage.GetOption()) { event.SetCancelled("Damage Disabled"); return; @@ -147,7 +147,7 @@ public class GameFlagManager implements Listener return; } - if (event.GetCause() == DamageCause.FALL && !game.DamageFall) + if (event.GetCause() == DamageCause.FALL && !game.DamageFall.GetOption()) { event.SetCancelled("Fall Damage Disabled"); return; @@ -168,7 +168,7 @@ public class GameFlagManager implements Listener //PvE else if (damager instanceof Player) { - if (!game.DamagePvE) + if (!game.DamagePvE.GetOption()) { event.SetCancelled("PvE Disabled"); return; @@ -177,7 +177,7 @@ public class GameFlagManager implements Listener //EvP else if (damagee instanceof Player) { - if (!game.DamageEvP) + if (!game.DamageEvP.GetOption()) { event.SetCancelled("EvP Disabled"); return; @@ -223,16 +223,16 @@ public class GameFlagManager implements Listener } - if (game.ItemPickup) + if (game.ItemPickup.GetOption()) { - if (game.ItemPickupDeny.contains(event.getItem().getItemStack().getTypeId())) + if (game.ItemPickupDeny.GetOption().contains(event.getItem().getItemStack().getTypeId())) { event.setCancelled(true); } } else { - if (!game.ItemPickupAllow.contains(event.getItem().getItemStack().getTypeId())) + if (!game.ItemPickupAllow.GetOption().contains(event.getItem().getItemStack().getTypeId())) { event.setCancelled(true); } @@ -257,16 +257,16 @@ public class GameFlagManager implements Listener return; } - if (game.ItemDrop) + if (game.ItemDrop.GetOption()) { - if (game.ItemDropDeny.contains(event.getItemDrop().getItemStack().getTypeId())) + if (game.ItemDropDeny.GetOption().contains(event.getItemDrop().getItemStack().getTypeId())) { event.setCancelled(true); } } else { - if (!game.ItemDropAllow.contains(event.getItemDrop().getItemStack().getTypeId())) + if (!game.ItemDropAllow.GetOption().contains(event.getItemDrop().getItemStack().getTypeId())) { event.setCancelled(true); } @@ -284,7 +284,7 @@ public class GameFlagManager implements Listener return; //normal inventories - if (!game.InventoryOpenBlock) + if (!game.InventoryOpenBlock.GetOption()) { if (event.getInventory().getType() == InventoryType.ANVIL || event.getInventory().getType() == InventoryType.BEACON || @@ -316,7 +316,7 @@ public class GameFlagManager implements Listener } //deal with chests - if (!game.InventoryOpenChest) + if (!game.InventoryOpenChest.GetOption()) { if (event.getInventory().getType() == InventoryType.CHEST) { @@ -339,7 +339,7 @@ public class GameFlagManager implements Listener if (!game.InProgress()) return; - if (game.InventoryClick) + if (game.InventoryClick.GetOption()) return; Player player = UtilPlayer.searchExact(event.getWhoClicked().getName()); @@ -377,22 +377,22 @@ public class GameFlagManager implements Listener event.setCancelled(true); } // Event Server Allowance - else if (game.BlockPlaceCreative && player.getGameMode() == GameMode.CREATIVE) + else if (game.BlockPlaceCreative.GetOption() && player.getGameMode() == GameMode.CREATIVE) { return; } else { - if (game.BlockPlace) + if (game.BlockPlace.GetOption()) { - if (game.BlockPlaceDeny.contains(event.getBlock().getTypeId())) + if (game.BlockPlaceDeny.GetOption().contains(event.getBlock().getTypeId())) { event.setCancelled(true); } } else { - if (!game.BlockPlaceAllow.contains(event.getBlock().getTypeId())) + if (!game.BlockPlaceAllow.GetOption().contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -420,15 +420,15 @@ public class GameFlagManager implements Listener event.setCancelled(true); } // Event Server Allowance - else if (game.BlockBreakCreative && player.getGameMode() == GameMode.CREATIVE) + else if (game.BlockBreakCreative.GetOption() && player.getGameMode() == GameMode.CREATIVE) { return; } else { - if (game.BlockBreak) + if (game.BlockBreak.GetOption()) { - if (game.BlockBreakDeny.contains(event.getBlock().getTypeId())) + if (game.BlockBreakDeny.GetOption().contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -436,7 +436,7 @@ public class GameFlagManager implements Listener } else { - if (!game.BlockBreakAllow.contains(event.getBlock().getTypeId())) + if (!game.BlockBreakAllow.GetOption().contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -453,7 +453,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks) + if (!game.PrivateBlocks.GetOption()) return; if (event.isCancelled()) @@ -492,7 +492,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks) + if (!game.PrivateBlocks.GetOption()) return; if (event.isCancelled()) @@ -546,7 +546,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks) + if (!game.PrivateBlocks.GetOption()) return; if (event.isCancelled()) @@ -587,7 +587,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks) + if (!game.PrivateBlocks.GetOption()) return; if (event.getAction() != Action.RIGHT_CLICK_BLOCK) @@ -639,7 +639,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks) + if (!game.PrivateBlocks.GetOption()) return; if (event.isCancelled()) @@ -689,13 +689,13 @@ public class GameFlagManager implements Listener player.setFallDistance(0); //Drop Items - if (game.DeathDropItems) + if (game.DeathDropItems.GetOption()) for (ItemStack stack : event.getDrops()) player.getWorld().dropItem(player.getLocation(), stack); event.getDrops().clear(); //DEATH OUT - if (game.GetState() == GameState.Live && game.DeathOut) + if (game.GetState() == GameState.Live && game.DeathOut.GetOption()) { //Event PlayerDeathOutEvent outEvent = new PlayerDeathOutEvent(game, player); @@ -708,16 +708,16 @@ public class GameFlagManager implements Listener } //RESPAWN - if (game.DeathSpectateSecs <= 0 && (game.GetTeam(player) == null || game.GetTeam(player).GetRespawnTime() <= 0)) + if (game.DeathSpectateSecs.GetOption() <= 0 && (game.GetTeam(player) == null || game.GetTeam(player).GetRespawnTime() <= 0)) { //Teleport - if (game.AutomaticRespawn && game.IsAlive(player)) + if (game.AutomaticRespawn.GetOption() && game.IsAlive(player)) { game.RespawnPlayer(player); } else { - Manager.addSpectator(player, game.DeathTeleport); + Manager.addSpectator(player, game.DeathTeleport.GetOption()); } Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() @@ -732,7 +732,7 @@ public class GameFlagManager implements Listener //TIMER else { - double time = game.DeathSpectateSecs; + double time = game.DeathSpectateSecs.GetOption(); if (game.GetTeam(player) != null) if (game.GetTeam(player).GetRespawnTime() > time) time = game.GetTeam(player).GetRespawnTime(); @@ -752,7 +752,7 @@ public class GameFlagManager implements Listener if (!game.IsAlive(player)) { - Manager.addSpectator(player, game.DeathTeleport); + Manager.addSpectator(player, game.DeathTeleport.GetOption()); return; } @@ -773,7 +773,7 @@ public class GameFlagManager implements Listener } else { - Manager.addSpectator(player, game.DeathTeleport); + Manager.addSpectator(player, game.DeathTeleport.GetOption()); } player.setFireTicks(0); @@ -790,7 +790,7 @@ public class GameFlagManager implements Listener if (game == null) return; //Drop Items - if (game.QuitDropItems) + if (game.QuitDropItems.GetOption()) if (game.IsLive()) if (game.IsAlive(event.getPlayer())) UtilInv.drop(event.getPlayer(), true); @@ -800,7 +800,7 @@ public class GameFlagManager implements Listener game.GetPlayerKits().remove(event.getPlayer()); game.GetPlayerGems().remove(event.getPlayer()); - if (!game.QuitOut) + if (!game.QuitOut.GetOption()) return; GameTeam team = game.GetTeam(event.getPlayer()); @@ -821,7 +821,7 @@ public class GameFlagManager implements Listener if (game == null || game.GetState() != GameState.Prepare) return; - if (!game.PrepareFreeze) + if (!game.PrepareFreeze.GetOption()) return; if (!game.IsAlive(event.getPlayer())) @@ -897,7 +897,7 @@ public class GameFlagManager implements Listener ((CraftPlayer)player).getHandle().spectating = false; } - if (!game.WorldBoundaryKill) + if (!game.WorldBoundaryKill.GetOption()) { UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!"); @@ -937,7 +937,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.CreatureAllow && !game.CreatureAllowOverride) + if (!game.CreatureAllow.GetOption() && !game.CreatureAllowOverride.GetOption()) { if (game.WorldData != null) { @@ -967,7 +967,7 @@ public class GameFlagManager implements Listener if (!(game.IsLive() || game.GetState() == GameState.Prepare)) return; - if (!game.TeleportsDisqualify) + if (!game.TeleportsDisqualify.GetOption()) return; if (!game.IsAlive(event.getPlayer())) @@ -1021,7 +1021,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.WorldWeatherEnabled) + if (!game.WorldWeatherEnabled.GetOption()) { if (game.WorldData != null) { @@ -1046,11 +1046,11 @@ public class GameFlagManager implements Listener if (!game.IsLive()) return; - if (game.WorldWaterDamage <= 0) + if (game.WorldWaterDamage.GetOption() <= 0) { if (!game.WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty()) { - game.WorldWaterDamage = 4; + game.WorldWaterDamage.SetOption(4); } else { @@ -1065,7 +1065,7 @@ public class GameFlagManager implements Listener { //Damage Event Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.DROWNING, game.WorldWaterDamage, true, false, false, + DamageCause.DROWNING, game.WorldWaterDamage.GetOption(), true, false, false, "Water", "Water Damage"); player.getWorld().playSound(player.getLocation(), @@ -1083,7 +1083,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldSoilTrample) + if (game.WorldSoilTrample.GetOption()) return; if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL) @@ -1098,7 +1098,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldBlockBurn) + if (game.WorldBlockBurn.GetOption()) return; event.setCancelled(true); @@ -1110,7 +1110,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldBlockGrow) + if (game.WorldBlockGrow.GetOption()) return; event.setCancelled(true); @@ -1122,7 +1122,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldFireSpread) + if (game.WorldFireSpread.GetOption()) return; event.setCancelled(true); @@ -1134,7 +1134,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldLeavesDecay) + if (game.WorldLeavesDecay.GetOption()) return; event.setCancelled(true); @@ -1149,7 +1149,7 @@ public class GameFlagManager implements Listener if (Manager.GetGame() == null) return; - if (!Manager.GetGame().AnnounceStay) + if (!Manager.GetGame().AnnounceStay.GetOption()) return; if (!Manager.GetGame().IsLive()) @@ -1176,7 +1176,7 @@ public class GameFlagManager implements Listener public void AntiHackStrict(GameStateChangeEvent event) { if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Live) - AntiHack.Instance.setStrict(event.GetGame().StrictAntiHack); + AntiHack.Instance.setStrict(event.GetGame().StrictAntiHack.GetOption()); else AntiHack.Instance.setStrict(true); @@ -1188,7 +1188,7 @@ public class GameFlagManager implements Listener if (Manager.GetGame() == null) return; - if (!Manager.GetGame().DisableKillCommand) + if (!Manager.GetGame().DisableKillCommand.GetOption()) return; if (event.getMessage().toLowerCase().startsWith("/kill")) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index a77e3f72b..27667c295 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -1045,7 +1045,7 @@ public class GameLobbyManager implements Listener if (event.getType() != UpdateType.FAST) return; - if (Manager.GetGame() != null && !Manager.GetGame().DisplayLobbySide) + if (Manager.GetGame() != null && !Manager.GetGame().DisplayLobbySide.GetOption()) { return; } @@ -1318,7 +1318,7 @@ public class GameLobbyManager implements Listener if (Manager.GetGame() == null) return; - if (Manager.GetGame().GetState() != GameState.Recruit && Manager.GetGame().GadgetsDisabled) + if (Manager.GetGame().GetState() != GameState.Recruit && Manager.GetGame().GadgetsDisabled.GetOption()) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 34a778feb..df4777940 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -411,7 +411,7 @@ public class GameManager implements Listener return; //Disabling Cosmetics - if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled) + if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled.GetOption()) { if (Manager.getCosmeticManager().isShowingInterface()) { @@ -761,7 +761,7 @@ public class GameManager implements Listener PlayerPrepareTeleportEvent playerStateEvent = new PlayerPrepareTeleportEvent(game, player); UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); } - }, i * game.TickPerTeleport); + }, i * game.TickPerTeleport.GetOption()); } //Announce Game after every player is TP'd in @@ -776,7 +776,7 @@ public class GameManager implements Listener GamePrepareCountdownCommence event = new GamePrepareCountdownCommence(game); UtilServer.getServer().getPluginManager().callEvent(event); } - }, players.size() * game.TickPerTeleport); + }, players.size() * game.TickPerTeleport.GetOption()); //Spectators Move for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java index 1923c030f..5298787f7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -50,7 +50,7 @@ public class MiscManager implements Listener Player player = event.getPlayer(); //BoneMeal - if (!Manager.GetGame().WorldBoneMeal && + if (!Manager.GetGame().WorldBoneMeal.GetOption() && event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) From f7575360db8db96b757f18300bdd2466f0a22bd0 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Fri, 25 Mar 2016 16:42:39 -0400 Subject: [PATCH 09/34] Setting up a class to handle Materials as GameOptions --- .../game/arcade/game/GameOptionItem.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java new file mode 100644 index 000000000..ea006b058 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java @@ -0,0 +1,28 @@ +package nautilus.game.arcade.game; + +import org.bukkit.Material; +import org.bukkit.material.MaterialData; + +public class GameOptionItem extends GameOption { + + private MaterialData _optionMaterialData; + + //GameOptionItem will be the parent class of any materials/tools/etc. that may need to be created as GameOptions + @SuppressWarnings("deprecation") + public GameOptionItem(MaterialData _optMat, String optName, String optDesc) { + super(optName, optDesc); + // TODO Auto-generated constructor stub + _optionMaterialData = _optMat; + } + + public MaterialData GetOption() + { + return _optionMaterialData; + } + + public void setOption(MaterialData _optMatData) + { + _optionMaterialData = _optMatData; + } + +} From 57a1e06406bf11820242c4117bee7192189f7895 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Fri, 25 Mar 2016 20:11:35 -0400 Subject: [PATCH 10/34] no message --- .../nautilus/game/arcade/game/GameOption.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java index 0630d0bed..a168ac165 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java @@ -1,10 +1,13 @@ package nautilus.game.arcade.game; +import org.bukkit.material.MaterialData; + public class GameOption { //Store the name and Description of each option - Literally every GameOption should have these private String _optionName; private String _optionDescription; + private MaterialData _optionMaterialData; public GameOption(String optName, String optDesc) { @@ -12,6 +15,13 @@ public class GameOption _optionDescription = optDesc; } + public GameOption(MaterialData _optMat, String optName, String optDesc) + { + _optionName = optName; + _optionDescription = optDesc; + _optionMaterialData = _optMat; + } + //Get methods for name of option and description public String GetOptionName() { @@ -23,6 +33,16 @@ public class GameOption return _optionDescription; } + public String GetOptionMaterialData() + { + if(_optionMaterialData != null) + { + return _optionMaterialData; + } + + return "None"; + } + /*Every GameOption will have SetOption and GetOption methods * However, since each GameOption class will have a different return type * and take different parameters, there isn't much need to create any here at this time From abcdadc8d0947f2c9cc4bcaa14f998b778ab434c Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Mon, 28 Mar 2016 12:40:41 -0400 Subject: [PATCH 11/34] Corrected a small error in GameOption. --- .../src/nautilus/game/arcade/game/GameOption.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java index a168ac165..c450c4fb4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java @@ -33,14 +33,14 @@ public class GameOption return _optionDescription; } - public String GetOptionMaterialData() + public MaterialData GetOptionMaterialData() { if(_optionMaterialData != null) { return _optionMaterialData; } - return "None"; + return null; } /*Every GameOption will have SetOption and GetOption methods From d8d952691b3b5cd8f13dbed9f376bbc1f7007343 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Mon, 28 Mar 2016 13:40:34 -0400 Subject: [PATCH 12/34] cleaning up my code a bit --- .../src/nautilus/game/arcade/game/GameOptionItem.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java index ea006b058..1805678c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.game; -import org.bukkit.Material; import org.bukkit.material.MaterialData; public class GameOptionItem extends GameOption { @@ -8,7 +7,6 @@ public class GameOptionItem extends GameOption { private MaterialData _optionMaterialData; //GameOptionItem will be the parent class of any materials/tools/etc. that may need to be created as GameOptions - @SuppressWarnings("deprecation") public GameOptionItem(MaterialData _optMat, String optName, String optDesc) { super(optName, optDesc); // TODO Auto-generated constructor stub From 38a079846d39fe20ac62a38120484cdfbac18521 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Mon, 28 Mar 2016 18:14:52 -0400 Subject: [PATCH 13/34] Some basic ideas for Elo I will be experimenting with --- .../src/mineplex/core/elo/EloManager.java | 23 +++++++++++++++++++ .../src/mineplex/core/elo/EloPlayer.java | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index d1c44b6d6..cceb3b082 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -2,6 +2,7 @@ package mineplex.core.elo; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.UUID; import mineplex.core.MiniDbClientPlugin; @@ -46,6 +47,28 @@ public class EloManager extends MiniDbClientPlugin return elo; } + //get a player's Division + public String getPlayerDivision(UUID uuid, String gameType) + { + String updatedDivision = ""; + + //get playerElo for gametype (need to store this to check it against other Elo's) + int playerElo = getElo(uuid, gameType); + //this list will be filled with ELO's from other players (but only for the same game type + ArrayList otherElos = new ArrayList(); + + for(int i = 0; i < _playerElos.size(); i++) + { + //we're only concerned with this Game Type + if(_playerElos.containsKey(gameType)) + { + + } + } + + return updatedDivision; + } + public EloTeam getNewRatings(EloTeam teamA, EloTeam teamB, GameResult result) { EloTeam newTeam = new EloTeam(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index a2661fee3..61c8ad014 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -5,8 +5,12 @@ public class EloPlayer public String UniqueId; public int Rating; + //Division stuff (to be implemented, pending review) + private String _division; + public void printInfo() { System.out.println(UniqueId + "'s elo is " + Rating); } + } From f496392c5ae2c3160864aa347d839dd026d3678f Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Tue, 29 Mar 2016 13:49:59 -0400 Subject: [PATCH 14/34] EloDivision class created. EloManager can now calculate division ranking (EloDivision can also do this once we are ready for it to) --- .../src/mineplex/core/elo/EloDivision.java | 55 +++++++++++++++++++ .../src/mineplex/core/elo/EloManager.java | 38 +++++++++++-- .../src/mineplex/core/elo/EloSettings.java | 36 ++++++++++++ 3 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/elo/EloDivision.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloDivision.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloDivision.java new file mode 100644 index 000000000..e1b3be8b8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloDivision.java @@ -0,0 +1,55 @@ +package mineplex.core.elo; + +import org.bukkit.Material; +import org.bukkit.material.MaterialData; + +public class EloDivision +{ + private byte _divisionPercentile; + private String _divisionName; + + //If I understand MaterialData objects correctly, + private Material _divisionMaterial; + private byte _divisionMaterialValue; + private MaterialData _divisionMaterialData; + + public EloDivision(byte divPercent) + { + // TODO Auto-generated constructor stub + _divisionPercentile = divPercent; + _divisionName = CalculateDivision(divPercent); + + } + + public String CalculateDivision(double divPercent) + { + if (divPercent == 100) return "Diamond"; + if (divPercent <= 99 && divPercent >= 81) return "Emerald"; + if (divPercent <= 80 && divPercent >= 61) return "Lapis"; + if (divPercent <= 60 && divPercent >= 41) return "Gold"; + if (divPercent <= 40 && divPercent >= 21) return "Iron"; + + //if none of the above are true, a player is in the bottom 20% + return "Coal"; + } + + @SuppressWarnings("deprecation") + //method to set icon's material(since it will change with player's ELO) + public void setDivisionIcon(Material divMat, byte divData) + { + _divisionMaterial = divMat; + _divisionMaterialValue = divData; + _divisionMaterialData = new MaterialData(_divisionMaterial, _divisionMaterialValue); + } + + public MaterialData getMaterialData() + { + return _divisionMaterialData; + } + + public String getDivisionName() + { + return _divisionName; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index cceb3b082..257e0c470 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -3,6 +3,7 @@ package mineplex.core.elo; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.UUID; import mineplex.core.MiniDbClientPlugin; @@ -50,23 +51,48 @@ public class EloManager extends MiniDbClientPlugin //get a player's Division public String getPlayerDivision(UUID uuid, String gameType) { - String updatedDivision = ""; - - //get playerElo for gametype (need to store this to check it against other Elo's) + //get playerElo for gameType (need to store this to check it against other Elo's) int playerElo = getElo(uuid, gameType); //this list will be filled with ELO's from other players (but only for the same game type - ArrayList otherElos = new ArrayList(); + ArrayList allElos = new ArrayList(); for(int i = 0; i < _playerElos.size(); i++) { //we're only concerned with this Game Type if(_playerElos.containsKey(gameType)) { - + //add elo's to the list + allElos.add(_playerElos.get(uuid.toString()).get(gameType)); } } + //sort list of Elos (needed for percentile calculations) + Collections.sort(allElos); - return updatedDivision; + //Calculate how much going up one spot is worth + double individualValue = (100/allElos.size()); + + /* lastIndexOf gets the last instance of player's Elo (possibly relevant near the top/bottom of divisions?) + * Consequently, it should be easier for rank to go up than down. + * To make it easier to go down in rank than up, use of Indexof is recommended. + */ + double percentile = allElos.lastIndexOf(playerElo) * individualValue; + + + return CalculateDivision(percentile); + } + + //CalculateDivision copied from EloDivision for testing purposes + //will remove/alter one or both of them as needed + public String CalculateDivision(double divPercent) + { + if (divPercent == 100) return "Diamond"; + if (divPercent <= 99 && divPercent >= 81) return "Emerald"; + if (divPercent <= 80 && divPercent >= 61) return "Lapis"; + if (divPercent <= 60 && divPercent >= 41) return "Gold"; + if (divPercent <= 40 && divPercent >= 21) return "Iron"; + + //if none of the above are true, a player is in the bottom 20% + return "Coal"; } public EloTeam getNewRatings(EloTeam teamA, EloTeam teamB, GameResult result) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java new file mode 100644 index 000000000..1c4e1269e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java @@ -0,0 +1,36 @@ +package mineplex.core.elo; + +public class EloSettings { + + private boolean _fullElo = false; + private boolean _backendElo = false; + private boolean _eloDisabled = true; + + public EloSettings(int setElo) + { + switch(setElo) + { + case 0: + _fullElo = false; + _backendElo = false; + _eloDisabled = true; + break; + case 1: + _fullElo = true; + _backendElo = false; + _eloDisabled = false; + break; + case 2: + _fullElo = false; + _backendElo = true; + _eloDisabled = false; + break; + default: + _fullElo = false; + _backendElo = false; + _eloDisabled = true; + + } + } + +} From 0c479e1562fc10444ab47bb6670342b32fb4876b Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Tue, 29 Mar 2016 14:00:59 -0400 Subject: [PATCH 15/34] Made change to Elo calculation under Sigils' advisement. Now using indexOf, rather than lastIndexOf to find Elo --- .../Mineplex.Core/src/mineplex/core/elo/EloManager.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 257e0c470..81b979589 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -71,11 +71,10 @@ public class EloManager extends MiniDbClientPlugin //Calculate how much going up one spot is worth double individualValue = (100/allElos.size()); - /* lastIndexOf gets the last instance of player's Elo (possibly relevant near the top/bottom of divisions?) - * Consequently, it should be easier for rank to go up than down. - * To make it easier to go down in rank than up, use of Indexof is recommended. + /* IndexOf gets the first instance of player's Elo (relevant near the top/bottom of divisions) + * Consequently, everyone at the same Elo should be in the same division */ - double percentile = allElos.lastIndexOf(playerElo) * individualValue; + double percentile = allElos.indexOf(playerElo) * individualValue; return CalculateDivision(percentile); From 35fc5223b167f55e04473c10bc0b8e3a4cbadeab Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Tue, 29 Mar 2016 14:03:21 -0400 Subject: [PATCH 16/34] reverted previous changes back to lastIndexOf (and altered comments accordingly) on the advice of SJSampson (with whom Sigils agreed) --- .../Mineplex.Core/src/mineplex/core/elo/EloManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 81b979589..7c9a35c47 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -71,10 +71,11 @@ public class EloManager extends MiniDbClientPlugin //Calculate how much going up one spot is worth double individualValue = (100/allElos.size()); - /* IndexOf gets the first instance of player's Elo (relevant near the top/bottom of divisions) - * Consequently, everyone at the same Elo should be in the same division + /* lastIndexOf gets the last instance of player's Elo + * Consequently, it should be easier for rank to go up than down + * and everyone at the same Elo should be in the same division */ - double percentile = allElos.indexOf(playerElo) * individualValue; + double percentile = allElos.lastIndexOf(playerElo) * individualValue; return CalculateDivision(percentile); From 51cd770d38850db4c2e1bbb58a97346327777dfc Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Tue, 29 Mar 2016 16:00:57 -0400 Subject: [PATCH 17/34] Changes to help smooth the transition into using EloSettings. --- .../src/mineplex/core/elo/EloSettings.java | 33 +++++++++++++++---- .../src/nautilus/game/arcade/game/Game.java | 4 +++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java index 1c4e1269e..f392b2c44 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java @@ -8,7 +8,28 @@ public class EloSettings { public EloSettings(int setElo) { - switch(setElo) + setEloSetting(setElo); + } + + public int getEloSetting() + { + int settingEnum = 0; + + if(_backendElo) + { + settingEnum = 1; + } + else if (_fullElo) + { + settingEnum = 2; + } + + return settingEnum; + } + + public void setEloSetting(int newSetting) + { + switch(newSetting) { case 0: _fullElo = false; @@ -16,13 +37,13 @@ public class EloSettings { _eloDisabled = true; break; case 1: - _fullElo = true; - _backendElo = false; + _fullElo = false; + _backendElo = true; _eloDisabled = false; break; case 2: - _fullElo = false; - _backendElo = true; + _fullElo = true; + _backendElo = false; _eloDisabled = false; break; default: @@ -32,5 +53,5 @@ public class EloSettings { } } - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 0903a9d54..c0ced89b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -55,6 +55,7 @@ import mineplex.core.common.util.UtilTabTitle; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.elo.EloSettings; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; @@ -315,6 +316,9 @@ public abstract class Game implements Listener public String Winner = "Nobody"; public GameTeam WinnerTeam = null; + //EloSetting - experimental + public EloSettings EloSetting = new EloSettings(0); + public boolean EloRanking = false; public int EloStart = 1000; From 6048c97b521877218c66dbab66ba87d3bbe42ba8 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Tue, 29 Mar 2016 17:50:06 -0400 Subject: [PATCH 18/34] Tweaks to clean/clarify things --- .../Mineplex.Core/src/mineplex/core/elo/EloManager.java | 2 -- .../Mineplex.Core/src/mineplex/core/elo/EloPlayer.java | 5 +++++ .../Mineplex.Core/src/mineplex/core/elo/EloSettings.java | 8 ++++---- .../Mineplex.Core/src/mineplex/core/game/GameDisplay.java | 4 ++++ .../src/nautilus/game/arcade/game/Game.java | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 7c9a35c47..664947480 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -81,8 +81,6 @@ public class EloManager extends MiniDbClientPlugin return CalculateDivision(percentile); } - //CalculateDivision copied from EloDivision for testing purposes - //will remove/alter one or both of them as needed public String CalculateDivision(double divPercent) { if (divPercent == 100) return "Diamond"; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index 61c8ad014..24448c7e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -13,4 +13,9 @@ public class EloPlayer System.out.println(UniqueId + "'s elo is " + Rating); } + public void setDivision(String newDivision) + { + _division = newDivision; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java index f392b2c44..7768adc25 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloSettings.java @@ -13,18 +13,18 @@ public class EloSettings { public int getEloSetting() { - int settingEnum = 0; + int settingNum = 0; if(_backendElo) { - settingEnum = 1; + settingNum = 1; } else if (_fullElo) { - settingEnum = 2; + settingNum = 2; } - return settingEnum; + return settingNum; } public void setEloSetting(int newSetting) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index ac497cd48..55cbc264f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -3,6 +3,8 @@ package mineplex.core.game; import org.bukkit.DyeColor; import org.bukkit.Material; +import mineplex.core.elo.EloSettings; + public enum GameDisplay { //Mini @@ -88,6 +90,8 @@ public enum GameDisplay private int _gameId; // Unique identifying id for this gamemode (used for statistics) public int getGameId() { return _gameId; } + private EloSettings EloSetting = new EloSettings(0); + GameDisplay(String name, Material mat, byte data, GameCategory gameCategory, int gameId) { this(name, name, mat, data, gameCategory, gameId); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index c0ced89b7..3ff44040b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -316,7 +316,7 @@ public abstract class Game implements Listener public String Winner = "Nobody"; public GameTeam WinnerTeam = null; - //EloSetting - experimental + //EloSetting - experimental (0 = disabled, 1 = background, 2 = full) public EloSettings EloSetting = new EloSettings(0); public boolean EloRanking = false; From 00ee594f28b952e8fd9e3f8565cd7e9fdf5a484c Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Tue, 29 Mar 2016 17:50:45 -0400 Subject: [PATCH 19/34] Missed one file last time --- Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index 24448c7e1..e34a03f15 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -5,7 +5,7 @@ public class EloPlayer public String UniqueId; public int Rating; - //Division stuff (to be implemented, pending review) + //String to hold division player is currently in private String _division; public void printInfo() From b1c29a4fa6e4844054b60dc5598b0808c9c6958b Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Wed, 30 Mar 2016 16:06:30 -0400 Subject: [PATCH 20/34] Setup proper Elo brackets with the top 1% being placed in diamond. Also changed starting Elo to 1400 (middle of Iron 1), leaving Coal as a purely regressive division. --- .../src/mineplex/core/elo/EloManager.java | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 664947480..c20b8a942 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -32,7 +32,7 @@ public class EloManager extends MiniDbClientPlugin public int getElo(UUID uuid, String gameType) { - int elo = 1000; + int elo = 1400; synchronized (_playerEloLock) { @@ -78,19 +78,29 @@ public class EloManager extends MiniDbClientPlugin double percentile = allElos.lastIndexOf(playerElo) * individualValue; - return CalculateDivision(percentile); + return CalculateDivision(playerElo, percentile); } - public String CalculateDivision(double divPercent) + public String CalculateDivision(int playerElo, double divPercent) { - if (divPercent == 100) return "Diamond"; - if (divPercent <= 99 && divPercent >= 81) return "Emerald"; - if (divPercent <= 80 && divPercent >= 61) return "Lapis"; - if (divPercent <= 60 && divPercent >= 41) return "Gold"; - if (divPercent <= 40 && divPercent >= 21) return "Iron"; + if (playerElo >= 3500 && divPercent > 99) return "Diamond"; + if (playerElo >= 3500) return "Emerald 3"; + if (playerElo < 3500 && playerElo >= 3300) return "Emerald 2"; + if (playerElo < 3300 && playerElo >= 3100) return "Emerald 1"; + if (playerElo < 3100 && playerElo >= 2900) return "Lapis 3"; + if (playerElo < 2900 && playerElo >= 2700) return "Lapis 2"; + if (playerElo < 2700 && playerElo >= 2500) return "Lapis 1"; + if (playerElo < 2500 && playerElo >= 2300) return "Gold 3"; + if (playerElo < 2300 && playerElo >= 2100) return "Gold 2"; + if (playerElo < 2100 && playerElo >= 1900) return "Gold 1"; + if (playerElo < 1900 && playerElo >= 1700) return "Iron 3"; + if (playerElo < 1700 && playerElo >= 1500) return "Iron 2"; + if (playerElo < 1500 && playerElo >= 1300) return "Iron 1"; + if (playerElo < 1300 && playerElo >= 800) return "Coal 3"; + if (playerElo < 800 && playerElo >= 600) return "Coal 2"; + if (playerElo < 600 && playerElo >= 400) return "Coal 1"; - //if none of the above are true, a player is in the bottom 20% - return "Coal"; + return "Result not found"; } public EloTeam getNewRatings(EloTeam teamA, EloTeam teamB, GameResult result) From cbb9798c358229c9afe7ac00228a6d54bfc347aa Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Thu, 31 Mar 2016 12:49:22 -0400 Subject: [PATCH 21/34] Added AdjustPlayertElo method to increment/decrement the Elo's of individual players at the end of a game. Currently calling the new method in AnnounceEnd. --- .../src/mineplex/core/elo/EloPlayer.java | 5 + .../src/nautilus/game/arcade/game/Game.java | 91 ++++++++++++++++++- 2 files changed, 95 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index e34a03f15..e3a72bfa5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -18,4 +18,9 @@ public class EloPlayer _division = newDivision; } + public void addRating(int toAdd) + { + Rating += toAdd; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 3ff44040b..f204a2c77 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -320,7 +320,7 @@ public abstract class Game implements Listener public EloSettings EloSetting = new EloSettings(0); public boolean EloRanking = false; - public int EloStart = 1000; + public int EloStart = 1400; public boolean CanAddStats = true; public boolean CanGiveLoot = true; @@ -1272,10 +1272,99 @@ public abstract class Game implements Listener } UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); + + AdjustPlayerElo(places); if (AnnounceSilence.GetOption()) Manager.GetChat().Silence(5000, false); } + + public void AdjustPlayerElo(List places) + { + + for (Player player : UtilServer.getPlayers()) + { + int currentElo = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + int lossMultiplier = 1; + int sizeModifier = 3; + //nobody won, add 10 points to all players + //Profitable enough see the match through to the end, but not enough for a stale-mate to be a more desirable outcome than 3rd place + if (places == null || places.isEmpty()) + { + int newElo = currentElo + 10; + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + //Top 3 players get 25, 20, and 15 points, respectively + else + { + if (places.size() >= 1) + { + if (player.getUniqueId() == places.get(0).getUniqueId()) + { + int newElo = currentElo + 25; + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + } + if (places.size() >= 5) + { + if (player.getUniqueId() == places.get(1).getUniqueId()) + { + int newElo = currentElo + 20; + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + } + if (places.size() >= 6) + { + if (player.getUniqueId() == places.get(2).getUniqueId()) + { + int newElo = currentElo + 15; + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + + } + if (places.size() > 6 && places.size() <= 7) + { + if (player.getUniqueId() == places.get(5).getUniqueId()) + { + int newElo = currentElo - 5; + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + } + if (places.size() == 7) + { + if (player.getUniqueId() == places.get(6).getUniqueId()) + { + int newElo = currentElo - 10; + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + } + if (places.size() >= 8) + { + //for games with 8+ players, this if statement is just going to run 3 times to check 3 different places + while(lossMultiplier != 0) + { + if (player.getUniqueId() == places.get(places.size() - sizeModifier).getUniqueId()) + { + int newElo = currentElo - (5 * lossMultiplier); + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + + if(sizeModifier >= 1) + { + lossMultiplier++; + sizeModifier--; + } + else + { + lossMultiplier = 0; + } + } + } + } + + } + + } + } public void Announce(String message) { From 6ccc6df6aa8cacebb913180d9ea99512b7dc2e7e Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Thu, 31 Mar 2016 13:57:21 -0400 Subject: [PATCH 22/34] Elo calculations now account for player's Elo, relative to the average Elo among players --- .../src/nautilus/game/arcade/game/Game.java | 81 +++++++++++++++++-- 1 file changed, 74 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index f204a2c77..b547c3439 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1279,14 +1279,61 @@ public abstract class Game implements Listener Manager.GetChat().Silence(5000, false); } + public int CalculateEloMultiplier(int currentElo, int averageElo) + { + + int eloDifference = averageElo - currentElo; + + if (Math.abs(eloDifference) <= 50) + { + return 0; + } + if (eloDifference >= 200) + { + return 3; + } + if (eloDifference >= 100) + { + return 2; + } + if (eloDifference > 50) + { + return 1; + } + if (eloDifference <= -200) + { + return -3; + } + if (eloDifference <= -100) + { + return -2; + } + if (eloDifference < 50) + { + return -1; + } + + + return 0; + } + public void AdjustPlayerElo(List places) { + int averageElo = 0; + for (Player player : UtilServer.getPlayers()) + { + averageElo += Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + } + //average Elo of all players + averageElo = averageElo/places.size(); for (Player player : UtilServer.getPlayers()) { int currentElo = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); int lossMultiplier = 1; int sizeModifier = 3; + int eloMultiplier = CalculateEloMultiplier(currentElo, averageElo); + //nobody won, add 10 points to all players //Profitable enough see the match through to the end, but not enough for a stale-mate to be a more desirable outcome than 3rd place if (places == null || places.isEmpty()) @@ -1300,8 +1347,8 @@ public abstract class Game implements Listener if (places.size() >= 1) { if (player.getUniqueId() == places.get(0).getUniqueId()) - { - int newElo = currentElo + 25; + { + int newElo = currentElo + 25 + (5 * eloMultiplier); Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); } } @@ -1309,7 +1356,7 @@ public abstract class Game implements Listener { if (player.getUniqueId() == places.get(1).getUniqueId()) { - int newElo = currentElo + 20; + int newElo = currentElo + 20 + (5 * eloMultiplier); Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); } } @@ -1317,7 +1364,12 @@ public abstract class Game implements Listener { if (player.getUniqueId() == places.get(2).getUniqueId()) { - int newElo = currentElo + 15; + if (eloMultiplier < -2) + { + eloMultiplier = -2; + } + + int newElo = currentElo + 15 + (5 * eloMultiplier); Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); } @@ -1326,7 +1378,12 @@ public abstract class Game implements Listener { if (player.getUniqueId() == places.get(5).getUniqueId()) { - int newElo = currentElo - 5; + if(eloMultiplier > 1) + { + eloMultiplier = 0; + } + + int newElo = currentElo - 5 + (5 * eloMultiplier); Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); } } @@ -1334,7 +1391,12 @@ public abstract class Game implements Listener { if (player.getUniqueId() == places.get(6).getUniqueId()) { - int newElo = currentElo - 10; + if(eloMultiplier > 2) + { + eloMultiplier = 2; + } + + int newElo = currentElo - 10 + (5 * eloMultiplier); Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); } } @@ -1345,7 +1407,12 @@ public abstract class Game implements Listener { if (player.getUniqueId() == places.get(places.size() - sizeModifier).getUniqueId()) { - int newElo = currentElo - (5 * lossMultiplier); + if(eloMultiplier > lossMultiplier) + { + eloMultiplier = lossMultiplier; + } + + int newElo = currentElo - (5 * lossMultiplier) + (5 * eloMultiplier); Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); if(sizeModifier >= 1) From 5e1003cccb02a65eb505ee03f1a4721a2b7ed01b Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Thu, 31 Mar 2016 14:06:45 -0400 Subject: [PATCH 23/34] Missed a minus sign in my previous commit. --- .../src/nautilus/game/arcade/game/Game.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index b547c3439..193106f3e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1308,7 +1308,7 @@ public abstract class Game implements Listener { return -2; } - if (eloDifference < 50) + if (eloDifference < -50) { return -1; } From 6e23a17acb0af19cfb6e7ff934915079f919f7db Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Fri, 1 Apr 2016 16:01:57 -0400 Subject: [PATCH 24/34] Removed unnecessary code. --- Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index e3a72bfa5..e34a03f15 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -18,9 +18,4 @@ public class EloPlayer _division = newDivision; } - public void addRating(int toAdd) - { - Rating += toAdd; - } - } From c6c52885a94a78215e866b15fea799d3dfb199a4 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Tue, 5 Apr 2016 15:16:40 -0400 Subject: [PATCH 25/34] Fixed commit --- .../src/nautilus/game/arcade/game/GameOption.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java index c450c4fb4..38f67d7fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOption.java @@ -1,3 +1,8 @@ +/*Every GameOption will have SetOption and GetOption methods + * However, since each GameOption class will have a different return type + * and take different parameters, there isn't much need to create any here at this time +*/ + package nautilus.game.arcade.game; import org.bukkit.material.MaterialData; @@ -43,9 +48,4 @@ public class GameOption return null; } - /*Every GameOption will have SetOption and GetOption methods - * However, since each GameOption class will have a different return type - * and take different parameters, there isn't much need to create any here at this time - */ - } From 09db5a8131e2535ae1585f18d5998cbd098e5792 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Tue, 5 Apr 2016 16:41:50 -0400 Subject: [PATCH 26/34] I'm committing this so I can checkout to a different branch --- .../mineplex/core/common/DefaultHashMap.java | 35 + .../mineplex/core/common/GsonLocation.java | 80 ++ .../mineplex/core/common/MaterialData.java | 46 + .../core/common/block/DataLocationMap.java | 83 ++ .../events/PlayerRecieveBroadcastEvent.java | 52 + .../mineplex/core/common/function/Result.java | 7 + .../core/common/generator/VoidGenerator.java | 15 + .../core/common/util/EnclosedObject.java | 31 + .../mineplex/core/common/util/MapBuilder.java | 27 + .../core/common/util/NumberFloater.java | 28 + .../core/common/util/UtilCollections.java | 278 +++++ .../core/common/util/UtilOfflinePlayer.java | 29 + .../core/common/util/UtilStreams.java | 58 ++ .../mineplex/core/common/util/UtilTrig.java | 80 ++ .../mineplex/core/common/util/UtilWeb.java | 58 ++ .../mineplex/core/chat/FilterPriority.java | 7 + .../core/fallingblock/FallingBlocks.java | 62 ++ .../core/incognito/IncognitoManager.java | 169 +++ .../commands/IncognitoToggleCommand.java | 30 + .../events/IncognitoStatusChangeEvent.java | 64 ++ .../incognito/repository/IncognitoClient.java | 6 + .../repository/IncognitoRepository.java | 33 + .../texttutorial/TextTutorialManager.java | 154 +++ .../core/texttutorial/tutorial/Phase.java | 47 + .../core/texttutorial/tutorial/Tutorial.java | 74 ++ .../texttutorial/tutorial/TutorialData.java | 102 ++ .../game/clans/clans/ClansBetaManager.java | 27 + .../clans/clans/commands/QueryCommand.java | 53 + .../event/ClanCreationCompleteEvent.java | 194 ++++ .../event/ClansCommandPreExecutedEvent.java | 68 ++ .../clans/event/ClansWaterPlaceEvent.java | 53 + .../clans/event/PreEnergyShopBuyEvent.java | 58 ++ .../gui/events/ClansButtonClickEvent.java | 67 ++ .../game/clans/clans/invsee/Invsee.java | 23 + .../clans/invsee/commands/InvseeCommand.java | 54 + .../clans/invsee/ui/InvseeInventory.java | 99 ++ .../clans/map/events/PlayerGetMapEvent.java | 44 + .../clans/nameblacklist/ClansBlacklist.java | 62 ++ .../commands/AddBlacklistCommand.java | 40 + .../ClanNameBlacklistRepository.java | 75 ++ .../clans/clans/nether/NetherManager.java | 277 +++++ .../game/clans/clans/nether/Portal.java | 143 +++ .../game/clans/clans/siege/SiegeManager.java | 335 ++++++ .../siege/commands/CommandSiegeSupplies.java | 35 + .../siege/events/LoadSiegeWeaponEvent.java | 53 + .../siege/events/MountSiegeWeaponEvent.java | 53 + .../siege/events/SiegeWeaponExplodeEvent.java | 53 + .../clans/clans/siege/outpost/Outpost.java | 629 +++++++++++ .../clans/siege/outpost/OutpostManager.java | 314 ++++++ .../clans/siege/outpost/OutpostState.java | 38 + .../clans/siege/outpost/OutpostType.java | 395 +++++++ .../siege/outpost/build/OutpostBlock.java | 82 ++ .../outpost/build/OutpostBlockBanner.java | 40 + .../siege/repository/OutpostRepository.java | 141 +++ .../repository/SiegeWeaponRepository.java | 204 ++++ .../siege/repository/tokens/OutpostToken.java | 17 + .../repository/tokens/SiegeWeaponToken.java | 21 + .../game/clans/clans/siege/weapon/Cannon.java | 459 ++++++++ .../clans/clans/siege/weapon/SiegeWeapon.java | 979 ++++++++++++++++++ .../clans/siege/weapon/projectile/Crater.java | 231 +++++ .../siege/weapon/projectile/CraterBlock.java | 32 + .../projectile/ProjectileAttributes.java | 75 ++ .../weapon/projectile/ProjectileType.java | 7 + .../weapon/projectile/WeaponProjectile.java | 197 ++++ .../event/PreCraterSetBlockEvent.java | 72 ++ .../clans/siege/weapon/util/AccessRule.java | 23 + .../clans/siege/weapon/util/AccessType.java | 7 + .../weapon/util/BarrierCollisionBox.java | 251 +++++ .../siege/weapon/util/WeaponStateInfo.java | 25 + .../clans/staff/SilentChestInventory.java | 37 + .../clans/clans/staff/SilentChestOpen.java | 49 + .../items/legendaries/EnergyCrossbow.java | 188 ++++ .../items/legendaries/MeridianScepter.java | 249 +++++ .../game/clans/items/rares/Crossbow.java | 62 ++ .../game/clans/items/rares/RareItem.java | 98 ++ .../game/clans/items/rares/RunedPickaxe.java | 130 +++ .../game/clans/legacytutorial/Tutorial.java | 629 +++++++++++ .../clans/legacytutorial/TutorialClient.java | 40 + .../clans/legacytutorial/TutorialManager.java | 211 ++++ .../clans/legacytutorial/TutorialTask.java | 267 +++++ .../commands/DoSkipTutorialCommand.java | 31 + .../commands/SkipTutorialCommand.java | 31 + .../gettingstarted/TaskClaim.java | 42 + .../gettingstarted/TaskCreateClan.java | 52 + .../gettingstarted/TaskCustomizeClass.java | 61 ++ .../gettingstarted/TaskDisbandClan.java | 41 + .../gettingstarted/TaskEquipClass.java | 120 +++ .../gettingstarted/TaskExploreShops.java | 92 ++ .../gettingstarted/TaskLeaveSpawn.java | 65 ++ .../gettingstarted/TaskMakingMoney.java | 72 ++ .../gettingstarted/TaskSetHome.java | 44 + .../gettingstarted/TaskUseAbility.java | 156 +++ .../gettingstarted/TaskViewClanDetails.java | 38 + .../gettingstarted/TaskWelcome.java | 21 + .../TutorialGettingStarted.java | 108 ++ .../clans/message/ClansMessageManager.java | 65 ++ .../mineplex/game/clans/message/Message.java | 47 + .../game/clans/shop/pvp/tnt/TNTGenPage.java | 154 +++ .../game/clans/shop/pvp/tnt/TNTGenShop.java | 22 + .../clans/texttutorial/ClassTutorial.java | 14 + .../game/clans/tutorial/Tutorial.java | 400 +++++++ .../game/clans/tutorial/TutorialManager.java | 185 ++++ .../game/clans/tutorial/TutorialRegion.java | 75 ++ .../game/clans/tutorial/TutorialSession.java | 118 +++ .../game/clans/tutorial/TutorialType.java | 6 + .../clans/tutorial/TutorialWorldManager.java | 107 ++ .../clans/tutorial/command/FinishCommand.java | 23 + .../clans/tutorial/command/StartCommand.java | 41 + .../tutorial/command/TutorialCommand.java | 27 + .../tutorial/gui/TutorialSelectPage.java | 43 + .../game/clans/tutorial/gui/TutorialShop.java | 33 + .../tutorial/gui/button/DeclineButton.java | 15 + .../tutorial/gui/button/StartButton.java | 28 + .../tutorial/map/TutorialMapManager.java | 680 ++++++++++++ .../tutorial/map/TutorialMapRenderer.java | 243 +++++ .../clans/tutorial/objective/Objective.java | 332 ++++++ .../tutorial/objective/ObjectiveData.java | 5 + .../tutorial/objective/ObjectiveGoal.java | 232 +++++ .../tutorial/objective/ObjectiveListener.java | 23 + .../tutorial/objective/OrderedObjective.java | 133 +++ .../objective/OrderedObjectiveData.java | 21 + .../tutorial/objective/SingleObjective.java | 61 ++ .../objective/UnorderedObjective.java | 124 +++ .../objective/UnorderedObjectiveData.java | 48 + .../tutorials/clans/ClansMainTutorial.java | 608 +++++++++++ .../clans/objective/AttackEnemyObjective.java | 212 ++++ .../clans/objective/ClanObjective.java | 39 + .../clans/objective/ClassesObjective.java | 44 + .../clans/objective/EnergyObjective.java | 42 + .../clans/objective/FieldsObjective.java | 56 + .../clans/objective/FinalObjective.java | 42 + .../objective/PurchaseItemsObjective.java | 75 ++ .../clans/objective/ShopsObjective.java | 119 +++ .../clans/objective/goals/HoldItemGoal.java | 75 ++ .../goals/attackenemy/BlowUpWallGoal.java | 125 +++ .../goals/attackenemy/ClanInfoGoal.java | 92 ++ .../goals/attackenemy/GetMapGoal.java | 57 + .../goals/attackenemy/LoadCannonGoal.java | 46 + .../goals/attackenemy/MountCannonGoal.java | 71 ++ .../attackenemy/StealEnemyPotatoesGoal.java | 129 +++ .../objective/goals/clan/BuildHouseGoal.java | 94 ++ .../objective/goals/clan/ClaimLandGoal.java | 76 ++ .../objective/goals/clan/ClanDetailsGoal.java | 63 ++ .../goals/clan/ClanManagementGoal.java | 60 ++ .../objective/goals/clan/CreateClanGoal.java | 61 ++ .../objective/goals/clan/LeaveSpawnGoal.java | 79 ++ .../objective/goals/clan/SetHomeGoal.java | 75 ++ .../goals/classes/EquipDefaultBuildGoal.java | 46 + .../goals/classes/OpenClassManagerGoal.java | 59 ++ .../goals/classes/SelectBullsChargeGoal.java | 66 ++ .../goals/classes/UseBullsChargeGoal.java | 50 + .../objective/goals/energy/BuyEnergyGoal.java | 64 ++ .../goals/energy/ExplainEnergyGoal.java | 57 + .../goals/fields/GoToFieldsGoal.java | 75 ++ .../goals/fields/IdentifyFieldsGoal.java | 64 ++ .../goals/fields/MineDiamondsGoal.java | 112 ++ .../goals/fields/SellDiamondsGoal.java | 61 ++ .../goals/finalobj/DisbandClanGoal.java | 64 ++ .../goals/finalobj/TpClanHomeGoal.java | 91 ++ .../objective/goals/shops/GoToShopsGoal.java | 77 ++ .../objective/goals/shops/PurchaseGoal.java | 66 ++ .../goals/shops/SellPotatoesGoal.java | 59 ++ .../clans/repository/TutorialRepository.java | 68 ++ .../clans/tutorial/visual/VisualManager.java | 35 + .../shop/event/OpenClassShopEvent.java | 18 + .../CustomerSupportRepository.java | 25 + 166 files changed, 17496 insertions(+) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/DefaultHashMap.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/GsonLocation.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/MaterialData.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/DataLocationMap.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/function/Result.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/generator/VoidGenerator.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/EnclosedObject.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapBuilder.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NumberFloater.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilCollections.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilOfflinePlayer.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilStreams.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTrig.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWeb.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/chat/FilterPriority.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/fallingblock/FallingBlocks.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/incognito/events/IncognitoStatusChangeEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoClient.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoRepository.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Phase.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Tutorial.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/TutorialData.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansBetaManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/QueryCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanCreationCompleteEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClansCommandPreExecutedEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClansWaterPlaceEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PreEnergyShopBuyEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/events/ClansButtonClickEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/Invsee.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/commands/InvseeCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/ui/InvseeInventory.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/events/PlayerGetMapEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/ClansBlacklist.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/commands/AddBlacklistCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/repository/ClanNameBlacklistRepository.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/Portal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/SiegeManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/commands/CommandSiegeSupplies.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/LoadSiegeWeaponEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/MountSiegeWeaponEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/SiegeWeaponExplodeEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostState.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostType.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/build/OutpostBlock.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/build/OutpostBlockBanner.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/OutpostRepository.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/tokens/OutpostToken.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/tokens/SiegeWeaponToken.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/Crater.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/CraterBlock.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/ProjectileAttributes.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/ProjectileType.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/WeaponProjectile.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/event/PreCraterSetBlockEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/AccessRule.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/AccessType.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/BarrierCollisionBox.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/WeaponStateInfo.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/staff/SilentChestInventory.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/staff/SilentChestOpen.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/EnergyCrossbow.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/MeridianScepter.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/Crossbow.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RareItem.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialClient.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialTask.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/DoSkipTutorialCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/SkipTutorialCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskClaim.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskCreateClan.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskCustomizeClass.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskDisbandClan.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskEquipClass.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskExploreShops.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskLeaveSpawn.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskMakingMoney.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskSetHome.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskUseAbility.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskViewClanDetails.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskWelcome.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TutorialGettingStarted.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/message/ClansMessageManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/message/Message.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/tnt/TNTGenPage.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/tnt/TNTGenShop.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/texttutorial/ClassTutorial.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialRegion.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialSession.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialType.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialWorldManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/StartCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/TutorialSelectPage.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/TutorialShop.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/button/DeclineButton.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/button/StartButton.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/map/TutorialMapManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/map/TutorialMapRenderer.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/Objective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveData.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveListener.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/OrderedObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/OrderedObjectiveData.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/SingleObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/UnorderedObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/UnorderedObjectiveData.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClanObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClassesObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/EnergyObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FieldsObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FinalObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/PurchaseItemsObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ShopsObjective.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/HoldItemGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/BlowUpWallGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/ClanInfoGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/GetMapGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/LoadCannonGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/MountCannonGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/StealEnemyPotatoesGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/BuildHouseGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanDetailsGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanManagementGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/SetHomeGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/EquipDefaultBuildGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/OpenClassManagerGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/SelectBullsChargeGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/UseBullsChargeGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/BuyEnergyGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/GoToFieldsGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/IdentifyFieldsGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/MineDiamondsGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/SellDiamondsGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/TpClanHomeGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/GoToShopsGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/PurchaseGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/SellPotatoesGoal.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/repository/TutorialRepository.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/visual/VisualManager.java create mode 100644 Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/event/OpenClassShopEvent.java create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupportRepository.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/DefaultHashMap.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/DefaultHashMap.java new file mode 100644 index 000000000..142060041 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/DefaultHashMap.java @@ -0,0 +1,35 @@ +package mineplex.core.common; + +import java.util.HashMap; +import java.util.function.Function; + +public class DefaultHashMap +{ + private HashMap _map; + + private Function _defaultPopulator; + + public DefaultHashMap(Function defaultPopulator) + { + _map = new HashMap(); + + _defaultPopulator = defaultPopulator; + } + + public V get(K key) + { + _map.putIfAbsent(key, _defaultPopulator.apply(key)); + + return _map.get(key); + } + + public void put(K key, V value) + { + _map.put(key, value); + } + + public void remove(K key) + { + _map.remove(key); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/GsonLocation.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/GsonLocation.java new file mode 100644 index 000000000..2e4ac3446 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/GsonLocation.java @@ -0,0 +1,80 @@ +package mineplex.core.common; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; + +public class GsonLocation +{ + private String _world; + private double _posX; + private double _posY; + private double _posZ; + private float _yaw; + private float _pitch; + + public GsonLocation(Location location) + { + _world = location.getWorld().getName(); + _posX = location.getX(); + _posY = location.getY(); + _posZ = location.getZ(); + _yaw = location.getYaw(); + _pitch = location.getPitch(); + } + + public GsonLocation(String world, double x, double y, double z) + { + this(Bukkit.getWorld(world), x, y, z, .0f, .0f); + } + + public GsonLocation(String world, double x, double y, double z, float yaw, float pitch) + { + this(Bukkit.getWorld(world), x, y, z, yaw, pitch); + } + + public GsonLocation(World world, double x, double y, double z, float yaw, float pitch) + { + _world = world.getName(); + _posX = x; + _posY = y; + _posZ = z; + _yaw = yaw; + _pitch = pitch; + } + + public GsonLocation(double x, double y, double z) + { + this(x, y, z, .0f, .0f); + } + + public GsonLocation(double x, double y, double z, float yaw, float pitch) + { + this("world", x, y, z, yaw, pitch); + } + + public Location bukkit() + { + return new Location(Bukkit.getWorld(_world), _posX, _posY, _posZ); + } + + public String getWorld() + { + return _world; + } + + public double getX() + { + return _posX; + } + + public double getY() + { + return _posY; + } + + public double getZ() + { + return _posZ; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/MaterialData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/MaterialData.java new file mode 100644 index 000000000..cf8210198 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/MaterialData.java @@ -0,0 +1,46 @@ +package mineplex.core.common; + +import org.bukkit.Material; + +public class MaterialData +{ + private final Material _material; + private final byte _data; + + private MaterialData(Material material, byte data) + { + _material = material; + _data = data; + } + + public static MaterialData of(Material material) + { + return new MaterialData(material, (byte) 0); + } + + public static MaterialData of(Material material, byte data) + { + return new MaterialData(material, data); + } + + @Override + public boolean equals(Object o) + { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + MaterialData that = (MaterialData) o; + + if (_data != that._data) return false; + return _material == that._material; + + } + + @Override + public int hashCode() + { + int result = _material.hashCode(); + result = 31 * result + (int) _data; + return result; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/DataLocationMap.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/DataLocationMap.java new file mode 100644 index 000000000..147732edd --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/DataLocationMap.java @@ -0,0 +1,83 @@ +package mineplex.core.common.block; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.List; + +import org.bukkit.DyeColor; +import org.bukkit.Location; + +public class DataLocationMap +{ + private EnumMap> _goldDataMap; + private EnumMap> _ironDataMap; + private EnumMap> _spongeDataMap; + + public DataLocationMap() + { + _goldDataMap = new EnumMap<>(DyeColor.class); + _ironDataMap = new EnumMap<>(DyeColor.class); + _spongeDataMap = new EnumMap<>(DyeColor.class); + } + + public List getGoldLocations(DyeColor color) + { + List list = _goldDataMap.get(color); + return list == null ? Collections.emptyList() : list; + } + + public void addGoldLocation(DyeColor color, Location location) + { + if (_goldDataMap.containsKey(color)) + { + _goldDataMap.get(color).add(location); + } + else + { + List list = new ArrayList<>(); + list.add(location); + _goldDataMap.put(color, list); + } + } + + public List getIronLocations(DyeColor color) + { + List list = _ironDataMap.get(color); + return list == null ? Collections.emptyList() : list; + } + + public void addIronLocation(DyeColor color, Location location) + { + if (_ironDataMap.containsKey(color)) + { + _ironDataMap.get(color).add(location); + } + else + { + List list = new ArrayList<>(); + list.add(location); + _ironDataMap.put(color, list); + } + } + + public void addSpongeLocation(DyeColor color, Location location) { + if (_spongeDataMap.containsKey(color)) + { + _spongeDataMap.get(color).add(location); + } + else + { + List list = new ArrayList<>(); + list.add(location); + _spongeDataMap.put(color, list); + } + } + + public List getSpongeLocations(DyeColor color) + { + List list = _spongeDataMap.get(color); + return list == null ? Collections.emptyList() : list; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java new file mode 100644 index 000000000..4cf361fb6 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/events/PlayerRecieveBroadcastEvent.java @@ -0,0 +1,52 @@ +package mineplex.core.common.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerRecieveBroadcastEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private String _message; + + private boolean _cancelled; + + public PlayerRecieveBroadcastEvent(Player player, String message) + { + _player = player; + _message = message; + } + + public Player getPlayer() + { + return _player; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public String getMessage() + { + return _message; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/function/Result.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/function/Result.java new file mode 100644 index 000000000..cb45540e3 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/function/Result.java @@ -0,0 +1,7 @@ +package mineplex.core.common.function; + +@FunctionalInterface +public interface Result +{ + public void Get(T result); +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/generator/VoidGenerator.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/generator/VoidGenerator.java new file mode 100644 index 000000000..085678e9c --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/generator/VoidGenerator.java @@ -0,0 +1,15 @@ +package mineplex.core.common.generator; + +import java.util.Random; + +import org.bukkit.World; +import org.bukkit.generator.ChunkGenerator; + +public class VoidGenerator extends ChunkGenerator +{ + @Override + public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) + { + return createChunkData(world); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/EnclosedObject.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/EnclosedObject.java new file mode 100644 index 000000000..50f548a46 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/EnclosedObject.java @@ -0,0 +1,31 @@ +package mineplex.core.common.util; + +public class EnclosedObject +{ + private T _value; + + public EnclosedObject() + { + this((T) null); + } + + public EnclosedObject(T t) + { + _value = t; + } + + public T Get() + { + return _value; + } + + public T Set(T value) + { + return _value = value; + } + + public String toString() + { + return _value.toString(); + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapBuilder.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapBuilder.java new file mode 100644 index 000000000..5e54c7e0c --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapBuilder.java @@ -0,0 +1,27 @@ +package mineplex.core.common.util; + +import java.util.HashMap; +import java.util.Map; + +public class MapBuilder +{ + private Map _map; + + public MapBuilder() + { + _map = new HashMap<>(); + } + + public MapBuilder Put(K key, V value) + { + _map.put(key, value); + + return this; + } + + public Map GetMap() + { + return _map; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NumberFloater.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NumberFloater.java new file mode 100644 index 000000000..7a07934f5 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/NumberFloater.java @@ -0,0 +1,28 @@ +package mineplex.core.common.util; + +public class NumberFloater +{ + private double _min; + private double _max; + private double _modifyPerCall; + + private double _cur; + private boolean _up; + + public NumberFloater(double min, double max, double modify) + { + _min = min; + _max = max; + _modifyPerCall = modify; + } + + public double pulse() + { + if (_up && (_cur = UtilMath.clamp(_cur += _modifyPerCall, _min, _max)) >= _max) + _up = false; + else if ((_cur = UtilMath.clamp(_cur -= _modifyPerCall, _min, _max)) <= _min) + _up = true; + + return _cur; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilCollections.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilCollections.java new file mode 100644 index 000000000..d2eef098c --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilCollections.java @@ -0,0 +1,278 @@ +package mineplex.core.common.util; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Function; + +import com.google.common.collect.Lists; + +public class UtilCollections +{ + public static Random Random = new Random(); + + @SafeVarargs + public static NautArrayList newNautList(E... elements) + { + return new NautArrayList(elements); + } + + public static NautArrayList newNautList() + { + return new NautArrayList(); + } + + public static NautHashMap newNautMap(K[] keys, V[] values) + { + return new NautHashMap(keys, values); + } + + public static NautHashMap newNautMap() + { + return new NautHashMap(); + } + + public static T getLast(List list) + { + return list.isEmpty() ? null : list.get(list.size() - 1); + } + + public static T getFirst(List list) + { + return list.isEmpty() ? null : list.get(0); + } + + public static T getLast(NautArrayList list) + { + return list.isEmpty() ? null : list.get(list.size() - 1); + } + + public static T getFirst(NautArrayList list) + { + return list.isEmpty() ? null : list.get(0); + } + + public static void forEach(E[] elements, Function filter, Consumer consumer) + { + for (int i = 0; i < elements.length; i++) + { + consumer.accept(filter.apply(elements[i])); + } + } + + public static void forEach(E[] elements, Consumer consumer) + { + for (int i = 0; i < elements.length; i++) + { + consumer.accept(elements[i]); + } + } + + public static void forEach(E[] elements, BiConsumer consumer) + { + for (int i = 0; i < elements.length; i++) + { + consumer.accept(Integer.valueOf(i), elements[i]); + } + } + + public static void addAll(E[] elements, Collection collection) + { + forEach(elements, collection::add); + } + + public static void loop(int min, int max, Consumer consumer) + { + for (int i = min; i < max; i++) + { + consumer.accept(Integer.valueOf(i)); + } + } + + public static byte[] ensureSize(byte[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static boolean[] ensureSize(boolean[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static int[] ensureSize(int[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static long[] ensureSize(long[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static short[] ensureSize(short[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static char[] ensureSize(char[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static float[] ensureSize(float[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static double[] ensureSize(double[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static T[] ensureSize(T[] array, int size) + { + if (array.length <= size) + { + return array; + } + + return Arrays.copyOf(array, size); + } + + public static byte random(byte[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static short random(short[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static char random(char[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static boolean random(boolean[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static int random(int[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static long random(long[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static double random(double[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static float random(float[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static T random(T[] array) + { + return array[Random.nextInt(array.length)]; + } + + public static List toList(T[] array) + { + return Lists.newArrayList(array); + } + + public static boolean equal(T1[] array1, T2[] array2) + { + return Arrays.equals(array1, array2); + } + + public static void ForEach(List list, Consumer consumer) + { + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) + { + consumer.accept(iterator.next()); + } + } + + @SafeVarargs + public static List newList(X... elements) + { + return toList(elements); + } + + public static String combine(X[] data, String delimiter) + { + StringBuilder total = new StringBuilder(); + + int loops = 0; + + for (X x : data) + { + if (delimiter != null && loops != 0) + { + total.append(delimiter); + } + + total.append(x.toString()); + + loops++; + } + + return total.toString(); + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilOfflinePlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilOfflinePlayer.java new file mode 100644 index 000000000..cbc537082 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilOfflinePlayer.java @@ -0,0 +1,29 @@ +package mineplex.core.common.util; + +import java.io.File; +import java.io.FileInputStream; + +import org.bukkit.inventory.ItemStack; + +import com.java.sk89q.jnbt.NBTInputStream; +import com.java.sk89q.jnbt.NamedTag; + +public class UtilOfflinePlayer +{ + public static ItemStack loadOfflineInventory(File file) + { + try (NBTInputStream stream = new NBTInputStream(new FileInputStream(file))) + { + NamedTag tag = stream.readNamedTag(); + + System.out.println(tag); + + } + catch (Exception e) + { + e.printStackTrace(); + } + + return null; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilStreams.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilStreams.java new file mode 100644 index 000000000..4fea3c6de --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilStreams.java @@ -0,0 +1,58 @@ +package mineplex.core.common.util; + +import java.io.DataInputStream; +import java.io.IOException; +import java.util.stream.Stream; + +import org.apache.commons.lang.Validate; + +public class UtilStreams +{ + public static boolean IsEmpty(Stream stream) + { + return Sum(stream) != 0; + } + + public static int Sum(Stream stream) + { + return stream.mapToInt(v -> 1).sum(); + } + + public static Object[] ToArray(Stream stream) + { + return stream.toArray(); + } + + public static T Get(int index, Stream stream) + { + if (Sum(stream) < index + 1) + { + return null; + } + + return (T) ToArray(stream)[index]; + } + + public static T GetFirst(Stream stream) + { + return Get(0, stream); + } + + public static T GetLast(Stream stream) + { + return Get(Sum(stream) + 1, stream); + } + + public static byte[] ReadBytes(DataInputStream dos, int bytes) throws IOException + { + Validate.isTrue(bytes > 0, "Amount of bytes to read must be > 0"); + + byte[] read = new byte[bytes]; + + for (int i = 0; i < bytes; i++) + read[i] = dos.readByte(); + + return read; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTrig.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTrig.java new file mode 100644 index 000000000..5eb5311f5 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTrig.java @@ -0,0 +1,80 @@ +package mineplex.core.common.util; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.util.Vector; + +public class UtilTrig +{ + public static List GetCirclePoints(Vector origin, int points, double radius) + { + List list = new LinkedList<>(); + + double slice = 2 * Math.PI / points; + + for (int point = 0; point < points; point++) + { + double angle = slice * point; + list.add(new Vector(origin.getX() + radius * Math.cos(angle), 0, origin.getZ() + radius * Math.sin(angle))); + } + + return list; + } + + public static ArrayList GetSpherePoints(Location loc, double radius, double height, boolean hollow, double addition) + { + ArrayList circleblocks = new ArrayList(); + double cx = loc.getBlockX(); + double cy = loc.getBlockY(); + double cz = loc.getBlockZ(); + + for (double y = cy - radius; y < cy + radius; y += addition) + { + for (double x = cx - radius; x <= cx + radius; x += addition) + { + for (double z = cz - radius; z <= cz + radius; z += addition) + { + double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (cy - y) * (cy - y); + + if (dist < radius * radius && !(hollow && dist < (radius - 1) * (radius - 1))) + { + Location l = new Location(loc.getWorld(), x, y, z); + circleblocks.add(l); + } + } + } + } + + return circleblocks; + } + + public static List GetSpherePoints(Vector vector, double radius, double height, boolean hollow, double addition) + { + List circleblocks = new ArrayList<>(); + double cx = vector.getX(); + double cy = vector.getY(); + double cz = vector.getZ(); + + for (double y = cy - radius; y < cy + radius; y += addition) + { + for (double x = cx - radius; x <= cx + radius; x += addition) + { + for (double z = cz - radius; z <= cz + radius; z += addition) + { + double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (cy - y) * (cy - y); + + if (dist < radius * radius && !(hollow && dist < (radius - 1) * (radius - 1))) + { + Vector l = new Vector(x, y, z); + circleblocks.add(l); + } + } + } + } + + return circleblocks; + } +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWeb.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWeb.java new file mode 100644 index 000000000..5b45d1913 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWeb.java @@ -0,0 +1,58 @@ +package mineplex.core.common.util; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.Reader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Map; + +public class UtilWeb +{ + public static String doPOST(String url, Map params) + { + try + { + StringBuilder postData = new StringBuilder(); + for (Map.Entry param : params.entrySet()) + { + if (postData.length() != 0) + { + postData.append('&'); + } + + postData.append(URLEncoder.encode(param.getKey(), "UTF-8")); + postData.append('='); + postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8")); + } + + byte[] postDataBytes = postData.toString().getBytes("UTF-8"); + + HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length)); + conn.setDoOutput(true); + conn.getOutputStream().write(postDataBytes); + + Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); + + StringBuilder back = new StringBuilder(); + + for (int $char; ($char = in.read()) >= 0;) + { + back.append((char) $char); + } + + return back.toString(); + } + catch (Exception exception) + { + exception.printStackTrace(); + + return null; + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/FilterPriority.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/FilterPriority.java new file mode 100644 index 000000000..71aae5059 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/FilterPriority.java @@ -0,0 +1,7 @@ +package mineplex.core.chat; + +public enum FilterPriority +{ + HIGH, + LOW; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fallingblock/FallingBlocks.java b/Plugins/Mineplex.Core/src/mineplex/core/fallingblock/FallingBlocks.java new file mode 100644 index 000000000..46b462c17 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/fallingblock/FallingBlocks.java @@ -0,0 +1,62 @@ +package mineplex.core.fallingblock; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.FallingBlock; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; + +public class FallingBlocks extends MiniPlugin +{ + public static FallingBlocks Instance; + + private static final String METADATA = "FALLING_BLOCK_SPECIAL"; + + public FallingBlocks(JavaPlugin plugin) + { + super("Falling Blocks", plugin); + + Instance = this; + } + + public void Spawn(Location location, Material type, byte data, Location center) + { + Vector vec = UtilAlg.getTrajectory(center, location); + + if (vec.getY() < 0) + { + vec.setY(vec.getY() * -1); + } + + Spawn(location, type, data, vec); + } + + public void Spawn(Location location, Material type, byte data, Vector velocity) + { + FallingBlock fall = location.getWorld().spawnFallingBlock(location.add(0.5, 0.5, 0.5), type, data); + fall.setDropItem(false); + + UtilAction.velocity(fall, velocity, 0.5 + 0.25 * Math.random(), false, 0, 0.4 + 0.20 * Math.random(), 10, false); + + fall.setMetadata(METADATA, new FixedMetadataValue(_plugin, "x")); + UtilEnt.SetMetadata(fall, METADATA, "x"); + } + + @EventHandler + public void BlockFall(EntityChangeBlockEvent event) + { + if (event.getEntity().hasMetadata(METADATA)) + { + event.getEntity().remove(); + event.setCancelled(true); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java new file mode 100644 index 000000000..91d873faa --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java @@ -0,0 +1,169 @@ +package mineplex.core.incognito; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.base.Function; + +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.incognito.commands.IncognitoToggleCommand; +import mineplex.core.incognito.events.IncognitoHidePlayerEvent; +import mineplex.core.incognito.events.IncognitoStatusChangeEvent; +import mineplex.core.incognito.repository.IncognitoClient; +import mineplex.core.incognito.repository.IncognitoRepository; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class IncognitoManager extends MiniDbClientPlugin +{ + private CoreClientManager _clientManager; + private IncognitoRepository _repository; + + public IncognitoManager(JavaPlugin plugin, CoreClientManager clientManager, PacketHandler packetHandler) + { + super("Incognito", plugin, clientManager); + + _repository = new IncognitoRepository(this); + _clientManager = clientManager; + } + + public void addCommands() + { + addCommand(new IncognitoToggleCommand(this)); + } + + public boolean toggle(Player caller) + { + boolean enabled = !Get(caller).Status; + + IncognitoStatusChangeEvent event = UtilServer.CallEvent(new IncognitoStatusChangeEvent(caller, enabled)); + + if (event.isCancelled()) + { + return false; + } + + Get(caller).Status = enabled; + + if (!enabled) + { + if (event.doShow()) + { + for (Player other : UtilServer.getPlayers()) + { + other.showPlayer(caller); + } + } + } + else + { + IncognitoHidePlayerEvent customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(caller)); + + if (!customEvent.isCancelled()) + { + UtilServer.getPlayersCollection().forEach(player -> { + player.hidePlayer(caller); + }); + } + } + + runAsync(() -> _repository.setStatus(_clientManager.getAccountId(caller), enabled)); + + return enabled; + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Join(PlayerJoinEvent event) + { + if (Get(event.getPlayer()).Status) + { + event.setJoinMessage(null); + informIncognito(event.getPlayer()); + } + + IncognitoHidePlayerEvent customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(event.getPlayer())); + + UtilServer.getPlayersCollection().forEach(player -> { + if (!customEvent.isCancelled() && Get(event.getPlayer()).Status && !_clientManager.hasRank(player, _clientManager.Get(event.getPlayer()).GetRank())) + { + player.hidePlayer(event.getPlayer()); + } + + if (Get(player).Status) + { + IncognitoHidePlayerEvent customEvent2 = UtilServer.CallEvent(new IncognitoHidePlayerEvent(player)); + + if (!customEvent2.isCancelled() && !_clientManager.hasRank(event.getPlayer(), _clientManager.Get(player).GetRank())) + { + event.getPlayer().hidePlayer(player); + } + } + }); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Quit(PlayerQuitEvent event) + { + if (Get(event.getPlayer()).Status) + { + event.setQuitMessage(null); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Kick(PlayerKickEvent event) + { + if (Get(event.getPlayer()).Status) + { + event.setLeaveMessage(null); + } + } + + private void informIncognito(Player player) + { + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cGoldB + "You are currently incognito."); + UtilPlayer.message(player, C.cYellow + "This means you are invisible to all except for those who are " + _clientManager.Get(player).GetRank().getTag(true, false) + C.mBody + "+"); + UtilPlayer.message(player, " "); + } + + protected IncognitoClient AddPlayer(String player) + { + return new IncognitoClient(); + } + + public IncognitoRepository getRepository() + { + return _repository; + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT * FROM incognitoStaff WHERE accountId = " + accountId + ";"; + } + + @Override + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + Get(playerName).Status = resultSet.getInt("status") == 1; + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java new file mode 100644 index 000000000..23f54dca7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java @@ -0,0 +1,30 @@ +package mineplex.core.incognito.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.incognito.IncognitoManager; + +public class IncognitoToggleCommand extends CommandBase +{ + public IncognitoToggleCommand(IncognitoManager plugin) + { + super(plugin, Rank.HELPER, "incognito", "vanish"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (Plugin.toggle(caller)) + { + UtilPlayer.message(caller, F.main("Incognito", "You are now incognito. Your status will only change when you run " + F.elem(AliasUsed) + " again.")); + } + else + { + UtilPlayer.message(caller, F.main("Incognito", "You are no longer incognito. Your status will only change when you run " + F.elem(AliasUsed) + " again.")); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/events/IncognitoStatusChangeEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/events/IncognitoStatusChangeEvent.java new file mode 100644 index 000000000..79e3291ee --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/events/IncognitoStatusChangeEvent.java @@ -0,0 +1,64 @@ +package mineplex.core.incognito.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class IncognitoStatusChangeEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private boolean _newState; + + private boolean _cancelled; + + private boolean _show = true; + + public IncognitoStatusChangeEvent(Player player, boolean newState) + { + _player = player; + _newState = newState; + } + + public boolean getNewState() + { + return _newState; + } + + public Player getPlayer() + { + return _player; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public void show(boolean show) + { + _show = show; + } + + public boolean doShow() + { + return _show; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoClient.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoClient.java new file mode 100644 index 000000000..18382fd22 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoClient.java @@ -0,0 +1,6 @@ +package mineplex.core.incognito.repository; + +public class IncognitoClient +{ + public boolean Status; +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoRepository.java new file mode 100644 index 000000000..b27472430 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/repository/IncognitoRepository.java @@ -0,0 +1,33 @@ +package mineplex.core.incognito.repository; + +import mineplex.core.database.MinecraftRepository; +import mineplex.core.incognito.IncognitoManager; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.column.ColumnInt; + +public class IncognitoRepository extends MinecraftRepository +{ + private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS incognitoStaff (accountId INT NOT NULL, status TINYINT(1) DEFAULT '0', PRIMARY KEY (accountId));"; + private static final String INSERT_STATUS = "INSERT INTO incognitoStaff (accountId, status) VALUES (?, ?);"; + private static final String UPDATE_STATUS = "UPDATE incognitoStaff SET status=? WHERE accountId=?;"; + + public IncognitoRepository(IncognitoManager incognitoManager) + { + super(incognitoManager.getPlugin(), DBPool.getAccount()); + } + + public void setStatus(int accountId, boolean status) + { + if (executeUpdate(UPDATE_STATUS, new ColumnInt("status", status ? 1 : 0), new ColumnInt("accountId", accountId)) <= 0) + executeInsert(INSERT_STATUS, null, new ColumnInt("accountId", accountId), new ColumnInt("status", status ? 1 : 0)); + } + + protected void initialize() + { + executeUpdate(CREATE_TABLE); + } + + protected void update() + { + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java new file mode 100644 index 000000000..57c4d924c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/TextTutorialManager.java @@ -0,0 +1,154 @@ +package mineplex.core.texttutorial; + +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Sound; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import mineplex.core.task.TaskManager; +import mineplex.core.texttutorial.tutorial.Tutorial; +import mineplex.core.texttutorial.tutorial.TutorialData; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class TextTutorialManager extends MiniPlugin +{ + private DonationManager _donationManager; + private TaskManager _taskManager; + + private HashSet _tutorials; + + public TextTutorialManager(JavaPlugin plugin, DonationManager donationManager, TaskManager taskManager) + { + super("Text Tutorial", plugin); + + _donationManager = donationManager; + _taskManager = taskManager; + } + + @EventHandler + public void startTutorial(PlayerInteractEntityEvent event) + { + if (isInTutorial(event.getPlayer())) + return; + + if (!(event.getRightClicked() instanceof LivingEntity)) + return; + + LivingEntity ent = (LivingEntity)event.getRightClicked(); + + String name = ent.getCustomName(); + if (name == null) + return; + + for (Tutorial tut : _tutorials) + { + if (name.contains(tut.getName())) + { + UtilPlayer.message(event.getPlayer(), F.main("Tutorial", "You started " + F.elem(tut.getName()) + ".")); + tut.startTutorial(event.getPlayer()); + return; + } + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (final Tutorial tut : _tutorials) + { + Iterator iterator = tut.getTutorialDatas().iterator(); + while (iterator.hasNext()) + { + TutorialData data = iterator.next(); + final Player player = data.getPlayer(); + + //Check if Phase Completed + if (data.tick()) + { + //Next Phase + if (data.getPhaseStep() < tut.getPhaseSize()) + { + data.setNextPhase(tut.getPhase(data.getPhaseStep())); + } + //End Tutorial + else + { + iterator.remove(); + + //Inform + UtilPlayer.message(player, F.main("Tutorial", "You completed " + F.elem(tut.getName()) + ".")); + + //Gems + if (tut.getGemReward() > 0) + { + if (!_taskManager.hasCompletedTask(player, tut.getTaskId())) + { + _taskManager.completedTask(new Callback() + { + public void run(Boolean completed) + { + _donationManager.RewardGems(new Callback() + { + public void run(Boolean completed) + { + if (completed) + { + UtilPlayer.message(player, F.main("Tutorial", "You received " + F.elem(C.cGreen + tut.getGemReward() + " Gems") + ".")); + + //Sound + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); + } + } + }, "Tutorial " + tut.getName(), player.getName(), player.getUniqueId(), tut.getGemReward()); + } + }, player, tut.getTaskId()); + } + } + } + } + } + } + } + + @EventHandler + public void playerQuit(PlayerQuitEvent event) + { + for (Tutorial tut : _tutorials) + tut.stopTutorial(event.getPlayer()); + } + + @EventHandler + public void cancelInteract(PlayerInteractEvent event) + { + if (isInTutorial(event.getPlayer())) + event.setCancelled(true); + } + + public boolean isInTutorial(Player player) + { + for (Tutorial tutorial : _tutorials) + { + if (tutorial.isInTutorial(player)) + return true; + } + + return false; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Phase.java b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Phase.java new file mode 100644 index 000000000..7cd9a80a9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Phase.java @@ -0,0 +1,47 @@ +package mineplex.core.texttutorial.tutorial; + +import org.bukkit.Location; + +public class Phase +{ + private Location _location; + private String _header; + private String[] _text; + + public Phase(Location location, String header, String[] text) + { + _location = location; + _header = header; + _text = text; + } + + public Location getLocation() + { + return _location; + } + + public void setLocation(Location location) + { + _location = location; + } + + public String getHeader() + { + return _header; + } + + public void setHeader(String header) + { + _header = header; + } + + public String[] getText() + { + return _text; + } + + public void setText(String[] text) + { + _text = text; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Tutorial.java b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Tutorial.java new file mode 100644 index 000000000..362139c9c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/Tutorial.java @@ -0,0 +1,74 @@ +package mineplex.core.texttutorial.tutorial; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; + +import org.bukkit.entity.Player; + +public abstract class Tutorial +{ + private String _name; + private String _taskId; + private int _gemReward; + + private ArrayList _phases; + private HashMap _playerMap; + + public Tutorial(String name, String taskId, int gemReward) + { + _name = name; + _taskId = taskId; + _gemReward = gemReward; + } + + public String getName() + { + return _name; + } + + public String getTaskId() + { + return _taskId; + } + + public void startTutorial(Player player) + { + _playerMap.put(player, new TutorialData(player, _phases.get(0))); + } + + public void stopTutorial(Player player) + { + _playerMap.remove(player); + } + + public boolean isInTutorial(Player player) + { + return _playerMap.containsKey(player); + } + + protected void addPhase(Phase phase) + { + _phases.add(phase); + } + + public Collection getTutorialDatas() + { + return _playerMap.values(); + } + + public Phase getPhase(int phaseIndex) + { + return _phases.get(phaseIndex); + } + + public int getPhaseSize() + { + return _phases.size(); + } + + public int getGemReward() + { + return _gemReward; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/TutorialData.java b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/TutorialData.java new file mode 100644 index 000000000..fdad7738f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/texttutorial/tutorial/TutorialData.java @@ -0,0 +1,102 @@ +package mineplex.core.texttutorial.tutorial; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; + +public class TutorialData +{ + private Player _player; + private Phase _phase; + private int _phaseStep; + private int _textStep; + private long _sleep; + + public TutorialData(Player player, Phase startPhase) + { + _player = player; + _phase = startPhase; + _phaseStep = 0; + _textStep = 0; + _sleep = System.currentTimeMillis() + 3000; + } + + public boolean tick() + { + if (!_player.getLocation().equals(_phase.getLocation())) + _player.teleport(_phase.getLocation()); + + if (System.currentTimeMillis() < _sleep) + return false; + + if (_textStep >= _phase.getText().length) + { + // No more text to display, move to next phase + _phaseStep++; + _sleep = System.currentTimeMillis() + 2000; + + return true; + } + + // Display Text + String text = _phase.getText()[_textStep]; + + UtilPlayer.message(_player, " "); + UtilPlayer.message(_player, " "); + UtilPlayer.message(_player, " "); + UtilPlayer.message(_player, C.cGreen + C.Strike + C.Bold + "========================================"); + UtilPlayer.message(_player, C.cGold + C.Bold + _phase.getHeader()); + UtilPlayer.message(_player, " "); + + for (int i=0 ; i<=_textStep ; i++) + UtilPlayer.message(_player, " " + _phase.getText()[i]); + + for (int i=_textStep ; i<=5 ; i++) + UtilPlayer.message(_player, " "); + + UtilPlayer.message(_player, C.cGreen + C.Strike + C.Bold + "========================================"); + + if (text.length() > 0) + { + _player.playSound(_player.getLocation(), Sound.ORB_PICKUP, 2f, 1.5f); + _sleep = System.currentTimeMillis() + 1000 + (50*text.length()); + } + else + { + _sleep = System.currentTimeMillis() + 600; + } + + _textStep++; + + return false; + } + + public void setNextPhase(Phase phase) + { + _phase = phase; + _textStep = 0; + _player.teleport(_phase.getLocation()); + } + + public Phase getPhase() + { + return _phase; + } + + public long getSleep() + { + return _sleep; + } + + public int getPhaseStep() + { + return _phaseStep; + } + + public Player getPlayer() + { + return _player; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansBetaManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansBetaManager.java new file mode 100644 index 000000000..a669ca6f4 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansBetaManager.java @@ -0,0 +1,27 @@ +package mineplex.game.clans.clans; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.task.TaskManager; +import mineplex.game.clans.Clans; + +public class ClansBetaManager extends MiniPlugin +{ + public ClansBetaManager(ClansManager manager, TaskManager taskManager) + { + super("Clans Beta", manager.getPlugin()); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerJoin(final PlayerJoinEvent event) + { + UtilPlayer.message(event.getPlayer(), C.cDAquaB + "Welcome to Mineplex Clans " + Clans.VERSION); + + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/QueryCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/QueryCommand.java new file mode 100644 index 000000000..8e95c06e0 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/QueryCommand.java @@ -0,0 +1,53 @@ +package mineplex.game.clans.clans.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.database.MinecraftRepository; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.RepositoryBase; + +public class QueryCommand extends CommandBase +{ + private ClansManager _clansManager; + + public QueryCommand(ClansManager plugin) + { + super(plugin, Rank.JNR_DEV, "query"); + _clansManager = plugin; + } + + @Override + public void Execute(final Player caller, String[] args) + { + if (args.length == 0) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Query missing.")); + return; + } + + final String query = F.combine(args, 0, null, false); + + new MinecraftRepository(Plugin.getPlugin(), DBPool.getAccount()) { + protected void initialize() + { + executeUpdate(query); + } + + protected void update() + { + } + }; + } + + public static void message(Player player, String message) + { + UtilPlayer.message(player, F.main("Clans", message)); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanCreationCompleteEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanCreationCompleteEvent.java new file mode 100644 index 000000000..789e55d21 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClanCreationCompleteEvent.java @@ -0,0 +1,194 @@ +package mineplex.game.clans.clans.event; + +import java.sql.Timestamp; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.game.clans.core.repository.tokens.ClanToken; + +public class ClanCreationCompleteEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _founder; + private int _id; + private String _name; + private String _description; + private String _home; + private boolean _admin; + private int _energy; + private int _kills; + private int _murders; + private int _deaths; + private int _warWins; + private int _warLosses; + private Timestamp _dateCreated; + private Timestamp _lastOnline; + + public ClanCreationCompleteEvent(ClanToken token, Player founder) + { + _founder = founder; + + _id = token.Id; + _name = token.Name; + _description = token.Description; + _home = token.Home; + _admin = token.Admin; + _energy = token.Energy; + _kills = token.Kills; + _murders = token.Murder; + _deaths = token.Deaths; + _warWins = token.WarWins; + _warLosses = token.WarLosses; + _dateCreated = token.DateCreated; + _lastOnline = token.LastOnline; + } + + public Player getFounder() + { + return _founder; + } + + public int getId() + { + return _id; + } + + public void setId(int id) + { + _id = id; + } + + public String getName() + { + return _name; + } + + public void setName(String name) + { + _name = name; + } + + public String getDescription() + { + return _description; + } + + public void setDescription(String description) + { + _description = description; + } + + public String getHome() + { + return _home; + } + + public void setHome(String home) + { + _home = home; + } + + public boolean isAdmin() + { + return _admin; + } + + public void setAdmin(boolean admin) + { + _admin = admin; + } + + public int getEnergy() + { + return _energy; + } + + public void setEnergy(int energy) + { + _energy = energy; + } + + public int getKills() + { + return _kills; + } + + public void setKills(int kills) + { + _kills = kills; + } + + public int getMurders() + { + return _murders; + } + + public void setMurders(int murders) + { + _murders = murders; + } + + public int getDeaths() + { + return _deaths; + } + + public void setDeaths(int deaths) + { + _deaths = deaths; + } + + public int getWarWins() + { + return _warWins; + } + + public void setWarWins(int warWins) + { + _warWins = warWins; + } + + public int getWarLosses() + { + return _warLosses; + } + + public void setWarLosses(int warLosses) + { + _warLosses = warLosses; + } + + public Timestamp getDateCreated() + { + return _dateCreated; + } + + public void setDateCreated(Timestamp dateCreated) + { + _dateCreated = dateCreated; + } + + public Timestamp getLastOnline() + { + return _lastOnline; + } + + public void setLastOnline(Timestamp lastOnline) + { + _lastOnline = lastOnline; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClansCommandPreExecutedEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClansCommandPreExecutedEvent.java new file mode 100644 index 000000000..5c8695c35 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClansCommandPreExecutedEvent.java @@ -0,0 +1,68 @@ +package mineplex.game.clans.clans.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClansCommandPreExecutedEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private String[] _args; + + private boolean _cancelled; + + public ClansCommandPreExecutedEvent(Player player, String... args) + { + _player = player; + _args = args; + } + + public ClansCommandPreExecutedEvent(Player player, Object... args) + { + _player = player; + + String[] strArgs = new String[args != null ? args.length : 0]; + + int index = 0; + for (Object obj : args) + { + strArgs[index] = obj.toString(); + + index++; + } + + _args = strArgs; + } + + public Player getPlayer() + { + return _player; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public String[] getArguments() + { + return _args; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClansWaterPlaceEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClansWaterPlaceEvent.java new file mode 100644 index 000000000..c6826eeef --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/ClansWaterPlaceEvent.java @@ -0,0 +1,53 @@ +package mineplex.game.clans.clans.event; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClansWaterPlaceEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private Block _block; + + private boolean _cancelled; + + public ClansWaterPlaceEvent(Player player, Block block) + { + _player = player; + _block = block; + } + + public Player getPlayer() + { + return _player; + } + + public Block getBlock() + { + return _block; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PreEnergyShopBuyEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PreEnergyShopBuyEvent.java new file mode 100644 index 000000000..6c0af3913 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PreEnergyShopBuyEvent.java @@ -0,0 +1,58 @@ +package mineplex.game.clans.clans.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PreEnergyShopBuyEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private boolean _cancelled; + + private Player _player; + private int _energy; + private int _cost; + + public PreEnergyShopBuyEvent(Player player, int energy, int cost) + { + _player = player; + _energy = energy; + _cost = cost; + } + + public Player getPlayer() + { + return _player; + } + + public int getCost() + { + return _cost; + } + + public int getEnergy() + { + return _energy; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/events/ClansButtonClickEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/events/ClansButtonClickEvent.java new file mode 100644 index 000000000..844a1159b --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/events/ClansButtonClickEvent.java @@ -0,0 +1,67 @@ +package mineplex.game.clans.clans.gui.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ClansButtonClickEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private ButtonType _type; + + private boolean _cancelled; + + public ClansButtonClickEvent(Player player, ButtonType type) + { + _player = player; + _type = type; + } + + public Player getPlayer() + { + return _player; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public ButtonType getButtonType() { + return _type; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + + public enum ButtonType + { + AddAlly, + AddTrusted, + AddWar, + Create, + Disband, + Energy, + Invite, + Join, + Leave, + Member, + Territory, + Who; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/Invsee.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/Invsee.java new file mode 100644 index 000000000..3409089ea --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/Invsee.java @@ -0,0 +1,23 @@ +package mineplex.game.clans.clans.invsee; + +import mineplex.core.MiniPlugin; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.invsee.commands.InvseeCommand; + +public class Invsee extends MiniPlugin +{ + private ClansManager _clansManager; + + public Invsee(ClansManager clansManager) + { + super("Inventory Viewer", clansManager.getPlugin()); + + _clansManager = clansManager; + } + + public void addCommands() + { + addCommand(new InvseeCommand(this)); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/commands/InvseeCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/commands/InvseeCommand.java new file mode 100644 index 000000000..a4fd436bd --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/commands/InvseeCommand.java @@ -0,0 +1,54 @@ +package mineplex.game.clans.clans.invsee.commands; + +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.invsee.Invsee; +import mineplex.game.clans.clans.invsee.ui.InvseeInventory; + +public class InvseeCommand extends CommandBase +{ + public InvseeCommand(Invsee plugin) + { + super(plugin, Rank.ADMIN, "invsee"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args.length == 0) + { + + } + else + { + String name = args[0]; + + OfflinePlayer player; + + if (UtilServer.IsOnline(name)) + { + player = UtilServer.GetPlayer(name); + } + else + { + player = UtilServer.GetOffline(name); + } + + if (player == null) + { + UtilPlayer.message(caller, F.main("Clans", "Specified player is neither online nor is offline. Perhaps they changed their name?")); + return; + } + + new InvseeInventory(player).ShowTo(caller); + } + } + + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/ui/InvseeInventory.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/ui/InvseeInventory.java new file mode 100644 index 000000000..eb605e17b --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/invsee/ui/InvseeInventory.java @@ -0,0 +1,99 @@ +package mineplex.game.clans.clans.invsee.ui; + +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilCollections; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class InvseeInventory implements Listener +{ + private OfflinePlayer _player; + private Inventory _inventory; + + private boolean _online; + + private Player _admin; + + public InvseeInventory(OfflinePlayer player) + { + _online = (_player = player) instanceof Player; + + _inventory = UtilServer.getServer().createInventory(null, 54, player.getName() + " " + (_online ? C.cGreen + "ONLINE" : C.cRed + "OFFLINE")); + + UtilServer.RegisterEvents(this); + } + + public void ShowTo(Player admin) + { + _admin = admin; + admin.openInventory(_inventory); + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + if (_online && event.getPlayer().equals(_player)) + { + _admin.closeInventory(); + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (_online) + { + if (!UtilCollections.equal(_inventory.getContents(), ((Player) _player).getInventory().getContents())) + { + _inventory.setContents(((Player) _player).getInventory().getContents()); + } + } + } + + @EventHandler + public void inventoryClick(InventoryClickEvent event) + { + if (event.getClickedInventory().equals(((Player) _player).getInventory())) + { + _inventory.setContents(((Player) _player).getInventory().getContents()); + } + else if (event.getClickedInventory().equals(_inventory)) + { + if (_online) + { + ((Player) _player).getInventory().setContents(_inventory.getContents()); + } + } + } + + @EventHandler + public void closeInventory(InventoryCloseEvent event) + { + if (event.getInventory().equals(_inventory)) + { + UtilServer.Unregister(this); + + if (!_online) + { + // save offline inv + } + } + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/events/PlayerGetMapEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/events/PlayerGetMapEvent.java new file mode 100644 index 000000000..5e5bccc4a --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/events/PlayerGetMapEvent.java @@ -0,0 +1,44 @@ +package mineplex.game.clans.clans.map.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerGetMapEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + + private boolean _cancelled; + + public PlayerGetMapEvent(Player player) + { + _player = player; + } + + public Player getPlayer() + { + return _player; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/ClansBlacklist.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/ClansBlacklist.java new file mode 100644 index 000000000..3cdc005f9 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/ClansBlacklist.java @@ -0,0 +1,62 @@ +package mineplex.game.clans.clans.nameblacklist; + +import java.util.List; + +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.nameblacklist.commands.AddBlacklistCommand; +import mineplex.game.clans.clans.nameblacklist.repository.ClanNameBlacklistRepository; + +public class ClansBlacklist extends MiniPlugin +{ + private List _blacklist; + private ClanNameBlacklistRepository _repository; + + public ClansBlacklist(JavaPlugin plugin) + { + super("Clan Name Blacklist", plugin); + + _repository = new ClanNameBlacklistRepository(plugin, this); + + runAsync(() -> _repository.loadNames(this::setBlacklist)); + } + + // Fetch new blacklisted clans every 16 seconds (in case someone blacklists a clan name on a different server) + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() == UpdateType.SLOWER) + { + runAsync(() -> _repository.loadNames(this::setBlacklist)); + } + } + + private void setBlacklist(List blacklist) + { + _blacklist = blacklist; + } + + public boolean allowed(String name) + { + return !_blacklist.contains(name.toLowerCase()); + } + + public void add(String name) + { + _blacklist.add(name); + } + + public void addCommands() + { + addCommand(new AddBlacklistCommand(this)); + } + + public ClanNameBlacklistRepository getRepository() + { + return _repository; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/commands/AddBlacklistCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/commands/AddBlacklistCommand.java new file mode 100644 index 000000000..e05417ff5 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/commands/AddBlacklistCommand.java @@ -0,0 +1,40 @@ +package mineplex.game.clans.clans.nameblacklist.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.nameblacklist.ClansBlacklist; + +public class AddBlacklistCommand extends CommandBase +{ + public AddBlacklistCommand(ClansBlacklist plugin) + { + super(plugin, Rank.CMOD, "blacklistname"); + } + + @Override + public void Execute(final Player caller, String[] args) + { + if (args == null || args.length < 1) + { + UtilPlayer.message(caller, C.cGold + "/blacklistname - Blacklists a clan name."); + } + else if (args.length >= 1) + { + final String blacklist = args[0]; + + Plugin.runAsync(() -> { + Plugin.getRepository().add(blacklist, caller.getName()); + UtilPlayer.message(caller, F.main("Clans", "Successfully added " + F.elem(blacklist) + " to the clan name blacklist.")); + }); + } + else + { + UtilPlayer.message(caller, C.cGold + "/blacklistname - Blacklists a clan name."); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/repository/ClanNameBlacklistRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/repository/ClanNameBlacklistRepository.java new file mode 100644 index 000000000..2b011adc7 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nameblacklist/repository/ClanNameBlacklistRepository.java @@ -0,0 +1,75 @@ +package mineplex.game.clans.clans.nameblacklist.repository; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.Callback; +import mineplex.core.database.MinecraftRepository; +import mineplex.game.clans.clans.nameblacklist.ClansBlacklist; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.column.ColumnTimestamp; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class ClanNameBlacklistRepository extends MinecraftRepository +{ + private static final String CREATE = "CREATE TABLE IF NOT EXISTS clanNameBlacklist (" + + "clanName VARCHAR(20) NOT NULL, " + + "admin VARCHAR(16) NOT NULL, " + + "added TIMESTAMP," + + "PRIMARY KEY (clanName));"; + + private static final String GET = "SELECT * FROM clanNameBlacklist;"; + private static final String ADD = "INSERT INTO clanNameBlacklist (clanName, admin, added) VALUES (?, ?, ?);"; + private static final String REMOVE = "DELETE FROM clanNameBlacklist WHERE clanName=?;"; + + private ClansBlacklist _blacklist; + + public ClanNameBlacklistRepository(JavaPlugin plugin, ClansBlacklist blacklist) + { + super(plugin, DBPool.getAccount()); + + _blacklist = blacklist; + } + + public void add(String name, String mod) + { + _blacklist.add(name.toLowerCase()); + executeInsert(ADD, null, + new ColumnVarChar("clanName", 20, name.toLowerCase()), + new ColumnVarChar("admin", 16, mod), + new ColumnTimestamp("added", new Timestamp(System.currentTimeMillis())) + ); + } + + public void loadNames(final Callback> callback) + { + executeQuery(GET, resultSet -> { + final List list = new ArrayList<>(); + + while (resultSet.next()) + { + String clanName = resultSet.getString("clanName"); + String mod = resultSet.getString("admin"); + + list.add(clanName); + } + + callback.run(list); + }); + } + + @Override + protected void initialize() + { + } + + @Override + protected void update() + { + executeUpdate(CREATE); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java new file mode 100644 index 000000000..b17121c43 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java @@ -0,0 +1,277 @@ +package mineplex.game.clans.clans.nether; + +import java.io.File; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.WorldBorder; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerPortalEvent; +import org.bukkit.inventory.ItemStack; + +import com.google.common.collect.Lists; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilCollections; +import mineplex.core.common.util.UtilFile; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanTips.TipType; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.core.repository.ClanTerritory; + +public class NetherManager extends MiniPlugin +{ + private ClansManager _clansManager; + + private World _netherWorld; + + private List _portals = Lists.newArrayList(); + + private File _portalCfg; + + public NetherManager(ClansManager clansManager) + { + super("Nether Manager", clansManager.getPlugin()); + _clansManager = clansManager; + + _portalCfg = new File(UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "nether.cfg"); + + begin(); + } + + public void begin() + { + _netherWorld = Bukkit.getWorld("world_nether"); + + WorldBorder worldBorder = _netherWorld.getWorldBorder(); + worldBorder.setCenter(0, 0); + worldBorder.setSize(200 * 2); + + parsePortals(); + } + + private void parsePortals() + { + String data = UtilFile.read(_portalCfg); + + if (data.length() < 5) + { + return; + } + + UtilCollections.forEach(data.split("\n"), string -> string.trim(), sPortal -> { + + String[] destinations = sPortal.split(">>"); + + Location from = UtilWorld.strToLoc(destinations[0]); + Location to = UtilWorld.strToLoc(destinations[1].split(":")[0]); + + Portal portal = Portal.create(from, to, UtilWorld.strToLoc(to.getWorld().getName() + "," + destinations[1].split(":")[1])); + + if (portal == null) + { + log("FAILED TO LOAD PORTAL [" + sPortal + "]"); + } + else + { + _portals.add(portal); + } + }); + } + + + @EventHandler + public void cmd(PlayerCommandPreprocessEvent event) + { + if (!_clansManager.getClientManager().hasRank(event.getPlayer(), Rank.JNR_DEV)) + { + return; + } + + if (event.getMessage().startsWith("/nether")) + { + event.getPlayer().teleport(new Location(_netherWorld, 0, 90, 0)); + event.setCancelled(true); + } + } + + @EventHandler + public void breakBlock(BlockBreakEvent event) + { + Block block = event.getBlock(); + Player player = event.getPlayer(); + ItemStack item = player.getItemInHand(); + + if (player.getGameMode() == GameMode.CREATIVE) + { + return; + } + + if (!block.getWorld().equals(_netherWorld)) + { + return; + } + + _portals + .stream() + .filter(portal -> UtilAlg.getAverageBlockLocation(portal.getToBlocks()).distance(block.getLocation()) < 15) + .limit(1) + .forEach(portal -> { + UtilPlayer.message(player, F.main("Clans", "You are not allowed to break this block.")); + event.setCancelled(true); + }); + + if (!item.getType().equals(Material.GOLD_PICKAXE)) + { + UtilPlayer.message(player, F.main("Clans", "You can only break blocks in the Nether with a " + F.elem("Golden Pickaxe") + ".")); + event.setCancelled(true); + return; + } + + if (block.getType().equals(Material.OBSIDIAN) || block.getType().equals(Material.PORTAL)) + { + UtilPlayer.message(player, F.main("Clans", "You are not allowed to break this block.")); + event.setCancelled(true); + return; + } + } + + @EventHandler + public void placeBlock(BlockPlaceEvent event) + { + Block block = event.getBlock(); + Player player = event.getPlayer(); + ItemStack item = player.getItemInHand(); + + if (player.getGameMode() == GameMode.CREATIVE) + { + return; + } + + if (!block.getWorld().equals(_netherWorld)) + { + return; + } + + if (!UtilItem.isFromNether(item)) + { + UtilPlayer.message(player, F.main("Clans", "You can only place blocks here that come from " + F.clansNether("The Nether") + ".")); + event.setCancelled(true); + return; + } + + _portals + .stream() + .filter(portal -> UtilAlg.getAverageBlockLocation(portal.getToBlocks()).distance(block.getLocation()) < 15) + .limit(1) + .forEach(portal -> { + UtilPlayer.message(player, F.main("Clans", "You are not allowed to place blocks here.")); + event.setCancelled(true); + }); + + if (block.getType().equals(Material.OBSIDIAN) || block.getType().equals(Material.PORTAL)) + { + UtilPlayer.message(player, F.main("Clans", "You are not allowed to place blocks here.")); + event.setCancelled(true); + return; + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + { + UtilServer.getPlayersCollection() + .stream() + .filter(player -> player.getWorld().equals(_netherWorld)) + .forEach(player -> { + player.setCompassTarget(new Location(_netherWorld, -200.d + UtilMath.r(400), player.getLocation().getY(), -200.d + UtilMath.r(400))); + _clansManager.getItemMapManager().removeMap(player); + }); + } + + if (event.getType() == UpdateType.SLOW) + { + _portals.forEach(portal -> { + portal.getFromObsidianBlocks().forEach(block -> UtilBlock.setSilent(block, Material.OBSIDIAN)); + portal.getFromPortalBlocks().forEach(block -> UtilBlock.setSilent(block, Material.PORTAL)); + + portal.getToObsidianBlocks().forEach(block -> UtilBlock.setSilent(block, Material.OBSIDIAN)); + portal.getToPortalBlocks().forEach(block -> UtilBlock.setSilent(block, Material.PORTAL)); + }); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onPortal(PlayerPortalEvent event) + { + Player player = event.getPlayer(); + Location location = player.getLocation(); + + ClanTerritory territory = _clansManager.getClanUtility().getClaim(location); + + if (event.getTo().getWorld().equals(_netherWorld)) + { + if (territory != null && territory.Owner.equals("Borderlands")) + { + _portals + .stream() + .filter(portal -> + portal.getFromPortalBlocks() + .stream() + .filter(block -> player.getLocation().distance(block.getLocation()) <= 2) + .iterator().hasNext() + ).limit(1) + .forEach(portal -> { + event.setTo(portal.getToOut()); + _clansManager.ClanTips.displayTip(TipType.ENTER_NETHER, player); + }); + } + } + else + { + _portals + .stream() + .filter(portal -> + portal.getToPortalBlocks() + .stream() + .filter(block -> player.getLocation().distance(block.getLocation()) <= 2) + .iterator().hasNext() + ).limit(1) + .forEach(portal -> { + event.setTo(UtilAlg.getAverageBlockLocation(portal.getFromPortalBlocks())); + }); + } + } + + public World getNetherWorld() + { + return _netherWorld; + } + + public boolean isInNether(Player player) + { + return player.getWorld().equals(_netherWorld); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/Portal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/Portal.java new file mode 100644 index 000000000..362599881 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/Portal.java @@ -0,0 +1,143 @@ +package mineplex.game.clans.clans.nether; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; + +import com.google.common.collect.Lists; + +import mineplex.core.common.util.UtilBlock; + +public class Portal +{ + private List _fromPortalBlocks; + private List _fromObsidianBlocks; + + private List _toPortalBlocks; + private List _toObsidianBlocks; + + private List _fromBlocks; + private List _toBlocks; + + private Location _toOut; + + public final boolean Success; + + public Portal(Location from, Location to, Location toOut) + { + _fromPortalBlocks = Lists.newArrayList(); + _fromObsidianBlocks = Lists.newArrayList(); + + _toPortalBlocks = Lists.newArrayList(); + _toObsidianBlocks = Lists.newArrayList(); + + _toOut = toOut; + + if (!isValidPortalBlock(from.getBlock()) || !isValidPortalBlock(to.getBlock())) + { + if (!isValidPortalBlock(from.getBlock())) + from = UtilBlock.getInRadius(from.getBlock(), 4).keySet().stream().filter(this::isValidPortalBlock).limit(1).iterator().next().getLocation(); + + if (!isValidPortalBlock(to.getBlock())) + to = UtilBlock.getInRadius(to.getBlock(), 4).keySet().stream().filter(this::isValidPortalBlock).limit(1).iterator().next().getLocation(); + + if (to == null || from == null) + { + System.out.println("[PORTAL] INVALID PORTAL PROVIDED (" + from + " --> " + to + ")"); + + Success = false; + + return; + } + } + + for (Block other : UtilBlock.getInRadius(from, 25).keySet()) + { + if (other.getType() == Material.OBSIDIAN) + { + _fromObsidianBlocks.add(other); + } + else if (other.getType() == Material.PORTAL) + { + _fromPortalBlocks.add(other); + } + } + + for (Block other : UtilBlock.getInRadius(to, 7.5d).keySet()) + { + if (other.getType() == Material.OBSIDIAN) + { + _toObsidianBlocks.add(other); + } + else if (other.getType() == Material.PORTAL) + { + _toPortalBlocks.add(other); + } + } + + _fromBlocks = new ArrayList<>(); + _toBlocks = new ArrayList<>(); + + _fromBlocks.addAll(_fromObsidianBlocks); + _fromBlocks.addAll(_fromPortalBlocks); + _toBlocks.addAll(_toObsidianBlocks); + _toBlocks.addAll(_toPortalBlocks); + + Success = true; + } + + public Location getToOut() + { + return _toOut; + } + + public List getFromPortalBlocks() + { + return _fromPortalBlocks; + } + + public List getFromObsidianBlocks() + { + return _fromObsidianBlocks; + } + + public List getToPortalBlocks() + { + return _toPortalBlocks; + } + + public List getToObsidianBlocks() + { + return _toObsidianBlocks; + } + + public List getFromBlocks() + { + return _fromBlocks; + } + + public List getToBlocks() + { + return _toBlocks; + } + + private boolean isValidPortalBlock(Block block) + { + return block.getType() == Material.OBSIDIAN || block.getType() == Material.PORTAL; + } + + public static Portal create(Location from, Location to, Location toOut) + { + Portal portal = new Portal(from, to, toOut); + + if (!portal.Success) + { + return null; + } + + return portal; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/SiegeManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/SiegeManager.java new file mode 100644 index 000000000..9744381f6 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/SiegeManager.java @@ -0,0 +1,335 @@ +package mineplex.game.clans.clans.siege; + +import java.util.Stack; + +import org.bukkit.Location; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockPlaceEvent; + +import com.google.gson.Gson; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +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.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.siege.commands.CommandSiegeSupplies; +import mineplex.game.clans.clans.siege.outpost.OutpostManager; +import mineplex.game.clans.clans.siege.repository.SiegeWeaponRepository; +import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken; +import mineplex.game.clans.clans.siege.weapon.Cannon; +import mineplex.game.clans.clans.siege.weapon.SiegeWeapon; +import mineplex.game.clans.core.repository.ClanTerritory; +import mineplex.game.clans.spawn.Spawn; +import net.minecraft.server.v1_8_R3.Material; + +public class SiegeManager extends MiniPlugin +{ + private ClansManager _clansManager; + + private OutpostManager _outpostManager; + + public static SiegeManager Instance; + + public NautHashMap LiveSiegeWeapons = new NautHashMap<>(); + public NautHashMap UnsyncedSiegeWeapons = new NautHashMap<>(); + + private Gson _gson; + + private SiegeWeaponRepository _repository; + + public SiegeManager(ClansManager clans) + { + super("Siege Manager", clans.getPlugin()); + + _gson = new Gson(); + + _clansManager = clans; + + _outpostManager = new OutpostManager(clans, this); + + addCommand(new CommandSiegeSupplies(_outpostManager)); + + Instance = this; + + _repository = new SiegeWeaponRepository(clans.getPlugin()); + + _outpostManager.loadOutposts(); + + getRepository().getWeaponsByServer(getClansManager().getServerId(), tokens -> + tokens.forEach(token -> + runSync(() -> { + final SiegeWeapon weapon; + + token.Location.getChunk().load(); + + switch(token.WeaponType) + { + case 2: + weapon = new Cannon(SiegeManager.this, token); + break; + default: + System.out.println("[WEAPONS] ERROR WHILST LOADING WEAPON: INVALID WEAPON TYPE"); + return; + } + + System.out.println("[WEAPONS] LOADED SIEGE WEAPON " + weapon.getClass().getSimpleName() + " [" + token.UniqueId + "]"); + + LiveSiegeWeapons.put(Integer.valueOf(token.UniqueId), weapon); + }) + ) + ); + } + + @EventHandler + public void CleanupWeirdos(UpdateEvent event) + { + if (event.getType() == UpdateType.SEC && UtilServer.getPlayers().length != 0) + { + Spawn.getSpawnWorld().getEntitiesByClass(Slime.class).stream().filter(slime -> slime.getSize() != -1).forEach(slime -> { + + boolean part = false; + + for (SiegeWeapon weapon : LiveSiegeWeapons.values()) + { + if (weapon.isPartOf(slime.getUniqueId())) + { + part = true; + break; + } + } + + + if (!part) + for (SiegeWeapon weapon : UnsyncedSiegeWeapons.values()) + { + if (weapon.isPartOf(slime.getUniqueId())) + { + part = true; + break; + } + } + + if (!part) + { + slime.remove(); + } + else + { + slime.setSize(-1); + } + }); + } + } + + @EventHandler + public void save(UpdateEvent event) + { + if (!UtilTime.elapsed(_initializedTime, 5500) || UtilServer.getPlayers().length == 0) + { + return; + } + + if (event.getType() == UpdateType.SLOW) + { + _outpostManager.saveOutposts(); + saveSiegeWeapons(); + + for (Entity entity : Spawn.getSpawnWorld().getEntitiesByClass(ArmorStand.class)) + { + boolean part = false; + + for (SiegeWeapon weapon : LiveSiegeWeapons.values()) + { + if (weapon.isPartOf(entity.getUniqueId())) + { + part = true; + break; + } + } + + if (!part) + for (SiegeWeapon weapon : UnsyncedSiegeWeapons.values()) + { + if (weapon.isPartOf(entity.getUniqueId())) + { + part = true; + break; + } + } + + if (!part) + { + if (((ArmorStand) entity).getHelmet() != null && ((ArmorStand) entity).getHelmet().getType().equals(Material.SPONGE)) + { + entity.remove(); + } + + if (entity.getPassenger() != null && entity.getPassenger() instanceof Slime && entity.getPassenger().getPassenger() instanceof Slime) + { + entity.getPassenger().getPassenger().remove(); + entity.getPassenger().remove(); + entity.remove(); + } + } + } + } + } + + private void saveSiegeWeapons() + { + final Stack queue = new Stack<>(); + + for (final SiegeWeapon weapon : LiveSiegeWeapons.values()) + { + final SiegeWeaponToken token = weapon.toToken(); + + if (UnsyncedSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId))) + continue; + + queue.push(() -> { + _repository.updateWeapon(token); + }); + } + + + runAsync(() -> { + while (!queue.isEmpty()) + { + queue.pop().run(); + } + + _repository.getWeaponsByServer(_clansManager.getServerId(), tokens -> { + tokens.forEach(token -> { + if (!LiveSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId)) && !UnsyncedSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId))) + { + System.out.println("LiveSiegeWeapons no longer contains old weapon " + token.UniqueId + ", deleting."); + _repository.deleteWeapon(token.UniqueId); + } + }); + }); + }); + } + + @EventHandler + public void onBlockPlace(BlockPlaceEvent event) + { + if (event.getItemInHand().isSimilar(Cannon.CANNON_ITEM)) + { + event.setCancelled(true); + + if (trySpawnCannon(event.getPlayer(), event.getBlock().getLocation())) + { + event.getPlayer().setItemInHand(UtilInv.decrement(event.getPlayer().getItemInHand())); + return; + } + } + +// if (event.getItemInHand().isSimilar(Catapult.CATAPULT_ITEM)) +// { +// event.setCancelled(true); +// +// if (trySpawnCatapult(event.getPlayer(), event.getBlock().getLocation())) +// { +// event.getPlayer().setItemInHand(UtilInv.decrement(event.getPlayer().getItemInHand())); +// return; +// } +// } + } + + public boolean trySpawnCannon(Player player, Location location) + { +// if (_clansManager.getNetherManager().isInNether(player)) +// { +// _clansManager.message(player, "You are not allowed to place this in " + F.clansNether("The Nether") + "."); +// +// return false; +// } + + if (!_clansManager.isInClan(player)) + { + UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place a Cannon.")); + return false; + } + + if (_clansManager.hasTimer(player)) + { + UtilPlayer.message(player, F.main("Clans", "You cannot place a Cannon whilst protected from pvp.")); + return false; + } + + ClanTerritory claim = _clansManager.getClanUtility().getClaim(location); + + if (claim != null && !claim.Owner.equals(_clansManager.getClan(player).getName())) + { + UtilPlayer.message(player, F.main("Clans", "You must place a Cannon in the Wilderness or your own Territory.")); + return false; + } + + spawnCannon(player, location); + + return true; + } + + public Cannon spawnCannon(Player player, Location location) + { + return spawnCannon(player, location, true); + } + + public Cannon spawnCannon(Player player, Location location, boolean syncWithDb) + { + Cannon cannon = new Cannon(location, _clansManager.getClan(player), this, syncWithDb); + + UnsyncedSiegeWeapons.put(Integer.valueOf(cannon.getUniqueId()), cannon); + + return cannon; + } + + public void dead(SiegeWeapon weapon) + { + LiveSiegeWeapons.remove(Integer.valueOf(weapon.getUniqueId())); + SiegeWeapon unsynced = UnsyncedSiegeWeapons.remove(Integer.valueOf(weapon.getUniqueId())); + + if (unsynced == null) + _repository.deleteWeapon(weapon.getUniqueId()); + } + + public OutpostManager getOutpostManager() + { + return _outpostManager; + } + + public Gson getGson() + { + return _gson; + } + + public ClansManager getClansManager() + { + return _clansManager; + } + + public int randomId() + { + /** + * prevents id from ever being 0 (which is used internally as NULL) + */ + return 1 + UtilMath.random.nextInt(Integer.MAX_VALUE - 1); + } + + public SiegeWeaponRepository getRepository() + { + return _repository; + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/commands/CommandSiegeSupplies.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/commands/CommandSiegeSupplies.java new file mode 100644 index 000000000..8f0b7a6ae --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/commands/CommandSiegeSupplies.java @@ -0,0 +1,35 @@ +package mineplex.game.clans.clans.siege.commands; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.siege.outpost.Outpost; +import mineplex.game.clans.clans.siege.outpost.OutpostManager; +import mineplex.game.clans.clans.siege.weapon.Cannon; + +public class CommandSiegeSupplies extends CommandBase +{ + public CommandSiegeSupplies(OutpostManager plugin) + { + super(plugin, Rank.MODERATOR, "siege"); + } + + @Override + public void Execute(Player caller, String[] args) + { + ItemStack outpost = new ItemStack(Outpost.OUTPOST_ITEM); + ItemStack cannons = new ItemStack(Cannon.CANNON_ITEM); + + outpost.setAmount(64); + cannons.setAmount(64); + + caller.getInventory().addItem(outpost); + caller.getInventory().addItem(cannons); + + UtilPlayer.message(caller, F.main("Clans", "Received supplies for a siege.")); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/LoadSiegeWeaponEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/LoadSiegeWeaponEvent.java new file mode 100644 index 000000000..92fd2d1e5 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/LoadSiegeWeaponEvent.java @@ -0,0 +1,53 @@ +package mineplex.game.clans.clans.siege.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.game.clans.clans.siege.weapon.SiegeWeapon; + +public class LoadSiegeWeaponEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private SiegeWeapon _weapon; + + private boolean _cancelled; + + public LoadSiegeWeaponEvent(Player player, SiegeWeapon weapon) + { + _player = player; + _weapon = weapon; + } + + public SiegeWeapon getWeapon() + { + return _weapon; + } + + public Player getPlayer() + { + return _player; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/MountSiegeWeaponEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/MountSiegeWeaponEvent.java new file mode 100644 index 000000000..bf6d46166 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/MountSiegeWeaponEvent.java @@ -0,0 +1,53 @@ +package mineplex.game.clans.clans.siege.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.game.clans.clans.siege.weapon.SiegeWeapon; + +public class MountSiegeWeaponEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private SiegeWeapon _weapon; + + private boolean _cancelled; + + public MountSiegeWeaponEvent(Player player, SiegeWeapon weapon) + { + _player = player; + _weapon = weapon; + } + + public SiegeWeapon getWeapon() + { + return _weapon; + } + + public Player getPlayer() + { + return _player; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/SiegeWeaponExplodeEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/SiegeWeaponExplodeEvent.java new file mode 100644 index 000000000..c0bec7a14 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/events/SiegeWeaponExplodeEvent.java @@ -0,0 +1,53 @@ +package mineplex.game.clans.clans.siege.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.game.clans.clans.siege.weapon.SiegeWeapon; +import mineplex.game.clans.clans.siege.weapon.projectile.WeaponProjectile; + +public class SiegeWeaponExplodeEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private SiegeWeapon _weapon; + private WeaponProjectile _projectile; + + private boolean _cancelled; + + public SiegeWeaponExplodeEvent(SiegeWeapon weapon, WeaponProjectile projectile) + { + _weapon = weapon; + _projectile = projectile; + } + + public SiegeWeapon getWeapon() + { + return _weapon; + } + + public WeaponProjectile getProjectile() + { + return _projectile; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java new file mode 100644 index 000000000..f8dbbe9cb --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java @@ -0,0 +1,629 @@ +package mineplex.game.clans.clans.siege.outpost; + +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.ColorFader; +import mineplex.core.common.util.EnclosedObject; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LoopIterator; +import mineplex.core.common.util.RGBData; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilColor; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +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.UtilText; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTrig; +import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.HologramInteraction; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.event.ClansWaterPlaceEvent; +import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent; +import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent; +import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock; +import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken; +import mineplex.game.clans.core.repository.ClanTerritory; +import net.minecraft.server.v1_8_R3.AxisAlignedBB; + +public class Outpost implements Listener +{ + protected static final long MAX_LIFETIME = 30 * 60 * 1000; // 30 minutes + public static final ItemStack OUTPOST_ITEM = new ItemBuilder(Material.BEACON, 1).setRawTitle(C.Reset + C.cBlue + "Outpost").build(); + + public static final long PREP_TIME = 2 * 60 * 1000; + + private OutpostManager _outpostManager; + + private final int _uniqueId; + + private ClanInfo _ownerClan; + + private Location _startCorner; + private Location _origin; + private Location _endCorner; + + private Location _forceFieldStart; + private Location _forceFieldEnd; + + private Location _core; + + private LinkedHashMap _blocks; + private LinkedHashMap _buildQueue = new LinkedHashMap<>(); + + protected OutpostType _type; + private OutpostState _state; + + private Hologram _preHologram; + private Hologram _preHologram2; + + private LoopIterator _circleStages; + private LoopIterator _reverseCircleStages; + + private ColorFader _fader = new ColorFader(30, UtilColor.hexToRgb(0x00A296), UtilColor.hexToRgb(0x29E6B6)); + + private long _timeSpawned; + + public ClanInfo _againstClan; + + private Hologram _lifetimeLeft; + + public Outpost(OutpostManager outpostManager, OutpostToken token) + { + _outpostManager = outpostManager; + + _uniqueId = token.UniqueId; + + _ownerClan = token.OwnerClan; + + _startCorner = token.Origin.clone().subtract(token.Type._size, 1.1, token.Type._size); + _endCorner = token.Origin.clone().add(token.Type._size + .9, token.Type._ySize - 1, token.Type._size + .9); + + _forceFieldStart = _startCorner.clone().subtract(4, 0, 4); + _forceFieldEnd = _endCorner.clone().add(4.5, 0, 4.5); + + _origin = token.Origin.clone(); + + _type = token.Type; + + _timeSpawned = token.TimeSpawned; + + _core = _type.getCoreLocation(_origin); + + _preHologram = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 2.3, 0.5), F.elem(_ownerClan.getName()) + C.cWhite + "'s Outpost block (Right-Click to activate)"); + _preHologram2 = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 3, 0.5), "Despawning: " + UtilText.getProgress(null, 0, null, true)); + + _lifetimeLeft = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 1.5, 0.5), "Despawning in " + F.time(UtilTime.MakeStr(MAX_LIFETIME))); + _lifetimeLeft.setInteraction(new HologramInteraction() + { + public void onClick(Player player, ClickType clickType) + { + if (_ownerClan.isMember(player) || _state != OutpostState.LIVE) + return; + + if (clickType == ClickType.LEFT || clickType == ClickType.SHIFT_LEFT) + kill(); + } + + }); + + + if (token.OutpostState == OutpostState.AWAITING) + { + _preHologram.start(); + _preHologram2.start(); + } + + _blocks = _type.createBuildQueue(_origin, _ownerClan.Clans); + + _state = token.OutpostState; + + _circleStages = new LoopIterator(UtilTrig.GetCirclePoints(new Vector(0., 0., 0.), 40, .6d)); + + List reverse = UtilTrig.GetCirclePoints(new Vector(0., 0., 0.), 40, .6d); + Collections.reverse(reverse); + _reverseCircleStages = new LoopIterator(reverse); + + } + + public Outpost(OutpostManager outpostManager, ClanInfo clan, Location location, OutpostType type) + { + _outpostManager = outpostManager; + + _uniqueId = outpostManager.getSiegeManager().randomId(); + + _ownerClan = clan; + + _startCorner = location.clone().subtract(type._size, 1.1, type._size); + _endCorner = location.clone().add(type._size + .9, type._ySize - 1, type._size + .9); + + _forceFieldStart = _startCorner.clone().subtract(4, 0, 4); + _forceFieldEnd = _endCorner.clone().add(4.5, 0, 4.5); + + _origin = location.clone(); + + _type = type; + + _timeSpawned = System.currentTimeMillis(); + + _core = _type.getCoreLocation(_origin); + + _preHologram = new Hologram(_ownerClan.Clans.getHologramManager(), _origin.clone().add(0.5, 2.3, 0.5), F.elem(_ownerClan.getName()) + C.cWhite + "'s Outpost block (Right-Click to activate)"); + _preHologram2 = new Hologram(_ownerClan.Clans.getHologramManager(), _origin.clone().add(0.5, 3, 0.5), "Despawning: " + UtilText.getProgress(null, 0, null, true)); + + _preHologram.start(); + _preHologram2.start(); + + _state = OutpostState.AWAITING; + + _outpostManager.getRepository().insertOutpost(toToken()); + + _circleStages = new LoopIterator(UtilTrig.GetCirclePoints(new Vector(0., 0., 0.), 40, .6d)); + + List reverse = UtilTrig.GetCirclePoints(new Vector(0., 0., 0.), 40, .6d); + Collections.reverse(reverse); + _reverseCircleStages = new LoopIterator(reverse); + + UtilServer.RegisterEvents(this); + + _lifetimeLeft = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 1.5, 0.5), "Despawning in " + F.time(UtilTime.MakeStr(MAX_LIFETIME))); + _lifetimeLeft.setInteraction(new HologramInteraction() + { + public void onClick(Player player, ClickType clickType) + { + if (_ownerClan.isMember(player) || _state != OutpostState.LIVE) + return; + + if (clickType == ClickType.LEFT || clickType == ClickType.SHIFT_LEFT) + kill(); + } + }); + } + + private void cleanup() + { + _blocks = null; + + if (_preHologram != null) _preHologram.stop(); + if (_preHologram2 != null) _preHologram2.stop(); + + _preHologram = null; + _preHologram2 = null; + + _state = OutpostState.DEAD; + + _outpostManager.queueForRemoval(_ownerClan.getName()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void onInteract(PlayerInteractEvent event) + { + if (getState() == OutpostState.LIVE) + { + do + { + if (event.getClickedBlock() == null) + break; + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + break; + + if (!UtilItem.isDoor(event.getClickedBlock().getType())) + break; + + if (_ownerClan.isMember(event.getPlayer())) + break; + + if (UtilAlg.inBoundingBox(event.getClickedBlock().getLocation(), _startCorner.clone().subtract(.5, 0, .5), _endCorner)) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot open the doors of this Outpost.")); + event.setCancelled(true); + return; + } + } while(false); + } + + if (getState() != OutpostState.AWAITING) + return; + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (getLifetime() <= 2000) + return; + + + if(_outpostManager.getClansManager().hasTimer(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot activate an Outpost whilst protected from PvP.")); + return; + } + + if (!_ownerClan.equals(_ownerClan.Clans.getClanUtility().getClanByPlayer(event.getPlayer()))) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "This is not yours to activate!")); + return; + } + + if (event.getClickedBlock() != null && _origin.equals(event.getClickedBlock().getLocation())) + { + if (event.getClickedBlock().getType().equals(Material.BEACON)) + { + _origin.getBlock().setType(Material.AIR); + beginConstruction(); + } + } + } + + @EventHandler + public void onBlockDamage(BlockDamageEvent event) + { + if (event.getBlock().getLocation().equals(_core) && getState() == OutpostState.LIVE) + { + + if(_outpostManager.getClansManager().hasTimer(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You cannot destroy an Outpost whilst protected from PvP.")); + event.setCancelled(true); + return; + } + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have destroyed " + F.elem(_ownerClan.getName()) + "'s Outpost!")); + + _core.getBlock().setType(Material.AIR); + + _ownerClan.inform("Your Outpost has been destroyed!", null); + UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _ownerClan.getOnlinePlayersArray()); + + if (getState() == OutpostState.AWAITING) + cleanup(); + else + kill(); + + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockBreak(BlockBreakEvent event) + { + if (getState() == OutpostState.AWAITING && event.getBlock().getLocation().equals(_origin)) + { + _origin.getBlock().setType(Material.AIR); + _origin.getWorld().dropItem(_origin, OUTPOST_ITEM); + _ownerClan.inform("Your Outpost block has been destroyed.", null); + cleanup(); + event.setCancelled(true); + return; + } + + if (event.getBlock().getLocation().equals(_core) && getState() == OutpostState.LIVE) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have destroyed " + F.elem(_ownerClan.getName()) + "'s Outpost!")); + + _core.getBlock().setType(Material.AIR); + + _ownerClan.inform("Your Outpost has been destroyed!", null); + UtilTextMiddle.display("Siege", "Your Outpost has been destroyed", 20, 100, 20, _ownerClan.getOnlinePlayersArray()); + + if (getState() == OutpostState.AWAITING) + cleanup(); + else + kill(); + + event.setCancelled(true); + return; + } + + if (UtilAlg.inBoundingBox(event.getBlock().getLocation(), _startCorner.clone().subtract(.5, 0, .5), _endCorner)) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not break blocks in Outposts.")); + event.setCancelled(true); + } + } + + @EventHandler + public void onWaterPlace(ClansWaterPlaceEvent event) + { + if (UtilAlg.inBoundingBox(event.getBlock().getLocation(), _startCorner.clone().subtract(.5, 0, .5), _endCorner)) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not place water in Outposts.")); + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void onBlockPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + if (UtilAlg.inBoundingBox(event.getBlock().getLocation(), _startCorner.clone().subtract(.5, 0, .5), _endCorner)) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not place blocks in Outposts.")); + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void claimTerritory(PlayerClaimTerritoryEvent event) + { + if (UtilMath.offset2d(event.getClaimedChunk().getBlock(8, 0, 8).getLocation(), _origin) < 32) + { + UtilPlayer.message(event.getClaimer(), F.main("Clans", "You may not claim this close to an Outpost.")); + event.setCancelled(true); + } + } + + protected void update() + { + if (_state == OutpostState.AWAITING) + { + if (getLifetime() > 60000) + { + _origin.getBlock().setType(Material.AIR); + _ownerClan.inform("You have lost your Outpost block, as no one activated it fast enough!", null); + cleanup(); + return; + } + + _preHologram2.setText(UtilText.getProgress(null, UtilMath.clamp(getLifetime(), 0., 60000.) / 60000., null, true)); + + RGBData color = UtilColor.RgbLightBlue; + + for (int x = -_type._size; x <= _type._size; x++) + for (int z = -_type._size; z <= _type._size; z++) + if (x == -_type._size || x == _type._size || z == -_type._size || z == _type._size) + UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, UtilBlock.getHighest(_origin.getWorld(), _origin.clone().add(x + .5, .1, z + .5).getBlockX(), _origin.clone().add(x + .5, .1, z + .5).getBlockZ()).getLocation().add(0.5, 0, 0.5), new Vector(color.getRed(), color.getGreen(), color.getBlue()), 1f, 0, ViewDist.NORMAL); + + return; + } + + if (_lifetimeLeft != null) + _lifetimeLeft.setText("Despawning in " + F.time(UtilTime.MakeStr(MAX_LIFETIME - (System.currentTimeMillis() - _timeSpawned)))); + + if (_state == OutpostState.CONSTRUCTING) + { + if (_buildQueue.isEmpty()) + { + _state = OutpostState.LIVE; + + return; + } + else + { + Iterator iterator = _buildQueue.keySet().iterator(); + + if (iterator.hasNext()) + _buildQueue.remove(iterator.next()).set(); + } + + // Forcefield + RGBData color = UtilColor.RgbLightBlue; + + for (int x = _forceFieldStart.getBlockX(); x <= _forceFieldEnd.getBlockX(); x++) + for (int z = _forceFieldStart.getBlockZ(); z <= _forceFieldEnd.getBlockZ(); z++) + if (x == _forceFieldStart.getBlockX() || x == _forceFieldEnd.getBlockX() || z == _forceFieldStart.getBlockZ() || z == _forceFieldEnd.getBlockZ()) + UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, new Location(_core.getWorld(), x + .5, UtilBlock.getHighest(_core.getWorld(), x, z).getY() + .15, z + .5), new Vector(color.getRed(), color.getGreen(), color.getBlue()), 1f, 0, ViewDist.NORMAL); + } + + RGBData next = _fader.next(); + + { + RGBData color = _state == OutpostState.LIVE ? next : UtilColor.RgbRed; + + Vector nextCircleStage = _circleStages.next(); + + double circleX = nextCircleStage.getX(); + double circleZ = nextCircleStage.getZ(); + + UtilParticle.PlayParticleToAll(ParticleType.MOB_SPELL, _core.clone().add(circleX + .5, 1.1d, circleZ + .5), new Vector(color.getRed(), color.getGreen(), color.getBlue()), 1.f, 0, ViewDist.NORMAL); + } + + { + RGBData color = _state == OutpostState.LIVE ? next : UtilColor.RgbRed; + + Vector nextCircleStage = _reverseCircleStages.next(); + + double circleX = nextCircleStage.getX(); + double circleZ = nextCircleStage.getZ(); + + UtilParticle.PlayParticleToAll(ParticleType.MOB_SPELL, _core.clone().add(circleX + .5, 1.1d, circleZ + .5), new Vector(color.getRed(), color.getGreen(), color.getBlue()), 1.f, 0, ViewDist.NORMAL); + } + } + + @EventHandler + public void forcefield(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST || getState() != OutpostState.CONSTRUCTING) + return; + + UtilServer.getPlayersCollection().stream() + .filter(player -> !_ownerClan.isMember(player)) + .filter(player -> UtilAlg.inBoundingBox(player.getLocation(), _forceFieldStart, _forceFieldEnd)) + .forEach(player -> { + UtilAction.velocity(player, UtilAlg.getTrajectory2d(_core, player.getLocation()), .77, true, 0.8, 0, 1.1, true); + UtilPlayer.message(player, F.main("Clans", "This Outpost is still under construction!")); + player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f); + }); + } + + public void beginConstruction() + { + // Cleanup pre-Outpost stuff + _preHologram.stop(); + _preHologram2.stop(); + + _preHologram = null; + _preHologram = null; + + _lifetimeLeft.start(); + + _state = OutpostState.CONSTRUCTING; + _blocks = new LinkedHashMap<>(_buildQueue = _type.createBuildQueue(_origin, _ownerClan.Clans)); + + _ownerClan.inform("Siege", "Your Outpost is now being constructed.", null); + + //Inform nearby Clans + for (int chunkX = -3; chunkX < 3; chunkX++) + for (int chunkZ = -3; chunkZ < 3; chunkZ++) + { + ClanTerritory territory = _ownerClan.Clans.getClanUtility().getClaim(_origin.getWorld().getChunkAt(_origin.getChunk().getX() + chunkX, _origin.getChunk().getZ() + chunkZ)); + + if (territory != null && _outpostManager.getClansManager().getBlacklist().allowed(territory.Owner)) + { + ClanInfo clan = _ownerClan.Clans.getClanUtility().getClanByClanName(territory.Owner); + + clan.inform("A siege has begun near your territory!", null); + UtilTextMiddle.display("Siege", "A Siege has been declared on your Clan!", 20, 100, 20, clan.getOnlinePlayersArray()); + } + } + } + + public void kill() + { + _state = OutpostState.DESTRUCTING; + + EnclosedObject wait = new EnclosedObject<>(0); + + _blocks.values().stream().filter(block -> UtilMath.random.nextBoolean() && UtilMath.random.nextBoolean()).filter(block -> UtilMath.random.nextBoolean()).limit(13).forEach(block -> + _outpostManager.runSyncLater(() -> { + UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, block.getLocation(), new Vector(0,0,0), 1f, 1, ViewDist.MAX); + _origin.getWorld().playSound(block.getLocation(), Sound.EXPLODE, 1.0f, 1.0f); + }, wait.Set(Integer.valueOf(wait.Get().intValue() + 4 + UtilMath.random.nextInt(4))).longValue()) + ); + + _outpostManager.runSyncLater(() -> { + _blocks.values().stream().forEach(OutpostBlock::restore); + }, wait.Get().intValue() + 5L); + + _outpostManager.runSyncLater(() -> { + _blocks.values().stream().forEach(block -> { + Material mat = Material.getMaterial(block.getId()); + + if (UtilItem.isTranslucent(mat) || UtilMath.random.nextBoolean()) + { + block.restore(); + return; + } + + FallingBlock fall = block.getLocation().getWorld().spawnFallingBlock(block.getLocation(), block.getId(), block.getData()); + fall.setDropItem(false); + Vector vec = UtilAlg.getTrajectory(fall.getLocation(), getExactMiddle()); + + UtilAction.velocity(fall, vec, 1, false, 0, 0.6, 10, false); + + fall.setMetadata("ClansOutpost", new FixedMetadataValue(_ownerClan.Clans.getPlugin(), _ownerClan.getName())); + + block.restore(); + }); + + cleanup(); + }, wait.Get().intValue() + 6L); + + if (_lifetimeLeft != null) _lifetimeLeft.stop(); + + _lifetimeLeft = null; + + _ownerClan.inform("Your Clan's Outpost has been destroyed.", null); + } + + @EventHandler + public void onSiegeWeaponExplode(SiegeWeaponExplodeEvent event) + { + if (UtilAlg.inBoundingBox(event.getProjectile().getLocation(), _startCorner.clone().subtract(2, 2, 2), _endCorner.clone().add(2, 2, 2))) + { + if (getLifetime() < 15 * 60 * 1000) + { + event.setCancelled(true); + } + } + } + + public ClanInfo getOwner() + { + return _ownerClan; + } + + public long getLifetime() + { + return System.currentTimeMillis() - _timeSpawned; + } + + public AxisAlignedBB getBounds() + { + return UtilAlg.toBoundingBox(_startCorner, _endCorner); + } + + public Location getExactMiddle() + { + return UtilAlg.getMidpoint(_startCorner, _endCorner); + } + + public OutpostState getState() + { + return _state; + } + + public ClanInfo getAgainst() + { + return _againstClan; + } + + public int getUniqueId() + { + return _uniqueId; + } + + public OutpostToken toToken() + { + OutpostToken token = new OutpostToken(); + + token.UniqueId = _uniqueId; + token.Origin = _origin; + token.Type = _type; + token.OwnerClan = _ownerClan; + token.TimeSpawned = _timeSpawned; + token.OutpostState = _state; + + return token; + } + + public Location getCoreLocation() + { + return _core; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostManager.java new file mode 100644 index 000000000..c2f382bf4 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostManager.java @@ -0,0 +1,314 @@ +package mineplex.game.clans.clans.siege.outpost; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; + +import com.google.common.collect.Lists; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent; +import mineplex.game.clans.clans.siege.SiegeManager; +import mineplex.game.clans.clans.siege.repository.OutpostRepository; +import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken; +import mineplex.game.clans.core.repository.ClanTerritory; + +public class OutpostManager extends MiniPlugin +{ + private ClansManager _clansManager; + + private NautHashMap _outposts = new NautHashMap<>(); + private NautHashMap _idToOutpost = new NautHashMap<>(); + + private List _removalQueue; + + private SiegeManager _siegeManager; + + private OutpostRepository _repository; + + public OutpostManager(ClansManager clansManager, SiegeManager siegeManager) + { + super("Outpost Manager", clansManager.getPlugin()); + + _siegeManager = siegeManager; + + _clansManager = clansManager; + + _repository = new OutpostRepository(clansManager.getPlugin(), this); + + _removalQueue = new ArrayList<>(); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onPlaceBlock(BlockPlaceEvent event) + { + if (event.getItemInHand().isSimilar(Outpost.OUTPOST_ITEM)) + if (!spawnOutpost(event.getPlayer(), event.getBlock().getLocation(), OutpostType.MK_III)) + event.setCancelled(true); + } + + public boolean spawnOutpost(Player player, Location location, OutpostType type) + { +// if (_clansManager.getNetherManager().isInNether(player)) +// { +// _clansManager.message(player, "You are not allowed to place this in " + F.clansNether("The Nether") + "."); +// +// return false; +// } + + if (!_clansManager.isInClan(player)) + { + UtilPlayer.message(player, F.main("Clans", "You must be in a Clan to place an Outpost.")); + return false; + } + + if(_clansManager.hasTimer(player)) + { + UtilPlayer.message(player, F.main("Clans", "You can't place an Outpost whilst protected from PvP.")); + return false; + } + + if (location.getBlockY() < 30) + { + UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost this deep.")); + return false; + } + + ClanInfo clan = _clansManager.getClan(player); + + if (UtilItem.isBoundless(location.clone().subtract(0, 1, 0).getBlock().getType())) + { + UtilPlayer.message(player, F.main("Clans", "An Outpost must not be placed floating.")); + return false; + } + + if (Get(clan) != null) + { + UtilPlayer.message(player, F.main("Clans", "Your Clan already has an outpost.")); + return false; + } + + if (_clansManager.getClanUtility().getClaim(location) != null) + { + UtilPlayer.message(player, F.main("Clans", "An Outpost must be placed in the Wilderness.")); + return false; + } + + for (Outpost outpost : _outposts.values()) + { + if (UtilMath.offset(location, outpost.getExactMiddle()) < type._size + 8) + { + UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost near other Outposts.")); + return false; + } + } + + for (int x = -2; x < 2; x++) + for (int z = -2; z < 2; z++) + { + Chunk chunk = location.getWorld().getChunkAt(location.getChunk().getX() + x, location.getChunk().getZ() + z); + + ClanTerritory claim = _clansManager.getClanUtility().getClaim(chunk); + + if (claim != null) + { + if (!claim.Owner.equals(clan.getName()) && _clansManager.getBlacklist().allowed(claim.Owner)) + { + UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost this close to a Clan's Territory.")); + return false; + } + } + } + + boolean gut = false; + + for (int x = -6; x < 6; x++) + for (int z = -6; z < 6; z++) + { + Chunk chunk = location.getWorld().getChunkAt(location.getChunk().getX() + x, location.getChunk().getZ() + z); + + ClanTerritory claim = _clansManager.getClanUtility().getClaim(chunk); + + if (claim != null) + { + System.out.println(claim.Owner + ", " + clan.getName()); + + if (!claim.Owner.equals(clan.getName()) && _clansManager.getBlacklist().allowed(claim.Owner)) + { + gut = true; /* das ist gut!!! */ + break; + } + } + } + + /* das ist schlecht */ + if (!gut) + { + UtilPlayer.message(player, F.main("Clans", "An Outpost must be placed near a rival Clan's Territory.")); + return false; + } + + for (int x = -type._size; x < type._size; x++) + for (int y = -1; y < type._ySize; y++) + for (int z = -type._size; z < type._size; z++) + { + Location loc = location.clone().add(x, y, z); + + if (_clansManager.getClanUtility().isClaimed(loc)) + { + UtilPlayer.message(player, F.main("Clans", "You cannot place an Outpost where it may intersect with claimed territory.")); + return false; + } + } + + _outposts.put(clan.getName(), new Outpost(this, clan, location, type)); + _idToOutpost.put(Integer.valueOf(_outposts.get(clan.getName()).getUniqueId()), _outposts.get(clan.getName())); + + return true; + } + + @EventHandler + public void onBlockFall(EntityChangeBlockEvent event) + { + if (event.getEntity().hasMetadata("ClansOutpost")) + event.setCancelled(true); + } + + @EventHandler + public void onClaim(PlayerClaimTerritoryEvent event) + { + for (Outpost outpost : _outposts.values()) + { + if (outpost.getBounds().b(UtilAlg.toBoundingBox(event.getClaimedChunk().getBlock(0, 0, 0).getLocation(), event.getClaimedChunk().getBlock(15, 254, 15).getLocation()))) + { + event.setCancelled(true); + UtilPlayer.message(event.getClaimer(), F.main("Clans", "You cannot claim this territory as it overlaps with " + F.elem(outpost.getOwner().getName()) + "'s Outpost.")); + break; + } + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + _outposts.values() + .stream() + .forEach(Outpost::update); + + if (event.getType() == UpdateType.FASTER) + if (!_removalQueue.isEmpty()) + HandlerList.unregisterAll(_idToOutpost.remove(Integer.valueOf(_outposts.remove(_removalQueue.remove(0)).getUniqueId()))); + + if (event.getType() == UpdateType.TWOSEC) + _outposts.values() + .stream() + .filter(outpost -> outpost.getState() == OutpostState.LIVE && outpost.getLifetime() > Outpost.MAX_LIFETIME) + .forEach(Outpost::kill); + } + + public Outpost Get(ClanInfo clan) + { + return clan == null ? null : _outposts.get(clan.getName().toLowerCase()); + } + + public void queueForRemoval(String name) + { + _removalQueue.add(name); + } + + public SiegeManager getSiegeManager() + { + return _siegeManager; + } + + public List getOutposts() + { + return Lists.newArrayList(_outposts.values()); + } + + public Outpost Get(int outpostId) + { + return _idToOutpost.get(Integer.valueOf(outpostId)); + } + + public ClansManager getClansManager() + { + return _clansManager; + } + + public void loadOutposts() + { + System.out.println("[OUTPOSTS] LOADING OUTPOSTS FROM DATABASE"); + + _repository.getOutpostsByServer(_clansManager.getServerId(), tokens -> + tokens.forEach(token -> { + Outpost outpost = new Outpost(this, token); + + if ((System.currentTimeMillis() - token.TimeSpawned) > Outpost.MAX_LIFETIME) + { + System.out.println("[OUTPOSTS] SKIPPING & REMOVING OUTPOST [" + token.UniqueId + "] BECAUSE OF OLD AGE"); + + _repository.deleteOutpost(token.UniqueId); + outpost.kill(); + + return; + } + + System.out.println("[OUTPOSTS] INITIALIZED OUTPOST FROM DATABASE SAVE"); + + _outposts.put(token.OwnerClan.getName(), outpost); + }) + ); + } + + public void saveOutposts() + { + final Stack queue = new Stack<>(); + + _outposts.values().forEach(outpost -> { + final OutpostToken token = outpost.toToken(); + + queue.push(() -> _repository.updateOutpost(token)); + }); + + runAsync(() -> { + while (!queue.isEmpty()) + queue.pop().run(); + + _repository.getOutpostsByServer(_clansManager.getServerId(), tokens -> { + tokens.forEach(token -> { + if (!_idToOutpost.containsKey(Integer.valueOf(token.UniqueId))) + { + System.out.println("[OUTPOSTS] OUTPOST [" + token.UniqueId + "] NO LONGER EXISTS, DELETING"); + _repository.deleteOutpost(token.UniqueId); + } + }); + }); + }); + } + + public OutpostRepository getRepository() + { + return _repository; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostState.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostState.java new file mode 100644 index 000000000..8d37671fa --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostState.java @@ -0,0 +1,38 @@ +package mineplex.game.clans.clans.siege.outpost; + +public enum OutpostState +{ + /** + * this much space between them so that there is some room for any potential new states. + */ + AWAITING(10), + CONSTRUCTING(20), + LIVE(30), + DESTRUCTING(40), + DEAD(50); + + private byte _id; + + OutpostState(int id) + { + _id = (byte) id; + } + + public static OutpostState ById(byte id) + { + for (OutpostState state : values()) + { + if (state._id == id) + { + return state; + } + } + + return null; + } + + public byte getId() + { + return _id; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostType.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostType.java new file mode 100644 index 000000000..134e6b000 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/OutpostType.java @@ -0,0 +1,395 @@ +package mineplex.game.clans.clans.siege.outpost; + +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; + +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.util.UtilWorld; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock; +import mineplex.game.clans.clans.siege.outpost.build.OutpostBlockBanner; +import net.minecraft.server.v1_8_R3.NBTTagCompound; + +public enum OutpostType +{ + MK_I(1, 3, 6) { + public LinkedHashMap createBuildQueue(Location location, ClansManager clans) + { + LinkedHashMap build = new LinkedHashMap<>(); + + for (int y = -1; y <= _ySize; y++) + { + for (int x = -_size; x <= _size; x++) + { + for (int z = -_size; z <= _size; z++) + { + Location loc = new Location(location.getWorld(), location.getX()+x, location.getY()+y, location.getZ()+z); + + if (clans.getClanUtility().isClaimed(loc)) + { + continue; + } + + boolean added = false; + + //Floor + if (y == -1 && Math.abs(x) <= _size-1 && Math.abs(z) <= _size-1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 98, (byte)0)); + added = true; + } + + //Walls + if (Math.abs(x) == _size || Math.abs(z) == _size) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 98, (byte)0)); + added = true; + } + + //Roof + if (y == 5 && Math.abs(x) <= _size-1 && Math.abs(z) <= _size-1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 44, (byte)13)); + added = true; + } + + //Clear + if (!added) + { + if (loc.getBlock().getTypeId() != 0) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 0, (byte) 0)); + } + } + } + } + } + + for (int y= -1; y <= _ySize; y++) + { + for (int x = -_size; x <= _size; x++) + { + for (int z = -_size; z <= _size; z++) + { + Location loc = new Location(location.getWorld(), location.getX()+x, location.getY()+y, location.getZ()+z); + + if (clans.getClanUtility().isClaimed(loc)) + { + continue; + } + + //Doors + if (y == 0 || y == 1) + { + if (x == 0 && z == _size) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 71, (byte)(y * 8 + 2 + 4))); + } + + if (x == 0 && z == -_size) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 71, (byte)(y * 8 + 4))); + } + + if (x == _size && z == 0) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 71, (byte)(y * 8 + 3 + 4))); + } + + if (x == -_size && z == 0) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 71, (byte)(y * 8 + 1 + 4))); + } + } + + //Platform + if (y == 2) + { + if (Math.abs(x) == _size-1 && Math.abs(z) < _size) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 44, (byte)13)); + } + + if (Math.abs(z) == _size-1 && Math.abs(x) < _size) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 44, (byte)13)); + } + } + + //Windows + if (y == 4) + { + if (Math.abs(x) == _size && Math.abs(z) < _size-1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 0, (byte)0)); + } + + if (Math.abs(z) == _size && Math.abs(x) < _size-1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 0, (byte)0)); + } + } + + //Ladders + if (y >= 0 && y < 3) + { + if (x == _size-1 && z == _size-1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 65, (byte)2)); + } + + if (x == (-_size)+1 && z == (-_size)+1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 65, (byte)3)); + } + } + + //Chests + if (y == 0) + { + if (x == _size-1 && z == (-_size)+1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 54, (byte)0)); + } + + if (x == (-_size)+1 && z == _size-1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 54, (byte)0)); + } + + if (x == _size-2 && z == (-_size)+1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 54, (byte)0)); + } + + if (x == (-_size)+2 && z == _size-1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 54, (byte)0)); + } + } + + //Beacon Floor + if (y == -1) + { + if (Math.abs(x) <= 1 && Math.abs(z) <= 1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 42, (byte)0)); + } + } + + //Beacon Roof + if (y == 5) + { + if (Math.abs(x) == 1 && Math.abs(z) <= 1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 98, (byte)0)); + } + + if (Math.abs(z) == 1 && Math.abs(x) <= 1) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 98, (byte)0)); + } + } + + //Beacon Glass + if (y == 5 && x == 0 && z == 0) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, 20, (byte)0)); + } + } + } + } + + //Core + build.put(UtilWorld.locToStr(getCoreLocation(location)), new OutpostBlock(build, getCoreLocation(location), Material.DIAMOND_BLOCK.getId(), (byte)0)); + + return build; + } + + public List getWallLocations(Location middle) + { + List list = new ArrayList<>(); + + list.add(middle.clone().add(_size / 2, 0, 0).add(1, 0, 0)); + list.add(middle.clone().add(_size / 2, 0, -(_size / 2)).add(1, 0, -1)); + list.add(middle.clone().add(-(_size / 2), 0, -(_size / 2)).add(-1, 0, -1)); + list.add(middle.clone().add(-(_size / 2), 0, 0).add(-1, 0, 0)); + + return list; + } + + public Location getCoreLocation(Location location) + { + return location.clone().subtract(0, 1, 0); + } + }, + MK_II(2, 5, 25) { + public LinkedHashMap createBuildQueue(Location location, ClansManager clans) + { + try + { + LinkedHashMap build = new LinkedHashMap<>(); + + File file = new File("schematic" + File.separator + "outpost_mk_II.schematic"); + Schematic schematic = UtilSchematic.loadSchematic(file); + + for (int y = 0; y < schematic.getHeight(); y++) + { + for (int x = 0; x < schematic.getWidth(); x++) + { + for (int z = 0; z < schematic.getLength(); z++) + { + int relativeX = -(schematic.getWidth() / 2) + x; + int relativeZ = -(schematic.getLength() / 2) + z; + + Location loc = location.clone().add(relativeX, y - 1, relativeZ); + + if (schematic.getBlock(x, y, z) == 0 && loc.getBlock().getType() == Material.AIR) + { + continue; + } + + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, schematic.getBlock(x, y, z), schematic.getData(x, y, z))); + } + } + } + + //Core + build.put(UtilWorld.locToStr(getCoreLocation(location)), new OutpostBlock(build, getCoreLocation(location), Material.DIAMOND_BLOCK.getId(), (byte)0)); + + return build; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + + public List getWallLocations(Location middle) + { + List list = new ArrayList<>(); + + list.add(middle.clone().add(_size / 2, 0, 0).add(1, 0, 0)); + list.add(middle.clone().add(_size / 2, 0, -(_size / 2)).add(1, 0, -1)); + list.add(middle.clone().add(-(_size / 2), 0, -(_size / 2)).add(-1, 0, -1)); + list.add(middle.clone().add(-(_size / 2), 0, 0).add(-1, 0, 0)); + + return list; + } + + public Location getCoreLocation(Location location) + { + return location.clone().subtract(0, 1, 0); + } + }, + MK_III(3, 5, 25) { + public LinkedHashMap createBuildQueue(Location location, ClansManager clans) + { + try + { + LinkedHashMap build = new LinkedHashMap<>(); + + File file = new File("schematic" + File.separator + "outpost_mk_III.schematic"); + Schematic schematic = UtilSchematic.loadSchematic(file); + + for (int y = 0; y < schematic.getHeight(); y++) + { + for (int x = 0; x < schematic.getWidth(); x++) + { + for (int z = 0; z < schematic.getLength(); z++) + { + int relativeX = -(schematic.getWidth() / 2) + x; + int relativeZ = -(schematic.getLength() / 2) + z; + + Location loc = location.clone().add(relativeX, y - 1, relativeZ); + + if (schematic.getBlock(x, y, z) == 0 && loc.getBlock().getType() == Material.AIR) + { + continue; + } + + if (Material.getMaterial(schematic.getBlock(x, y, z)).name().contains("BANNER")) + { + build.put(UtilWorld.locToStr(loc), new OutpostBlockBanner(build, loc, schematic.getBlock(x, y, z), schematic.getData(x, y, z), DyeColor.RED)); + } + else + build.put(UtilWorld.locToStr(loc), new OutpostBlock(build, loc, schematic.getBlock(x, y, z), schematic.getData(x, y, z))); + } + } + } + + //Core + build.put(UtilWorld.locToStr(getCoreLocation(location)), new OutpostBlock(build, getCoreLocation(location), Material.DIAMOND_BLOCK.getId(), (byte)0)); + + return build; + } + catch(Exception e) + { + e.printStackTrace(); + return null; + } + } + + public List getWallLocations(Location middle) + { + List list = new ArrayList<>(); + + list.add(middle.clone().add(_size / 2, 0, 0).add(1, 0, 0)); + list.add(middle.clone().add(_size / 2, 0, -(_size / 2)).add(1, 0, -1)); + list.add(middle.clone().add(-(_size / 2), 0, -(_size / 2)).add(-1, 0, -1)); + list.add(middle.clone().add(-(_size / 2), 0, 0).add(-1, 0, 0)); + + return list; + } + + public Location getCoreLocation(Location location) + { + return location.clone().subtract(0, 1, 0); + } + }; + + protected int _size; + protected int _ySize; + + private int _id; + + OutpostType(int id, int size, int ySize) + { + _size = size; + _ySize = ySize; + _id = id; + } + + public int getId() + { + return _id; + } + + public abstract LinkedHashMap createBuildQueue(Location location, ClansManager clans); + + public abstract Location getCoreLocation(Location location); + + public abstract List getWallLocations(Location location); + + public static OutpostType ById(byte id) + { + for (OutpostType type : values()) + { + if (type._id == id) + { + return type; + } + } + + return null; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/build/OutpostBlock.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/build/OutpostBlock.java new file mode 100644 index 000000000..c0f2f490e --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/build/OutpostBlock.java @@ -0,0 +1,82 @@ +package mineplex.game.clans.clans.siege.outpost.build; + +import java.util.Map; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockState; + +import mineplex.core.common.util.UtilWorld; + +public class OutpostBlock +{ + private Location _location; + private int _id; + private byte _data; + + private int _originalId; + private byte _originalData; + + public OutpostBlock(Map blocks, Location loc, int id, byte data) + { + _location = loc; + _id = id; + _data = data; + + String locStr = UtilWorld.locToStr(loc); + + if (blocks.containsKey(locStr)) + { + _originalId = blocks.get(locStr)._originalId; + _originalData = blocks.get(locStr)._originalData; + } + else + { + _originalId = _location.getBlock().getTypeId(); + _originalData = _location.getBlock().getData(); + } + } + + public void set() + { + _location.getBlock().setTypeIdAndData(_id, _data, false); + if (_id != 0) + { + _location.getWorld().playEffect(_location, Effect.STEP_SOUND, Material.getMaterial(_id), 10); + } + } + + public void restore() + { + BlockState state = _location.getBlock().getState(); + state.setTypeId(_originalId); + state.setRawData(_originalData); + state.update(true, false); + } + + public int getId() + { + return _id; + } + + public byte getData() + { + return _data; + } + + public int getOriginalId() + { + return _originalId; + } + + public int getOriginalData() + { + return _originalData; + } + + public Location getLocation() + { + return _location; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/build/OutpostBlockBanner.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/build/OutpostBlockBanner.java new file mode 100644 index 000000000..02ec95e86 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/build/OutpostBlockBanner.java @@ -0,0 +1,40 @@ +package mineplex.game.clans.clans.siege.outpost.build; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.block.Banner; +import org.bukkit.block.banner.Pattern; + +/** + * Special block for Mk III Outpost + * + */ +public class OutpostBlockBanner extends OutpostBlock +{ + private DyeColor _baseColor; + private List _patterns; + + public OutpostBlockBanner(Map blocks, Location loc, int id, byte data, DyeColor color, Pattern... patterns) + { + super(blocks, loc, id, data); + _baseColor = color; + _patterns = new ArrayList<>(Arrays.asList(patterns)); + } + + @Override + public void set() + { + super.set(); + + Banner banner = (Banner) getLocation().getBlock().getState(); + banner.setBaseColor(_baseColor); + banner.setPatterns(_patterns); + + banner.update(true, false); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/OutpostRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/OutpostRepository.java new file mode 100644 index 000000000..6ff1675e6 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/OutpostRepository.java @@ -0,0 +1,141 @@ +package mineplex.game.clans.clans.siege.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.List; + +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.collect.Lists; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.database.MinecraftRepository; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.siege.outpost.OutpostManager; +import mineplex.game.clans.clans.siege.outpost.OutpostState; +import mineplex.game.clans.clans.siege.outpost.OutpostType; +import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.column.ColumnByte; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnTimestamp; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class OutpostRepository extends MinecraftRepository +{ + private OutpostManager _manager; + + private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansOutposts (uniqueId INT NOT NULL," + + "serverId INT NOT NULL," + + "origin VARCHAR(30)," + + "outpostType TINYINT NOT NULL," + + "ownerClan INT NOT NULL," + + "timeSpawned LONG," + + "outpostState TINYINT NOT NULL," + + "PRIMARY KEY (uniqueId));"; + + private static final String GET_OUTPOST_BY_ID = "SELECT * FROM clansOutposts WHERE uniqueId=?;"; + private static final String GET_OUTPOST_BY_CLAN = "SELECT * FROM clansOutposts WHERE ownerClan=?;"; + private static final String GET_OUTPOSTS_BY_SERVER = "SELECT * FROM clansOutposts WHERE serverId=?;"; + + private static final String UPDATE_OUTPOST = "UPDATE clansOutposts SET outpostState=? WHERE uniqueId=?;"; + private static final String INSERT_OUTPOST = "INSERT INTO clansOutposts VALUES (?, ?, ?, ?, ?, ?, ?);"; + + private static final String DELETE_OUTPOST = "DELETE FROM clansOutposts WHERE uniqueId=?;"; + + public OutpostRepository(JavaPlugin plugin, OutpostManager manager) + { + super(plugin, DBPool.getAccount()); + + _manager = manager; + } + + public void deleteOutpost(final int uniqueId) + { + executeUpdate(DELETE_OUTPOST, new ColumnInt("uniqueId", uniqueId)); + } + + public void getOutpostById(final int uniqueId, final Callback callback) + { + executeQuery(GET_OUTPOST_BY_ID, resultSet -> { + OutpostToken token = new OutpostToken(); + + resultSet.next(); + + load(token, resultSet); + + callback.run(token); + }, new ColumnInt("uniqueId", uniqueId)); + } + + public void getOutpostByClan(final ClanInfo clan, final Callback callback) + { + executeQuery(GET_OUTPOST_BY_CLAN, resultSet -> { + resultSet.next(); + + OutpostToken token = new OutpostToken(); + + load(token, resultSet); + + callback.run(token); + }, new ColumnInt("ownerClan", clan.getId())); + } + + public void getOutpostsByServer(final int serverId, final Callback> callback) + { + executeQuery(GET_OUTPOSTS_BY_SERVER, resultSet -> { + List tokens = Lists.newArrayList(); + + while (resultSet.next()) + { + OutpostToken token = new OutpostToken(); + load(token, resultSet); + tokens.add(token); + } + + callback.run(tokens); + }, new ColumnInt("serverId", serverId)); + } + + private void load(OutpostToken token, ResultSet columns) throws SQLException + { + token.UniqueId = columns.getInt("uniqueId"); + token.Origin = UtilWorld.strToLoc(columns.getString("origin")); + token.Type = OutpostType.ById(columns.getByte("outpostType")); + token.OwnerClan = _manager.getClansManager().getClanUtility().getClanById(columns.getInt("ownerClan")); + token.TimeSpawned = columns.getTimestamp("timeSpawned").getTime(); + token.OutpostState = OutpostState.ById(columns.getByte("outpostState")); + } + + @Override + protected void initialize() + { + executeUpdate(CREATE); + } + + @Override + protected void update() + { + } + + public void updateOutpost(OutpostToken token) + { + executeUpdate(UPDATE_OUTPOST, + new ColumnByte("outpostState", Byte.valueOf(token.OutpostState.getId())), + new ColumnInt("uniqueId", token.UniqueId)); + } + + public void insertOutpost(OutpostToken token) + { + executeUpdate(INSERT_OUTPOST, + new ColumnInt("uniqueId", token.UniqueId), + new ColumnInt("serverId", _manager.getClansManager().getServerId()), + new ColumnVarChar("origin", 30, UtilWorld.locToStr(token.Origin)), + new ColumnInt("outpostType", token.Type.getId()), + new ColumnInt("ownerClan", token.OwnerClan.getId()), + new ColumnTimestamp("timeSpawned", new Timestamp(token.TimeSpawned)), + new ColumnByte("outpostState", Byte.valueOf(token.OutpostState.getId()))); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java new file mode 100644 index 000000000..5fc7caca3 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/SiegeWeaponRepository.java @@ -0,0 +1,204 @@ +package mineplex.game.clans.clans.siege.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.collect.Lists; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.database.MinecraftRepository; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.siege.SiegeManager; +import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnTimestamp; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class SiegeWeaponRepository extends MinecraftRepository +{ + private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansSiegeWeapons (uniqueId INT NOT NULL," + + "serverId INT NOT NULL," + + "location VARCHAR(30)," + + "ownerClan INT NOT NULL," + + "weaponType TINYINT NOT NULL," + + "health INT NOT NULL," + + "yaw INT NOT NULL," + + "lastFired LONG," + + "entities VARCHAR(200)," + + "PRIMARY KEY (uniqueId));"; + + private static final String GET_WEAPON_BY_ID = "SELECT * FROM clansSiegeWeapons WHERE uniqueId=?;"; + private static final String GET_WEAPONS_BY_CLAN = "SELECT * FROM clansSiegeWeapons WHERE ownerClan=?;"; + private static final String GET_WEAPONS_BY_SERVER = "SELECT * FROM clansSiegeWeapons WHERE serverId=?;"; + + private static final String UPDATE_WEAPON = "UPDATE clansSiegeWeapons SET health=?,yaw=?,lastFired=? WHERE uniqueId=?;"; + private static final String INSERT_WEAPON = "INSERT INTO clansSiegeWeapons VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);"; + + private static final String DELETE_WEAPON = "DELETE FROM clansSiegeWeapons WHERE uniqueId=?;"; + + public SiegeWeaponRepository(JavaPlugin plugin) + { + super(plugin, DBPool.getAccount()); + } + + public void deleteWeapon(final int uniqueId) + { + System.out.println("Siege Repo> Deleting weapon " + uniqueId); + + SiegeManager.Instance.runAsync(() -> + executeUpdate(DELETE_WEAPON, new ColumnInt("uniqueId", uniqueId)) + ); + } + + public void getWeaponById(final int uniqueId, final Callback callback) + { + SiegeManager.Instance.runAsync(() -> + executeQuery(GET_WEAPON_BY_ID, resultSet -> { + SiegeWeaponToken token = new SiegeWeaponToken(); + + resultSet.next(); + + load(token, resultSet); + + callback.run(token); + }, new ColumnInt("uniqueId", uniqueId)) + ); + } + + public void getWeaponsByServer(final int serverId, final Callback> callback) + { + SiegeManager.Instance.runAsync(() -> + executeQuery(GET_WEAPONS_BY_SERVER, resultSet -> { + List tokens = Lists.newArrayList(); + + while (resultSet.next()) + { + SiegeWeaponToken token = new SiegeWeaponToken(); + + load(token, resultSet); + + tokens.add(token); + } + + callback.run(tokens); + }, new ColumnInt("serverId", serverId)) + ); + } + + public void getWeaponsByClan(final ClanInfo clan, final Callback> callback) + { + SiegeManager.Instance.runAsync(() -> + executeQuery(GET_WEAPONS_BY_CLAN, resultSet -> { + List tokens = Lists.newArrayList(); + + while (resultSet.next()) + { + SiegeWeaponToken token = new SiegeWeaponToken(); + + load(token, resultSet); + + tokens.add(token); + } + + callback.run(tokens); + }, new ColumnInt("ownerClan", clan.getId())) + ); + } + + private void load(SiegeWeaponToken token, ResultSet columns) throws SQLException + { + token.UniqueId = columns.getInt("uniqueId"); + token.Location = UtilWorld.strToLoc(columns.getString("location")); + token.OwnerClan = SiegeManager.Instance.getClansManager().getClanUtility().getClanById(columns.getInt("ownerClan")); + token.WeaponType = columns.getByte("weaponType"); + token.Health = columns.getShort("health"); + token.Yaw = columns.getShort("yaw"); + token.LastFired = columns.getTimestamp("lastFired").getTime(); + token.Entities = decodeEntities(columns.getString("entities")); + + System.out.println("Siege Repo> Loaded weapon " + token.UniqueId); + } + + public void updateWeapon(SiegeWeaponToken token) + { + System.out.println("Siege Repo> Updating weapon " + token.UniqueId); + + SiegeManager.Instance.runAsync(() -> + executeUpdate(UPDATE_WEAPON, + new ColumnInt("health", token.Health), + new ColumnInt("yaw", token.Yaw), + new ColumnTimestamp("lastFired", new Timestamp(token.LastFired)), + new ColumnInt("uniqueId", token.UniqueId)) + ); + } + + public void insertWeapon(SiegeWeaponToken token) + { + System.out.println("Siege Repo> Inserting new weapon " + token.UniqueId); + + SiegeManager.Instance.runAsync(() -> + executeUpdate(INSERT_WEAPON, + new ColumnInt("uniqueId", token.UniqueId), + new ColumnInt("serverId", SiegeManager.Instance.getClansManager().getServerId()), + new ColumnVarChar("location", 30, UtilWorld.locToStr(token.Location)), + new ColumnInt("ownerClan", token.OwnerClan.getId()), + new ColumnInt("weaponType", token.WeaponType), + new ColumnInt("health", token.Health), + new ColumnInt("yaw", token.Yaw), + new ColumnTimestamp("lastFired", new Timestamp(token.LastFired)), + new ColumnVarChar("entities", 100, encodeEntities(token.Entities))) + ); + } + + private String encodeEntities(Map entities) + { + StringBuilder builder = new StringBuilder(); + + int l = 0; + for (String name : entities.keySet()) + { + if (l != 0) + { + builder.append(","); + } + + builder.append(name + ":" + entities.get(name)); + l++; + } + + return builder.toString(); + } + + private Map decodeEntities(String data) + { + Map map = new HashMap<>(); + + for (String entries : data.split(",")) + { + map.put(entries.split(":")[0], entries.split(":")[1]); + } + + return map; + } + + @Override + protected void initialize() + { + SiegeManager.Instance.runAsync(() -> + executeUpdate(CREATE) + ); + } + + @Override + protected void update() + { + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/tokens/OutpostToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/tokens/OutpostToken.java new file mode 100644 index 000000000..0436fbda9 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/tokens/OutpostToken.java @@ -0,0 +1,17 @@ +package mineplex.game.clans.clans.siege.repository.tokens; + +import org.bukkit.Location; + +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.siege.outpost.OutpostState; +import mineplex.game.clans.clans.siege.outpost.OutpostType; + +public class OutpostToken +{ + public int UniqueId; + public Location Origin; + public OutpostType Type; + public ClanInfo OwnerClan; + public long TimeSpawned; + public OutpostState OutpostState; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/tokens/SiegeWeaponToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/tokens/SiegeWeaponToken.java new file mode 100644 index 000000000..876e73935 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/repository/tokens/SiegeWeaponToken.java @@ -0,0 +1,21 @@ +package mineplex.game.clans.clans.siege.repository.tokens; + +import java.util.Map; +import java.util.UUID; + +import org.bukkit.Location; + +import mineplex.game.clans.clans.ClanInfo; + +public class SiegeWeaponToken +{ + public int UniqueId; + public ClanInfo OwnerClan; + public byte WeaponType; + public Location Location; + public int Health; + public int Yaw; + public long LastFired; + public Map Entities; + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java new file mode 100644 index 000000000..45510438c --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java @@ -0,0 +1,459 @@ +package mineplex.game.clans.clans.siege.weapon; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map.Entry; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + +import com.google.common.collect.Lists; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilCollections; +import mineplex.core.common.util.UtilEnt; +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.itemstack.ItemBuilder; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.siege.SiegeManager; +import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent; +import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken; +import mineplex.game.clans.clans.siege.weapon.projectile.ProjectileAttributes; +import mineplex.game.clans.clans.siege.weapon.projectile.WeaponProjectile; +import mineplex.game.clans.clans.siege.weapon.util.AccessRule; +import mineplex.game.clans.clans.siege.weapon.util.AccessType; +import mineplex.game.clans.clans.siege.weapon.util.WeaponStateInfo; + +public class Cannon extends SiegeWeapon +{ + public static final ItemStack CANNON_ITEM = new ItemBuilder(Material.SPONGE, 1).setData((byte) 1).setRawTitle(C.Reset + C.cBlue + "Cannon").build(); + + private int _firepower = 1; + + public Cannon(SiegeManager siegeManager, SiegeWeaponToken token) + { + super(300, "Cannon", token, siegeManager.getClansManager(), siegeManager); + + System.out.println("Siege> Loading Cannon from token " + token.UniqueId); + + setBoundingBox(1); + + setStateInfo("Unloaded", new WeaponStateInfo(Material.SPONGE, (byte) 1)); + setStateInfo("Loaded", new WeaponStateInfo(Material.SPONGE, (byte) 0)); + + setAmmunitionType(Material.TNT); + + setAmmunitionSlot(4); + setMaximumAmmunitionPerSlot(1); + + _baseDamage = 650; + + setProjectileAttributes(new ProjectileAttributes().setPrimedTnt().setDoCrater().craterSize(3).craterChanceOfAir(2.d)); + + setFireRule(new AccessRule(AccessType.LCLICK_BB, player -> { + if (!isRiding(player)) + { + return false; + } + +// if (!_ownerClan.isMember(player)) +// { +// UtilPlayer.message(player, F.main("Clans", "This cannon is not owned by your Clan.")); +// return false; +// } + + if(_clans.hasTimer(player)) + { + UtilPlayer.message(player, F.main("Clans", "You cannot fire a cannon whilst on PvPTimer")); + return false; + } + + if (!canBeFired()) + { + UtilPlayer.message(player, F.main("Clans", "Cannon is not loaded correctly.")); + return false; + } + + if (System.currentTimeMillis() - _lastFired < 20000) + { + UtilPlayer.message(player, F.main("Clans", "Cannon is cooling down (" + F.time(UtilTime.MakeStr(20000 - (System.currentTimeMillis() - _lastFired))) + ")")); + return false; + } + + return true; + })); + + enableInventory(UtilServer.getServer().createInventory(null, InventoryType.DISPENSER, C.cDAquaB + _name), new AccessRule(AccessType.RCLICK_BB, player -> player.equals(getRider()))); + + setRideable(new AccessRule(AccessType.RCLICK_BB, player -> { +// if (!_ownerClan.isMember(player)) +// { +// UtilPlayer.message(player, F.main("Clans", "This Cannon is not owned by your Clan.")); +// return false; +// } + + if (getRider() != null && !getRider().equals(player)) + { + UtilPlayer.message(player, F.main("Clans", "Someone is already riding this cannon.")); + return false; + } + + if(_clans.hasTimer(player)) + { + UtilPlayer.message(player, F.main("Clans", "You cannot ride on a Cannon whilst on PvPTimer")); + return false; + } + + return !player.equals(getRider()); + })); + } + + public Cannon(Location location, ClanInfo clan, SiegeManager siegeManager, boolean syncWithDb) + { + super(2, location.clone().add(0.5, 0, 0.5), 1400, "Cannon", clan, clan.Clans, siegeManager); + + _syncWithDb = syncWithDb; + + setBoundingBox(1); + + setStateInfo("Unloaded", new WeaponStateInfo(Material.SPONGE, (byte) 1)); + setStateInfo("Loaded", new WeaponStateInfo(Material.SPONGE, (byte) 0)); + + loadEntities(); + + setFirepowerType(Material.SULPHUR); + setAmmunitionType(Material.TNT); + + setFirepowerSlots(Integer.valueOf(1), Integer.valueOf(3), Integer.valueOf(5), Integer.valueOf(7)); + setMaximumFirepowerPerSlot(3); + + setAmmunitionSlot(4); + setMaximumAmmunitionPerSlot(1); + + _baseDamage = 650; + + setProjectileAttributes(new ProjectileAttributes().setPrimedTnt().setDoCrater().craterSize(3).craterChanceOfAir(2.d)); + + setFireRule(new AccessRule(AccessType.LCLICK_BB, player -> { + if (!isRiding(player)) + { + return false; + } + +// if (!_ownerClan.isMember(player)) +// { +// UtilPlayer.message(player, F.main("Clans", "This Cannon is not owned by your Clan.")); +// return false; +// } + + if (_clans.hasTimer(player)) + { + UtilPlayer.message(player, F.main("Clans", "You cannot fire a Cannon whilst protected from pvp.")); + return false; + } + + if (!canBeFired()) + { + UtilPlayer.message(player, F.main("Clans", "Cannon is not loaded correctly.")); + return false; + } + + if (System.currentTimeMillis() - _lastFired < 20000) + { + UtilPlayer.message(player, F.main("Clans", "Cannon is cooling down (" + F.time(UtilTime.MakeStr(20000 - (System.currentTimeMillis() - _lastFired))) + ")")); + return false; + } + + return true; + })); + + enableInventory(UtilServer.getServer().createInventory(null, InventoryType.DISPENSER, C.cDAquaB + _name), new AccessRule(AccessType.RCLICK_BB, player -> player.equals(getRider()))); + + setRideable(new AccessRule(AccessType.RCLICK_BB, player -> { +// if (!_ownerClan.isMember(player)) +// { +// UtilPlayer.message(player, F.main("Clans", "This Cannon is not owned by your Clan.")); +// return false; +// } + + if (getRider() != null && !getRider().equals(player)) + { + UtilPlayer.message(player, F.main("Clans", "Someone is already riding this Cannon.")); + return false; + } + + if(_clans.hasTimer(player)) + { + UtilPlayer.message(player, F.main("Clans", "You cannot ride on a Cannon whilst protected from pvp.")); + return false; + } + + return !player.equals(getRider()); + })); + } + + @EventHandler + protected void InventoryClick(InventoryClickEvent event) + { + if (event.getClickedInventory() == null) + { + return; + } + + if (event.getClick() == ClickType.SHIFT_RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) + { + if(_inventory.getViewers().contains(event.getWhoClicked())) + { + event.setCancelled(true); //block shift right clicking tnt into this inventory + getClans().runSyncLater(() -> ((Player) event.getWhoClicked()).updateInventory(), 1L); + } + + return; + } + + if (!event.getClickedInventory().equals(_inventory)) + { + return; + } + + if (event.getSlot() == 0) + { + int oldFirepower = _firepower; + + _firepower = UtilMath.clamp(--_firepower, 1, 3); + + if (oldFirepower != _firepower) + { + ((Player) event.getWhoClicked()).playSound(event.getWhoClicked().getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f); + } + else + { + ((Player) event.getWhoClicked()).playSound(event.getWhoClicked().getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f); + } + + event.setCancelled(true); + } + else if (event.getSlot() == 1) + { + event.setCancelled(true); + } + else if (event.getSlot() == 2) + { + int oldFirepower = _firepower; + + _firepower = UtilMath.clamp(++_firepower, 1, 3); + + if (oldFirepower != _firepower) + { + ((Player) event.getWhoClicked()).playSound(event.getWhoClicked().getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f); + } + else + { + ((Player) event.getWhoClicked()).playSound(event.getWhoClicked().getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f); + } + + event.setCancelled(true); + } + else if (event.getSlot() != _ammunitionSlot) + { + event.setCancelled(true); + } + } + + private void updateInventory() + { + _inventory.setItem(0, new ItemBuilder(Material.LEVER).setTitle(C.cRed + "-1 Firepower").build()); + _inventory.setItem(1, new ItemBuilder(Material.SULPHUR).setTitle(C.cWhiteB + "Firepower: " + C.cYellow + _firepower).setAmount(_firepower).build()); + _inventory.setItem(2, new ItemBuilder(Material.LEVER).setTitle(C.cGreen + "+1 Firepower").build()); + + for (int slot : UtilCollections.newList(Integer.valueOf(3), Integer.valueOf(5), Integer.valueOf(6), Integer.valueOf(7), Integer.valueOf(8))) + { + _inventory.setItem(slot, new ItemBuilder(Material.COBBLESTONE).setTitle(C.cGray + "Cannon Wall").build()); + } + } + + protected boolean CustomInventoryValid(int slot, ItemStack item) + { + return true; // all slots are now filled; slot == 0 || slot == 1 || slot == 2; + } + + private void loadEntities() + { + Slime filler = _location.getWorld().spawn(_location.clone(), Slime.class); + + UtilEnt.silence(filler, true); + UtilEnt.Vegetate(filler); + + filler.setSize(-1); + filler.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1, true, false)); + + addEntity(filler, "Filler_1"); + + Slime playerMount = _location.getWorld().spawn(_location.clone(), Slime.class); + + UtilEnt.silence(playerMount, true); + UtilEnt.Vegetate(playerMount); + + playerMount.setSize(-1); + playerMount.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1, true, false)); + + getEntity("Filler_1").setPassenger(playerMount); + addEntity(playerMount, "PLAYERMOUNT"); + + ArmorStand weapon = _location.getWorld().spawn(_location.clone(), ArmorStand.class); + + UtilEnt.setFakeHead(weapon, true); + weapon.teleport(_location); + weapon.setVisible(false); + weapon.setGravity(false); + + weapon.setPassenger(getEntity("Filler_1")); + + addEntity(weapon, "WEAPON"); + + + insert(); + } + + @Override + public void FindEntities() + { + Lists.newArrayList(_location.getWorld().getEntities()) + .forEach(entity -> { + for (Entry entry : _loadedToken.Entities.entrySet()) + { + if (entity.getUniqueId().toString().equals(entry.getValue())) + { + addEntity(entity, entry.getKey()); + } + } + }); + + if (getEntity("WEAPON") == null || getEntity("Filler_1") == null || getEntity("PLAYERMOUNT") == null) + { + System.out.println("[Cannon] Could not find all entities, killing."); + kill(); + } + } + + @Override + public void CustomFire(WeaponProjectile projectile) + { + projectile.setLocation(projectile.getLocation().add(.0, .2, .0)); + + UtilParticle.PlayParticleToAll(ParticleType.LARGE_EXPLODE, projectile.getLocation(), new Vector(0, 0, 0), .1f, 2, ViewDist.MAX); + UtilServer.getServer().getOnlinePlayers().forEach(player -> player.playSound(projectile.getLocation(), Sound.EXPLODE, 1.f, 1.f)); + } + + @Override + public String GetNextState() + { + if (getAmmunition() > 0) + { + return "Loaded"; + } + + return "Unloaded"; + } + + protected int getPowerLevel() + { + return _firepower; + } + + @Override + protected void CustomTick() + { + updateInventory(); + + if (getProjectile() != null) + { + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, getProjectile().getLocation().add(0, .5, 0), new Vector(0, 0, 0), .1f, 3, ViewDist.MAX); + } + } + + protected void handleLeftClick(Player player) + { + super.handleLeftClick(player); + } + + @Override + protected double[] GetProjectileVelocity() + { + int firepower = getPowerLevel(); + + double hMult = 0; + double yAdd = 0; + + if (firepower == 1) + { + hMult = 1.2; + yAdd = 0.5; + } + else if (firepower == 2) + { + hMult = 1.7; + yAdd = 0.55; + } + else if (firepower >= 3) + { + hMult = 2.35; + yAdd = 0.6; + } + + return new double[] { yAdd, hMult }; + } + + @EventHandler + public void explosionEffects(SiegeWeaponExplodeEvent event) + { + for (int i = 0; i < 8; i++) + { + // Explosion particle effects. + Location point = UtilAlg.getRandomLocation(event.getProjectile().getLocation(), 5); + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, point, 0, 0, 0, 1, 2, ViewDist.MAX); + } + + // Block explosion. + ArrayList blocks = new ArrayList<>(); + int attempts = 0; + while (blocks.size() < 10 && (attempts < 30)) + { + Block block = UtilAlg.getRandomLocation(event.getProjectile().getLocation(), (4 * getPowerLevel())).getBlock(); + if ((block.getType() != Material.AIR) && (!blocks.contains(block))) + { + blocks.add(block); + } + + attempts++; + } + + _siegeManager.getClansManager().getExplosion().BlockExplosion( + blocks, + event.getProjectile().getLocation(), + false + ); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java new file mode 100644 index 000000000..11520d2dc --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java @@ -0,0 +1,979 @@ +package mineplex.game.clans.clans.siege.weapon; + +import java.util.HashMap; +import java.util.UUID; + +import org.apache.commons.lang.Validate; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.player.PlayerArmorStandManipulateEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.world.ChunkUnloadEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.EulerAngle; +import org.spigotmc.event.entity.EntityDismountEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautArrayList; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilCollections; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.hologram.Hologram; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.siege.SiegeManager; +import mineplex.game.clans.clans.siege.events.LoadSiegeWeaponEvent; +import mineplex.game.clans.clans.siege.events.MountSiegeWeaponEvent; +import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent; +import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken; +import mineplex.game.clans.clans.siege.weapon.projectile.ProjectileAttributes; +import mineplex.game.clans.clans.siege.weapon.projectile.WeaponProjectile; +import mineplex.game.clans.clans.siege.weapon.util.AccessRule; +import mineplex.game.clans.clans.siege.weapon.util.AccessType; +import mineplex.game.clans.clans.siege.weapon.util.BarrierCollisionBox; +import mineplex.game.clans.clans.siege.weapon.util.WeaponStateInfo; +import mineplex.game.clans.items.PlayerGear; +import mineplex.game.clans.items.legendaries.AlligatorsTooth; +import mineplex.game.clans.items.legendaries.GiantsBroadsword; +import mineplex.game.clans.items.legendaries.HyperAxe; +import mineplex.game.clans.items.legendaries.LegendaryItem; +import mineplex.game.clans.items.legendaries.MagneticMaul; +import mineplex.game.clans.items.legendaries.WindBlade; + +public abstract class SiegeWeapon implements Listener +{ + // Constants + protected final int _maxHealth; + protected final byte _weaponTypeIdentifier; + + protected SiegeWeaponToken _loadedToken; + + // Managers + protected ClansManager _clans; + protected SiegeManager _siegeManager; + + // Info + protected final int _uniqueId; + + protected final ClanInfo _ownerClan; + protected final Location _location; + protected final String _name; + + protected int _health; + protected String _currentState; + protected boolean _alive = true; + protected boolean _invincible = false; + + // Mechanics + protected final NautArrayList _comprisedOf; + + protected Player _rider; + protected Inventory _inventory; + protected AccessRule _inventoryAccess; + protected BarrierCollisionBox _collisionBox; + + protected AccessRule _fireAccess; + + protected int _boundingBoxSize; + + protected double _yaw; + + protected long _lastRight = -1; + protected long _lastLeft = -1; + protected long _lastFired = -1; + + // Display + protected Hologram _infoHologram; + + // Utility + protected final NautHashMap _registeredStates; + protected final NautHashMap _entityMapping; + + protected boolean _syncWithDb; + + // Customizability + private double[] _forcedVelocity; + + protected boolean _isRideable; + protected boolean _invertRotation; + protected AccessRule _mountAccess; + + protected float _rotSpeed = 20.f; + + protected int _ammunitionSlot; + protected Material _ammunitionType; + protected int _maxAmmunition; + + protected NautArrayList _firepowerSlots = new NautArrayList<>(); + protected Material _firepowerType; + protected int _maxFirepowerPerSlot; + + protected int _baseDamage; + + protected ProjectileAttributes _projectileAttributes; + protected WeaponProjectile _projectile; + + public SiegeWeapon(int maxHealth, String name, SiegeWeaponToken token, ClansManager clansManager, SiegeManager siegeManager) + { + _weaponTypeIdentifier = token.WeaponType; + + _loadedToken = token; + + _uniqueId = token.UniqueId; + + _siegeManager = siegeManager; + _location = token.Location; + _name = name; + _health = _maxHealth = maxHealth; + _ownerClan = token.OwnerClan; + + _comprisedOf = new NautArrayList<>(); + _registeredStates = new NautHashMap<>(); + _entityMapping = new NautHashMap<>(); + + _infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth()); + _infoHologram.start(); + +// _infoHologram.setInteraction((player, type) -> { +// if (player.equals(_rider)) +// { +// if (type.equals(ClickType.LEFT)) +// { +// handleLeftClick(player); +// } +// } +// }); + + UtilServer.RegisterEvents(this); + + _clans = clansManager; + + _yaw = token.Yaw; + _lastFired = token.LastFired; + + _health = token.Health; + + FindEntities(); + } + + public SiegeWeapon(int typeId, Location location, int maxHealth, String name, ClanInfo owner, ClansManager clansManager, SiegeManager siegeManager) + { + _uniqueId = siegeManager.randomId(); + _weaponTypeIdentifier = (byte) typeId; + + _siegeManager = siegeManager; + _location = location; + _name = name; + _health = _maxHealth = maxHealth; + _ownerClan = owner; + + _comprisedOf = new NautArrayList<>(); + _registeredStates = new NautHashMap<>(); + _entityMapping = new NautHashMap<>(); + + _infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth()); + _infoHologram.start(); + + UtilServer.getPluginManager().registerEvents(this, clansManager.getPlugin()); + + _clans = clansManager; + } + + protected void insert() + { + if (_syncWithDb) + _siegeManager.getRepository().insertWeapon(toToken()); + } + + protected int calculateDamage(Player player) + { + ItemStack stack = player.getItemInHand(); + PlayerGear gear = _clans.getGearManager().getPlayerGear(player); + + if (stack == null) + return 1; + + if (gear.getWeapon() != null && gear.getWeapon() instanceof LegendaryItem) + if (gear.getWeapon() instanceof AlligatorsTooth) + return 8; + else if (gear.getWeapon() instanceof GiantsBroadsword) + return 10; + else if (gear.getWeapon() instanceof HyperAxe) + return 3; + else if (gear.getWeapon() instanceof MagneticMaul) + return 8; + else if (gear.getWeapon() instanceof WindBlade) + return 7; + + return (int) UtilItem.getAttackDamage(stack.getType()); + } + + protected void enableInventory(Inventory inventory, AccessRule accessRule) + { + _inventory = inventory; + _inventoryAccess = accessRule; + } + + protected void setBoundingBox(int size) + { + Validate.isTrue(size > 0, "Size must be a positive number."); + Validate.isTrue(UtilMath.isOdd(size), "Size must be an odd number."); + + _boundingBoxSize = size; + + _collisionBox = size == 1 ? BarrierCollisionBox.single(_location.clone()) : BarrierCollisionBox.all(_location.clone().subtract((size - 1) / 2, 0, (size - 1) / 2), _location.clone().add(((size - 1) / 2) + .2, size - 1, ((size - 1) / 2) + .2)); + _collisionBox.Construct(); + _collisionBox.registerRight((block, player) -> handleRightClick(player)); + _collisionBox.registerLeft((block, player) -> handleLeftClick(player)); + } + + protected void setBoundingBox(int size, int y) + { + Validate.isTrue(size > 0, "Size must be a positive number."); + Validate.isTrue(UtilMath.isOdd(size), "Size must be an odd number."); + + _boundingBoxSize = size; + + _collisionBox = size == 1 ? BarrierCollisionBox.single(_location.clone()) : BarrierCollisionBox.all(_location.clone().subtract((size - 1) / 2, 0, (size - 1) / 2), _location.clone().add(((size - 1) / 2) + .2, y, ((size - 1) / 2) + .2)); + _collisionBox.Construct(); + _collisionBox.registerRight((block, player) -> handleRightClick(player)); + _collisionBox.registerLeft((block, player) -> handleLeftClick(player)); + } + + private void update() + { + if (getEntity("WEAPON") == null || getEntity("PLAYERMOUNT") == null) + { + kill(); + return; + } + + if (_inventory != null) + checkInventory(); + + _rider = (Player) getEntity("PLAYERMOUNT").getPassenger(); + + if (!GetNextState().equals(_currentState)) + setState(GetNextState()); + + if (_projectile != null && _projectile.hasDied()) + _projectile = null; + + ArmorStand armorStand = (ArmorStand) getEntity("WEAPON"); + double standYaw = _yaw % 360; + + if (getRider() != null) + { + double riderYaw = (getRider().getLocation().getYaw() + (_invertRotation ? 180 : 0)) % 360; + + double dif = riderYaw - standYaw; + if (dif > 180) dif -= 360; + if (dif < -180) dif += 360; + + double yaw = (float) ((float)standYaw + Math.min(dif / _rotSpeed, 4f)); + + armorStand.setHeadPose(new EulerAngle(0, Math.toRadians(CustomRotate(_yaw = yaw)), 0)); + } + } + + protected boolean canBeFired() + { + return getPowerLevel() > 0 && getAmmunition() > 0 && _projectile == null; + } + + public void SetForcedVelocity(double vertical, double horizontal) + { + _forcedVelocity = new double[] { vertical, horizontal }; + } + + private void fire(Player player) + { + _lastFired = System.currentTimeMillis(); + + double[] vel = GetProjectileVelocity(); + + if (_forcedVelocity != null) + { + vel = _forcedVelocity; + } + + _inventory.clear(); + + CustomFire(_projectile = new WeaponProjectile(this, _location.clone().add(.5, 0, .5), _projectileAttributes, ((ArmorStand) getEntity("WEAPON")).getHeadPose().getY(), vel[0], vel[1])); + } + + protected void setFireRule(AccessRule rule) + { + _fireAccess = rule; + } + + protected void setFirepowerType(Material type) + { + _firepowerType = type; + } + + protected void setAmmunitionType(Material type) + { + _ammunitionType = type; + } + + protected void setFirepowerSlots(Integer... slots) + { + _firepowerSlots = UtilCollections.newNautList(slots); + } + + protected void setMaximumFirepowerPerSlot(int maxFirepowerPerSlot) + { + _maxFirepowerPerSlot = maxFirepowerPerSlot; + } + + protected void setAmmunitionSlot(int ammunitionSlot) + { + _ammunitionSlot = ammunitionSlot; + } + + protected void setMaximumAmmunitionPerSlot(int maxAmmunition) + { + _maxAmmunition = maxAmmunition; + } + + protected void setProjectileAttributes(ProjectileAttributes projectileAttributes) + { + _projectileAttributes = projectileAttributes; + } + + protected boolean isRiding(Player player) + { + return player.equals(getRider()); + } + + protected void setRideable(AccessRule accessRule) + { + _isRideable = true; + _mountAccess = accessRule; + } + + public void kill() + { + System.out.println("Killing: " + this.getClass().getSimpleName() + " [" + _uniqueId + "]"); + + _siegeManager.runSync(() -> { + CustomCleanup(); + + _comprisedOf.forEach(Entity::remove); + + _entityMapping.clear(); + _comprisedOf.clear(); + _infoHologram.stop(); + + if (_collisionBox != null) _collisionBox.Destruct(); + + _siegeManager.dead(this); + + _alive = false; + }); + + HandlerList.unregisterAll(this); + } + + private void handleMount(Player player) + { + UtilServer.CallEvent(new MountSiegeWeaponEvent(player, this)); + + if (!CustomMount(player)) + { + getEntity("PLAYERMOUNT").setPassenger(player); + } + + CustomOnMount(player); + } + + private void handleInventoryOpen(Player player) + { + player.openInventory(_inventory); + } + + private void handleRightClick(Player player) + { + if (_lastRight == -1) + { + _lastRight = System.currentTimeMillis(); + } + else + { + if (System.currentTimeMillis() - _lastRight <= 40) + { + return; + } + } + + _lastRight = System.currentTimeMillis(); + + CustomRightClick(player); + + if (_isRideable && _mountAccess.allow(AccessType.RCLICK_BB, player)) + { + handleMount(player); + return; + } + + if (_inventory != null && _inventoryAccess.allow(AccessType.RCLICK_BB, player)) + { + handleInventoryOpen(player); + return; + } + + if (_fireAccess.allow(AccessType.RCLICK_BB, player)) + { + fire(player); + } + } + + protected boolean CustomInventoryValid(int slot, ItemStack item) + { + return false; + } + + private void dismount(Player player) + { + player.teleport(player.getLocation().add(0, 1, 0)); + } + + protected void handleLeftClick(Player player) + { + if (_lastLeft == -1) + { + _lastLeft = System.currentTimeMillis(); + } + else + { + if (System.currentTimeMillis() - _lastLeft <= 40) + { + return; + } + } + + _lastLeft = System.currentTimeMillis(); + + CustomLeftClick(player); + + if (_isRideable && _mountAccess.allow(AccessType.LCLICK_BB, player)) + { + handleMount(player); + return; + } + + if (_inventory != null && _inventoryAccess.allow(AccessType.LCLICK_BB, player)) + { + handleInventoryOpen(player); + return; + } + + if (_fireAccess.allow(AccessType.LCLICK_BB, player)) + { + fire(player); + return; + } + + if (!player.equals(_rider) && Recharge.Instance.use(player, "Damage Cannon", 200, false, false)) + { + int health = calculateDamage(player); + + removeHealth(health); + + new Hologram( + _siegeManager.getClansManager().getHologramManager(), + _location.clone().add(UtilMath.random(-1, 1),1.4, UtilMath.random(-1, 1)), + 3500l, + C.cRed + "-" + health) + .start(); + } + } + + + protected abstract double[] GetProjectileVelocity(); + protected abstract String GetNextState(); + protected abstract void FindEntities(); + protected void CustomTick() { return; } + protected void CustomOnMount(Player player) { return; } + protected void CustomLeftClick(Player player) { return; } + protected void CustomRightClick(Player player) { return; } + protected void CustomCleanup() { return; } + protected void CustomUpdateState(String state) { return; } + protected void CustomFire(WeaponProjectile projectile) { return; } + protected double CustomRotate(double yaw) { return yaw; } + protected boolean CustomDismount(Player player, Entity entity) { return false; } + protected boolean CustomMount(Player player) { return false; } + + protected final void addEntity(Entity entity, String uniqueName) + { + _comprisedOf.add(entity); + + _entityMapping.put(uniqueName, entity); + } + + protected final void removeEntity(String uniqueName) + { + Entity entity = _entityMapping.get(uniqueName); + + _entityMapping.remove(uniqueName); + _comprisedOf.remove(entity); + + entity.remove(); + } + + protected final Entity getEntity(String uniqueName) + { + return _entityMapping.get(uniqueName); + } + + public final int getHealth() + { + return _health; + } + + public final String getDisplayHealth() + { + return UtilText.getProgress(null, ((double) _health) / ((double) _maxHealth), null, false, 12); + } + + public final void setHealth(int health) + { + _health = UtilMath.clamp(health, 0, _maxHealth); + + _infoHologram.setText(_name + " Health", getDisplayHealth()); + + if (_health == 0 && !_invincible) + kill(); + } + + public final void removeHealth(int health) + { + if (_invincible) return; + setHealth(_health - health); + } + + public final void addHealth(int health) + { + setHealth(_health + health); + } + + public final void setState(String state) + { + Validate.isTrue(_registeredStates.containsKey(state), "Provided state has not yet been registered."); + + ((ArmorStand) getEntity("WEAPON")).setHelmet(new ItemStack(_registeredStates.get(state).getType(), 1, (short) 0, (byte) _registeredStates.get(state).getData())); + + CustomUpdateState(_currentState = state); + } + + public final void setStateInfo(String state, WeaponStateInfo info) + { + _registeredStates.put(state, info); + } + + public final WeaponStateInfo getStateInfo(String state) + { + if (!_registeredStates.containsKey(state)) + _registeredStates.put(state, new WeaponStateInfo(Material.STONE, (byte) 101)); + + return _registeredStates.get(state); + } + + public void checkInventory() + { + for (int slot = 0; slot < _inventory.getSize(); slot++) + { + ItemStack item = _inventory.getItem(slot); + + if (item == null) + continue; + + if (slot == _ammunitionSlot) + { + if (item.getType() != _ammunitionType) + { + if (CustomInventoryValid(slot, item)) + continue; + + if (getRider() != null) + getRider().getInventory().addItem(item); + else + _location.getWorld().dropItem(_location, item); + + _inventory.setItem(slot, null); + } + else + { + if (item.getAmount() > _maxAmmunition) + { + if (getRider() != null) + getRider().getInventory().addItem(new ItemStack(_ammunitionType, item.getAmount() - _maxAmmunition)); + else + _location.getWorld().dropItem(_location, item); + + _inventory.setItem(slot, new ItemStack(_ammunitionType, _maxAmmunition)); + } + else + { + UtilServer.CallEvent(new LoadSiegeWeaponEvent(getRider(), this)); + } + } + } + else if (_firepowerSlots.contains(Integer.valueOf(slot))) + { + if (item.getType() != _firepowerType) + { + if (CustomInventoryValid(slot, item)) + continue; + + if (getRider() != null) + getRider().getInventory().addItem(item); + else + _location.getWorld().dropItem(_location, item); + + _inventory.setItem(slot, null); + } + else + { + if (item.getAmount() > _maxFirepowerPerSlot) + { + if (getRider() != null) + getRider().getInventory().addItem(new ItemStack(_firepowerType, item.getAmount() - _maxFirepowerPerSlot)); + else + _location.getWorld().dropItem(_location, item); + + _inventory.setItem(slot, new ItemStack(_firepowerType, _maxFirepowerPerSlot)); + } + } + } + else + { + if (CustomInventoryValid(slot, item)) + continue; + + if (getRider() != null) + getRider().getInventory().addItem(item); + else + _location.getWorld().dropItem(_location, item); + + _inventory.setItem(slot, null); + } + } + } + + @EventHandler + public void onSiegeWeaponExplode(SiegeWeaponExplodeEvent event) + { + if (UtilAlg.inBoundingBox(event.getProjectile().getLocation(), _location.clone().subtract(3, 2, 3), _location.clone().add(3, 2, 3))) + { + kill(); + + _ownerClan.inform("One of your Cannons has been destroyed!", null); + UtilTextMiddle.display("Damage", "You destroyed " + F.elem(getOwner().getName()) + "'s " + _name + ".", 10, 60, 10, event.getWeapon().getRider()); + UtilPlayer.message(event.getWeapon().getRider(), F.main("Clans", "You destroyed " + F.elem(getOwner().getName()) + "'s " + _name + ".")); + } + } + + @EventHandler + public void onDamage(EntityDamageEvent event) + { + if (_comprisedOf.contains(event.getEntity())) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onDmg(EntityDamageByEntityEvent event) + { + if (_comprisedOf.contains(event.getEntity()) && event.getDamager() instanceof Player) + { + if (!((Player) event.getDamager()).equals(_rider)) + { + handleLeftClick((Player) event.getDamager()); + } + + event.setCancelled(true); + } + } + + @EventHandler + public void onCloseInv(InventoryCloseEvent event) + { + if (!event.getInventory().equals(_inventory)) + return; + + ClansManager.getInstance().runSyncLater(() -> { + if (!event.getPlayer().getInventory().equals(_inventory) && canBeFired()) + UtilTextMiddle.display(_name + " Ready", "Power Level: " + C.cGreen + UtilText.repeat("▌", getPowerLevel()) + C.cRed + UtilText.repeat("▌", _maxFirepowerPerSlot - getPowerLevel()), 20, 100, 20, (Player) event.getPlayer()); + }, 3L); + } + + @EventHandler + public void onDismount(EntityDismountEvent event) + { + if (event.getEntity() instanceof Player && (event.getDismounted().equals(getEntity("PLAYERMOUNT")) || CustomDismount((Player) event.getEntity(), event.getDismounted()))) + dismount((Player) event.getEntity()); + } + + @EventHandler + public void onInteract(PlayerInteractAtEntityEvent event) + { + if (_comprisedOf.contains(event.getRightClicked())) + { + handleRightClick(event.getPlayer()); + event.setCancelled(true); + } + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (!event.getPlayer().equals(_rider)) + { + return; + } + + System.out.println(event.getAction()); + + if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) + { + handleRightClick(event.getPlayer()); + event.setCancelled(true); + } + else if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) + { + handleLeftClick(event.getPlayer()); + event.setCancelled(true); + } + } + + @EventHandler + public void onInteract(PlayerInteractEntityEvent event) + { + if (_comprisedOf.contains(event.getRightClicked())) + { + handleRightClick(event.getPlayer()); + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockBreak(BlockBreakEvent event) + { + if (!event.getBlock().getLocation().getWorld().equals(_location.getWorld())) + { + return; + } + + if (event.getBlock().getLocation().distance(_location) < _boundingBoxSize + 1.65 && event.getBlock().getLocation().getY() <= _location.getY()) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not break blocks near a Siege Weapon")); + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockPlace(BlockPlaceEvent event) + { + if (!event.getBlock().getLocation().getWorld().equals(_location.getWorld())) + { + return; + } + + if (event.getBlock().getLocation().distance(_location) < _boundingBoxSize + 1.65 && event.getBlock().getLocation().getY() <= _location.getY()) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You may not place blocks near a Siege Weapon")); + event.setCancelled(true); + } + } + + public boolean inProtection(Block block) + { + if (!block.getLocation().getWorld().equals(_location.getWorld())) + { + return false; + } + + return block.getLocation().distance(_location) < _boundingBoxSize + 1.65 && block.getLocation().getY() <= _location.getY() + 2; + } + + @EventHandler + public void onInteract(PlayerArmorStandManipulateEvent event) + { + if (_comprisedOf.contains(event.getRightClicked())) + { + handleRightClick(event.getPlayer()); + event.setCancelled(true); + } + } + + @EventHandler + public void chunkUnload(ChunkUnloadEvent event) + { + if (_comprisedOf.stream().anyMatch(entity -> entity.getLocation().getChunk().equals(event.getChunk()))) + event.setCancelled(true); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + update(); + + CustomTick(); + } + + public Location getLocation() + { + return _location.clone(); + } + + public double getSize() + { + return _boundingBoxSize; + } + + + public int getBaseDamage() + { + return _baseDamage; + } + + public ClanInfo getOwner() + { + return _ownerClan; + } + + public ClansManager getClans() + { + return _clans; + } + + protected WeaponProjectile getProjectile() + { + return _projectile; + } + + protected int getAmmunition() + { + ItemStack item = _inventory.getItem(_ammunitionSlot); + + if (item != null && item.getType().equals(_ammunitionType)) + return item.getAmount(); + + return 0; + } + + protected int getPowerLevel() + { + int power = 0; + + for (int slot : _firepowerSlots) + { + ItemStack item = _inventory.getItem(slot); + + if (item == null || !item.getType().equals(_firepowerType)) + continue; + + power += _inventory.getItem(slot).getAmount(); + } + + return power / 4; + } + + public int getUniqueId() + { + return _uniqueId; + } + + public Player getRider() + { + return _rider; + } + + public final String getState() + { + return _currentState; + } + + public final boolean shouldSyncWithDb() + { + return _syncWithDb; + } + + public SiegeWeaponToken toToken() + { + SiegeWeaponToken token = new SiegeWeaponToken(); + + token.UniqueId = _uniqueId; + token.OwnerClan = _ownerClan; + token.WeaponType = _weaponTypeIdentifier; + token.Location = _location; + token.Health = _health; + token.Yaw = (int) _yaw; + token.Entities = new HashMap<>(); + + _entityMapping.entrySet().forEach(entry -> + token.Entities.put(entry.getKey(), entry.getValue().getUniqueId().toString()) + ); + + return token; + } + + public boolean isPartOf(UUID uniqueId) + { + if (_loadedToken == null) + { + for (Entity entity : _comprisedOf) + { + if (entity.getUniqueId().equals(uniqueId)) + return true; + } + + return false; + } + + return _loadedToken.Entities.values().contains(uniqueId.toString()); + } + + public void setInvincible(boolean invincible) + { + _invincible = invincible; + } + + public boolean isInvincible() + { + return _invincible; + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/Crater.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/Crater.java new file mode 100644 index 000000000..6443697b8 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/Crater.java @@ -0,0 +1,231 @@ +package mineplex.game.clans.clans.siege.weapon.projectile; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +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.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilItem; +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.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.nameblacklist.ClansBlacklist; +import mineplex.game.clans.clans.siege.weapon.SiegeWeapon; +import mineplex.game.clans.core.repository.ClanTerritory; + +public class Crater implements Listener +{ + public static final Material CHARRED_TYPE = Material.OBSIDIAN; + + private final SiegeWeapon _weapon; + private final Location _origin; + + private final long _birthTime; + + private final int _size; + private final double _airChance; + + private final boolean _fire; + + private final List _blocks; + + public Crater(SiegeWeapon weapon, WeaponProjectile projectile, Location origin, int size, double airChance, boolean doFire) + { + _weapon = weapon; + _origin = origin; + + _birthTime = System.currentTimeMillis(); + _blocks = new ArrayList<>(); + + _size = size; + _airChance = airChance; + _fire = doFire; + + UtilServer.getPluginManager().registerEvents(this, _weapon.getClans().getPlugin()); + + createExplosion(); + } + + @EventHandler + public void updateEffects(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + _blocks.stream().filter(block -> block.Type == CHARRED_TYPE).forEach(block -> { + long lifetime = System.currentTimeMillis() - _birthTime; + + long max = 80000; + + if (block.Location.getBlock().getType() != CHARRED_TYPE) + { + return; + } + + // Water touching the charred blocks + if (UtilBlock.getInRadius(block.Location, 1.6).keySet().stream().filter(water -> water.getType() == Material.WATER).iterator().hasNext()) + { + return; + } + + if (lifetime < max) + { + UtilParticle.PlayParticleToAll(ParticleType.FLAME, block.Location.clone().add(.5, 1, .5), new Vector(0, 0, 0), .0f, 3, ViewDist.MAX); + UtilParticle.PlayParticleToAll(lifetime >= max / 1.4 ? ParticleType.SMOKE : ParticleType.LARGE_SMOKE, block.Location.clone().add(.5, .8, .5), new Vector(0, 0, 0), .0f, 1, ViewDist.MAX); + } + else + { + HandlerList.unregisterAll(this); + } + }); + } + + private void createExplosion() + { + ClanTerritory terr = _weapon.getClans().getClanUtility().getClaim(_origin); + + if (terr != null && !ClansManager.getInstance().getBlacklist().allowed(terr.Owner)) + { + return; + } + + _blocks.add(new CraterBlock(_origin, 0, Material.AIR)); + + HashMap blockList = new HashMap(); + int iR = (int) _size + 1; + + for (int x = -iR; x <= iR; x++) + { + for (int z = -iR; z <= iR; z++) + { + for (int y = -iR; y <= iR; y++) + { + Block curBlock = _origin.getBlock().getRelative(x, y, z); + + double offset = UtilMath.offset(_origin, curBlock.getLocation()); + + if (offset <= _size) + { + blockList.put(curBlock, Double.valueOf(offset)); + } + } + } + } + + for (Entry entry : blockList.entrySet()) + { + Block block = entry.getKey(); + + ClanTerritory territory = _weapon.getClans().getClanUtility().getClaim(block.getLocation()); + + if (territory != null && !ClansManager.getInstance().getBlacklist().allowed(territory.Owner)) + { + continue; + } + + double distance = entry.getValue().doubleValue(); + + boolean air = distance <= _airChance || (Math.random() > (distance) / 3.65d); + + if (block.getState() instanceof Chest) continue; + + if (block.getType() == Material.AIR) continue; + + if (air) + { + _blocks.add(new CraterBlock(block.getLocation(), distance, Material.AIR)); + + Block above = block; + + while (!UtilItem.isBoundless((above = above.getRelative(BlockFace.UP)).getType())) + { + _blocks.add(new CraterBlock(above.getLocation(), distance, Material.AIR)); + } + + if (!UtilItem.isBoundless(block.getRelative(BlockFace.DOWN).getType())) + { + if (_fire && Math.random() >= .5) + { + _blocks.add(new CraterBlock(block.getLocation(), distance, Material.FIRE)); + } + } + } + } + + _blocks.forEach(CraterBlock::set); + + for (Entry entry : blockList.entrySet()) + { + Block block = entry.getKey(); + + ClanTerritory territory = _weapon.getClans().getClanUtility().getClaim(block.getLocation()); + + if (territory != null && !ClansManager.getInstance().getBlacklist().allowed(territory.Owner)) + { + continue; + } + + double distance = entry.getValue().doubleValue(); + + if (block.getType() == Material.AIR) continue; + + if (block.getState() instanceof Chest) + { + Chest chest = (Chest) block.getState(); + + for (ItemStack item : chest.getBlockInventory().getContents()) + { + if (item == null) + { + continue; + } + + if (item.getType() == Material.AIR) + { + continue; + } + + _origin.getWorld().dropItemNaturally(_origin, item); + } + } + + if ( + distance > _airChance && + Math.random() > .75 && + UtilItem.isBoundless(block.getRelative(BlockFace.UP).getType()) && + !UtilItem.isBoundless(block.getRelative(BlockFace.DOWN).getType()) && + !block.getRelative(BlockFace.UP).getType().equals(CHARRED_TYPE) && + !block.getRelative(BlockFace.DOWN).getType().equals(CHARRED_TYPE)) + { + _blocks.add(new CraterBlock(block.getLocation(), distance, CHARRED_TYPE)); + + if (_fire) + { + _blocks.add(new CraterBlock(block.getRelative(BlockFace.UP).getLocation(), distance, Material.FIRE)); + } + } + } + + _blocks.forEach(CraterBlock::set); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/CraterBlock.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/CraterBlock.java new file mode 100644 index 000000000..e8ff4058b --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/CraterBlock.java @@ -0,0 +1,32 @@ +package mineplex.game.clans.clans.siege.weapon.projectile; + +import org.bukkit.Location; +import org.bukkit.Material; + +public class CraterBlock +{ + public Material Type; + public byte Data; + public double DistanceToOrigin; + + public Location Location; + + public CraterBlock(Location location, double dist, Material type, byte data) + { + Location = location; + DistanceToOrigin = dist; + Type = type; + Data = data; + } + + public CraterBlock(Location location, double dist, Material type) + { + this(location, dist, type, (byte) 0); + } + + public void set() + { + Location.getBlock().setType(Type); + Location.getBlock().setData(Data); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/ProjectileAttributes.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/ProjectileAttributes.java new file mode 100644 index 000000000..bbb6ffa7c --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/ProjectileAttributes.java @@ -0,0 +1,75 @@ +package mineplex.game.clans.clans.siege.weapon.projectile; + +import org.bukkit.Material; + +public class ProjectileAttributes +{ + protected boolean _isFallingBlock; + protected Material _fallingBlockType; + protected byte _fallingBlockData; + + protected boolean _isPrimedTnt; + + protected boolean _doCrater; + protected int _craterSize; + protected double _craterChanceOfAir; + + protected boolean _craterDoFire; + + public ProjectileAttributes setFallingBlock() + { + _isFallingBlock = true; + + return this; + } + + public ProjectileAttributes setFallingBlockType(Material type) + { + _fallingBlockType = type; + + return this; + } + + public ProjectileAttributes setFallingBlockData(byte data) + { + _fallingBlockData = data; + + return this; + } + + public ProjectileAttributes setPrimedTnt() + { + _isPrimedTnt = true; + + return this; + } + + public ProjectileAttributes setDoCrater() + { + _doCrater = true; + + return this; + } + + public ProjectileAttributes craterSize(int size) + { + _craterSize = size; + + return this; + } + + public ProjectileAttributes craterDoFire(boolean doFire) + { + _craterDoFire = doFire; + + return this; + } + + public ProjectileAttributes craterChanceOfAir(double chance) + { + _craterChanceOfAir = chance; + + return this; + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/ProjectileType.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/ProjectileType.java new file mode 100644 index 000000000..018255e8f --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/ProjectileType.java @@ -0,0 +1,7 @@ +package mineplex.game.clans.clans.siege.weapon.projectile; + +public enum ProjectileType +{ + PRIMED_TNT, + FALLING_BLOCK; +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/WeaponProjectile.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/WeaponProjectile.java new file mode 100644 index 000000000..fc893ceaf --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/WeaponProjectile.java @@ -0,0 +1,197 @@ +package mineplex.game.clans.clans.siege.weapon.projectile; + +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.FallingBlock; +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.Listener; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent; +import mineplex.game.clans.clans.siege.weapon.SiegeWeapon; + +public class WeaponProjectile implements Listener +{ + private ProjectileAttributes _attributes; + private Location _origin; + private Entity _projectileEntity; + + private SiegeWeapon _weapon; + + private double _yRot; + private double _xMulti; + private double _yVel; + + private boolean _dead; + + private Player _shooter; + + public WeaponProjectile(SiegeWeapon weapon, Location origin, ProjectileAttributes attributes, double yRot, double yVel, double xMulti) + { + _shooter = weapon.getRider(); + _weapon = weapon; + _origin = origin; + _attributes = attributes; + _yRot = yRot; + _yVel = yVel; + _xMulti = xMulti; + + UtilServer.getPluginManager().registerEvents(this, weapon.getClans().getPlugin()); + + spawn(); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onTntExplode(EntityExplodeEvent event) + { + if (event.getEntity().equals(_projectileEntity)) + { + ((TNTPrimed) event.getEntity()).setFuseTicks(60); + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockFall(EntityChangeBlockEvent event) + { + if (!_dead && event.getEntity().equals(_projectileEntity)) + { + die(); + event.setCancelled(true); + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + if (_projectileEntity.isDead()) + { + die(); + return; + } + + if (_dead || _projectileEntity == null) + { + die(); + return; + } + + ((TNTPrimed) _projectileEntity).setFuseTicks(60); + + if ((Math.abs(_projectileEntity.getVelocity().getX()) < 0.01 + || Math.abs(_projectileEntity.getVelocity().getZ()) < 0.01) + && UtilBlock.getInRadius(_projectileEntity.getLocation(), 2) + .keySet() + .stream() + .filter(block -> !UtilItem.isBoundless(block.getType())) + .iterator().hasNext() && _projectileEntity.getTicksLived() >= 10) + { + SiegeWeaponExplodeEvent newEvent = new SiegeWeaponExplodeEvent(_weapon, this); + + UtilServer.CallEvent(newEvent); + + if (!newEvent.isCancelled()) + { + new Crater(_weapon, this, UtilBlock.nearestFloor(_projectileEntity.getLocation()), _attributes._craterSize, _attributes._craterChanceOfAir, _attributes._craterDoFire); + } + + UtilServer.getServer().getOnlinePlayers().forEach(player -> player.playSound(_projectileEntity.getLocation(), Sound.EXPLODE, 1.f, 1.f)); + + die(); + } + } + + public boolean hasDied() + { + return _dead; + } + + public Location getLocation() + { + return _projectileEntity.getLocation(); + } + + public void setLocation(Location location) + { + _projectileEntity.teleport(location); + } + + private void die() + { + HandlerList.unregisterAll(this); + + if (_projectileEntity != null) + { + _projectileEntity.remove(); + _projectileEntity = null; + } + + _dead = true; + } + + private void spawn() + { + if (_attributes._isFallingBlock) + { + FallingBlock fallingBlock = _origin.getWorld().spawnFallingBlock(_origin, _attributes._fallingBlockType, _attributes._fallingBlockData); + + _projectileEntity = fallingBlock; + + Vector velocity = UtilAlg.getTrajectory( + _origin, + UtilAlg.moveForward( + _origin, + 2., + (float) Math.toDegrees(_yRot), false)) + .multiply(_xMulti) + .setY(_yVel); + + fallingBlock.setVelocity(velocity); + } + else if (_attributes._isPrimedTnt) + { + TNTPrimed tnt = _origin.getWorld().spawn(_origin, TNTPrimed.class); + + _projectileEntity = tnt; + + Vector velocity = UtilAlg.getTrajectory( + _origin, + UtilAlg.moveForward( + _origin, + 2., + (float) Math.toDegrees(_yRot), false)) + .multiply(_xMulti) + .setY(_yVel); + + tnt.setVelocity(velocity); + } + } + + public int getCraterSize() + { + return _attributes._craterSize; + } + + public Player getShooter() + { + return _shooter; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/event/PreCraterSetBlockEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/event/PreCraterSetBlockEvent.java new file mode 100644 index 000000000..81bc117fc --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/event/PreCraterSetBlockEvent.java @@ -0,0 +1,72 @@ +package mineplex.game.clans.clans.siege.weapon.projectile.event; + +import java.util.Set; + +import org.bukkit.block.Block; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.game.clans.clans.siege.weapon.SiegeWeapon; +import mineplex.game.clans.clans.siege.weapon.projectile.Crater; +import mineplex.game.clans.clans.siege.weapon.projectile.WeaponProjectile; + +public class PreCraterSetBlockEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private SiegeWeapon _weapon; + private WeaponProjectile _projectile; + private Set _blocks; + private Crater _crater; + + + private boolean _cancelled; + + public PreCraterSetBlockEvent(Set blocks, Crater crater, SiegeWeapon weapon, WeaponProjectile projectile) + { + _blocks = blocks; + _crater = crater; + _weapon = weapon; + _projectile = projectile; + } + + public Set getBlocks() + { + return _blocks; + } + + public Crater getCrater() + { + return _crater; + } + + public SiegeWeapon getWeapon() + { + return _weapon; + } + + public WeaponProjectile getProjectile() + { + return _projectile; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/AccessRule.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/AccessRule.java new file mode 100644 index 000000000..b1eb7b37d --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/AccessRule.java @@ -0,0 +1,23 @@ +package mineplex.game.clans.clans.siege.weapon.util; + +import java.util.function.Predicate; + +import org.bukkit.entity.Player; + +public class AccessRule +{ + private Predicate _access; + private AccessType _type; + + public AccessRule(AccessType type, Predicate access) + { + _type = type; + _access = access; + } + + public boolean allow(AccessType type, Player player) + { + return type.equals(_type) && _access.test(player); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/AccessType.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/AccessType.java new file mode 100644 index 000000000..6fccb310d --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/AccessType.java @@ -0,0 +1,7 @@ +package mineplex.game.clans.clans.siege.weapon.util; + +public enum AccessType +{ + RCLICK_BB, + LCLICK_BB, +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/BarrierCollisionBox.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/BarrierCollisionBox.java new file mode 100644 index 000000000..08b28a04d --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/BarrierCollisionBox.java @@ -0,0 +1,251 @@ +package mineplex.game.clans.clans.siege.weapon.util; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.BiConsumer; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilCollections; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class BarrierCollisionBox implements Listener +{ + private List _collisionBlocks; + + private List> _leftClickListeners; + private List> _rightClickListeners; + + BarrierCollisionBox() + { + _collisionBlocks = new ArrayList<>(); + + _leftClickListeners = new ArrayList<>(); + _rightClickListeners = new ArrayList<>(); + } + + BarrierCollisionBox(List locations) + { + this(); + + _collisionBlocks.addAll(locations); + } + + BarrierCollisionBox(Location start, Location end) + { + this(); + + UtilBlock.getInBoundingBox(start.getBlock().getLocation(), end.getBlock().getLocation(), false).forEach(block -> _collisionBlocks.add(block.getLocation())); + } + + public void Construct() + { + setBlocks(); + + UtilServer.RegisterEvents(this); + } + + public void Destruct() + { + HandlerList.unregisterAll(this); + + resetBlocks(); + + _leftClickListeners.clear(); + _rightClickListeners.clear(); + _collisionBlocks.clear(); + } + + public void Update() + { + setBlocks(); + } + + public void registerLeft(BiConsumer listener) + { + _leftClickListeners.add(listener); + } + + public void registerRight(BiConsumer listener) + { + _rightClickListeners.add(listener); + } + + public void unregisterLeft(BiConsumer listener) + { + _leftClickListeners.remove(listener); + } + + public void unregisterRight(BiConsumer listener) + { + _rightClickListeners.remove(listener); + } + + private void onLeftClick(Location location, Player player) + { + UtilCollections.ForEach(_leftClickListeners, listener -> listener.accept(location, player)); + } + + private void onRightClick(Location location, Player player) + { + UtilCollections.ForEach(_rightClickListeners, listener -> listener.accept(location, player)); + } + + private void resetBlocks() + { + _collisionBlocks + .stream() + .filter(location -> location.getBlock().getType().equals(Material.BARRIER)) + .forEach(location -> location.getBlock().setType(Material.AIR)); + } + + private void setBlocks() + { + for (Location location : _collisionBlocks) + { + location.getBlock().setType(Material.BARRIER); + } + } + + public boolean isInBox(Location location) + { + for (Location other : _collisionBlocks) + { + if (other.equals(location)) + { + return true; + } + } + + return false; + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + { + Update(); + } + } + + // Events for interaction with the collision box; + @EventHandler + public void blockDamage(BlockDamageEvent event) + { + if (isInBox(event.getBlock().getLocation())) + { + onLeftClick(event.getBlock().getLocation(), event.getPlayer()); + event.setCancelled(true); + } + } + + @EventHandler + public void blockBreak(BlockBreakEvent event) + { + if (isInBox(event.getBlock().getLocation())) + { + onLeftClick(event.getBlock().getLocation(), event.getPlayer()); + event.setCancelled(true); + } + } + + @EventHandler + public void interact(PlayerInteractEvent event) + { + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + { + return; + } + + if (isInBox(event.getClickedBlock().getLocation())) + { + onRightClick(event.getClickedBlock().getLocation(), event.getPlayer()); + event.setCancelled(true); + } + } + + public BarrierCollisionBox add(Location... location) + { + _collisionBlocks.addAll(Arrays.asList(location)); + + Update(); + + return this; + } + + public BarrierCollisionBox add(List location) + { + _collisionBlocks.addAll(location); + + Update(); + + return this; + } + + public BarrierCollisionBox remove(Location... location) + { + _collisionBlocks.removeAll(Arrays.asList(location)); + + Update(); + + return this; + } + + public BarrierCollisionBox add(BarrierCollisionBox box, boolean destructOld, boolean cloneListeners) + { + _collisionBlocks.addAll(box._collisionBlocks); + + if (cloneListeners) + { + _leftClickListeners.addAll(box._leftClickListeners); + _rightClickListeners.addAll(box._rightClickListeners); + } + + if (destructOld) + { + box.Destruct(); + } + + Update(); + + return this; + } + + public BarrierCollisionBox add(BarrierCollisionBox box) + { + return add(box, false, false); + } + + public BarrierCollisionBox addAll(Location start, Location end) + { + UtilBlock.getInBoundingBox(start, end).forEach(block -> _collisionBlocks.add(block.getLocation())); + + Update(); + + return this; + } + + public static BarrierCollisionBox all(Location start, Location end) + { + return new BarrierCollisionBox(start, end); + } + + public static BarrierCollisionBox single(Location location) + { + return new BarrierCollisionBox(new ArrayList<>(Arrays.asList(location.getBlock().getLocation()))); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/WeaponStateInfo.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/WeaponStateInfo.java new file mode 100644 index 000000000..b0eae35e7 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/util/WeaponStateInfo.java @@ -0,0 +1,25 @@ +package mineplex.game.clans.clans.siege.weapon.util; + +import org.bukkit.Material; + +public class WeaponStateInfo +{ + private Material _material; + private byte _data; + + public WeaponStateInfo(Material material, byte data) + { + _material = material; + _data = data; + } + + public Material getType() + { + return _material; + } + + public byte getData() + { + return _data; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/staff/SilentChestInventory.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/staff/SilentChestInventory.java new file mode 100644 index 000000000..505f0a340 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/staff/SilentChestInventory.java @@ -0,0 +1,37 @@ +package mineplex.game.clans.clans.staff; + +import org.bukkit.block.Chest; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.inventory.Inventory; + +import mineplex.core.common.util.UtilServer; + +public class SilentChestInventory implements Listener +{ + private Chest _chest; + private Inventory _inventory; + + private Player _viewer; + + public SilentChestInventory(Chest chest, Player viewer) + { + _chest = chest; + + viewer.openInventory(_chest.getBlockInventory()); + + UtilServer.RegisterEvents(this); + } + + @EventHandler + public void closeInventory(InventoryCloseEvent event) + { + if (event.getInventory().equals(_inventory) && event.getPlayer().equals(_viewer)) + { + UtilServer.Unregister(this); + } + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/staff/SilentChestOpen.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/staff/SilentChestOpen.java new file mode 100644 index 000000000..2f9bfabae --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/staff/SilentChestOpen.java @@ -0,0 +1,49 @@ +package mineplex.game.clans.clans.staff; + +import org.bukkit.block.BlockState; +import org.bukkit.block.Chest; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilServer; +import mineplex.core.incognito.IncognitoManager; +import mineplex.game.clans.clans.ClansManager; + +public class SilentChestOpen extends MiniPlugin +{ + private ClansManager _clansManager; + + public SilentChestOpen(ClansManager clansManager) + { + super("Silent Chest", clansManager.getPlugin()); + + _clansManager = clansManager; + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (!_clansManager.getIncognitoManager().Get(event.getPlayer()).Status) + return; + + if (!ClansManager.getInstance().getClientManager().hasRank(event.getPlayer(), Rank.CMOD)) + return; + + if (event.getClickedBlock() == null) + return; + + BlockState block = event.getClickedBlock().getState(); + + if (!(block instanceof Chest)) + return; + + Chest chest = (Chest) block; + + UtilServer.RegisterEvents(new SilentChestInventory(chest, event.getPlayer())); + + event.setCancelled(true); + + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/EnergyCrossbow.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/EnergyCrossbow.java new file mode 100644 index 000000000..473627884 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/EnergyCrossbow.java @@ -0,0 +1,188 @@ +package mineplex.game.clans.items.legendaries; + +import java.util.HashMap; +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.RGBData; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilCollections; +import mineplex.core.common.util.UtilColor; +import mineplex.core.common.util.UtilEnt; +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.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTrig; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; + +public class EnergyCrossbow extends LegendaryItem +{ + private long _lastFire = System.currentTimeMillis(); + private long _interactWait; + + private static List _preCalculatedSphere; + + { + ClansManager.getInstance().runAsync(() -> + _preCalculatedSphere = UtilTrig.GetSpherePoints(new Vector(0, 0, 0), 1.8d, 1.8d, true, .4d) + ); + } + + public EnergyCrossbow() + { + super("Energy Crossbow", UtilText.splitLinesToArray(new String[] { + C.cWhite + "Legend says " + + " ", + "#" + C.cYellow + "Right-Click" + C.cWhite + " to fire Crossbow." + }, LineFormat.LORE), Material.RECORD_6); + } + + @Override + public void update(Player wielder) + { + if ((System.currentTimeMillis() - _lastBlock) < 98 && (System.currentTimeMillis() - _interactWait) >= 98) + { + if (Recharge.Instance.use(wielder, "Crossbow", 6500, true, true)) + { + fire(wielder); + + _interactWait = System.currentTimeMillis(); + } + } + } + + private void fire(final Player player) + { + UtilServer.RegisterEvents(new Listener() { + private Location _lastLoc; + + private Arrow _arrow; + private Player _player; + + private RGBData[] colors = { UtilColor.RgbLightRed, UtilColor.RgbLightRed.Lighten(), UtilColor.RgbLightRed.Darken() }; + + { + _player = player; + + Arrow arrow = _player.shootArrow(); + + arrow.setVelocity(arrow.getVelocity().multiply(3.4444444444444)); + + arrow.setShooter(_player); + + _arrow = arrow; + + _player.playSound(_arrow.getLocation(), Sound.BAT_TAKEOFF, 0.1f, 2.f); + _player.playSound(_arrow.getLocation(), Sound.ZOMBIE_WOODBREAK, 0.5f, .5f); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (_arrow == null || _arrow.isDead()) + { + HandlerList.unregisterAll(this); + + return; + } + + if (_lastLoc != null) + { + Location lastLoc = _lastLoc.clone(); + + while (UtilMath.offset(lastLoc, _arrow.getLocation()) > 0.1) + { + lastLoc.add(UtilAlg.getTrajectory(lastLoc, _arrow.getLocation()).multiply(0.1)); + + UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, lastLoc, UtilCollections.random(colors).ToVector(), 1f, 0, ViewDist.MAX); + } + } + + _lastLoc = _arrow.getLocation(); + } + + private void hit() + { + HandlerList.unregisterAll(this); + + for (Vector vector : _preCalculatedSphere) + { + UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, _arrow.getLocation().add(vector), UtilColor.RgbLightRed.ToVector(), 1.0f, 0, ViewDist.MAX); + } + + HashMap targets = UtilEnt.getInRadius(_arrow.getLocation(), 3.d); + for (LivingEntity entity : targets.keySet()) + { + if (entity.equals(_arrow.getShooter())) + continue; + + ClansManager.getInstance().getDamageManager().NewDamageEvent(entity, _player, _arrow, + DamageCause.CUSTOM, 8, true, true, false, + _player.getName(), "Energy Crossbow"); + } + + _arrow.remove(); + _arrow = null; + } + + @EventHandler + public void projectileHit(ProjectileHitEvent event) + { + if (!event.getEntity().equals(_arrow)) + { + return; + } + + ClansManager.getInstance().runSyncLater(this::hit, 1); + } + + @EventHandler + public void entityHurt(EntityDamageByEntityEvent event) + { + if (!event.getDamager().equals(_arrow)) + { + return; + } + + if (event.getEntity().equals(_arrow.getShooter()) || !(event.getEntity() instanceof LivingEntity)) + { + _arrow.remove(); + _arrow = null; + + return; + } + + event.setCancelled(true); + + ClansManager.getInstance().getDamageManager().NewDamageEvent((LivingEntity) event.getEntity(), _player, _arrow, + DamageCause.CUSTOM, 1.5d, true, true, false, + _player.getName(), "Energy Crossbow"); + + hit(); + } + + }); + + _lastFire = System.currentTimeMillis(); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/MeridianScepter.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/MeridianScepter.java new file mode 100644 index 000000000..cff2d6e38 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/MeridianScepter.java @@ -0,0 +1,249 @@ +package mineplex.game.clans.items.legendaries; + +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.RGBData; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilCollections; +import mineplex.core.common.util.UtilColor; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.incognito.IncognitoManager; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilText; +import mineplex.core.recharge.Recharge; +import mineplex.game.clans.clans.ClansManager; + +public class MeridianScepter extends LegendaryItem +{ + private long _lastFire = System.currentTimeMillis(); + private long _interactWait; + + private RGBData[] colors = { UtilColor.RgbPurple, UtilColor.RgbPurple.Lighten(), UtilColor.RgbPurple.Darken() }; + + public MeridianScepter() + { + super("Meridian Scepter", UtilText.splitLinesToArray(new String[] { + C.cWhite + "Legend says that this scepter was found, and retrieved from the deepest trench in all of Minecraftia. It is said that he who wields this scepter holds the power of Poseidon himself." + + " ", + "#" + C.cYellow + "Right-Click" + C.cWhite + " to use Scepter." + }, LineFormat.LORE), Material.RECORD_6); + } + + @Override + public void update(Player wielder) + { + if ((System.currentTimeMillis() - _lastBlock) < 98 && (System.currentTimeMillis() - _interactWait) >= 98) + { + if (ClansManager.getInstance().hasTimer(wielder)) + { + UtilPlayer.message(wielder, F.main("Clans", "You are not allowed to fire the Meridian Scepter whilst under pvp protection.")); + return; + } + + if (ClansManager.getInstance().getClanUtility().getClaim(wielder.getLocation()) != null && ClansManager.getInstance().getClanUtility().getClaim(wielder.getLocation()).isSafe(wielder.getLocation())) + { + UtilPlayer.message(wielder, F.main("Clans", "You are not allowed to fire the " + F.elem("Meridian Scepter") + " whilst in a safe zone.")); + return; + } + + if (Recharge.Instance.use(wielder, "Meridian Scepter", 4000, true, true)) + { + fire(wielder); + + _interactWait = System.currentTimeMillis(); + } + } + } + + private void fire(final Player shooter) + { + final Location projectile = shooter.getEyeLocation(); + final Location origin = shooter.getEyeLocation(); + final Vector direction = shooter.getEyeLocation().getDirection().normalize().multiply(0.25); + final int maxRange = 50; + final int maxDings = maxRange * 4; + final int damage = 6; + + UtilServer.repeat(new BukkitRunnable() + { + private int dingsDone; + private Location previousLocation = projectile; + + private void burst() + { + for (Entity cur : projectile.getWorld().getEntities()) + { + if (cur == shooter || !(cur instanceof Player) || (cur instanceof Player && UtilPlayer.isSpectator(cur))) + continue; + + Player player = (Player) cur; + + Location eLoc = player.getLocation(); + + // If they are less than 0.5 blocks away + if (eLoc.clone().add(0, player.getEyeHeight() / 2, 0).distance(projectile) <= 0.7) + { + ClansManager.getInstance().getDamageManager().NewDamageEvent(player, player, null, + DamageCause.CUSTOM, damage, true, true, false, + player.getName(), "Meridian Scepter"); + + player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * 4, 0)); + + UtilPlayer.message(player, F.main("Clans", F.elem(player.getName()) + " hit you with a " + F.elem("Meridian Scepter") + C.mBody + ".")); + UtilPlayer.message(shooter, F.main("Clans", "You hit " + F.elem(player.getName()) + " with your " + F.elem("Meridian Scepter") + C.mBody + ".")); + } + } + + playParticle(projectile, previousLocation); + + cancel(); + } + + public void run() + { + if (dingsDone >= maxDings || !shooter.isOnline()) + { + burst(); + } + else + { + for (int i = 0; i < 2; i++) + { + Player closestPlayer = null; + double dist = 0; + + for (Player closest : UtilServer.getPlayers()) + { + if (!closest.getWorld().equals(projectile.getWorld())) + { + continue; + } + + if (ClansManager.getInstance().hasTimer(closest)) + { + continue; + } + + if (ClansManager.getInstance().getClan(shooter) == ClansManager.getInstance().getClan(closest)) + { + continue; + } + + if (shooter.getGameMode().equals(GameMode.CREATIVE) || shooter.getGameMode().equals(GameMode.SPECTATOR)) + { + continue; + } + + if (ClansManager.getInstance().getIncognitoManager().Get(closest).Status) + { + continue; + } + + if (ClansManager.getInstance().getClan(shooter) != null && ClansManager.getInstance().getClan(shooter).isAlly(ClansManager.getInstance().getClan(closest))) + { + continue; + } + + if (ClansManager.getInstance().getClanUtility().getClaim(closest.getLocation()) != null && ClansManager.getInstance().getClanUtility().getClaim(closest.getLocation()).isSafe(closest.getLocation())) + { + continue; + } + + Location loc = closest.getLocation(); + + if (closest != shooter) + { + double dist1 = loc.distance(origin); + if (dist1 < maxRange + 10) + { + double dist2 = projectile.distance(loc); + if (closestPlayer == null || dist2 < dist) + { + double dist3 = projectile.clone().add(direction).distance(loc); + + if (dist3 < dist2) + { + closestPlayer = closest; + dist = dist2; + } + } + } + } + } + + if (closestPlayer != null) + { + Vector newDirection = closestPlayer.getLocation().add(0, 1, 0).toVector() + .subtract(projectile.toVector()); + + direction.add(newDirection.normalize().multiply(0.01)).normalize().multiply(0.15); + } + + projectile.add(direction); + + for (Entity cur : projectile.getWorld().getEntities()) + { + if (cur == shooter || !(cur instanceof LivingEntity) + || (cur instanceof Player && UtilPlayer.isSpectator(cur))) + continue; + + LivingEntity ent = (LivingEntity) cur; + + Location eLoc = ent.getLocation(); + + // If they are less than 0.5 blocks away + if (eLoc.clone().add(0, projectile.getY() - eLoc.getY(), 0).distance(projectile) <= 0.7) + { + // If it is in their body height + if (Math.abs((eLoc.getY() + (ent.getEyeHeight() / 1.5)) - projectile.getY()) <= ent.getEyeHeight() / 2) + { + burst(); + return; + } + } + } + + if (UtilBlock.solid(projectile.getBlock())) + { + burst(); + return; + } + + playParticle(projectile, previousLocation); + previousLocation = projectile.clone(); + + dingsDone++; + } + + projectile.getWorld().playSound(projectile, Sound.BLAZE_BREATH, 0.2F, 1f); + } + } + }, 0); + } + + private void playParticle(Location start, Location end) + { + for (Location loc : UtilShapes.getLinesDistancedPoints(start, end, 0.06)) + { + UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, UtilCollections.random(colors).ToVector(), 1f, 0, ViewDist.LONG); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/Crossbow.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/Crossbow.java new file mode 100644 index 000000000..99b983de9 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/Crossbow.java @@ -0,0 +1,62 @@ +package mineplex.game.clans.items.rares; + +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilText; +import mineplex.core.recharge.Recharge; + +public class Crossbow extends RareItem +{ + private static final Material LOADED_TYPE = Material.COMMAND_MINECART; + private static final Material UNLOADED_TYPE = Material.RECORD_6; + + private long _lastFire = System.currentTimeMillis(); + private long _interactWait; + + public Crossbow() + { + super("Crossbow", UtilText.splitLinesToArray(new String[] { + "#" + C.cYellow + "Right-Click" + C.cWhite + " to fire Crossbow." + }, LineFormat.LORE), UNLOADED_TYPE); + } + + @Override + public void update(Player wielder) + { + if (UtilInv.contains(wielder, Material.ARROW, (byte) 0, 1)) + { + wielder.getItemInHand().setType(LOADED_TYPE); + } + else + { + wielder.getItemInHand().setType(UNLOADED_TYPE); + } + + if ((System.currentTimeMillis() - _lastBlock) < 98 && (System.currentTimeMillis() - _interactWait) >= 98) + { + if (UtilInv.remove(wielder, Material.ARROW, (byte) 0, 1)) + { + if (Recharge.Instance.use(wielder, "Crossbow", 4000, true, true)) + { + fire(wielder); + + _interactWait = System.currentTimeMillis(); + } + } + } + } + + private void fire(final Player player) + { + Arrow arrow = player.shootArrow(); + + arrow.setShooter(player); + + _lastFire = System.currentTimeMillis(); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RareItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RareItem.java new file mode 100644 index 000000000..a986b1840 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RareItem.java @@ -0,0 +1,98 @@ +package mineplex.game.clans.items.rares; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.game.clans.items.CustomItem; +import mineplex.game.clans.items.generation.ValueDistribution; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +public class RareItem extends CustomItem +{ + public final long BLOCK_COOLDOWN = 200l; // Right clicking activates right click for 200ms + + protected long _lastBlock; // Timestamp of last block from wielder + public long timeSinceLastBlock() { return System.currentTimeMillis() - _lastBlock; } + + public RareItem(String name, String[] description, Material material) + { + super(name, description, material); + + _lastBlock = 0l; + } + + public void update(Player wielder) + { + // Leave implementation to potential subtypes + } + + public void preUpdate(Player wielder) + { + } + + public void onAttack(CustomDamageEvent event, Player wielder) + { + // Leave implementation to potential subtypes + } + + @Override + public void onAttack(CustomDamageEvent event) + { + if (event.GetDamagerPlayer(true) != null) + { + onAttack(event, event.GetDamagerPlayer(true)); + } + + super.onAttack(event); + } + + public void onInteract(PlayerInteractEvent event) + { + Action action = event.getAction(); + + if (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) + { + _lastBlock = System.currentTimeMillis(); + } + + super.onInteract(event); + } + + public boolean isHoldingRightClick() + { + return timeSinceLastBlock() <= BLOCK_COOLDOWN; + } + + protected void log(String message) + { + System.out.println("[Custom Item - " + _displayName + "] " + message); + } + + /** + * @param minValue - the minimum value for attribute value range + * @param maxValue - the maximum value for attribute value range + * @return newly instantiated {@link ValueDistribution} for attribute values in range [{@code minValue}. {@code maxValue}]. + */ + public static ValueDistribution generateDistribution(double minValue, double maxValue) + { + return new ValueDistribution(minValue, maxValue); + } + + /** + * Add a {@link PotionEffect} to {@code player} with specified {@code type}, {@code amplifier} (power) and + * {@code tickDuration} of the effect. + * @param player - the player to receive the potion effect + * @param type - the type of potion to apply + * @param tickDuration - the duration (in ticks) to apply the potion for + * @param amplifier - the amplifier (level/power, zero-based) of the potion effect + */ + public static void grantPotionEffect(Player player, PotionEffectType type, int tickDuration, int amplifier) + { + player.removePotionEffect(type); + player.addPotionEffect(new PotionEffect(type, amplifier, tickDuration)); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java new file mode 100644 index 000000000..2bd901525 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java @@ -0,0 +1,130 @@ +package mineplex.game.clans.items.rares; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.core.repository.ClanTerritory; +import mineplex.game.clans.items.PlayerGear; + +public class RunedPickaxe extends RareItem +{ + private long _instamineEnabled; + private boolean _enabled; + + static + { + UtilServer.RegisterEvents(new Listener() { + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + UtilServer.getPlayersCollection().forEach(player -> { + PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(player); + + if (!(gear.getWeapon() instanceof RunedPickaxe)) + { + return; + } + + RunedPickaxe pick = (RunedPickaxe) gear.getWeapon(); + + if (pick._enabled && !UtilTime.elapsed(pick._instamineEnabled, 12000)) + { + UtilTextBottom.displayProgress("Instant mine", (((double) (((double) System.currentTimeMillis()) - ((double) pick._instamineEnabled))) / 12000D), null, true, player); + } + + if (pick._enabled + && (System.currentTimeMillis() - pick._instamineEnabled) >= 12000) + { + Recharge.Instance.use(player, "Instant Mine", 15 * 1000, true, true); + + pick._enabled = false; + } + }); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void blockDamage(BlockDamageEvent event) + { + PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(event.getPlayer()); + + if (!(gear.getWeapon() instanceof RunedPickaxe)) + { + return; + } + + RunedPickaxe pick = (RunedPickaxe) gear.getWeapon(); + + String playerClan = ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()) == null ? null : ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()).getName(); + + ClanTerritory territory = ClansManager.getInstance().getClanUtility().getClaim(event.getBlock().getLocation()); + + if (territory != null && !territory.Owner.equals(playerClan)) + return; + + if (event.getBlock().getType() == Material.BEDROCK) + return; + + if (!UtilTime.elapsed(pick._instamineEnabled, 12000)) + { + event.getBlock().breakNaturally(); + + event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.TILE_BREAK, event.getBlock().getTypeId(), 10); + + event.getPlayer().playSound(event.getBlock().getLocation(), Sound.LAVA_POP, 1.f, 1.f); + } + } + }); + } + + public RunedPickaxe() + { + super("Runed Pickaxe", UtilText.splitLinesToArray(new String[] { + "What an interesting design this pickaxe seems to have!", + C.cYellow + "Right-Click" + C.cWhite + " to use " + F.elem("Instant mine") + "." + }, LineFormat.LORE), Material.RECORD_7); + } + + public void onInteract(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + { + return; + } + + if (Recharge.Instance.usable(event.getPlayer(), "Instant Mine", true) && UtilTime.elapsed(_instamineEnabled, 15000)) + { + UtilTextMiddle.display("", "Instant mine enabled for " + F.elem("12 Seconds"), 20, 80, 20, event.getPlayer()); + _instamineEnabled = System.currentTimeMillis(); + _enabled = true; + } + + super.onInteract(event); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java new file mode 100644 index 000000000..b3221c89f --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/Tutorial.java @@ -0,0 +1,629 @@ +package mineplex.game.clans.legacytutorial; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.donation.DonationManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.scoreboard.ScoreboardManager; +import mineplex.core.scoreboard.elements.ScoreboardElement; +import mineplex.core.task.TaskManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.ClansPlayerTasks; +import mineplex.game.clans.clans.event.ClanJoinEvent; +import mineplex.game.clans.clans.event.ClanTipEvent; +import mineplex.game.clans.clans.playtime.Playtime; +import mineplex.game.clans.economy.GoldManager; + +/** + * + * I call this a tutorial, even though it is more accurately, "a set of + * achievements or goals, that are in some-what of a tutorial fashion." But that + * would be too long of a class name, so I'll stick with "Tutorial" for now. + * + */ +public abstract class Tutorial implements ScoreboardElement, Listener +{ + public static String TASK_COMPLETE_TASK = "tttatatta%sTask%s"; + public static String TUTORIAL_COMPLETE_TASK = "tatatatatat%sDone"; //do not change + public static String TUTORIAL_REWARD_TASK = "tatatatatat%sRewardGiven"; //do not change + public static String SKIPPED_TASK = "tatatatata%sSkip"; + + protected final TutorialManager _manager; + protected final GoldManager _goldManager; + protected final ClansManager _clansManager; + protected final TaskManager _taskManager; + protected final DonationManager _donationManager; + +// protected final LinkedHashMap> _tasks; + private final ArrayList> _tasks; + protected final LinkedHashMap> _nameToTask; + protected final LinkedHashMap _inTutorial; + + protected boolean _doScoreboard; + protected boolean _ghostMode; + + protected boolean _startOnJoin; + + protected String _technicalName; + protected String _displayName; + + protected int _goldReward = -1; + protected int _gemReward = -1; + protected int _coinReward = -1; + + protected Playtime _playtime; + + public Tutorial(final GoldManager goldManager, final Playtime playtime, final TaskManager taskManager, final ClansManager clansManager, final DonationManager donationManager, final TutorialManager manager, final PacketHandler packetHandler) + { + _clansManager = clansManager; + _goldManager = goldManager; + _donationManager = donationManager; + _taskManager = taskManager; + _manager = manager; + _tasks = new ArrayList>(); + _inTutorial = new LinkedHashMap<>(); + _nameToTask = new LinkedHashMap<>(); + _playtime = playtime; + + _manager.getPluginManager().registerEvents(this, _manager.getPlugin()); + } + + @Override + public List getLines(final ScoreboardManager manager, final Player player, final List out) + { + final List lines = new ArrayList<>(); + + if (!isInTutorial(player)) + { + return lines; + } + + if (!_doScoreboard) + { + return lines; + } + + if (get(player).CurrentTask == null) + { + return lines; + } + + out.clear(); + + final TutorialClient client = _inTutorial.get(player.getName()); + + lines.add(C.cAqua + "Tutorial"); + + for (final TutorialTask task : _tasks) + { + if (get(player).CurrentTask.equals(task)) + { + lines.add(C.cDAqua + task.getID() + ". " + task.getDisplayName()); + } + else if (client.CurrentTask.getID() > task.getID()) + { + lines.add(C.cGreen + task.getID() + ". " + task.getDisplayName()); + } + else + { + lines.add(C.cRed + task.getID() + ". " + task.getDisplayName()); + } + } + + lines.add(C.cYellow + "To skip, type: /skiptutorial"); + + return lines; + } + + public TutorialTask getTask(int index) + { + return _tasks.get(index); + } + + protected void addTask(TutorialTask task) + { + _tasks.add(task); + _nameToTask.put(task.getTechnicalName(), task); + } + + protected boolean hasFinishedTask(Player player, TutorialTask task) + { + if (get(player).QueuedFinish) + { + return true; + } + + return get(player).CurrentTask.getID() < task.getID(); + } + + private TutorialTask getLastTask() + { + return _tasks.get(_tasks.size() - 1); + } + + protected void finishTask(final Player player, final TutorialTask task) + { + if (player == null) + { + return; + } + + get(player).LastDescriptionSentTime = 0; + get(player).CurrentTask.visibleFinish(player); + + // 6 Seconds for player to read the finish message (sent by the line above) + // (will be instant if get(player).CurrentTask.getFinishMessage() is null). + _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() + { + public void run() + { + final TutorialTask lastTask = getLastTask(); + // Cycle to next task, or null if last task. + get(player).CurrentTask = task.equals(lastTask) ? null : _tasks.get(task.getDataId() + 1); + System.out.println("Next Task: " + get(player).CurrentTask); + + if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()))) + { + _taskManager.completedTask(new Callback() + { + public void run(final Boolean completed) + { + // If last task, end tutorial. + if (task.equals(lastTask)) + { + finishFor(player); + } + else + { + // Start next task in 1.5 Seconds (just to give a more smooth feel to the tutorial) + _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() + { + public void run() + { + System.out.println("STARTING NEXT TASK!"); + get(player).CurrentTask.startFor(player); + get(player).CurrentTaskStartTime = System.currentTimeMillis(); + } + }, 30L); + } + + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); + } + }, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())); + } + } + }, get(player).CurrentTask._finishMessage == null ? 1L : 6 * 20L); + } + + public TutorialTask getTask(final String technicalName) + { + return _nameToTask.get(technicalName); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onPickupItem(final PlayerPickupItemEvent event) + { + if (_ghostMode && isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onDropItem(final PlayerDropItemEvent event) + { + if (_ghostMode && isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onBreakBlock(final BlockBreakEvent event) + { + if (_ghostMode && isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) + public void onPlaceBlock(final BlockPlaceEvent event) + { + if (_ghostMode && isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + private void finishFor(final Player player) + { +// if (player.getOpenInventory() != null) +// { +// _inTutorial.get(player.getName()).QueuedFinish = true; +// return; +// } + _manager.finishTutorial(player); + _inTutorial.remove(player.getName()); + onFinished(player); + + if (_playtime.Get(player).FirstSession) + { + _playtime.Get(player).StartTime = System.currentTimeMillis(); + _playtime.Get(player).FirstSession = false; + TaskManager.Instance.completedTask(null, player, ClansPlayerTasks.FIRST_SESSION.id()); + } + + _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() + { + public void run() + { + UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20, player); + onFinishedDelay(player); + + // Do Reward + if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName))) + { + _taskManager.completedTask(new Callback() + { + @Override + public void run(Boolean data) + { + if (_goldReward != -1) + { + _goldManager.addGold(player, _goldReward); + UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + ".")); + } + + if (_gemReward != -1) + { + _donationManager.RewardGems(new Callback() { + public void run(Boolean data) + { + UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + ".")); + } + }, "Clans", player.getName(), player.getUniqueId(), _gemReward); + } + + if (_coinReward != -1) + { + _donationManager.RewardCoins(new Callback() { + public void run(Boolean data) + { + UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + ".")); + } + }, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward); + } + } + }, player, String.format(TUTORIAL_REWARD_TASK, _technicalName)); + } + else + { + UtilInv.remove(player, Material.IRON_AXE, (byte) 0, 1); + + UtilInv.remove(player, Material.IRON_HELMET, (byte) 0, 1); + UtilInv.remove(player, Material.IRON_CHESTPLATE, (byte) 0, 1); + UtilInv.remove(player, Material.IRON_LEGGINGS, (byte) 0, 1); + UtilInv.remove(player, Material.IRON_BOOTS, (byte) 0, 1); + + ItemStack[] armor = player.getInventory().getArmorContents(); + for (int i = 0 ; i < armor.length; i++) + { + if (UtilItem.isIronProduct(armor[i])) + { + armor[i] = null; + } + } + player.getInventory().setArmorContents(armor); + } + + _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() + { + public void run() + { + // Sets the tutorial as complete in the TaskManager and effects. + _taskManager.completedTask(new Callback() + { + public void run(final Boolean completed) + { + if (_ghostMode) + { + for (Player other : UtilServer.getPlayers()) + { + other.showPlayer(player); + player.showPlayer(other); + } + } + + for (int i = 0; i < 8; i++) + { + final int index = i; + _manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() + { + public void run() + { + UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, (index % 2 == 0) ? Color.RED : Color.LIME, false, false, new Vector(0, 0, 0), 0); + } + }, i * 10); + } + } + }, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)); + } + }, 20 * 2); + } + }, 20 * 2); + } + + // Implementation left to sub classes. + protected void onFinished(final Player player) + { + } + + protected void onFinishedDelay(final Player player) + { + } + + // Implementation left to sub classes. + protected void onBegin(final Player player) + { + } + + public void startFor(final Player player) + { + if (!_manager.isInTutorial(player)) + { + _manager.setTutorial(player, this); + } + + _inTutorial.put(player.getName(), new TutorialClient(player, this)); + + get(player).CurrentTask.startFor(player); + + player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); + + if (_ghostMode) + { + for (Player other : UtilServer.getPlayers()) + { + other.hidePlayer(player); + player.hidePlayer(other); + } + } + + onBegin(player); + } + + public void cancelFor(final Player player) + { + get(player).CurrentTask.cleanup(player); + get(player).CurrentTaskStartTime = -1; + _inTutorial.remove(player.getName()); + + _manager.finishTutorial(player); + + if (_ghostMode) + { + for (Player other : UtilServer.getPlayers()) + { + if (!isInTutorial(other)) other.showPlayer(player); + player.showPlayer(other); + } + } + + if (_playtime.Get(player).FirstSession) + { + _playtime.Get(player).StartTime = System.currentTimeMillis(); + _playtime.Get(player).FirstSession = false; + TaskManager.Instance.completedTask(null, player, ClansPlayerTasks.FIRST_SESSION.id()); + } + } + + public boolean isInTutorial(final Player player) + { + return _inTutorial.containsKey(player.getName()); + } + + public boolean isInTutorial(final String player) + { + return _inTutorial.containsKey(player); + } + + public boolean hasCompleted(final Player player) + { + return _taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)); + } + + public boolean hasSkipped(final Player player) + { + return _taskManager.hasCompletedTask(player, String.format(SKIPPED_TASK, _technicalName)); + } + + public void skip(final Player player) + { + new JsonMessage("") + .extra( + F.main( + "Tutorial", + "Are you sure you want to skip the tutorial? We " + )) + .extra("strongly") + .color("gold") + .extra(" advise you do complete it. You will be rewarded with armor, weapons and") + .color("gray") + .extra(" 30000 Gold") + .color("yellow") + .extra("!") + .color("gray") + + .sendToPlayer(player); + + new JsonMessage("") + .extra( + F.main( + "Tutorial", + "Click " + )) + .extra("here") + .color("aqua") + .click(ClickEvent.RUN_COMMAND, "/yesiconfirmiwanttoskip") + .extra(" here to confirm you want to skip the tutorial!") + .color("gray") + + .sendToPlayer(player); + } + + public void doSkip(final Player player) + { + _taskManager.completedTask(new Callback() + { + public void run(Boolean data) + { + cancelFor(player); + } + }, player, String.format(SKIPPED_TASK, _technicalName)); + } + + public String getTechnicalName() + { + return _technicalName; + } + + public TutorialClient get(final Player player) + { + return _inTutorial.get(player.getName()); + } + + @EventHandler + public void onClanTip(ClanTipEvent event) + { + if (isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void taskInfo(final UpdateEvent evt) + { + if (evt.getType() != UpdateType.SEC) + { + return; + } + + for (Player player : UtilServer.getPlayers()) + { + if (isInTutorial(player)) + { + if (get(player).QueuedFinish) + { + if (player.getOpenInventory() == null) + { + get(player).QueuedFinish = false; + finishFor(player); + } + else + { + continue; + } + } + + get(player).CurrentTask.trySendDescription(player, false); + } + } + } + + @EventHandler + public void chat(final AsyncPlayerChatEvent evt) + { + if (!isInTutorial(evt.getPlayer())) + { + return; + } + + Iterator iterator = evt.getRecipients().iterator(); + + while (iterator.hasNext()) + { + if (isInTutorial(iterator.next())) + { + iterator.remove(); + } + } + + evt.setCancelled(true); + } + + @EventHandler + public void onJoinClan(ClanJoinEvent event) + { + if (isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onPlayerJoin(final PlayerJoinEvent evt) + { + if (!hasSkipped(evt.getPlayer()) && _startOnJoin) + { + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable() + { + public void run() + { + if (!hasCompleted(evt.getPlayer())) + { + startFor(evt.getPlayer()); + } + } + }, 40L); + } + } + + public void cleanup(Player player) + { + System.out.println("Cleaning up Player in " + getClass().getName()); + + if (get(player) != null && get(player).CurrentTask != null) + { + System.out.println("Cleaning up current task: " + get(player).CurrentTask.getClass().getName()); + get(player).CurrentTask.cleanup(player); + } + + System.out.println("removing from in tutorial"); + _inTutorial.remove(player.getName()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialClient.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialClient.java new file mode 100644 index 000000000..a73f4fdd6 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialClient.java @@ -0,0 +1,40 @@ +package mineplex.game.clans.legacytutorial; + +import org.bukkit.entity.Player; + +public class TutorialClient +{ + public Player Player; + public TutorialTask CurrentTask; + public long LastDescriptionSentTime = System.currentTimeMillis() - 3000; + public boolean InClanOnStart; + public boolean QueuedFinish; + public long CurrentTaskStartTime; + + public TutorialClient(Player player, Tutorial tutorial) + { + Player = player; + + CurrentTask = tutorial.getTask(0); + CurrentTaskStartTime = System.currentTimeMillis(); + + InClanOnStart = tutorial._clansManager.isInClan(player); + + /* + for (TutorialTask task : tutorial._tasks.values()) + { + if (TaskManager.Instance.hasCompletedTask(player, String.format( + Tutorial.TASK_COMPLETE_TASK, + task.getTutorial().getTechnicalName(), + task.getTechnicalName() + ))) + { + if (CurrentTask.getID() <= task.getID()) + { + CurrentTask = task.getTutorial().getTasks().get(Math.min(task.getTutorial().getTasks().size(), task.getID() + 1)); + } + } + } + */ + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialManager.java new file mode 100644 index 000000000..56142641d --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialManager.java @@ -0,0 +1,211 @@ +package mineplex.game.clans.legacytutorial; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.preferences.PreferencesManager; +import mineplex.core.task.TaskManager; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.commands.RestartTutCommand; +import mineplex.game.clans.clans.playtime.Playtime; +import mineplex.game.clans.economy.GoldManager; +import mineplex.game.clans.legacytutorial.commands.DoSkipTutorialCommand; +import mineplex.game.clans.legacytutorial.commands.SkipTutorialCommand; +import net.md_5.bungee.api.ChatColor; +import net.minecraft.server.v1_8_R3.PacketPlayOutChat; + +public class TutorialManager extends MiniPlugin +{ + public static TutorialManager Instance; + + private final Map, Tutorial> _tutorials = new HashMap<>(); + private final Map _playerTutorials = new HashMap<>(); + + private final TaskManager _taskManager; + + public TutorialManager(final JavaPlugin plugin, final Playtime playtime, final GoldManager goldManager, final TaskManager taskManager, final DonationManager donationManager, final PreferencesManager preferencesManager, final ClansManager clansManager, final PacketHandler packetHandler) + { + super("Tutorials", plugin); + + Instance = this; + + _taskManager = taskManager; + +// _tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, playtime, clansManager, donationManager, goldManager, taskManager, packetHandler)); + } + + public void addCommands() + { + addCommand(new SkipTutorialCommand(this)); + addCommand(new DoSkipTutorialCommand(this)); + addCommand(new RestartTutCommand(this)); + } + + public boolean startTutorial(final Class tutorial, final Player player) + { + if (isInTutorial(player)) + { + cancelTutorial(player); + } + + if (_tutorials.containsKey(tutorial)) + { + _tutorials.get(tutorial).startFor(player); + + return isInTutorial(player); + } + + return false; + } + + public boolean isInTutorial(final Player player) + { + return _playerTutorials.containsKey(player.getName()); + } + + public void cancelTutorial(final Player player) + { + if (isInTutorial(player)) + { + getTutorial(player).cancelFor(player); + + UtilPlayer.message(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + ".")); + _playerTutorials.remove(player.getName()); + } + } + + public void skipTutorial(final Player player) + { + if (isInTutorial(player)) + { + getTutorial(player).skip(player); + } + } + + public void doSkip(final Player player) + { + if (isInTutorial(player)) + { + UtilPlayer.message(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + ".")); + getTutorial(player).doSkip(player); + } + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + System.out.println("Player Quit. In Tutorial: " + isInTutorial(event.getPlayer())); + + if (!isInTutorial(event.getPlayer())) + return; + + getTutorial(event.getPlayer()).cleanup(event.getPlayer()); + _playerTutorials.remove(event.getPlayer().getName()); + } + + public void finishTutorial(Player player) + { + _playerTutorials.remove(player.getName()); + } + + public void setTutorial(Player player, Tutorial tutorial) + { + _playerTutorials.put(player.getName(), tutorial); + } + + public Tutorial getTutorial(final Player player) + { + return _playerTutorials.get(player.getName()); + } + + public Map, Tutorial> getTutorials() + { + return _tutorials; + } + + public TaskManager getTaskManager() + { + return _taskManager; + } + + // Stolen from UtilTabTitle + private static class TextConverter + { + public static String convert(String text) + { + if (text == null || text.length() == 0) + { + return "\"\""; + } + + char c; + int i; + int len = text.length(); + StringBuilder sb = new StringBuilder(len + 4); + String t; + sb.append('"'); + + for (i = 0; i < len; i += 1) + { + c = text.charAt(i); + switch (c) + { + case '\\': + case '"': + sb.append('\\'); + sb.append(c); + break; + case '/': + sb.append('\\'); + sb.append(c); + break; + case '\b': + sb.append("\\b"); + break; + case '\t': + sb.append("\\t"); + break; + case '\n': + sb.append("\\n"); + break; + case '\f': + sb.append("\\f"); + break; + case '\r': + sb.append("\\r"); + break; + default: + if (c < ' ') + { + t = "000" + Integer.toHexString(c); + sb.append("\\u").append(t.substring(t.length() - 4)); + } + else + { + sb.append(c); + } + } + } + sb.append('"'); + return sb.toString(); + } + + public static String setPlayerName(Player player, String text) + { + return text.replaceAll("(?i)\\{PLAYER\\}", player.getName()); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialTask.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialTask.java new file mode 100644 index 000000000..15598cd14 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/TutorialTask.java @@ -0,0 +1,267 @@ +package mineplex.game.clans.legacytutorial; + +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.NautArrayList; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; + +public class TutorialTask implements Listener +{ + protected T _tutorial; + + protected long _autoCompleteTime = -1; + + protected String _displayName; + protected String _technicalName; + + protected String _description; + protected String _finishMessage; + + protected String[] _subtasks; + + protected Location _taskPos; + + // How much time after the beginning the task/last teleport it should take to teleport back to _taskPos. + protected int _taskTpDelay = 2 * 60 * 20; + + protected long _descriptionWaitTime = 30000; + + protected NautArrayList _inTask = new NautArrayList<>(); + + private long _lastTaskTp; + private int _id; + + public TutorialTask(T tutorial, int id) + { + _tutorial = tutorial; + _id = id; + + UtilServer.getServer().getPluginManager().registerEvents(this, _tutorial._manager.getPlugin()); + } + + protected void customStartFor(final Player player) + { + } + + protected void customEndFor(final Player player) + { + } + + protected final void startFor(final Player player) + { + _inTask.add(player.getName()); + + trySendDescription(player, true); + + customStartFor(player); + + if (_taskPos != null) + { + player.teleport(_taskPos); + _lastTaskTp = System.currentTimeMillis(); + if (_taskTpDelay != -1) + { + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){ + public void run() + { + if (isDoing(player)) + { + player.teleport(_taskPos); + _lastTaskTp = System.currentTimeMillis(); + } + } + }, _taskTpDelay); + } + } + + if (_autoCompleteTime != -1) + { + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){ + public void run() + { + if (isDoing(player)) + { + finishFor(player); + } + } + }, _autoCompleteTime); + } + } + + //@EventHandler + //todo: fix the multiline subtitles + public void displaySubtasks(UpdateEvent event) + { + if (!event.getType().equals(UpdateType.SEC)) + { + return; + } + + if (_subtasks == null || _subtasks.length == 0) + { + return; + } + + Iterator iterator = _inTask.iterator(); + while (iterator.hasNext()) + { + Player player = Bukkit.getPlayer(iterator.next()); + + if ((System.currentTimeMillis() - _tutorial.get(player).CurrentTaskStartTime) >= 15000) + { + if (isDoing(player)) + { + UtilTextMiddle.display("", UtilText.arrayToString(_subtasks, "\n"), 1, 25, 25, player); + } + } + } + } + + public boolean isDoing(Player player) + { + return _inTask != null && player != null && _inTask.contains(player.getName()); + } + + public void trySendDescription(Player player, boolean force) + { + if (!_tutorial.isInTutorial(player)) + { + return; + } + + TutorialClient client = _tutorial.get(player); + + if (client.QueuedFinish) + { + return; + } + + if (force || System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime()) + { + String description = _description; + ClanInfo clan = getClans().getClan(player); + if (clan != null) description = description.replace("(clan)", clan.getName()); + description = description.replace("{", C.cAqua).replace("}", C.cWhite); + + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cYellowB + "Part " + (_id + 1) + ": " + _displayName); + UtilPlayer.message(player, C.cWhite + " " + description); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + + UtilTextMiddle.display("", getDisplayName(), player); + + client.LastDescriptionSentTime = System.currentTimeMillis(); + } + } + + public final boolean hasFinished(final Player player) + { + if (_tutorial.get(player).QueuedFinish) + { + return true; + } + + // CurrentTask will be null if player has finished tutorial + return _tutorial.get(player).CurrentTask == null || _tutorial.get(player).CurrentTask.getID() < getID(); + } + + public String getDisplayName() + { + return _displayName; + } + + public String getDescription() + { + return _description; + } + + public String getFinishMessage() + { + return _finishMessage; + } + + public String getTechnicalName() + { + return _technicalName; + } + + public TutorialManager getManager() + { + return _tutorial._manager; + } + + public ClansManager getClans() + { + return _tutorial._clansManager; + } + + public int getDataId() + { + return _id; + } + + public int getID() + { + return _id + 1; + } + + public void finishFor(Player player) + { + customEndFor(player); + cleanup(player); + _tutorial.finishTask(player, this); + } + + public void visibleFinish(Player player) + { + if (_finishMessage != null) + { + String finishMessage = _finishMessage; + ClanInfo clan = getClans().getClan(player); + if (clan != null) finishMessage = finishMessage.replace("(clan)", clan.getName()); + finishMessage = finishMessage.replace("{", C.cAqua).replace("}", C.cWhite); + + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cWhite + finishMessage); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + } + } + + public void cleanup(Player player) + { + _inTask.remove(player.getName()); + } + + public long getDescriptionWaitTime() + { + return _descriptionWaitTime; + } + + public T getTutorial() + { + return _tutorial; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/DoSkipTutorialCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/DoSkipTutorialCommand.java new file mode 100644 index 000000000..599a875c5 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/DoSkipTutorialCommand.java @@ -0,0 +1,31 @@ +package mineplex.game.clans.legacytutorial.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.legacytutorial.TutorialManager; + +public class DoSkipTutorialCommand extends CommandBase +{ + public DoSkipTutorialCommand(final TutorialManager plugin) + { + super(plugin, Rank.ALL, "yesiconfirmiwanttoskip"); + } + + @Override + public void Execute(final Player caller, final String[] args) + { + if (Plugin.isInTutorial(caller)) + { + Plugin.doSkip(caller); + } + else + { + UtilPlayer.message(caller, F.main("Tutorials", "You are not currently in a tutorial.")); + } + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/SkipTutorialCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/SkipTutorialCommand.java new file mode 100644 index 000000000..2a8b36d20 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/commands/SkipTutorialCommand.java @@ -0,0 +1,31 @@ +package mineplex.game.clans.legacytutorial.commands; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.legacytutorial.TutorialManager; + +public class SkipTutorialCommand extends CommandBase +{ + public SkipTutorialCommand(final TutorialManager plugin) + { + super(plugin, Rank.ALL, "skiptutorial", "skiptut", "st"); + } + + @Override + public void Execute(final Player caller, final String[] args) + { + if (Plugin.isInTutorial(caller)) + { + Plugin.skipTutorial(caller); + } + else + { + UtilPlayer.message(caller, F.main("Tutorials", "You are not currently in a tutorial.")); + } + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskClaim.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskClaim.java new file mode 100644 index 000000000..c0b966649 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskClaim.java @@ -0,0 +1,42 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskClaim extends TutorialTask +{ + public TaskClaim(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Claim some Territory"; + _technicalName = "ClaimTerr"; + + _description = "Clans can claim 16x16 areas of Territory! " + + "Once claimed, only your Clan can break/place blocks here. " + + "This is the perfect place to build a base and stash your items! " + + "You can only claim in the Wilderness, and not next to other Clan's Territory. " + + "To claim some territory, go into the Clans GUI by typing {/c} and {Left-Clicking} the Territory button. (Looks like a flag)"; + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onClansCommand(PlayerPreClaimTerritoryEvent event) + { + if (!isDoing(event.getClaimer())) + { + return; + } + + if (!ClansManager.getInstance().isInClan(event.getClaimer())) + { + return; + } + + finishFor(event.getClaimer()); + event.setCancelled(true); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskCreateClan.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskCreateClan.java new file mode 100644 index 000000000..97cfa9ba2 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskCreateClan.java @@ -0,0 +1,52 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.event.ClanCreatedEvent; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskCreateClan extends TutorialTask +{ + public TaskCreateClan(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Create a Clan"; + _technicalName = "ClanCreation"; + + _description = "Before beginning, use the {/c create } command to start up your own Clan! " + + "If you are already in a Clan, don't worry, you will automatically skip this part."; + } + + @Override + public void customStartFor(final Player player) + { + if (_tutorial.get(player).InClanOnStart) + { + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getManager().getPlugin(), new Runnable(){ + public void run() + { + if (isDoing(player)) + { + finishFor(player); + } + } + }, 6 * 20); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onClanCreated(ClanCreatedEvent event) + { + if (!isDoing(event.getFounder())) + { + return; + } + + finishFor(event.getFounder()); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskCustomizeClass.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskCustomizeClass.java new file mode 100644 index 000000000..c591dae4f --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskCustomizeClass.java @@ -0,0 +1,61 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.spawn.Spawn; +import mineplex.game.clans.legacytutorial.TutorialTask; +import mineplex.minecraft.game.classcombat.Class.ClientClass; + +public class TaskCustomizeClass extends TutorialTask +{ + public TaskCustomizeClass(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Customize Class"; + _technicalName = "CustomizeKlass"; + + _description = "Now that you have equipped a class, use this enchantment table to customize your class builds. " + + "Click on the enchantment table, and click the edit build button. " + + "Make sure to select an axe ability to try out in the next task!"; + + _taskPos = new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onUpdate(final UpdateEvent event) + { + if (!event.getType().equals(UpdateType.SEC)) + { + return; + } + + Iterator iterator = _inTask.iterator(); + while (iterator.hasNext()) + { + Player player = Bukkit.getPlayer(iterator.next()); + final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(player); + + if (clientclass != null && clientclass.GetSavingCustomBuild() != null && clientclass.GetSavingCustomBuild().AxeSkill != null) + { + finishFor(player); + iterator.remove(); + } + } + } + + @Override + public void cleanup(Player player) + { + // handled in onUpdate + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskDisbandClan.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskDisbandClan.java new file mode 100644 index 000000000..8fbc07f2c --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskDisbandClan.java @@ -0,0 +1,41 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.game.clans.clans.event.ClanDisbandedEvent; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskDisbandClan extends TutorialTask +{ + public TaskDisbandClan(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Disband your Clan"; + _technicalName = "DisbandClan"; + + _description = "Finally, let's disband your Clan to end the Tutorial. " + + "Simply type {/c disband} to do this. " + + "This will delete your Clan, and you'll be able to create or join a new one! " + + "If you were already in a Clan before you originally begun the Tutorial, you will automatically skip this part."; + } + + @Override + public void customStartFor(final Player player) + { + } + + @EventHandler + public void sell(ClanDisbandedEvent event) + { + if (!isDoing(event.getDisbander())) + { + return; + } + + System.out.println("COMPLETE DISBAND CLAN!"); + + finishFor(event.getDisbander()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskEquipClass.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskEquipClass.java new file mode 100644 index 000000000..a2896c445 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskEquipClass.java @@ -0,0 +1,120 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.NautArrayList; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilItem; +import mineplex.core.task.TaskManager; +import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent; +import mineplex.game.clans.clans.event.ClansShopAddButtonEvent; +import mineplex.game.clans.spawn.Spawn; +import mineplex.game.clans.legacytutorial.TutorialTask; +import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent; + +public class TaskEquipClass extends TutorialTask +{ + public TaskEquipClass(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Equip a Class"; + _technicalName = "AuszustattenKlasse"; + + _description = "Use the PvP Gear shop, and right-click the Villager. " + + "Purchase Iron Armor from the PvP Shop. " + + "Then put on your armor to equip the Knight Class."; + +// _subtasks = new String[] { +// "Open the PvP Shop", +// "Buy Iron Armor Set", +// "Equip Iron Armor" +// }; + + _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f); + } + + private NautHashMap> _bought = new NautHashMap<>(); + + @EventHandler + public void onClassEquipped(ClassEquipEvent event) + { + if (!isDoing(event.getUser())) + { + return; + } + + finishFor(event.getUser()); + } + + @Override + public void customEndFor(Player player) + { + _bought.get(player.getName()).clear(); + _bought.remove(player.getName()); + } + + @Override + public void customStartFor(Player player) + { + _bought.put(player.getName(), new NautArrayList()); + + if (getClans().getClassManager().Get(player).GetGameClass() != null) + { + finishFor(player); + } + } + + @EventHandler + public void button(ClansShopAddButtonEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + if (!(UtilItem.isArmor(event.getMaterial()) && UtilItem.isIronProduct(event.getMaterial()))) + { + return; + } + + if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.get(event.getPlayer().getName()).contains(event.getMaterial())) + { + event.setBuyPrice(0); + event.setSellPrice(0); + } + } + + @EventHandler + public void buy(final ClansPlayerBuyItemEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + if (!(UtilItem.isArmor(event.getItem().getType()) && UtilItem.isIronProduct(event.getItem().getType()))) + { + return; + } + + if (event.getCost() == 0 && _bought.get(event.getPlayer().getName()).contains(event.getItem().getType())) + { + event.setCancelled(true); + return; + } + + TaskManager.Instance.completedTask(new Callback() { + @Override + public void run(Boolean data) + { + } + }, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name()); + + _bought.get(event.getPlayer().getName()).add(event.getItem().getType()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskExploreShops.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskExploreShops.java new file mode 100644 index 000000000..eb4b8cb6b --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskExploreShops.java @@ -0,0 +1,92 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.EnergyPageBuildEvent; +import mineplex.game.clans.spawn.Spawn; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskExploreShops extends TutorialTask +{ + public TaskExploreShops(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Welcome to the Shops"; + _technicalName = "WillkommenZumGeschaft"; + + _description = "Welcome to the Shops! Here you can buy all kinds of things that you may require during your adventure. " + + "You can also sell certain items to the Villagers to make a bit of extra Gold. " + + "Clan Energy is required to maintain the clan, without it, you will lose all claimed Territory! " + + "Go to the Energy Shop and buy {Max Energy}. (FREE)"; + + _finishMessage = "Great! " + + "Clans use energy to control Territory. " + + "More territory will cause your energy to drain faster, so make sure you remember to refill it regularly!"; + } + + @Override + public void customStartFor(Player player) + { + player.teleport(new Location(Spawn.getSpawnWorld(), 17, 66.5, -330, -180f, 0f)); + + ClansManager.getInstance().getClan(player).adjustEnergy(-(ClansManager.getInstance().getClan(player).getEnergyCostPerMinute() * 60)); + } + + @EventHandler + public void onItemPut(EnergyPageBuildEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + if (!ClansManager.getInstance().isInClan(event.getPlayer())) + { + return; + } + + if (ClansManager.getInstance().getClan(event.getPlayer()).getEnergyPurchasable() == 0) + { + finishFor(event.getPlayer()); + _inTask.remove(event.getPlayer().getName()); + return; + } + + event.setFree(true); + } + + @Override + public void cleanup(Player player) + { + // handled in on update + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TWOSEC) + { + return; + } + + Iterator iterator = _inTask.iterator(); + while (iterator.hasNext()) + { + Player player = Bukkit.getPlayer(iterator.next()); + if (ClansManager.getInstance().getClan(player).getEnergy() == ClansManager.getInstance().getClan(player).getEnergyMax()) + { + finishFor(player); + iterator.remove(); + } + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskLeaveSpawn.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskLeaveSpawn.java new file mode 100644 index 000000000..5a812ce65 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskLeaveSpawn.java @@ -0,0 +1,65 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import java.util.Iterator; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskLeaveSpawn extends TutorialTask +{ + public TaskLeaveSpawn(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Leave Spawn Islands"; + _technicalName = "LeaveSpawn"; + + _description = "Now you can leave the Spawn Island. " + + "Don't worry, you won't get hurt from the fall! " + + "Once you're down there, run out a couple of blocks to get to the Wilderness. " + + "When you finish the tutorial, you will be vulnerable to player attacks out there, so be careful!"; + } + + @Override + public void customStartFor(Player player) + { + if (player.getLocation().getY() < 100) + { + finishFor(player); + _inTask.remove(player.getName()); + } + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + Iterator iterator = _inTask.iterator(); + while (iterator.hasNext()) + { + String playerName = iterator.next(); + Player player = UtilPlayer.searchExact(playerName); + + if (player != null && player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null) + { + finishFor(player); + iterator.remove(); + } + } + } + + @Override + public void cleanup(Player player) + { + // We handle this in update() to avoid ConcurrentModificationException + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskMakingMoney.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskMakingMoney.java new file mode 100644 index 000000000..7b33cd35a --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskMakingMoney.java @@ -0,0 +1,72 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent; +import mineplex.game.clans.spawn.Spawn; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskMakingMoney extends TutorialTask +{ + public TaskMakingMoney(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Making Money (Farming)"; + _technicalName = "ImAFarmer"; + + _description = "We have given you a carrot to sell in the Organic Produce Shop. " + + "Click on the Villager, and {Right-Click} the carrot to sell your carrots in exchange for Gold."; + + _finishMessage = "Good job! " + + "Farming and selling foods like carrots and potatoes are great ways to make money. " + + "You can also sell blocks, ores, and many other items that a Shop may be interested in buying."; + + _taskPos = new Location(Spawn.getSpawnWorld(), 25.536, 66, -316.844, -100f, 0f); + } + + @Override + public void customStartFor(Player player) + { + player.getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 1)); + } + + @EventHandler + public void eat(PlayerItemConsumeEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + if (!event.getItem().getType().equals(Material.CARROT_ITEM)) + { + return; + } + + event.setCancelled(true); + } + + @EventHandler + public void button(ClansPlayerSellItemEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + if (!event.getItem().getType().equals(Material.CARROT_ITEM)) + { + return; + } + + System.out.println("FINISH CARROT"); + + finishFor(event.getPlayer()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskSetHome.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskSetHome.java new file mode 100644 index 000000000..42a185e30 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskSetHome.java @@ -0,0 +1,44 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskSetHome extends TutorialTask +{ + public TaskSetHome(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Set Clan Home"; + _technicalName = "SetClanHome"; + + _description = "You are now ready to set a Clan Home. " + + "To do this, use the {/c sethome} command. " + + "After you set a Clan Home, you or any of your Clan mates will be able to teleport back to the Clan Home by typing {/c home} whenever they are at Spawn."; + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onSetHome(ClansCommandExecutedEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + if (!ClansManager.getInstance().isInClan(event.getPlayer())) + { + return; + } + + if (!event.getCommand().equals("homeset")) + { + return; + } + + finishFor(event.getPlayer()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskUseAbility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskUseAbility.java new file mode 100644 index 000000000..6c180ae03 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskUseAbility.java @@ -0,0 +1,156 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.NautArrayList; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.task.TaskManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent; +import mineplex.game.clans.clans.event.ClansShopAddButtonEvent; +import mineplex.game.clans.spawn.Spawn; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskUseAbility extends TutorialTask +{ + public TaskUseAbility(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Use a Class Ability"; + _technicalName = "KlassAbilityUsage"; + + _description = "Now that you have equipped a class, you can start using abilities. " + + "Purchase an Iron Axe from the PvP Shop. " + + "Right-Click with your Iron Axe to use your Axe Ability!"; + + _taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f); + } + + private NautHashMap> _bought = new NautHashMap<>(); + private NautHashMap _teleported = new NautHashMap<>(); + + @Override + public void customStartFor(Player player) + { + _bought.put(player.getName(), new NautArrayList()); + } + + @Override + public void customEndFor(Player player) + { + _bought.get(player.getName()).clear(); + _bought.remove(player.getName()); + _teleported.remove(player.getName()); + } + + @EventHandler + public void teleportPlayer(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) return; + + Iterator iterator = _inTask.iterator(); + while (iterator.hasNext()) + { + Player _player = Bukkit.getPlayer(iterator.next()); + + if (!_teleported.containsKey(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING) + { + _player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f)); + _teleported.put(_player.getName(), true); + } + } + } + + /* + @EventHandler + public void onAbilityUesd(SkillTriggerEvent event) + { + if (!isDoing(event.GetPlayer())) + { + return; + } + + finishFor(event.GetPlayer()); + } + */ + + @EventHandler + public void onRightClick(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!isDoing(player)) + return; + + if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) + { + ItemStack item = player.getItemInHand(); + if (item != null && item.getType() == Material.IRON_AXE) + { + finishFor(player); + } + } + } + + @EventHandler + public void button(ClansShopAddButtonEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + if (!event.getMaterial().equals(Material.IRON_AXE)) + { + return; + } + + if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) + && !_bought.get(event.getPlayer().getName()).contains(event.getMaterial())) + { + event.setBuyPrice(0); + event.setSellPrice(0); + } + } + + @EventHandler + public void buy(final ClansPlayerBuyItemEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + if (!event.getItem().getType().equals(Material.IRON_AXE)) + { + return; + } + + if (event.getCost() == 0 && _bought.get(event.getPlayer().getName()).contains(event.getItem().getType())) + { + event.setCancelled(true); + return; + } + + TaskManager.Instance.completedTask(new Callback() { + @Override + public void run(Boolean data) + { + } + }, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name()); + _bought.get(event.getPlayer().getName()).add(event.getItem().getType()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskViewClanDetails.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskViewClanDetails.java new file mode 100644 index 000000000..d0af8ac05 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskViewClanDetails.java @@ -0,0 +1,38 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskViewClanDetails extends TutorialTask +{ + public TaskViewClanDetails(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _displayName = "Viewing Clan Details"; + _technicalName = "CommandClanX"; + + _description = "Now you can view information about your clan. " + + "To do this type {/c (clan)}! " + + "You can also use any clan's name to get some information about them as well."; + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onClansCommand(ClansCommandExecutedEvent event) + { + if (!isDoing(event.getPlayer())) + { + return; + } + + System.out.println(event.getCommand()); + + if (event.getCommand().equals("info")) + { + finishFor(event.getPlayer()); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskWelcome.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskWelcome.java new file mode 100644 index 000000000..1100966bc --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TaskWelcome.java @@ -0,0 +1,21 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import mineplex.game.clans.legacytutorial.TutorialTask; + +public class TaskWelcome extends TutorialTask +{ + public TaskWelcome(TutorialGettingStarted tutorial, int id) + { + super(tutorial, id); + + _autoCompleteTime = 20 * 10; + + _displayName = "Welcome"; + _technicalName = "Welcome"; + + _description = "Welcome to Clans! " + + "In this game mode, you are able to create a Clan, invite your friends to the Clan, build a base, claim it to protect, and fight others with your new powerful Clan!" + + "You can also join a friend's Clan if they invite you to it!" + + "When you finish the tutorial, you will be awarded {30,000 Gold}"; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TutorialGettingStarted.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TutorialGettingStarted.java new file mode 100644 index 000000000..99c2cb4e5 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/legacytutorial/gettingstarted/TutorialGettingStarted.java @@ -0,0 +1,108 @@ +package mineplex.game.clans.legacytutorial.gettingstarted; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.donation.DonationManager; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.task.TaskManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.playtime.Playtime; +import mineplex.game.clans.economy.GoldManager; +import mineplex.game.clans.legacytutorial.Tutorial; +import mineplex.game.clans.legacytutorial.TutorialManager; +import mineplex.game.clans.spawn.Spawn; + +public class TutorialGettingStarted extends Tutorial +{ + public TutorialGettingStarted(final TutorialManager manager, final Playtime playtime, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager, final PacketHandler packetHandler) + { + super(goldManager, playtime, taskManager, clansManager, donationManager, manager, packetHandler); + +// addTask(new TaskWelcome(this, 1)); + + int id = -1; + addTask(new TaskCreateClan(this, ++id)); + addTask(new TaskViewClanDetails(this, ++id)); + addTask(new TaskLeaveSpawn(this, ++id)); + addTask(new TaskClaim(this, ++id)); + addTask(new TaskSetHome(this, ++id)); + addTask(new TaskExploreShops(this, ++id)); + addTask(new TaskEquipClass(this, ++id)); + addTask(new TaskCustomizeClass(this, ++id)); + addTask(new TaskUseAbility(this, ++id)); + addTask(new TaskMakingMoney(this, ++id)); + addTask(new TaskDisbandClan(this, ++id)); + + _doScoreboard = true; + _ghostMode = true; + _startOnJoin = true; + _goldReward = 30000; + + _technicalName = "GettingStartedTutorial"; + _displayName = "Getting Started"; + } + + @Override + public void onFinished(final Player player) + { + player.resetPlayerTime(); + player.teleport(Spawn.getNorthSpawn()); + } + + @Override + protected void onFinishedDelay(Player player) + { + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, C.cYellowB + "CONGRATULATIONS"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold"); + UtilPlayer.message(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!"); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + } + + @Override + public void onBegin(final Player player) + { + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cYellowB + "Getting Started"); + UtilPlayer.message(player, C.cWhite + " Welcome to Clans! " + + "In this game mode you are able to create a clan, invite your friends to play with you, build a base, and wage war against others! " + + "When you finish the tutorial, you will be awarded " + C.cAqua + "30,000 Gold"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------"); + } + + + @EventHandler(priority = EventPriority.MONITOR) + public void onUpdate(final UpdateEvent event) + { + if (!event.getType().equals(UpdateType.SEC)) + { + return; + } + + for (Player player : UtilServer.getPlayers()) + { + if (isInTutorial(player)) + { + for (Player other : UtilServer.getPlayers()) + { + other.hidePlayer(player.getPlayer()); + player.hidePlayer(other); + } + } + } + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/message/ClansMessageManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/message/ClansMessageManager.java new file mode 100644 index 000000000..ac9a0332f --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/message/ClansMessageManager.java @@ -0,0 +1,65 @@ +package mineplex.game.clans.message; + +import java.util.HashMap; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ClansMessageManager extends MiniPlugin +{ + private static final Message BLANK_MESSAGE = new Message("", "", 20); + + private HashMap _playerMessageMap; + + public ClansMessageManager(JavaPlugin plugin) + { + super("Message", plugin); + + _playerMessageMap = new HashMap<>(); + } + + @EventHandler + public void tick(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + _playerMessageMap.forEach((player, message) ->{ + message.increment(); + if (message.shouldSend()) + { + message.send(player); + } + }); + } + + public void setMessage(Player player, String title, String description, int ticksBetween, boolean displayNow) + { + Message message = new Message(title, description, ticksBetween); + _playerMessageMap.put(player, message); + if (displayNow) message.send(player); + } + + public void removePlayer(Player player) + { + removePlayer(player, true); + } + + public void removePlayer(Player player, boolean sendBlankMessage) + { + BLANK_MESSAGE.send(player); + _playerMessageMap.remove(player); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + removePlayer(event.getPlayer(), false); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/message/Message.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/message/Message.java new file mode 100644 index 000000000..56910d733 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/message/Message.java @@ -0,0 +1,47 @@ +package mineplex.game.clans.message; + +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilTextMiddle; + +public class Message +{ + private int _ticksBetweenMessage; + private int _ticks; + + private String _title; + private String _description; + + public Message(String title, String description, int ticksBetweenMessage) + { + _title = title; + _description = description; + _ticksBetweenMessage = ticksBetweenMessage; + _ticks = 0; + } + + protected void send(Player player) + { + UtilTextMiddle.display(_title, _description, player); + } + + public int getTicks() + { + return _ticks; + } + + public int getTicksBetweenMessage() + { + return _ticksBetweenMessage; + } + + public void increment() + { + _ticks++; + } + + public boolean shouldSend() + { + return _ticks % _ticksBetweenMessage == 0; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/tnt/TNTGenPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/tnt/TNTGenPage.java new file mode 100644 index 000000000..eaed63bc0 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/tnt/TNTGenPage.java @@ -0,0 +1,154 @@ +package mineplex.game.clans.shop.pvp.tnt; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; +import org.bukkit.scheduler.BukkitRunnable; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilUI; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.tntGenerator.TntGenerator; +import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager; +import mineplex.game.clans.economy.GoldManager; +import mineplex.game.clans.shop.ClansShopItem; + +public class TNTGenPage extends ShopPageBase +{ + public TNTGenPage(ClansManager plugin, TNTGenShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player) + { + super(plugin, shop, clientManager, donationManager, "TNT Generator", player); + + buildPage(); + } + + @Override + protected void buildPage() + { + ClanInfo clan = _plugin.getClan(_player); + + if (clan == null) + { + _player.closeInventory(); + _player.playSound(_player.getLocation(), Sound.NOTE_BASS, 1, 1); + UtilPlayer.message(_player, F.main("Clans", "You must be in a clan to manage a TNT Generator.")); + return; + } + + if (clan.getGenerator() == null) + { + addButton(13, new ItemBuilder(Material.BREWING_STAND_ITEM).setTitle(C.cRed + "Buy TNT Generator").setLore(" ", C.cYellow + ClansShopItem.TNT_GENERATOR.getBuyPrice() + " Gold").build(), (player, click) -> { + clearPage(); + buildPage(); + + // Check if generator is still null + // Prevents someone from buying a generator at the same time as another clan member does. + if (clan.getGenerator() != null) + { + _player.playSound(_player.getLocation(), Sound.NOTE_BASS, 1, 1); + UtilPlayer.message(_player, F.main("Clans", "Your clan already has a TNT Generator.")); + return; + } + + if (_donationManager.Get(player).getGold() >= ClansShopItem.TNT_GENERATOR.getBuyPrice()) + { + GoldManager.getInstance().deductGold(success -> { + UtilPlayer.message(player, F.main("Clans", "You purchased a " + F.elem("TNT Generator") + " for your Clan. You can now access it from the " + F.elem("PvP Shop") + ".")); + clan.inform(F.main("Clans", F.elem(player.getName()) + " purchased a " + F.elem("TNT Generator") + " for the Clan. You can now access it from the " + F.elem("PvP Shop") + "."), player.getName()); + + TntGenerator generator = new TntGenerator(player.getUniqueId().toString()); + clan.setGenerator(generator); + _plugin.getClanDataAccess().updateGenerator(clan, null); + }, player, ClansShopItem.TNT_GENERATOR.getBuyPrice()); + } + else + { + UtilPlayer.message(player, F.main("Clans", "You can not afford to purchase a " + F.elem("TNT Generator") + " for your Clan.")); + _player.playSound(player.getLocation(), Sound.NOTE_BASS, 1, 1); + } + + clearPage(); + buildPage(); + }); + } + else + { + TntGenerator generator = clan.getGenerator(); + + String nextTnt = "Never"; + + if (generator.getStock() < 3) + { + nextTnt = UtilTime.MakeStr((TntGeneratorManager.SECONDS_PER_TNT - generator.getTicks()) * 1000); + } + + addButton(13, new ItemBuilder(Material.BREWING_STAND_ITEM) + .setTitle(C.cGreen + "TNT Generator") + .setLore( + " ", + C.cWhite + "Purchased by " + F.elem(clan.getMembers().get(generator.getBuyer()).getPlayerName()), + " ", + C.cWhite + "TNT Available: " + F.elem(Integer.valueOf(generator.getStock())), + " ", + C.cWhite + "Next TNT: " + F.elem(nextTnt)).build(), (player, click) -> { + clearPage(); + buildPage(); + }); + + if (generator.getStock() == 0) + { + return; + } + + int[] indices = UtilUI.getIndicesFor(generator.getStock(), 2); + + for (int index : indices) + { + addButton(index, new ItemBuilder(Material.TNT).setTitle(C.cGreen + "Retrieve TNT").setLore(" ", "Click to collect this TNT.").build(), (player, click) -> { + clearPage(); + buildPage(); + + if (generator.getStock() <= 0) + { + UtilPlayer.message(player, F.main("Clans", "Your " + F.elem("TNT Generator") + " no longer contains this piece of TNT.")); + _player.playSound(player.getLocation(), Sound.NOTE_BASS, 1, 1); + return; + } + + if (UtilInv.HasSpace(player, Material.TNT, 1)) + { + UtilPlayer.message(player, F.main("Clans", "You have successfully collected TNT from your " + F.elem("TNT Generator") + ".")); + clan.inform(F.main("Clans", F.elem(player.getName()) + " has collected TNT from the Clan's " + F.elem("TNT Generator") + "."), player.getName()); + player.getInventory().addItem(new ItemStack(Material.TNT, 1)); + generator.setStock(generator.getStock() - 1); + _player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1); + } + else + { + UtilPlayer.message(player, F.main("Clans", "You do not have enough sufficient space in your inventory to collect TNT.")); + _player.playSound(player.getLocation(), Sound.NOTE_BASS, 1, 1); + } + + clearPage(); + buildPage(); + + }); + } + } + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/tnt/TNTGenShop.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/tnt/TNTGenShop.java new file mode 100644 index 000000000..4e54909a4 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/tnt/TNTGenShop.java @@ -0,0 +1,22 @@ +package mineplex.game.clans.shop.pvp.tnt; + +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.game.clans.clans.ClansManager; + +public class TNTGenShop extends ShopBase +{ + public TNTGenShop(ClansManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager) + { + super(plugin, clientManager, donationManager, "TNT Generator"); + } + + @Override + protected ShopPageBase> buildPagesFor(Player player) + { + return new TNTGenPage(getPlugin(), this, getClientManager(), getDonationManager(), player); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/texttutorial/ClassTutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/texttutorial/ClassTutorial.java new file mode 100644 index 000000000..d6e3b3e79 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/texttutorial/ClassTutorial.java @@ -0,0 +1,14 @@ +package mineplex.game.clans.texttutorial; + +import mineplex.core.texttutorial.tutorial.Phase; +import mineplex.core.texttutorial.tutorial.Tutorial; + +public class ClassTutorial extends Tutorial +{ + public ClassTutorial() + { + super("Class Guide", "Clans.TextTutorial.Class", 0); + + addPhase(new Phase(null, "Classes", new String[] { "" })); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java new file mode 100644 index 000000000..1771b70be --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java @@ -0,0 +1,400 @@ +package mineplex.game.clans.tutorial; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.HologramManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.message.ClansMessageManager; +import mineplex.game.clans.tutorial.objective.Objective; +import mineplex.game.clans.tutorial.objective.ObjectiveListener; + +public abstract class Tutorial implements Listener, ObjectiveListener +{ + private HashMap _playerSessionMap; + + private JavaPlugin _plugin; + private HologramManager _hologram; + private ClansMessageManager _message; + private String _name; + private String _taskIdentifier; + private TutorialWorldManager _worldManager; + + // GUI Data + private Material _guiMaterial; + private byte _guiData; + + private List _objectives; + + public Tutorial(JavaPlugin plugin, ClansMessageManager message, HologramManager hologram, String name, String taskIdentifier, Material guiMaterial, byte data) + { + _plugin = plugin; + _message = message; + _hologram = hologram; + _name = name; + _taskIdentifier = taskIdentifier; + + _guiMaterial = guiMaterial; + _guiData = data; + + _playerSessionMap = new HashMap<>(); + _objectives = new ArrayList<>(); + } + + protected void addObjective(Objective objective) + { + _objectives.add(objective); + objective.addListener(this); + } + + public void start(Player player) + { + System.out.println(String.format("Tutorial> [%s] started tutorial [%s]", player.getName(), getName())); + + TutorialSession session = new TutorialSession(); + TutorialRegion region = _worldManager == null ? null : _worldManager.getNextRegion(); + session.setRegion(region); + + _playerSessionMap.put(player, session); + + onStart(player); + + // Start at first objective! + setObjective(player, 0); + + + _objectives.forEach(objective -> objective.setup(player, region)); + } + + private void setObjective(Player player, int objective) + { + if (_objectives.size() <= objective) + throw new IndexOutOfBoundsException("Invalid objective index: " + objective + ", size: " + _objectives.size()); + + _playerSessionMap.get(player).setObjectiveIndex(objective); + _objectives.get(objective).start(player); + } + + public boolean isInTutorial(Player player) + { + return _playerSessionMap.containsKey(player); + } + + public JavaPlugin getPlugin() + { + return _plugin; + } + + public String getName() + { + return _name; + } + + public Material getGuiMaterial() + { + return _guiMaterial; + } + + public byte getGuiData() + { + return _guiData; + } + + public ClansMessageManager getMessage() + { + return _message; + } + + public final String getTaskIdentifier() + { + return "clans.tutorial." + _taskIdentifier; + } + + @Override + public void onObjectiveFinish(Player player, Objective objective) + { + int index = _objectives.indexOf(objective); + + assert index != -1; + + if (index + 1 >= _objectives.size()) + { + finish(player); + } + else + { + setObjective(player, index + 1); + } + } + + @Override + public void onObjectiveStart(Player player, Objective objective) + { + } + + @Override + public void onObjectivePlayerUpdate(Player player, Objective objective) + { + } + + protected final void finish(Player player) + { + _objectives.forEach(objective -> objective.clean(player, getRegion(player))); + + removePlayer(player); + + System.out.println(String.format("Tutorial> [%s] finished tutorial [%s]", player.getName(), getName())); + + playFinishEffects(player.getLocation()); + onFinish(player); + } + + private void quit(Player player) + { + _objectives.forEach(objective -> objective.clean(player, getRegion(player))); + + removePlayer(player); + + System.out.println(String.format("Tutorial> [%s] quit tutorial [%s]", player.getName(), getName())); + + onQuit(player); + } + + private void removePlayer(Player player) + { + TutorialSession session = _playerSessionMap.remove(player); + + if (session != null) + { + if (session.getRegion() != null) + { + _worldManager.returnRegion(session.getRegion()); + } + + if (session.getSpawnHologram() != null) + session.getSpawnHologram().stop(); + + session.getHolograms().forEach(Hologram::stop); + } + } + + public Set getPlayers() + { + return _playerSessionMap.keySet(); + } + + /** + * Called when the player finishes the tutorial + */ + protected abstract void onFinish(Player player); + + /** + * Called when the player starts the tutorial + */ + protected abstract void onStart(Player player); + + /** + * Called when a player quits the tutorial or leaves the game in the tutorial + */ + protected abstract void onQuit(Player player); + + public void unregisterAll() + { + HandlerList.unregisterAll(this); + _objectives.forEach(Objective::unregisterAll); + } + + public List getScoreboardLines(Player player) + { + ArrayList lines = new ArrayList<>(); + TutorialSession session = _playerSessionMap.get(player); + if (session != null) + { + lines.add(" "); + + int objectiveIndex = session.getObjectiveIndex(); + Objective currentObjective = _objectives.get(objectiveIndex); + lines.add(C.cGreenB + currentObjective.getName(player)); + lines.add(" "); + currentObjective.addScoreboardLines(player, lines); + } + return lines; + } + + public void setWorldManager(TutorialWorldManager worldManager) + { + _worldManager = worldManager; + } + + public TutorialWorldManager getWorldManager() + { + return _worldManager; + } + + public TutorialRegion getRegion(Player player) + { + if(player == null || !player.isOnline() || _playerSessionMap == null || _playerSessionMap.get(player) == null) return null; + return _playerSessionMap.get(player).getRegion(); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + if (isInTutorial(event.getPlayer())) + { + quit(event.getPlayer()); + } + } + + @EventHandler + public void onKick(PlayerKickEvent event) + { + if (isInTutorial(event.getPlayer())) + { + quit(event.getPlayer()); + } + } + + @EventHandler + public void onHungerChange(FoodLevelChangeEvent event) + { + if (event.getEntity() instanceof Player && isInTutorial(((Player) event.getEntity()))) + { + event.setFoodLevel(20); + } + } + + @EventHandler + public void displayDescription(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Map.Entry entry : _playerSessionMap.entrySet()) + { + String prefix = entry.getValue().incrementAndGetColorTick() % 2 == 0 ? C.cWhite : C.cGreen; + Objective objective = _objectives.get(entry.getValue().getObjectiveIndex()); + UtilTextBottom.display(prefix + objective.getDescription(entry.getKey()), entry.getKey()); + } + } + + @EventHandler + public void displayText(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + { + return; + } + + for (Map.Entry entry : _playerSessionMap.entrySet()) + { + Player player = entry.getKey(); + Objective objective = _objectives.get(entry.getValue().getObjectiveIndex()); + + if (entry.getValue().incrementAndGetTextSeconds() < 20) + { + // 20 second delay between displaying. + return; + } + + objective.displayChatMessages(player); + } + } + + public void addHologram(Player player, Location location, String... text) + { + if (_playerSessionMap.containsKey(player)) + { + Hologram hologram = new Hologram(_hologram, location, text); + _playerSessionMap.get(player).getHolograms().add(hologram); + hologram.start(); + } + } + + public void setSpawnHologram(Player player, Location location, String... text) + { + if (_playerSessionMap.containsKey(player)) + { + TutorialSession session = _playerSessionMap.get(player); + if (session.getSpawnHologram() == null && !session.isRemovedHologram()) + { + Hologram hologram = new Hologram(_hologram, location, text); + session.setSpawnHologram(hologram); + hologram.start(); + } + else + { + session.getSpawnHologram().setText(text); + } + } + } + + public void removeSpawnHologram(Player player) + { + if (_playerSessionMap.containsKey(player)) + { + TutorialSession session = _playerSessionMap.get(player); + if (session.getSpawnHologram() != null) + { + session.getSpawnHologram().stop(); + session.setSpawnHologram(null); + } + + session.setRemovedHologram(true); + } + } + + public TutorialSession getTutorialSession(Player player) + { + return _playerSessionMap.get(player); + } + + private void playFinishEffects(Location location) + { + // Firework + UtilFirework.launchFirework( + location, + FireworkEffect.Type.STAR, + Color.GREEN, + true, + true, + null, + 1 + ); + + // Particles + UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, + location, 0.5F, 0.5F, 0.5F, 1, 3, UtilParticle.ViewDist.LONG); + UtilParticle.PlayParticle(UtilParticle.ParticleType.ENCHANTMENT_TABLE, + location, 0.5F, 0.5F, 0.5F, 1, 3, UtilParticle.ViewDist.LONG); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, + location, 0.5F, 0.5F, 0.5F, 1, 3, UtilParticle.ViewDist.LONG); + UtilParticle.PlayParticle(UtilParticle.ParticleType.NOTE, + location, 0.5F, 0.5F, 0.5F, 1, 3, UtilParticle.ViewDist.LONG); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java new file mode 100644 index 000000000..29609b670 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialManager.java @@ -0,0 +1,185 @@ +package mineplex.game.clans.tutorial; + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.chat.Chat; +import mineplex.core.chat.FilterPriority; +import mineplex.core.common.events.PlayerRecieveBroadcastEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import mineplex.core.hologram.HologramManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.scoreboard.ScoreboardManager; +import mineplex.core.scoreboard.elements.ScoreboardElement; +import mineplex.core.task.TaskManager; +import mineplex.game.clans.message.ClansMessageManager; +import mineplex.game.clans.tutorial.command.TutorialCommand; +import mineplex.game.clans.tutorial.gui.TutorialShop; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; + +public class TutorialManager extends MiniPlugin implements ScoreboardElement +{ + private CoreClientManager _clientManager; + private DonationManager _donationManager; + private ClansMessageManager _clansMessageManager; + + private EnumMap _tutorialMap; + private EnumMap _shopMap; // Don't need to do anything with shops currently + + public TutorialManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Chat chat, HologramManager hologram, NpcManager npcManager, TaskManager taskManager) + { + super("Clans Tutorial", plugin); + + _clientManager = clientManager; + _donationManager = donationManager; + _clansMessageManager = new ClansMessageManager(plugin); + + _tutorialMap = new EnumMap(TutorialType.class); + _shopMap = new EnumMap(TutorialType.class); + + addTutorial(TutorialType.MAIN, new ClansMainTutorial(plugin, _clansMessageManager, hologram, npcManager, taskManager)); + + chat.AddFilter(event -> { + if (inTutorial(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You are not allowed to speak while in a tutorial.")); + + return Boolean.TRUE; + } + + Iterator recipients = event.getRecipients().iterator(); + + while (recipients.hasNext()) + { + Player recipient = recipients.next(); + + if (inTutorial(recipient)) + { + recipients.remove(); + } + } + + return Boolean.FALSE; + }, FilterPriority.HIGH); + } + + @EventHandler + public void broadcast(PlayerRecieveBroadcastEvent event) + { + if (!inTutorial(event.getPlayer())) + { + return; + } + + if (!event.getMessage().startsWith(C.cBlue + "Event>")) + { + return; + } + + event.setCancelled(true); + } + + @Override + public void addCommands() + { + addCommand(new TutorialCommand(this)); + } + + private void addTutorial(TutorialType type, Tutorial tutorial) + { + if (_tutorialMap.containsKey(type)) + { + _tutorialMap.remove(type).unregisterAll(); + } + + _tutorialMap.put(type, tutorial); + _shopMap.put(type, new TutorialShop(this, _clientManager, _donationManager, tutorial)); + getPlugin().getServer().getPluginManager().registerEvents(tutorial, getPlugin()); + } + + public boolean inTutorial(Player player) + { + return getTutorial(player) != null; + } + + public Tutorial getTutorial(Player player) + { + for (Tutorial tutorial : _tutorialMap.values()) + { + if (tutorial.isInTutorial(player)) + return tutorial; + } + + return null; + } + + public void finishTutorial(Player player) + { + Tutorial tutorial = getTutorial(player); + if (tutorial != null) + { + tutorial.finish(player); + } + } + + public boolean startTutorial(Player player, TutorialType type) + { + if (inTutorial(player)) + { + UtilPlayer.message(player, F.main("Tutorial", "You are already in a tutorial")); + return false; + } + + if (_tutorialMap.containsKey(type)) + { + UtilPlayer.message(player, F.main("Tutorial", "Starting Tutorial: " + type.name())); + _tutorialMap.get(type).start(player); + return true; + } + + return false; + } + + public void openTutorialMenu(Player player, TutorialType type) + { + if (_shopMap.containsKey(type)) + { + _shopMap.get(type).attemptShopOpen(player); + } + } + + public ClansMessageManager getMessageManager() + { + return _clansMessageManager; + } + + public Tutorial getTutorial(TutorialType type) + { + return _tutorialMap.get(type); + } + + @Override + public List getLines(ScoreboardManager manager, Player player, List out) + { + Tutorial tutorial = getTutorial(player); + + if (tutorial != null) + { + out.clear(); + return tutorial.getScoreboardLines(player); + } + + return new ArrayList(0); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialRegion.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialRegion.java new file mode 100644 index 000000000..3e42a1f17 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialRegion.java @@ -0,0 +1,75 @@ +package mineplex.game.clans.tutorial; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; + +import mineplex.core.common.block.DataLocationMap; +import mineplex.core.common.block.schematic.Schematic; + +public class TutorialRegion +{ + private final Schematic _schematic; + private final Location _origin; + private DataLocationMap _locationMap; + + protected TutorialRegion(Schematic schematic, Location origin) + { + _origin = origin; + _schematic = schematic; + + pasteSchematic(); + } + + public Location getOrigin() + { + return _origin; + } + + public DataLocationMap getLocationMap() + { + return _locationMap; + } + + private void pasteSchematic() + { + _locationMap = _schematic.paste(getOrigin(), false); + } + + /** + * Clear the schematic area. This shouldn't be needed + */ + @Deprecated + private void clearSchematic() + { + for (int x = 0; x < _schematic.getWidth(); x++) + { + for (int y = 0; y < _schematic.getHeight(); y++) + { + for (int z = 0; z < _schematic.getLength(); z++) + { + Block b = _origin.clone().add(x, y, z).getBlock(); + if (b.getType() != Material.AIR) + { + b.setTypeIdAndData(0, (byte) 0, false); + } + } + } + } + } + + protected void reset() + { + long start = System.currentTimeMillis(); + System.out.println("TutorialRegion starting reset..."); + pasteSchematic(); + System.out.println("TutorialRegion finished reset! Took " + (System.currentTimeMillis() - start) + "ms"); + + } + + @Override + public String toString() + { + return "TutorialRegion[" + _origin.toString() + "]"; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialSession.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialSession.java new file mode 100644 index 000000000..271db3e05 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialSession.java @@ -0,0 +1,118 @@ +package mineplex.game.clans.tutorial; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.Location; + +import mineplex.core.hologram.Hologram; + +public class TutorialSession +{ + private final long _startTime; + private int _objectiveIndex; + private TutorialRegion _region; + private List _hologramList = new ArrayList<>(); + private Location _homeLocation; + private int _colorTick; + private int _textSeconds; + private Location _mapTargetLocation; + private Hologram _spawnHologram; + private boolean _removedHologram; + + public TutorialSession() + { + _startTime = System.currentTimeMillis(); + } + + public List getHolograms() + { + return _hologramList; + } + + public int getObjectiveIndex() + { + return _objectiveIndex; + } + + public void setObjectiveIndex(int objectiveIndex) + { + _objectiveIndex = objectiveIndex; + } + + public TutorialRegion getRegion() + { + return _region; + } + + public void setRegion(TutorialRegion region) + { + _region = region; + } + + public Location getHomeLocation() + { + return _homeLocation; + } + + public void setHomeLocation(Location homeLocation) + { + _homeLocation = homeLocation; + } + + public int incrementAndGetColorTick() + { + return ++_colorTick; + } + + public void setTextSeconds(int seconds) + { + _textSeconds = seconds; + } + + public int incrementAndGetTextSeconds() + { + _textSeconds++; + return _textSeconds; + } + + public void setMapTargetLocation(Location location) + { + _mapTargetLocation = location; + } + + public Location getMapTargetLocation() + { + return _mapTargetLocation; + } + + public long getStartTime() + { + return _startTime; + } + + public long getElapsedTime() + { + return System.currentTimeMillis() - _startTime; + } + + public boolean isRemovedHologram() + { + return _removedHologram; + } + + public void setRemovedHologram(boolean removedHologram) + { + _removedHologram = removedHologram; + } + + public void setSpawnHologram(Hologram spawnHologram) + { + _spawnHologram = spawnHologram; + } + + public Hologram getSpawnHologram() + { + return _spawnHologram; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialType.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialType.java new file mode 100644 index 000000000..984114613 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialType.java @@ -0,0 +1,6 @@ +package mineplex.game.clans.tutorial; + +public enum TutorialType +{ + MAIN +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialWorldManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialWorldManager.java new file mode 100644 index 000000000..40ac68fc6 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialWorldManager.java @@ -0,0 +1,107 @@ +package mineplex.game.clans.tutorial; + +import java.io.File; +import java.io.IOException; +import java.util.Stack; + +import org.bukkit.Bukkit; +import org.bukkit.Difficulty; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.generator.VoidGenerator; +import mineplex.game.clans.tutorial.TutorialRegion; + +public class TutorialWorldManager extends MiniPlugin +{ + public static final int BLOCKS_BETWEEN_TUTORIALS = 1200; + + private final World _tutorialWorld; + private final Schematic _schematic; + private Stack _regionStack; + private TutorialRegion _centerRegion; + + public TutorialWorldManager(JavaPlugin plugin, String worldName, String schematicName) throws IOException + { + super("Tutorial World", plugin); + + log("Creating Tutorial World"); + WorldCreator creator = new WorldCreator(worldName); + creator.generator(new VoidGenerator()); + _tutorialWorld = Bukkit.createWorld(creator); + _tutorialWorld.setDifficulty(Difficulty.EASY); + _tutorialWorld.setGameRuleValue("doDaylightCycle", "false"); + _tutorialWorld.setTime(6000); + _tutorialWorld.setAutoSave(false); + _tutorialWorld.setAmbientSpawnLimit(0); + _tutorialWorld.setMonsterSpawnLimit(0); + _tutorialWorld.setWaterAnimalSpawnLimit(0); + log("Tutorial World Created!"); + + log("Loading schematic - " + schematicName); + _schematic = UtilSchematic.loadSchematic(new File(schematicName)); + log("Finished loading schematic"); + + log("Populating Region Stack..."); + populateRegionStack(); + log("Finished loading Tutorial World Manager!"); + } + + private void populateRegionStack() + { + _regionStack = new Stack<>(); + + // Populate the stack with 100 available tutorial regions + for (int x = 0; x < 10; x++) + { + for (int z = 0; z < 10; z++) + { + long time = System.currentTimeMillis(); + double xLoc = (x) * BLOCKS_BETWEEN_TUTORIALS; // 1000x1000 regions + double zLoc = (z) * BLOCKS_BETWEEN_TUTORIALS; + + TutorialRegion region = new TutorialRegion(_schematic, new Location(_tutorialWorld, xLoc, 30, zLoc)); + if (x == 0 && z == 0) _centerRegion = region; + _regionStack.add(region); + System.out.println("Finished Generating Region: " + ((x * 10) + z) + ". Took " + (System.currentTimeMillis() - time) + " ms"); + } + } + } + + /** + * Get the next TutorialRegion in the stack. This region is prepared and ready for use in a tutorial + * @return + */ + public TutorialRegion getNextRegion() + { + return _regionStack.pop(); + } + + /** + * Notify the TutorialWorldManager that this TutorialRegion is no longer needed and should be cleaned up. + * The TutorialRegion should not be used after calling this method + */ + public void returnRegion(TutorialRegion region) + { + region.reset(); + _regionStack.push(region); + log("Returned " + region.toString()); + } + + public World getTutorialWorld() + { + return _tutorialWorld; + } + + public TutorialRegion getCenterRegion() + { + return _centerRegion; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java new file mode 100644 index 000000000..92decfb05 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java @@ -0,0 +1,23 @@ +package mineplex.game.clans.tutorial.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.game.clans.tutorial.TutorialManager; + +public class FinishCommand extends CommandBase +{ + public FinishCommand(TutorialManager plugin) + { + super(plugin, Rank.DEVELOPER, "finish", "end"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.finishTutorial(caller); + + + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/StartCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/StartCommand.java new file mode 100644 index 000000000..2e100d21b --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/StartCommand.java @@ -0,0 +1,41 @@ +package mineplex.game.clans.tutorial.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.tutorial.TutorialManager; +import mineplex.game.clans.tutorial.TutorialType; + +public class StartCommand extends CommandBase +{ + public StartCommand(TutorialManager plugin) + { + super(plugin, Rank.DEVELOPER, "start"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (args == null || args.length != 1) + { + UtilPlayer.message(caller, F.main("Tutorial", "/tutorial start ")); + return; + } + + TutorialType type = null; + + for (TutorialType check : TutorialType.values()) + { + if (check.name().equalsIgnoreCase(args[0])) + type = check; + } + + if (type != null) + Plugin.openTutorialMenu(caller, type); + else + UtilPlayer.message(caller, F.main("Tutorial", "Invalid Tutorial " + F.elem(args[0]))); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java new file mode 100644 index 000000000..cf38bd009 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java @@ -0,0 +1,27 @@ +package mineplex.game.clans.tutorial.command; + +import org.bukkit.entity.Player; + +import mineplex.core.command.CommandBase; +import mineplex.core.command.MultiCommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.tutorial.TutorialManager; + +public class TutorialCommand extends MultiCommandBase +{ + public TutorialCommand(TutorialManager plugin) + { + super(plugin, Rank.DEVELOPER, "tutorial", "tut"); + + AddCommand(new StartCommand(plugin)); + AddCommand(new FinishCommand(plugin)); + } + + @Override + protected void Help(Player caller, String[] args) + { + UtilPlayer.message(caller, F.main("Tutorial", "/tutorial start ")); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/TutorialSelectPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/TutorialSelectPage.java new file mode 100644 index 000000000..6265bd797 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/TutorialSelectPage.java @@ -0,0 +1,43 @@ +package mineplex.game.clans.tutorial.gui; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.game.clans.tutorial.Tutorial; +import mineplex.game.clans.tutorial.TutorialManager; +import mineplex.game.clans.tutorial.gui.button.DeclineButton; +import mineplex.game.clans.tutorial.gui.button.StartButton; + +public class TutorialSelectPage extends ShopPageBase +{ + public TutorialSelectPage(TutorialManager plugin, TutorialShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) + { + super(plugin, shop, clientManager, donationManager, shop.getTutorial().getName(), player, 45); + + buildPage(); + } + + @Override + protected void buildPage() + { + Tutorial tutorial = getShop().getTutorial(); + + String name = tutorial.getName(); + Material material = tutorial.getGuiMaterial(); + byte data = tutorial.getGuiData(); + + ShopItem infoItem = new ShopItem(material, data, name, new String[0], 0, false, false); + addItem(13, infoItem); + + ShopItem startItem = new ShopItem(Material.EMERALD_BLOCK, "Start " + tutorial.getName(), new String[0], 0, false, false); + addButton(27 + 6, startItem, new StartButton(tutorial)); + + ShopItem declineButton = new ShopItem(Material.REDSTONE_BLOCK, "Cancel", new String[0], 0, false, false); + addButton(27 + 2, declineButton, new DeclineButton()); + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/TutorialShop.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/TutorialShop.java new file mode 100644 index 000000000..29a8c62f7 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/TutorialShop.java @@ -0,0 +1,33 @@ +package mineplex.game.clans.tutorial.gui; + +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.page.ShopPageBase; +import mineplex.game.clans.tutorial.Tutorial; +import mineplex.game.clans.tutorial.TutorialManager; + +public class TutorialShop extends ShopBase +{ + private final Tutorial _tutorial; + + public TutorialShop(TutorialManager plugin, CoreClientManager clientManager, DonationManager donationManager, Tutorial tutorial) + { + super(plugin, clientManager, donationManager, tutorial.getName()); + + _tutorial = tutorial; + } + + @Override + protected ShopPageBase> buildPagesFor(Player player) + { + return new TutorialSelectPage(getPlugin(), this, getClientManager(), getDonationManager(), player); + } + + public Tutorial getTutorial() + { + return _tutorial; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/button/DeclineButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/button/DeclineButton.java new file mode 100644 index 000000000..e1b283fae --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/button/DeclineButton.java @@ -0,0 +1,15 @@ +package mineplex.game.clans.tutorial.gui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; + +public class DeclineButton implements IButton +{ + @Override + public void onClick(Player player, ClickType clickType) + { + player.closeInventory(); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/button/StartButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/button/StartButton.java new file mode 100644 index 000000000..8461ea669 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/gui/button/StartButton.java @@ -0,0 +1,28 @@ +package mineplex.game.clans.tutorial.gui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.game.clans.tutorial.Tutorial; + +public class StartButton implements IButton +{ + private final Tutorial _tutorial; + + public StartButton(Tutorial tutorial) + { + _tutorial = tutorial; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + if (!_tutorial.isInTutorial(player)) + { + _tutorial.start(player); + } + + player.closeInventory(); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/map/TutorialMapManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/map/TutorialMapManager.java new file mode 100644 index 000000000..b7e9d9a98 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/map/TutorialMapManager.java @@ -0,0 +1,680 @@ +package mineplex.game.clans.tutorial.map; + +import java.io.File; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; + +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.ItemFrame; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.map.MapRenderer; +import org.bukkit.map.MapView; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.base.Objects; +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Iterables; +import com.google.common.collect.Multisets; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +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.itemstack.ItemBuilder; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.tutorial.TutorialManager; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; + +import net.minecraft.server.v1_8_R3.Block; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.MaterialMapColor; +import net.minecraft.server.v1_8_R3.PersistentCollection; + +public class TutorialMapManager extends MiniPlugin +{ + private ClansMainTutorial _tutorial; + private int _blocksScan = 16; + private Comparator> _comparator; + private int _halfMapSize = 64; + private int[][] _heightMap; + private boolean _loadWorld = true; + private HashMap _map = new HashMap(); + private short _mapId = (short) UtilMath.r(Short.MAX_VALUE); + private ArrayList> _scanList = new ArrayList>(); + private World _world; + private int _centerX; + private int _centerZ; + private int _scale = 1; + private int _minX; + private int _minZ; + + public TutorialMapManager(JavaPlugin plugin, ClansMainTutorial tutorial, World world, int minX, int minZ, int maxX, int maxZ) + { + super("TutorialMapManager", plugin); + + _centerX = minX + ((maxX - minX) / 2); + _centerZ = minZ + ((maxZ - minZ) / 2); + _centerX = (int) (Math.round(_centerX / 16D) * 16); + _centerZ = (int) (Math.round(_centerZ / 16D) * 16); + _tutorial = tutorial; + _minX = minX; + _minZ = minZ; + + _heightMap = new int[(_halfMapSize * 2) + 16][]; + + _comparator = new Comparator>() + { + + @Override + public int compare(Entry o1, Entry o2) + { + // Render the places outside the map first to speed up visual errors fixing + int outsideMap = Boolean.compare(o1.getValue() < -_halfMapSize, o2.getValue() < -_halfMapSize); + + if (outsideMap != 0) + { + return -outsideMap; + } + + double dist1 = 0; + double dist2 = 0; + + for (Player player : UtilServer.getPlayers()) + { + dist1 += getDistance(o1, player.getLocation().getX(), player.getLocation().getZ()); + dist2 += getDistance(o2, player.getLocation().getX(), player.getLocation().getZ()); + } + + if (dist1 != dist2) + { + return Double.compare(dist1, dist2); + } + + dist1 = getDistance(o1, 0, 0); + dist2 = getDistance(o2, 0, 0); + + return Double.compare(dist1, dist2); + + } + }; + + for (int x = -_halfMapSize; x < _halfMapSize; x += _blocksScan) + { + for (int z = -_halfMapSize - 16; z < _halfMapSize; z += (z < -_halfMapSize ? 16 : _blocksScan)) + { + _scanList.add(new HashMap.SimpleEntry(x, z)); + } + } + + for (int s = 1; s <= 2; s++) + { + if (s == 2) + { + s = getScale(); + + if (s == 1) + break; + } + + int size = (_halfMapSize * 2) / s; + Byte[][] bytes = new Byte[size][]; + + for (int i = 0; i < size; i++) + { + bytes[i] = new Byte[size]; + } + + _map.put(s, bytes); + } + + for (int i = 0; i < _heightMap.length; i++) + { + _heightMap[i] = new int[_heightMap.length]; + } + + _world = world; + + try + { + File foundFile = null; + + for (File f : new File("world/data").listFiles()) + { + if (f.getName().startsWith("map_")) + { + foundFile = f; + break; + } + } + + if (foundFile == null) + { + PersistentCollection collection = ((CraftWorld) _world).getHandle().worldMaps; + Field f = collection.getClass().getDeclaredField("d"); + f.setAccessible(true); + ((HashMap) f.get(collection)).put("map", (short) 0); + } + + MapView view = Bukkit.createMap(_world); + _mapId = view.getId(); + setupRenderer(view); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + rebuildScan(); + } + + private void setupRenderer(MapView view) + { + for (MapRenderer renderer : view.getRenderers()) + { + view.removeRenderer(renderer); + } + + view.addRenderer(new TutorialMapRenderer(_tutorial, _minX, _minZ)); + } + + public int getScale() + { + return _scale; + } + + public int getX() + { + return _centerX; + } + + public int getZ() + { + return _centerZ; + } + + @EventHandler + public void preventMapInItemFrame(PlayerInteractEntityEvent event) + { + if (!(event.getRightClicked() instanceof ItemFrame)) + return; + + ItemStack item = event.getPlayer().getItemInHand(); + + if (item == null || item.getType() != Material.MAP || item.getDurability() < _mapId || item.getDurability() != _mapId) + return; + + event.setCancelled(true); + } + + /** + * Get the center of the map. + */ + public int calcMapCenter(int zoom, int cord) + { + int mapSize = _halfMapSize / zoom; // This is how large the map is in pixels + + int mapCord = cord / zoom; // This is pixels from true center of map, not held map + + int fDiff = mapSize - -mapCord; + int sDiff = mapSize - mapCord; + + double chunkBlock = cord & 0xF; + cord -= chunkBlock; + chunkBlock /= zoom; + + /*if ((fDiff < 64 || sDiff < 64) && (Math.abs(fDiff - sDiff) > 1)) + { + cord += (fDiff > sDiff ? Math.floor(chunkBlock) : Math.ceil(chunkBlock)); + } + else*/ + { + cord += (int) Math.floor(chunkBlock) * zoom; + } + + while ((fDiff < 64 || sDiff < 64) && (Math.abs(fDiff - sDiff) > 1)) + { + int change = (fDiff > sDiff ? -zoom : zoom); + cord += change; + + mapCord = cord / zoom; + + fDiff = mapSize - -mapCord; + sDiff = mapSize - mapCord; + } + + return cord; + } + + private void colorWorldHeight(int zoom, int startingX, int startingZ) + { + if (zoom == 0) + zoom = 1; + + Byte[][] map = _map.get(zoom); + + for (int x = startingX; x < startingX + _blocksScan; x += zoom) + { + double d0 = 0; + + // Prevents ugly lines for the first line of Z + + for (int addX = 0; addX < zoom; addX++) + { + for (int addZ = 0; addZ < zoom; addZ++) + { + int hX = x + addX + _halfMapSize; + int hZ = (startingZ - zoom) + addZ + _halfMapSize; + + if (hX >= _halfMapSize * 2 || hZ >= _halfMapSize * 2) + { + continue; + } + + d0 += _heightMap[hX + 16][hZ + 16] / (zoom * zoom); + } + } + + for (int z = startingZ; z < startingZ + _blocksScan; z += zoom) + { + // Water depth colors not included + double d1 = 0; + + for (int addX = 0; addX < zoom; addX++) + { + for (int addZ = 0; addZ < zoom; addZ++) + { + int hX = x + addX + _halfMapSize; + int hZ = z + addZ + _halfMapSize; + + if (hX >= _halfMapSize * 2 || hZ >= _halfMapSize * 2) + { + continue; + } + + d1 += _heightMap[hX + 16][hZ + 16] / (zoom * zoom); + } + } + + double d2 = (d1 - d0) * 4.0D / (zoom + 4) + ((x + z & 0x1) - 0.5D) * 0.4D; + byte b0 = 1; + + d0 = d1; + + if (d2 > 0.6D) + { + b0 = 2; + } + else if (d2 > 1.2D) + { + b0 = 3; + } + else if (d2 < -0.6D) + { + b0 = 0; + } + + int origColor = map[(x + _halfMapSize) / zoom][(z + _halfMapSize) / zoom] - 1; + + /*if (color < 4) + { + d2 = waterDepth * 0.1D + (k1 + j2 & 0x1) * 0.2D; + b0 = 1; + if (d2 < 0.5D) + { + b0 = 2; + } + + if (d2 > 0.9D) + { + b0 = 0; + } + }*/ + + byte color = (byte) (origColor + b0); + map[(x + _halfMapSize) / zoom][(z + _halfMapSize) / zoom] = color; + } + } + } + + private void drawWorldScale(int zoom, int startingX, int startingZ) + { + Byte[][] first = _map.get(1); + Byte[][] second = _map.get(zoom); + + for (int x = startingX; x < startingX + _blocksScan; x += zoom) + { + for (int z = startingZ; z < startingZ + _blocksScan; z += zoom) + { + HashMultiset hashmultiset = HashMultiset.create(); + + for (int addX = 0; addX < zoom; addX++) + { + for (int addZ = 0; addZ < zoom; addZ++) + { + int pX = x + addX + _halfMapSize; + int pZ = z + addZ + _halfMapSize; + + if (pX >= first.length || pZ >= first.length) + { + continue; + } + + Byte b = first[pX][pZ]; + + if (b == null) + continue; + + hashmultiset.add(b); + } + } + + Byte color = Iterables.getFirst(Multisets.copyHighestCountFirst(hashmultiset), (byte) 0); + + second[(x + _halfMapSize) / zoom][(z + _halfMapSize) / zoom] = color; + } + } + } + + @EventHandler + public void dropItem(ItemSpawnEvent event) + { + ItemStack item = event.getEntity().getItemStack(); + + if (item != null && item.getType() == Material.MAP && item.getDurability() == _mapId) + { + event.getEntity().remove(); + } + } + + private double getDistance(double x1, double z1, double x2, double z2) + { + x1 = (x1 - x2); + z1 = (z1 - z2); + + return (x1 * x1) + (z1 * z1); + } + + private double getDistance(Entry entry, double x1, double z1) + { + return getDistance(x1 + _centerX, z1 + _centerZ, entry.getKey() + (_blocksScan / 2), + entry.getValue() + (_blocksScan / 2)); + } + + public Byte[][] getMap(int scale) + { + return _map.get(scale); + } + + public int getMapSize() + { + return _halfMapSize; + } + + @EventHandler + public void preventMapMoveInventories(InventoryClickEvent event) + { + Inventory inv = event.getClickedInventory(); + + if (inv == null) + return; + + // Yeah, the loop looks a little weird.. + for (ItemStack item : new ItemStack[] + { + event.getCurrentItem(), + event.getCursor() + }) + { + if (item == null || item.getType() != Material.MAP || item.getDurability() != _mapId) + continue; + + if (inv.getHolder() instanceof Player ? !event.isShiftClick() : Objects.equal(event.getCurrentItem(), item)) + continue; + + event.setCancelled(true); + + UtilPlayer.message(event.getWhoClicked(), + F.main("Inventory", "You cannot move " + F.item("Clans Map") + " between inventories.")); + return; + } + } + + private void rebuildScan() + { + for (int x = -_halfMapSize; x < _halfMapSize; x += _blocksScan) + { + for (int z = -_halfMapSize - 16; z < _halfMapSize; z += (z < -_halfMapSize ? 16 : _blocksScan)) + { + _scanList.add(new HashMap.SimpleEntry(x, z)); + } + } + + if (!_loadWorld) + { + Iterator> itel = _scanList.iterator(); + + while (itel.hasNext()) + { + Entry entry = itel.next(); + boolean removeEntry = true; + + for (Player player : UtilServer.getPlayers()) + { + if (Math.sqrt(getDistance(entry, player.getLocation().getX(), player.getLocation().getZ())) < 200) + { + removeEntry = false; + break; + } + } + + if (removeEntry) + { + itel.remove(); + } + } + } + + Collections.sort(_scanList, _comparator); + } + + @EventHandler + public void renderMap(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + if (_scanList.isEmpty()) + { + if (_loadWorld) + { + _loadWorld = false; + } + + if (UtilServer.getPlayers().length == 0) + return; + + rebuildScan(); + } + else if (_scanList.size() % 20 == 0) + { + Collections.sort(_scanList, _comparator); + } + + if (_scanList.isEmpty()) + return; + + Entry entry = _scanList.remove(0); + + int startingX = entry.getKey(); + int startingZ = entry.getValue(); + + boolean outsideMap = startingZ < -_halfMapSize; + + scanWorldMap(startingX, startingZ, !outsideMap); + + if (outsideMap) + { + return; + } + + for (int s = 1; s <= 2; s++) + { + if (s == 2) + { + s = getScale(); + + if (s == 1) + break; + } + + if (s == 13 && _loadWorld) + continue; + + if (!outsideMap) + { + drawWorldScale(s, startingX, startingZ); + } + + colorWorldHeight(s, startingX, startingZ); + } + + colorWorldHeight(0, startingX, startingZ); + } + + public void scanWorldMap(int startingX, int startingZ, boolean setColors) + { + Byte[][] map = _map.get(1); + + for (int beginX = startingX; beginX < startingX + _blocksScan; beginX += 16) + { + for (int beginZ = startingZ - (startingZ > -_halfMapSize ? 16 : 0); beginZ < startingZ + + (setColors ? _blocksScan : 16); beginZ += 16) + { + Chunk chunk = _world.getChunkAt((beginX + _centerX) / 16, (beginZ + _centerZ) / 16); + boolean loaded = false; + + if (!chunk.isLoaded()) + { + if (_loadWorld) + { + loaded = chunk.load(); + } + else + { + continue; + } + } + + net.minecraft.server.v1_8_R3.Chunk nmsChunk = ((CraftChunk) chunk).getHandle(); + + for (int x = beginX; x < beginX + 16; x++) + { + for (int z = beginZ; z < beginZ + 16; z++) + { + int color = 0; + + if (!nmsChunk.isEmpty()) + { + int k3 = x & 0xF; + int l3 = z & 0xF; + + int l4 = nmsChunk.b(k3, l3) + 1; + IBlockData iblockdata = Blocks.AIR.getBlockData(); + + if (l4 > 1) + { + do + { + l4--; + iblockdata = nmsChunk.getBlockData(new BlockPosition(k3, l4, l3)); + } + while (iblockdata.getBlock().g(iblockdata) == MaterialMapColor.b && (l4 > 0)); + + if ((l4 > 0) && (iblockdata.getBlock().getMaterial().isLiquid())) + { + int j5 = l4 - 1; + Block block1; + do + { + block1 = nmsChunk.getType(new BlockPosition(k3, j5--, l3)); + } + while ((j5 > 0) && (block1.getMaterial().isLiquid())); + } + } + + _heightMap[x + _halfMapSize + 16][z + _halfMapSize + 16] = l4; + + if (setColors) + { + // color = block.f(i5).M; + IBlockData data = nmsChunk.getBlockData(new BlockPosition(k3, l4, l3)); + color = data.getBlock().g(data).M; + + color = (byte) ((color * 4) + 1); + } + } + + if (setColors && beginZ >= startingZ) + { + map[x + _halfMapSize][z + _halfMapSize] = (byte) color; + } + } + + if (loaded) + { + chunk.unload(); + } + } + } + } + } + + public void setMap(Player player) + { + for (ItemStack item : UtilInv.getItems(player)) + { + if (item.getType() == Material.MAP && item.getDurability() == _mapId) + { + return; + } + } + + ItemStack item = new ItemBuilder(Material.MAP, 1, _mapId).setTitle("Clans Map").build(); + + int slot = player.getInventory().firstEmpty(); + + if (slot >= 0) + { + ItemStack mapSlot = player.getInventory().getItem(8); + + if (mapSlot == null || mapSlot.getType() == Material.AIR) + { + slot = 8; + } + + player.getInventory().setItem(slot, item); + } + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/map/TutorialMapRenderer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/map/TutorialMapRenderer.java new file mode 100644 index 000000000..1132dd4ac --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/map/TutorialMapRenderer.java @@ -0,0 +1,243 @@ +package mineplex.game.clans.tutorial.map; + +import java.awt.*; +import java.util.List; + +import mineplex.core.recharge.Recharge; +import mineplex.game.clans.tutorial.TutorialManager; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.TutorialType; +import mineplex.game.clans.tutorial.TutorialWorldManager; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.map.MapCanvas; +import org.bukkit.map.MapCursor; +import org.bukkit.map.MapCursorCollection; +import org.bukkit.map.MapPalette; +import org.bukkit.map.MapRenderer; +import org.bukkit.map.MapView; + +public class TutorialMapRenderer extends MapRenderer +{ + private ClansMainTutorial _tutorial; + private int _minX; + private int _minZ; + + public TutorialMapRenderer(ClansMainTutorial tutorialManager, int minX, int minZ) + { + super(true); + + _tutorial = tutorialManager; + _minX = minX; + _minZ = minZ; + } + + @Override + public void render(MapView mapView, MapCanvas canvas, Player player) + { + TutorialMapManager tutorialMap = _tutorial.getMapManager(); + int zoom = tutorialMap.getScale(); + + Byte[][] map = tutorialMap.getMap(zoom); + + int centerX = 0; + int centerZ = 0; + + // We have this cooldown to squeeze out every single bit of performance from the server. + if (Recharge.Instance.use(player, "Draw Map", 4000, false, false)) + { + TutorialRegion region = _tutorial.getWorldManager().getCenterRegion(); + MinMaxArea shops = getArea(region, ClansMainTutorial.Bounds.SHOPS); + MinMaxArea fields = getArea(region, ClansMainTutorial.Bounds.FIELDS); + MinMaxArea spawn = getArea(region, ClansMainTutorial.Bounds.SPAWN); + MinMaxArea claim = getArea(region, ClansMainTutorial.Bounds.LAND_CLAIM); + MinMaxArea enemy = getArea(region, ClansMainTutorial.Bounds.ENEMY_LAND); + + for (int mapX = 0; mapX < 128; mapX++) + { + for (int mapZ = 0; mapZ < 128; mapZ++) + { + int blockX = centerX + (mapX - 64); + int blockZ = centerZ + (mapZ - 64); + + int pixelX = blockX + (map.length / 2); + int pixelZ = blockZ + (map.length / 2); + + int xRegion = mapX + _minX - 6; + int zRegion = mapZ + _minZ; + + Byte color = 0; + + + if (!(pixelX < 0 || pixelZ < 0 || pixelX >= map.length || pixelZ >= map.length) + && map[pixelX][pixelZ] != null) + { + color = map[pixelX][pixelZ]; + + if (!((color <= -113 || color >= 0) && color <= 127)) + color = (byte) 0; + + blockX *= zoom; + blockZ *= zoom; + + color = attemptDraw(false, color, Color.WHITE, new Color(50, 150, 255), xRegion, zRegion, shops, mapX, mapZ); + color = attemptDraw(false, color, Color.WHITE, new Color(255, 120, 0), xRegion, zRegion, fields, mapX, mapZ); + color = attemptDraw(false, color, Color.WHITE, new Color(0, 255, 100), xRegion, zRegion, spawn, mapX, mapZ); + color = attemptDraw(true, color, Color.CYAN, null, xRegion, zRegion, claim, mapX, mapZ); + color = attemptDraw(true, color, Color.RED, null, xRegion, zRegion, enemy, mapX, mapZ); + } + + /* TODO Figure out if you want to colorize this pixel + { + color = MapPalette.matchColor(r, g, b); + }*/ + + canvas.setPixel(mapX, mapZ, color); + } + } + + player.sendMap(mapView); + } + + MapCursorCollection cursors = canvas.getCursors(); + + while (cursors.size() > 0) + + { + cursors.removeCursor(cursors.getCursor(0)); + } + + Location l = player.getLocation().clone(); + l.setX((((int)l.getX()) % TutorialWorldManager.BLOCKS_BETWEEN_TUTORIALS) + (l.getX() - ((int) l.getX()))); + l.setZ((((int)l.getZ()) % TutorialWorldManager.BLOCKS_BETWEEN_TUTORIALS) + (l.getZ() - ((int) l.getZ()))); + + double mapX = (l.getX() - tutorialMap.getX()) / zoom; + double mapZ = (l.getZ() - tutorialMap.getZ()) / zoom; + + if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64) + { + byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D); + byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D); + + byte rotation = (byte) (int) ((l.getYaw() * 16D) / 360D); + + MapCursor cursor = new MapCursor(b0, b1, (byte) (rotation & 0xF), MapCursor.Type.WHITE_POINTER.getValue(), true); + + cursors.addCursor(cursor); + } + + // Add Tutorial Markers + TutorialSession session = _tutorial.getTutorialSession(player); + if (session != null) + { + if (session.getMapTargetLocation() != null) + { + Location point = session.getMapTargetLocation().clone(); + point.setX((((int)point.getX()) % TutorialWorldManager.BLOCKS_BETWEEN_TUTORIALS) + (point.getX() - ((int) point.getX()))); + point.setZ((((int)point.getZ()) % TutorialWorldManager.BLOCKS_BETWEEN_TUTORIALS) + (point.getZ() - ((int) point.getZ()))); + mapX = (point.getX() - tutorialMap.getX()) / zoom; + mapZ = (point.getZ() - tutorialMap.getZ()) / zoom; + + // To make these appear at the edges of the map, just change it from 64 to something like 128 for double the map size + if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64) + { + byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D); + byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D); + + byte cursorType = 4; // http://i.imgur.com/wpH6PT8.png + // Those are byte 5 and 6 + byte rotation = (byte) ((int) Math.floor(System.currentTimeMillis() / 1000D) % 16); + + MapCursor cursor = new MapCursor(b0, b1, rotation, cursorType, true); + + cursors.addCursor(cursor); + } + } + } + } + + private byte attemptDraw(boolean colorAll, byte color, Color color1, Color color2, int xRegion, int zRegion, MinMaxArea area, int mapX, int mapZ) + { + if (xRegion >= area.MinX && xRegion <= area.MaxX && zRegion >= area.MinZ && zRegion <= area.MaxZ) + { + if (xRegion == area.MinX || xRegion == area.MaxX || zRegion == area.MinZ || zRegion == area.MaxZ) + { + // Outer Ring + Color cColor = MapPalette.getColor(color); + double clans = colorAll ? 1 : 0.8;// 0.65; + + //Use clanColor2 no matter what for admins + Color drawColor = color1; + if (color2 != null) + { + drawColor = color2; + clans = 1; + } + + double base = 1 - clans; + + int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); + int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans)); + int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans)); + + color = MapPalette.matchColor(r, g, b); + } + else + { + // Inside + Color cColor = MapPalette.getColor(color); + + double clans = 0.065; + + //Stripes + boolean checker = (mapX + (mapZ % 4)) % 4 == 0; + Color drawColor = color1; +// if (colorAll) +// { +// clans = 0.8; +// } + if (checker && color2 != null && !colorAll) + { + drawColor = color2; + clans = 1; + } + + double base = 1 - clans; + + if (clans != 1 && (color == 0 || color == 1 || color == 2 || color == 3)) + return color; + + int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); + int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans)); + int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans)); + + color = MapPalette.matchColor(r, g, b); + } + } + + return color; + } + + private MinMaxArea getArea(TutorialRegion region, ClansMainTutorial.Bounds bounds) + { + MinMaxArea area = new MinMaxArea(); + List shopLocations = region.getLocationMap().getGoldLocations(bounds.getDataLocColor()); + area.MinX = Math.min(shopLocations.get(0).getBlockX(), shopLocations.get(1).getBlockX()); + area.MaxX = Math.max(shopLocations.get(0).getBlockX(), shopLocations.get(1).getBlockX()); + area.MinZ = Math.min(shopLocations.get(0).getBlockZ(), shopLocations.get(1).getBlockZ()); + area.MaxZ = Math.max(shopLocations.get(0).getBlockZ(), shopLocations.get(1).getBlockZ()); + + return area; + } + + private class MinMaxArea + { + public int MinX; + public int MaxX; + public int MinZ; + public int MaxZ; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/Objective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/Objective.java new file mode 100644 index 000000000..34cc9151a --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/Objective.java @@ -0,0 +1,332 @@ +package mineplex.game.clans.tutorial.objective; + +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.game.clans.tutorial.Tutorial; +import mineplex.game.clans.tutorial.TutorialRegion; + +/** + * An Objective represents a set of goals that need to be completed to move on to the next Objective in the quest + */ +public abstract class Objective implements Listener +{ + private Plugin _plugin; + private JavaPlugin _javaPlugin; + private String _name; + private String _description; + private String _extraDescription; + private boolean _displayStartMessage; + private int _startMessageDelay; + private boolean _displayFinishMessage; + private int _finishMessageDelay; + + private NautHashMap _active; + private List _listeners; + + public Objective(Plugin plugin, JavaPlugin javaPlugin, String name, String description, String extraDescription) + { + _plugin = plugin; + _javaPlugin = javaPlugin; + _name = name; + _description = description; + _extraDescription = extraDescription; + _displayStartMessage = false; + _displayFinishMessage = false; + _startMessageDelay = 60; + _finishMessageDelay = 1; + + _active = new NautHashMap<>(); + _listeners = new LinkedList<>(); + + javaPlugin.getServer().getPluginManager().registerEvents(this, javaPlugin); + } + + public Objective(Plugin plugin, JavaPlugin javaPlugin, String name, String description) + { + this(plugin, javaPlugin, name, description, null); + } + + public Plugin getPlugin() + { + return _plugin; + } + + public JavaPlugin getJavaPlugin() + { + return _javaPlugin; + } + + /** + * Get the name of this Objective + */ + public String getName(Player player) + { + return _name; + } + + /** + * Get the description of this Objective + */ + public String getDescription(Player player) + { + return _description; + } + + /** + * Get the extra description for this Objective + * Extra description should be any additional useful information that isn't required to complete the objective + */ + public String getExtraDescription(Player player) + { + return _extraDescription; + } + + /** + * Add an ObjectiveListener to this Objective + * @param listener + */ + public void addListener(ObjectiveListener listener) + { + _listeners.add(listener); + } + + /** + * Remove all ObjectiveListeners from this Objective + */ + public void clearListeners() + { + _listeners.clear(); + } + + protected abstract void customStart(Player player); + + /** + * Start this Objective for a player + * @param player + */ + public void start(Player player) + { + System.out.println(String.format("Tutorial> [%s] started objective [%s]", player.getName(), getName(player))); + + Data data = createDataObject(player); + _active.put(player.getUniqueId(), data); + + _listeners.forEach(listener -> listener.onObjectiveStart(player, this)); + + if (_displayStartMessage) + Bukkit.getServer().getScheduler().runTaskLater(getJavaPlugin(), () -> showStartMessage(player), _startMessageDelay); + + customStart(player); + } + + /** + * Leave this objective for a specific player + * This does not count as completing the object + * @param player + */ + public final void leave(Player player) + { + customLeave(player); + + _active.remove(player.getUniqueId()); + + getGoals().forEach(goal -> goal.leave(player)); + } + + protected abstract void customLeave(Player player); + + /** + * Returns a new Data object for use in the active map + * @param player + * @return + */ + protected abstract Data createDataObject(Player player); + + /** + * Called by ObjectiveGoals, used to notify this Objective that a goal has been completed + * @param goal + * @param player + */ + protected abstract void completeGoal(ObjectiveGoal goal, Player player); + + /** + * Called when a player is finished the tutorial + * @param player + * @param region + */ + public void clean(Player player, TutorialRegion region) + { + List> goals = getGoals(); + if (goals != null) + goals.forEach(goal -> goal.clean(player, region)); + + _active.remove(player.getUniqueId()); + } + + /** + * Called when a player starts the tutorial + * @param player + * @param region + */ + public void setup(Player player, TutorialRegion region) + { + List> goals = getGoals(); + if (goals != null) + goals.forEach(goal -> goal.setup(player, region)); + } + + /** + * Returns a list of all the ObjectiveGoals used by this Objective + * Can return null + */ + protected abstract List> getGoals(); + + protected final void finish(Player player) + { + System.out.println(String.format("Tutorial> [%s] finished objective [%s]", player.getName(), getName(player))); + + _active.remove(player.getUniqueId()); + + if (_displayFinishMessage) + Bukkit.getServer().getScheduler().runTaskLater(getJavaPlugin(), () -> showFinishMessage(player), _finishMessageDelay); + + player.playSound(player.getEyeLocation(), Sound.LEVEL_UP, 1f, 1f); + + customFinish(player); + + _listeners.forEach(listener -> listener.onObjectiveFinish(player, this)); + } + + protected final void notifyUpdate(Player player) + { + _listeners.forEach(listener -> listener.onObjectivePlayerUpdate(player, this)); + } + + protected abstract void customFinish(Player player); + + public boolean contains(Player player) + { + return contains(player.getUniqueId()); + } + + public boolean contains(UUID uuid) + { + return _active.containsKey(uuid); + } + + protected final List getActive() + { + return new LinkedList(_active.keySet()); + } + + protected final Player[] getActivePlayers() + { + Set uuidSet = _active.keySet(); + Player[] players = new Player[uuidSet.size()]; + + int index = 0; + for (UUID uuid : uuidSet) + { + players[index] = UtilPlayer.searchExact(uuid); + index++; + } + return players; + } + + public Data getData(Player player) + { + return _active.get(player.getUniqueId()); + } + + /** + * Unregister all listeners associated with this Objective + */ + public final void unregisterAll() + { + HandlerList.unregisterAll(this); + + List> goals = getGoals(); + if (goals != null) goals.forEach(HandlerList::unregisterAll); + } + + public abstract void addScoreboardLines(Player player, List lines); + + private void showStartMessage(Player player) + { + UtilTextMiddle.display(C.cAqua + "Next Tutorial Section", getName(player), 20, 60, 20, player); + } + + private void showFinishMessage(Player player) + { + UtilTextMiddle.display(C.cGreen + "Tutorial Section Completed", getName(player), 20, 60, 20, player); + } + + public void displayChatMessages(Player player) + { + for (int i = 0; i < 1; i++) + { + UtilPlayer.message(player, ""); + } + + ObjectiveGoal goal = getLatestGoal(player); + String name = goal == null ? getName(player) : goal.getName(player); + String extra = getExtraDescription(player); +// UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------"); + UtilPlayer.message(player, C.cPurpleB + name); + if (extra != null) + { + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cGray + " " + extra); + } + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cGreen + getDescription(player)); +// UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------"); + getPlugin().getTutorialSession(player).setTextSeconds(0); + } + + public void setDisplayStartMessage(boolean displayStartMessage) + { + _displayStartMessage = displayStartMessage; + } + + public abstract ObjectiveGoal getLatestGoal(Player player); + + public void setDisplayFinishMessage(boolean displayFinishMessage) + { + _displayFinishMessage = displayFinishMessage; + } + + public int getStartMessageDelay() + { + return _startMessageDelay; + } + + public void setStartMessageDelay(int startMessageDelay) + { + _startMessageDelay = startMessageDelay; + } + + public int getFinishMessageDelay() + { + return _finishMessageDelay; + } + + public void setFinishMessageDelay(int finishMessageDelay) + { + _finishMessageDelay = finishMessageDelay; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveData.java new file mode 100644 index 000000000..9d6f8ca00 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveData.java @@ -0,0 +1,5 @@ +package mineplex.game.clans.tutorial.objective; + +public class ObjectiveData +{ +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveGoal.java new file mode 100644 index 000000000..7a66d0a41 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveGoal.java @@ -0,0 +1,232 @@ +package mineplex.game.clans.tutorial.objective; + +import java.util.*; + +import mineplex.core.common.util.UtilFirework; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.*; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.tutorial.TutorialRegion; + +public abstract class ObjectiveGoal > implements Listener +{ + private T _objective; + + private HashSet _active; + private HashSet _removeList; + private String _name; + private String _description; + private String _extraDescription; + private boolean _displayStartMessage; + private int _startMessageDelay; + private boolean _displayFinishMessage; + private int _finishMessageDelay; + private DyeColor _fireworkLocations; + + public ObjectiveGoal(T objective, String name, String description) + { + this(objective, name, description, null, null); + } + + public ObjectiveGoal(T objective, String name, String description, String extraDescription, DyeColor fireworkLocs) + { + _objective = objective; + + _active = new HashSet<>(); + _removeList = new HashSet<>(); + _name = name; + _description = description; + _extraDescription = extraDescription; + _displayStartMessage = true; + _startMessageDelay = 1;//40; + _displayFinishMessage = false; + _finishMessageDelay = 1; + _fireworkLocations = fireworkLocs; + } + + public String getName(Player player) + { + return _name; + } + + public String getDescription(Player player) + { + return _description; + } + + public String getExtraDescription(Player player) + { + return _extraDescription; + } + + public Set getActivePlayers() + { + return _active; + } + + public boolean contains(Player player) + { + if (player == null || !player.isOnline()) + { + return false; + } + + return _active.contains(player.getUniqueId()); + } + + public final void start(Player player) + { + System.out.println(String.format("Tutorial> [%s] started objective goal [%s]", player.getName(), getName(player))); + + _active.add(player.getUniqueId()); + + if (_displayStartMessage) + { + Bukkit.getServer().getScheduler().runTaskLater(_objective.getJavaPlugin(), () -> displayStartMessage(player), _startMessageDelay); + } + + customStart(player); + } + + protected abstract void customStart(Player player); + + protected abstract void customFinish(Player player); + + protected void customLeave(Player player) { } + + protected void leave(Player player) + { + if (_active.contains(player.getUniqueId())) + { + System.out.println(String.format("Tutorial> [%s] left objective goal [%s]", player.getName(), getName(player))); + + _removeList.add(player.getUniqueId()); + } + + customLeave(player); + } + + protected void finish(Player player) + { + if (_active.contains(player.getUniqueId())) + { + System.out.println(String.format("Tutorial> [%s] finished objective goal [%s]", player.getName(), getName(player))); + + if (getObjective().getPlugin().getTutorialSession(player) != null) + getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0); + + _removeList.add(player.getUniqueId()); + + if (_displayFinishMessage) + { + Bukkit.getServer().getScheduler().runTaskLater(_objective.getJavaPlugin(), () -> displayFinishMessage(player), _finishMessageDelay); + } + + player.playSound(player.getEyeLocation(), Sound.ORB_PICKUP, 1f, 1f); + + customFinish(player); + + _objective.completeGoal(this, player); + } + } + + /** + * Called when a player starts the tutorial with this goal + */ + protected void setup(Player player, TutorialRegion region) + { + + } + + /** + * Called when a player finishes the tutorial with this goal + */ + protected void clean(Player player, TutorialRegion region) + { + _removeList.add(player.getUniqueId()); + } + + public T getObjective() + { + return _objective; + } + + protected void displayFinishMessage(Player player) + { + UtilTextMiddle.display(C.cGreen + "Completed Objective", getName(player), player); + } + + protected void displayStartMessage(Player player) + { + if (player == null || !player.isOnline()) + { + return; + } + + UtilTextMiddle.display(C.cYellow + "New Objective", getName(player), player); + + _objective.displayChatMessages(player); + } + + public void setDisplayStartMessage(boolean displayStartMessage) + { + _displayStartMessage = displayStartMessage; + } + + public void setDisplayFinishMessage(boolean displayFinishMessage) + { + _displayFinishMessage = displayFinishMessage; + } + + public void setStartMessageDelay(int startMessageDelay) + { + _startMessageDelay = startMessageDelay; + } + + public void setFinishMessageDelay(int finishMessageDelay) + { + _finishMessageDelay = finishMessageDelay; + } + + @EventHandler + public void update(UpdateEvent event) + { + if (!event.getType().equals(UpdateType.SEC_05)) return; + if (_fireworkLocations == null) return; + + for (UUID id : getActivePlayers()) + { + if (Bukkit.getPlayer(id) == null) continue; + List locations = getObjective().getPlugin().getRegion(Bukkit.getPlayer(id)).getLocationMap().getSpongeLocations(_fireworkLocations); + if (locations == null) continue; + for (Location loc : locations) + { + UtilFirework.playFirework(loc, FireworkEffect.Type.BURST, Color.AQUA, true, true); + } + } + } + + @EventHandler + public void activeCleaner(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (UUID uuid : _removeList) + { + _active.remove(uuid); + } + + _removeList.clear(); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveListener.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveListener.java new file mode 100644 index 000000000..59564fd3c --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveListener.java @@ -0,0 +1,23 @@ +package mineplex.game.clans.tutorial.objective; + +import org.bukkit.entity.Player; + +public interface ObjectiveListener +{ + /** + * Called when a player starts an objective + */ + public void onObjectiveStart(Player player, Objective objective); + + /** + * Called when a player progresses in an objective + * For example, in an OrderedObjective this will be called when the player + * moves to the next ObjectiveGoal + */ + public void onObjectivePlayerUpdate(Player player, Objective objective); + + /** + * Called when a player finishes an objective + */ + public void onObjectiveFinish(Player player, Objective objective); +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/OrderedObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/OrderedObjective.java new file mode 100644 index 000000000..450d3b167 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/OrderedObjective.java @@ -0,0 +1,133 @@ +package mineplex.game.clans.tutorial.objective; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.game.clans.tutorial.Tutorial; +import net.md_5.bungee.api.ChatColor; + +public abstract class OrderedObjective extends Objective +{ + private List> _goals; + + public OrderedObjective(Plugin plugin, JavaPlugin javaPlugin, String name, String description, String extraDescription) + { + super(plugin, javaPlugin, name, description, extraDescription); + + _goals = new ArrayList<>(); + } + + public OrderedObjective(Plugin plugin, JavaPlugin javaPlugin, String name, String description) + { + this(plugin, javaPlugin, name, description, null); + } + + protected void addGoal(ObjectiveGoal goal) + { + _goals.add(goal); + + getJavaPlugin().getServer().getPluginManager().registerEvents(goal, getJavaPlugin()); + } + + @Override + protected OrderedObjectiveData createDataObject(Player player) + { + return new OrderedObjectiveData(); + } + + @Override + protected void completeGoal(ObjectiveGoal goal, Player player) + { + int index = _goals.indexOf(goal); + + OrderedObjectiveData data = getData(player); + assert index == data.getIndex(); + + if (data == null || data.getIndex() + 1 >= _goals.size()) + { + finish(player); + } + else + { + setGoal(player, data.getIndex() + 1); + notifyUpdate(player); + } + } + + @Override + public String getDescription(Player player) + { + OrderedObjectiveData data = getData(player); + int index = data == null ? 0 : data.getIndex(); + return _goals.get(index).getDescription(player); + } + + @Override + public String getExtraDescription(Player player) + { + OrderedObjectiveData data = getData(player); + int index = data == null ? 0 : data.getIndex(); + return _goals.get(index).getExtraDescription(player); + } + + @Override + public ObjectiveGoal getLatestGoal(Player player) + { + OrderedObjectiveData data = getData(player); + int index = data == null ? 0 : data.getIndex(); + return _goals.get(index); + } + + @Override + protected void customStart(Player player) + { + setGoal(player, 0); + } + + @Override + protected void customLeave(Player player) + { + + } + + private void setGoal(Player player, int index) + { + OrderedObjectiveData data = getData(player); // Should never be null! + ObjectiveGoal nextGoal = _goals.get(index); + data.setIndex(index); + nextGoal.start(player); + } + + @Override + protected List> getGoals() + { + return _goals; + } + + @Override + public void addScoreboardLines(Player player, List lines) + { + if (contains(player)) + { + OrderedObjectiveData data = getData(player); +// lines.add(" " + getName()); + + for (int i = 0; i < _goals.size(); i++) + { + String prefix; + + if (i > data.getIndex()) + prefix = ChatColor.RED.toString(); + else if (i == data.getIndex()) + prefix = ">" + ChatColor.YELLOW.toString(); + else + prefix = ChatColor.GREEN.toString(); + + lines.add(" " + prefix + _goals.get(i).getName(player)); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/OrderedObjectiveData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/OrderedObjectiveData.java new file mode 100644 index 000000000..55fdd79dc --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/OrderedObjectiveData.java @@ -0,0 +1,21 @@ +package mineplex.game.clans.tutorial.objective; + +public class OrderedObjectiveData extends ObjectiveData +{ + private int _index; + + public OrderedObjectiveData() + { + _index = 0; + } + + public int getIndex() + { + return _index; + } + + public void setIndex(int index) + { + _index = index; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/SingleObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/SingleObjective.java new file mode 100644 index 000000000..78e47d648 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/SingleObjective.java @@ -0,0 +1,61 @@ +package mineplex.game.clans.tutorial.objective; + +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.C; +import mineplex.game.clans.tutorial.Tutorial; + +public abstract class SingleObjective extends Objective +{ + private final ObjectiveData _nullData; + + public SingleObjective(Plugin plugin, JavaPlugin javaPlugin, String name, String description, String extraDescription) + { + super(plugin, javaPlugin, name, description, extraDescription); + + _nullData = new ObjectiveData(); + } + + public SingleObjective(Plugin plugin, JavaPlugin javaPlugin, String name, String description) + { + this(plugin, javaPlugin, name, description, null); + } + + @Override + protected ObjectiveData createDataObject(Player player) + { + return _nullData; + } + + @Override + protected void completeGoal(ObjectiveGoal goal, Player player) + { + // Do Nothing + } + + @Override + public ObjectiveGoal getLatestGoal(Player player) + { + return null; + } + + @Override + protected List> getGoals() + { + return null; + } + + @Override + public void addScoreboardLines(Player player, List lines) + { + /* + if (contains(player)) + { + lines.add(" " + C.cRed + getName(player)); + } + */ + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/UnorderedObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/UnorderedObjective.java new file mode 100644 index 000000000..f145c2270 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/UnorderedObjective.java @@ -0,0 +1,124 @@ +package mineplex.game.clans.tutorial.objective; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.game.clans.tutorial.Tutorial; +import net.md_5.bungee.api.ChatColor; + +public abstract class UnorderedObjective extends Objective +{ + private List> _goals; + + public UnorderedObjective(Plugin plugin, JavaPlugin javaPlugin, String name, String description, String extraDescription) + { + super(plugin, javaPlugin, name, description, extraDescription); + + _goals = new ArrayList<>(); + } + + public UnorderedObjective(Plugin plugin, JavaPlugin javaPlugin, String name, String description) + { + this(plugin, javaPlugin, name, description, null); + } + + protected void addGoal(ObjectiveGoal goal) + { + _goals.add(goal); + + getJavaPlugin().getServer().getPluginManager().registerEvents(goal, getJavaPlugin()); + } + + @Override + protected UnorderedObjectiveData createDataObject(Player player) + { + return new UnorderedObjectiveData(_goals.size()); + } + + @Override + protected void completeGoal(ObjectiveGoal goal, Player player) + { + int index = _goals.indexOf(goal); + + UnorderedObjectiveData data = getData(player); + data.setComplete(index); + + if (data.isComplete()) + { + finish(player); + } + else + { + notifyUpdate(player); + } + } + + @Override + public String getDescription(Player player) + { + UnorderedObjectiveData data = getData(player); + if (data == null) return super.getDescription(player); + int index = data.getFirstIncompleteIndex(); + return index == -1 ? super.getDescription(player) : _goals.get(index).getDescription(player); + } + + @Override + public String getExtraDescription(Player player) + { + UnorderedObjectiveData data = getData(player); + if (data == null) return super.getExtraDescription(player); + int index = data.getFirstIncompleteIndex(); + return index == -1 ? super.getExtraDescription(player) : _goals.get(index).getExtraDescription(player); + } + + @Override + public ObjectiveGoal getLatestGoal(Player player) + { + UnorderedObjectiveData data = getData(player); + if (data == null) return null; + int index = data.getFirstIncompleteIndex(); + return index == -1 ? null : _goals.get(index); + } + + @Override + protected void customStart(Player player) + { + _goals.forEach(goal -> goal.start(player)); + } + + @Override + protected void customLeave(Player player) + { + + } + + @Override + protected List> getGoals() + { + return _goals; + } + + @Override + public void addScoreboardLines(Player player, List lines) + { + if (contains(player)) + { + UnorderedObjectiveData data = getData(player); +// lines.add(" " + getName()); + + for (int i = 0; i < _goals.size(); i++) + { + String prefix; + if (data.isComplete(i)) + prefix = ChatColor.GREEN.toString(); + else + prefix = ChatColor.RED.toString(); + + lines.add(" " + prefix + _goals.get(i).getName(player)); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/UnorderedObjectiveData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/UnorderedObjectiveData.java new file mode 100644 index 000000000..1d3bf705c --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/UnorderedObjectiveData.java @@ -0,0 +1,48 @@ +package mineplex.game.clans.tutorial.objective; + +public class UnorderedObjectiveData extends ObjectiveData +{ + private boolean[] _tasks; + + public UnorderedObjectiveData(int taskSize) + { + _tasks = new boolean[taskSize]; + } + + public boolean isComplete() + { + boolean complete = true; + for (int i = 0; i < _tasks.length; i++) + { + complete = complete && _tasks[i]; + } + return complete; + } + + public void setComplete(int taskId) + { + _tasks[taskId] = true; + } + + public boolean isComplete(int taskId) + { + return _tasks[taskId]; + } + + public int getFirstIncompleteIndex() + { + for (int i = 0; i < _tasks.length; i++) + { + if (_tasks[i] == false) + return i; + } + + return -1; + } + + public boolean[] getTasks() + { + return _tasks; + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java new file mode 100644 index 000000000..f26a6ac72 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java @@ -0,0 +1,608 @@ +package mineplex.game.clans.tutorial.tutorials.clans; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +import com.google.common.collect.Lists; +import mineplex.core.hologram.Hologram; +import mineplex.core.common.util.*; +import mineplex.core.task.TaskManager; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent; +import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent; +import mineplex.game.clans.clans.event.PreEnergyShopBuyEvent; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.hologram.HologramManager; +import mineplex.core.npc.NpcManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; +import mineplex.game.clans.economy.GoldManager; +import mineplex.game.clans.message.ClansMessageManager; +import mineplex.game.clans.spawn.Spawn; +import mineplex.game.clans.tutorial.Tutorial; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.TutorialWorldManager; +import mineplex.game.clans.tutorial.map.TutorialMapManager; +import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective; +import mineplex.game.clans.tutorial.tutorials.clans.objective.EnergyObjective; +import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective; +import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective; +import mineplex.game.clans.tutorial.tutorials.clans.objective.PurchaseItemsObjective; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ShopsObjective; +import mineplex.game.clans.tutorial.tutorials.clans.repository.TutorialRepository; +//import mineplex.game.clans.tutorial.tutorials.clans.repository.TutorialRepository; + +public class ClansMainTutorial extends Tutorial +{ + // The distance from which the gate opens when a player approaches. + private static final int GATE_OPEN_DISTANCE = 15; + + private TutorialMapManager _mapManager; + private List _fireworks; +// private TutorialRepository _repository; + private TaskManager _taskManager; + + + private List _items = Lists.newArrayList( + Material.SMOOTH_BRICK, + Material.TORCH, + Material.IRON_DOOR, + Material.IRON_DOOR_BLOCK + ); + + + public ClansMainTutorial(JavaPlugin plugin, ClansMessageManager message, HologramManager hologram, NpcManager npcManager, TaskManager taskManager) + { + super(plugin, message, hologram, "Clans Tutorial", "main", Material.DIAMOND_SWORD, (byte) 0); + + _fireworks = new ArrayList(); + + try + { + setWorldManager(new TutorialWorldManager(plugin, "main_tutorial", "schematic/ClansTutorial.schematic")); + } + catch (IOException e) + { + e.printStackTrace(); + } + + _mapManager = new TutorialMapManager(plugin, this, getWorldManager().getTutorialWorld(), -10, 0, 117, 127); + _taskManager = taskManager; + +// _repository = new TutorialRepository(ClansManager.getInstance().getClientManager()); + + addObjective(new ClanObjective(this, plugin)); + addObjective(new AttackEnemyObjective(this, plugin)); + addObjective(new ShopsObjective(this, npcManager, plugin)); + addObjective(new PurchaseItemsObjective(this, plugin)); + addObjective(new ClassesObjective(this, plugin)); + addObjective(new FieldsObjective(this, plugin)); + addObjective(new EnergyObjective(this, plugin)); + addObjective(new FinalObjective(this, plugin)); + } + + @Override + protected void onFinish(Player player) + { + _fireworks.add(player); + UtilTextMiddle.display(C.cYellow + "Congratulations", "You have completed the Tutorial!", 10, 60, 10, player); + + Bukkit.getScheduler().runTaskLater(getPlugin(), () -> { + _fireworks.remove(player); + getMessage().removePlayer(player); + + player.teleport(Spawn.getNorthSpawn()); + UtilInv.Clear(player); + + ClansManager.getInstance().getItemMapManager().setMap(player); + }, 20 * 10L); + + player.setWalkSpeed(0.2F); + + //ClansManager.getInstance().getPvpTimer().unpause(player); + + if (!_taskManager.hasCompletedTask(player, getTaskIdentifier())) + { + _taskManager.completedTask(new Callback() + { + @Override + public void run(Boolean data) + { + + GoldManager.getInstance().addGold(player, 32000); + UtilPlayer.message(player, F.main("Clans", "You have earned " + F.elem(32000 + " Gold") + " for finishing the tutorial!")); + } + }, player, getTaskIdentifier()); + } + + /* + ClansManager.getInstance().runAsync(() -> { + _repository.SetTimesPlayed(player.getUniqueId(), _repository.GetTimesPlayed(player.getUniqueId()) + 1); + + final int times = _repository.GetTimesPlayed(player.getUniqueId()); + + if (_repository.GetTimesPlayed(player.getUniqueId()) == 1) + { + ClansManager.getInstance().runSync(() -> { + if (times == 1) + { + GoldManager.getInstance().addGold(player, 32000); + UtilPlayer.message(player, F.main("Clans", "You have earned " + F.elem(32000 + " Gold") + " for finishing the tutorial!")); + } + + UtilInv.give(player, Material.COOKIE); + }); + } + }); + */ + } + + @Override + protected void onStart(Player player) + { + TutorialRegion region = getRegion(player); + + player.teleport(getSpawn(region)); + spawnFences(region, DyeColor.BLACK); // Fields + spawnFences(region, DyeColor.BROWN); // Shops + spawnFences(region, DyeColor.RED); // Middle + + player.setGameMode(GameMode.SURVIVAL); + player.getInventory().clear(); + player.getInventory().setArmorContents(new ItemStack[4]); + player.setHealth(20); + player.setFoodLevel(20); + + //ClansManager.getInstance().getPvpTimer().pause(player); + + // Spawn Holograms + setSpawnHologram(player, + getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -3), + C.cGoldB + "Welcome to the Clans Tutorial!", + " ", + "This will teach you the basics of Clans.", + "It will take about 5 minutes to complete.", + "You must complete it before playing Clans.", + " ", + "Starting in " + C.cGreen + "10 Seconds"); + + player.setWalkSpeed(0); + + addHologram(player, + getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -23), + "Jump Off!"); + + ClanInfo clan = ClansManager.getInstance().getClan(player); + if (clan != null) + { + ClansManager.getInstance().getClanDataAccess().delete(clan, null); + } + } + + @Override + protected void onQuit(Player player) + { + _fireworks.remove(player); + } + + public Location getPoint(TutorialRegion region, Point point) + { + return region.getLocationMap().getGoldLocations(point.getDataLocColor()).get(0).clone(); + } + + public boolean isIn(Location location, TutorialRegion region, Bounds bounds) + { + if (region.getOrigin().getWorld() != location.getWorld()) + return false; + + List locs = region.getLocationMap().getGoldLocations(bounds.getDataLocColor()); + return UtilAlg.inBoundingBox(location, locs.get(0), locs.get(1)); + } + + public boolean isIn(Player player, Bounds bounds) + { + if(player == null || !player.isOnline()) return false; + TutorialRegion region = getRegion(player); + + if (region != null) + { + if (player.getLocation() == null) return false; + return isIn(player.getLocation(), region, bounds); + } + + return false; + } + + public Location getCenter(TutorialRegion region, Bounds bounds) + { + List locs = region.getLocationMap().getGoldLocations(bounds.getDataLocColor()); + return UtilAlg.getMidpoint(locs.get(0), locs.get(1)); + } + + public Location getSpawn(TutorialRegion region) + { + Location location = region.getLocationMap().getGoldLocations(Point.SPAWN.getDataLocColor()).get(0).clone(); + location.setYaw(180); + return location; + } + + public enum Bounds + { + LAND_CLAIM(DyeColor.LIGHT_BLUE), + // Should be 16x16 + ENEMY_LAND(DyeColor.RED), + // Should be 16x16 + SPAWN(DyeColor.GREEN), + // Spawn Platform + FIELDS(DyeColor.PURPLE), + // Boulders for ores to spawn in? + SHOPS(DyeColor.YELLOW), + // Little shop areas similar to Shops in clans map + ENEMY_ATTACK_AREA(DyeColor.BLACK), + NPC_DIE_AREA(DyeColor.BLUE), + NPC_SHOOT_AREA(DyeColor.BROWN); + // Gray Wool - Cannon Location + // Magenta Wool - Spawn + // Lime Wool - Farming Shop + // Purple Wool - Pvp Shop + // Light Gray Wool - Energy Shop + + private DyeColor _dataLocColor; + + Bounds(DyeColor dataLocColor) + { + _dataLocColor = dataLocColor; + } + + public DyeColor getDataLocColor() + { + return _dataLocColor; + } + } + + public enum Point + { + SPAWN(DyeColor.MAGENTA), + FARMING_SHOP(DyeColor.LIME), + PVP_SHOP(DyeColor.PINK), + ENERGY_SHOP(DyeColor.SILVER), + MINING_SHOP(DyeColor.ORANGE), + CANNON(DyeColor.GRAY), + NPC_1(DyeColor.CYAN), + NPC_2(DyeColor.WHITE); + + private DyeColor _dataLocColor; + + Point(DyeColor dataLocColor) + { + _dataLocColor = dataLocColor; + } + + public DyeColor getDataLocColor() + { + return _dataLocColor; + } + } + + @EventHandler + public void dropItem(PlayerDropItemEvent event) + { + if (isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void breakBlock(BlockBreakEvent event) + { + if (isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void blockDamage(EntityDamageEvent event) + { + if (event.getEntity() instanceof Player) + { + if (isInTutorial((Player) event.getEntity())) + event.setCancelled(true); + } + } + + // Fences + // Black = fields + // Brown = shops + public void spawnFence(Block startBlock) + { + Block block = startBlock; + int count = 0; + while ((block.getType() == Material.AIR || block.getType() == Material.FENCE) && count < 100) + { + block.setType(Material.FENCE); + + block = block.getRelative(BlockFace.UP); + count++; + } + } + + public void destroyFence(Block startBlock) + { + Block block = startBlock; + int count = 0; + while (block.getType() == Material.FENCE && count < 100) + { + block.setType(Material.AIR); + + block = block.getRelative(BlockFace.UP); + count++; + } + } + + public void spawnFences(TutorialRegion region, DyeColor dataLoc) + { + List locations = region.getLocationMap().getIronLocations(dataLoc); + locations.stream().map(Location::getBlock).forEach(this::spawnFence); + } + + public void destroyFences(TutorialRegion region, DyeColor dataLoc) + { + List locations = region.getLocationMap().getIronLocations(dataLoc); + locations.stream().map(Location::getBlock).forEach(this::destroyFence); + } + + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void teleport(ClansCommandPreExecutedEvent event) + { + if (event.getArguments().length < 1) + { + return; + } + + if (!isInTutorial(event.getPlayer())) + { + return; + } + + if (event.getArguments()[0].equalsIgnoreCase("join") + || event.getArguments()[0].equalsIgnoreCase("leave") + || event.getArguments()[0].equalsIgnoreCase("stuck") + || event.getArguments()[0].equalsIgnoreCase("promote") + || event.getArguments()[0].equalsIgnoreCase("demote") + || event.getArguments()[0].equalsIgnoreCase("invite") + || event.getArguments()[0].equalsIgnoreCase("kick") + || event.getArguments()[0].equalsIgnoreCase("neutral") + || event.getArguments()[0].equalsIgnoreCase("enemy") + || event.getArguments()[0].equalsIgnoreCase("ally") + || event.getArguments()[0].equalsIgnoreCase("trust") + || event.getArguments()[0].equalsIgnoreCase("unclaim") + || event.getArguments()[0].equalsIgnoreCase("claim") + || event.getArguments()[0].equalsIgnoreCase("delete") + || event.getArguments()[0].equalsIgnoreCase("disband") + || event.getArguments()[0].equalsIgnoreCase("admin") + || event.getArguments()[0].equalsIgnoreCase("x")) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You are not allowed to run this command during the Tutorial.")); + event.setCancelled(true); + } + + } + + @EventHandler + public void checkInRegion(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Player player : getPlayers()) + { + if (player == null || !player.isOnline()) continue; + if (player.getLocation().getWorld() != getWorldManager().getTutorialWorld()) + { + TutorialRegion region = getRegion(player); + player.teleport(getSpawn(region)); + } + } + } + + @EventHandler + public void fireworkUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) return; + + for (Player player : _fireworks) + { + if (player == null || !player.isOnline()) continue; + UtilFirework.spawnRandomFirework(UtilAlg.getRandomLocation(player.getLocation(), 10)); + } + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { +// ClansManager.getInstance().runAsync(() -> { +// if (_repository.GetTimesPlayed(event.getPlayer().getUniqueId()) == 0) +// { +// ClansManager.getInstance().runSync(() -> start(event.getPlayer())); +// } +// }); + + if (!_taskManager.hasCompletedTask(event.getPlayer(), getTaskIdentifier())) + { + start(event.getPlayer()); + } + else if (!event.getPlayer().hasPlayedBefore() || !event.getPlayer().getLocation().getWorld().equals(Spawn.getSpawnWorld())) + { + Spawn.getInstance().teleport(event.getPlayer(), Spawn.getInstance().getSpawnLocation(), 2); + } + } + + @EventHandler + public void preventMovement(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player player : getPlayers()) + { + TutorialSession session = getTutorialSession(player); + long time = session.getElapsedTime(); + if (time <= 10000) // 10 seconds + { +// player.teleport(getSpawn(session.getRegion())); + + String secondsLeft = UtilTime.convertString(10000 - time, 0, UtilTime.TimeUnit.SECONDS); + setSpawnHologram(player, + getPoint(session.getRegion(), ClansMainTutorial.Point.SPAWN).add(0, 1.5, -3), + C.cGoldB + "Welcome to the Clans Tutorial!", + " ", + "This will teach you the basics of Clans.", + "It will take about 5 minutes to complete.", + "You must complete it before playing Clans.", + " ", + "Starting in " + C.cGreen + secondsLeft); + } + else if (!session.isRemovedHologram()) + { + removeSpawnHologram(player); + player.setWalkSpeed(0.2F); + } + } + } + + public void performGateCheck(Player player, DyeColor key) + { + if(player == null || !player.isOnline()) return; + Location exact = getRegion(player).getLocationMap().getIronLocations(key).get(0); + if(exact == null) return; + Location fence = UtilAlg.getAverageLocation(getRegion(player).getLocationMap().getIronLocations(key)); + + if (exact.getBlock().getType() == Material.AIR) + { + // Gates are already open. + return; + } + + if (player.getLocation().distanceSquared(fence) <= (GATE_OPEN_DISTANCE * GATE_OPEN_DISTANCE)) + { + // Within the correct blocks of the gates. + destroyFences(getRegion(player), key); + } + } + + public TutorialMapManager getMapManager() + { + return _mapManager; + } + + @EventHandler (priority = EventPriority.LOWEST) + public void onClick(ClansButtonClickEvent event) { + if(isInTutorial(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.LOWEST) + public void onShop(ClansPlayerBuyItemEvent event) + { + if(isInTutorial(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.LOWEST) + public void onSell(ClansPlayerSellItemEvent event) + { + if(isInTutorial(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void energyBuy(PreEnergyShopBuyEvent event) + { + if (isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void blockBreak(BlockDamageEvent event) + { + if (!isInTutorial(event.getPlayer())) + { + return; + } + + if (!isInBuildArea(event.getPlayer(), event.getBlock())) + { + return; + } + + + if (_items.contains(event.getBlock().getType())) + { + event.getBlock().breakNaturally(); + + event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.TILE_BREAK, event.getBlock().getTypeId(), 18); + + event.getPlayer().playSound(event.getBlock().getLocation(), Sound.LAVA_POP, 1.f, 1.f); + } + } + + + + + @EventHandler (priority = EventPriority.HIGHEST) + public void blockPlace(BlockPlaceEvent event) + { + if (!isInTutorial(event.getPlayer())) + { + return; + } + + if (isInBuildArea(event.getPlayer(), event.getBlock())) + { + event.setCancelled(false); + } + else + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You are not allowed to place blocks here.")); + event.setCancelled(true); + } + } + + public boolean isInBuildArea(Player player, Block block) + { + TutorialRegion region = getRegion(player); + return isIn(block.getLocation(), region, ClansMainTutorial.Bounds.LAND_CLAIM); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java new file mode 100644 index 000000000..35ba6c7ec --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java @@ -0,0 +1,212 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftZombie; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.DefaultHashMap; +import mineplex.core.common.util.C; +import mineplex.core.common.util.EnclosedObject; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +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.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.siege.weapon.Cannon; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.OrderedObjective; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.HoldItemGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.BlowUpWallGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.GetMapGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.LoadCannonGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.MountCannonGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.StealEnemyPotatoesGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.ClanInfoGoal; + +public class AttackEnemyObjective extends OrderedObjective +{ + private Map _cannon; + + private DefaultHashMap> _shooters; + + public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin) + { + super(clansMainTutorial, javaPlugin, "Enemy Clans Tutorial", "Attack and raid this enemy!"); + + _cannon = new HashMap<>(); + _shooters = new DefaultHashMap<>(username -> new ArrayList<>()); + + addGoal(new GetMapGoal(this)); + addGoal(new HoldItemGoal( + this, Material.MAP, + "Identify Enemy on Map", + "Find the Red Square on your Map.", + "Look at your map to help find where the Enemy Clan is. It's marked by " + + "a " + C.cRed + "Red Square" + C.mBody + ".", + 40 + )); + addGoal(new ClanInfoGoal(this)); + addGoal(new MountCannonGoal(this)); + addGoal(new LoadCannonGoal(this)); + addGoal(new BlowUpWallGoal(this)); + addGoal(new StealEnemyPotatoesGoal(this)); + + setStartMessageDelay(60); + } + + @Override + protected void customStart(Player player) + { + super.customStart(player); + + TutorialSession session = getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getPlugin().getCenter(session.getRegion(), ClansMainTutorial.Bounds.ENEMY_LAND)); + + addShooter("Chiss", getPlugin().getPoint(getPlugin().getRegion(player), ClansMainTutorial.Point.NPC_2), player); + addShooter("defek7", getPlugin().getPoint(getPlugin().getRegion(player), ClansMainTutorial.Point.NPC_1), player); + } + + private void addShooter(String name, Location location, Player active) + { + System.out.println("Adding shooter " + _shooters.get(active.getName()).size() + 1); + + Zombie shooter = location.getWorld().spawn(location.add(.5, 0, .8), Zombie.class); + + shooter.setCustomName(name); + shooter.setCustomNameVisible(true); + + UtilEnt.Vegetate(shooter); + + shooter.teleport(location); + shooter.setHealth(shooter.getMaxHealth()); + + shooter.getEquipment().setItemInHand(new ItemStack(Material.BOW, 1)); + shooter.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1)); + shooter.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS, 1)); + shooter.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET, 1)); + + _shooters.get(active.getName()).add(shooter); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() == UpdateType.FASTER) + { + for (Player player : getActivePlayers()) + { + _shooters.get(player.getName()).forEach(shooter -> { + shooter.setHealth(shooter.getMaxHealth()); + + shooter.getEquipment().setItemInHand(new ItemStack(Material.BOW, 1)); + shooter.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1)); + shooter.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS, 1)); + shooter.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET, 1)); + + if (player.getLocation().distance(shooter.getLocation()) > 16) + { + return; + } + + UtilEnt.LookAt(shooter, player.getEyeLocation()); + + if (Recharge.Instance.usable(player, "ShotBy" + shooter.getUniqueId().toString())) + { + Arrow arrow = shooter.shootArrow(); + + arrow.setVelocity(UtilAlg.getTrajectory(arrow.getLocation(), player.getEyeLocation()).multiply(1.6)); + + Recharge.Instance.use(player, "ShotBy" + shooter.getUniqueId().toString(), 500 + UtilMath.r(2000), false, false); + } + }); + + EnclosedObject kill = new EnclosedObject<>(Boolean.FALSE); + + _shooters.get(player.getName()).forEach(shooter -> { + if (player.getLocation().distance(shooter.getLocation()) < 5) + { + kill.Set(Boolean.TRUE); + } + }); + + if (kill.Get().booleanValue()) + { + _shooters.get(player.getName()).forEach(shooter -> { + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, shooter.getLocation().add(0, .5, 0), new Vector(0d, 0d, 0d), 0.2f, 15, ViewDist.MAX, player); + UtilParticle.PlayParticle(ParticleType.SMOKE, shooter.getLocation().add(0, .5, 0), new Vector(0d, 0d, 0d), 0.2f, 15, ViewDist.MAX, player); + player.playSound(player.getLocation(), Sound.LAVA_POP, 1.0f, 1.0f); + shooter.remove(); + }); + + _shooters.get(player.getName()).clear(); + } + + if (player.getHealth() <= 6) + { + player.setHealth(6); + } + } + } + } + + @Override + protected void customLeave(Player player) + { + } + + @Override + public void clean(Player player, TutorialRegion region) + { + super.clean(player, region); + + System.out.println("Clearing shooters"); + + _shooters.get(player.getName()).forEach(shooter -> { + shooter.remove(); + }); + + _shooters.get(player.getName()).clear(); + } + + @Override + protected void customFinish(Player player) + { + System.out.println("Clearing shooters"); + + _shooters.get(player.getName()).forEach(shooter -> { + shooter.remove(); + }); + + _shooters.get(player.getName()).clear(); + } + + public Map getCannons() + { + return _cannon; + } + + public DefaultHashMap> getShooters() + { + return _shooters; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClanObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClanObjective.java new file mode 100644 index 000000000..2374ae9bd --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClanObjective.java @@ -0,0 +1,39 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective; + +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.*; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.game.clans.tutorial.objective.OrderedObjective; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.BlowUpWallGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.StealEnemyPotatoesGoal; + +public class ClanObjective extends OrderedObjective +{ + public ClanObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin) + { + super(clansMainTutorial, javaPlugin, "Clans Tutorial", "Create clan with /c create "); + + addGoal(new LeaveSpawnGoal(this)); + addGoal(new CreateClanGoal(this)); + addGoal(new ClanManagementGoal(this)); + addGoal(new ClaimLandGoal(this)); + addGoal(new BuildHouseGoal(this)); + addGoal(new SetHomeGoal(this)); + + // Wait 1 second because the player is logging in/loading + setStartMessageDelay(20); + } + + @Override + protected void customLeave(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClassesObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClassesObjective.java new file mode 100644 index 000000000..671596940 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ClassesObjective.java @@ -0,0 +1,44 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.OrderedObjective; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes.EquipDefaultBuildGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes.OpenClassManagerGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes.UseBullsChargeGoal; + +public class ClassesObjective extends OrderedObjective +{ + public ClassesObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin) + { + super(clansMainTutorial, javaPlugin, "Classes Tutorial", "Learn to use our fully customizable classes"); + + addGoal(new EquipDefaultBuildGoal(this)); + addGoal(new OpenClassManagerGoal(this)); + addGoal(new UseBullsChargeGoal(this)); + + setStartMessageDelay(60); + } + + @Override + protected void customStart(Player player) + { + super.customStart(player); + + TutorialSession session = getPlugin().getTutorialSession(player); + session.setMapTargetLocation(null); + } + + @Override + protected void customLeave(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/EnergyObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/EnergyObjective.java new file mode 100644 index 000000000..ecced2abd --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/EnergyObjective.java @@ -0,0 +1,42 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.OrderedObjective; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy.BuyEnergyGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy.ExplainEnergyGoal; + +public class EnergyObjective extends OrderedObjective +{ + public EnergyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin) + { + super(clansMainTutorial, javaPlugin, "Energy Tutorial", "A Clan requires Energy to maintain all of it's territory."); + + addGoal(new ExplainEnergyGoal(this)); + addGoal(new BuyEnergyGoal(this)); + + setStartMessageDelay(60); + } + + @Override + protected void customStart(Player player) + { + super.customStart(player); + + TutorialSession session = getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getPlugin().getPoint(session.getRegion(), ClansMainTutorial.Point.ENERGY_SHOP)); + } + + @Override + protected void customLeave(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FieldsObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FieldsObjective.java new file mode 100644 index 000000000..7ff835cc3 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FieldsObjective.java @@ -0,0 +1,56 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.C; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.OrderedObjective; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.HoldItemGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields.GoToFieldsGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields.MineDiamondsGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields.SellDiamondsGoal; + +public class FieldsObjective extends OrderedObjective +{ + public FieldsObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin) + { + super(clansMainTutorial, javaPlugin, "Fields Tutorial", "Get various resources by mining for them in the fields"); + + addGoal(new HoldItemGoal( + this, + Material.MAP, + "Identify Fields on Map", + "Find the Orange Striped Area on your Map", + "Fields are marked by " + C.cGold + "Orange Stripes" + C.mBody + ".", + 80L + )); + addGoal(new GoToFieldsGoal(this)); + addGoal(new MineDiamondsGoal(this)); + addGoal(new SellDiamondsGoal(this)); + +// setStartMessageDelay(60); + } + + @Override + protected void customLeave(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @Override + protected void customStart(Player player) + { + super.customStart(player); + + TutorialSession session = getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getPlugin().getCenter(session.getRegion(), ClansMainTutorial.Bounds.FIELDS)); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FinalObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FinalObjective.java new file mode 100644 index 000000000..9ea92b621 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FinalObjective.java @@ -0,0 +1,42 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.OrderedObjective; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj.DisbandClanGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj.TpClanHomeGoal; + +public class FinalObjective extends OrderedObjective +{ + public FinalObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin) + { + super(clansMainTutorial, javaPlugin, "Clans Tutorial 2", "Finalize your knowledge of Clans"); + + addGoal(new TpClanHomeGoal(this)); // IMPLEMENTED + addGoal(new DisbandClanGoal(this)); // IMPLEMENTED + + setStartMessageDelay(60); + } + + @Override + protected void customStart(Player player) + { + super.customStart(player); + + TutorialSession session = getPlugin().getTutorialSession(player); + session.setMapTargetLocation(null); + } + + @Override + protected void customLeave(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/PurchaseItemsObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/PurchaseItemsObjective.java new file mode 100644 index 000000000..b86ab328e --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/PurchaseItemsObjective.java @@ -0,0 +1,75 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.*; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.UnorderedObjective; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.shops.PurchaseGoal; + +import java.util.List; +import java.util.UUID; + +public class PurchaseItemsObjective extends UnorderedObjective +{ + public PurchaseItemsObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin) + { + super(clansMainTutorial, javaPlugin, "Purchase Items Tutorial", "Purchase Items from Shop"); + + addGoal(new PurchaseGoal( + this, + Material.IRON_HELMET, + "Purchase Iron Helmet", + "Buy an Iron Helmet from the PvP Gear NPC", + "The shops sell everything you could ever need and more. Buy armour from the " + C.cYellow + "PvP NPC." + )); + addGoal(new PurchaseGoal(this, Material.IRON_CHESTPLATE, "Purchase Iron Chestplate", + "Buy an Iron Chestplate")); + addGoal(new PurchaseGoal(this, Material.IRON_LEGGINGS, "Purchase Iron Leggings", + "Buy Iron Leggings")); + addGoal(new PurchaseGoal(this, Material.IRON_BOOTS, "Purchase Iron Boots", + "Buy Iron Boots")); + addGoal(new PurchaseGoal(this, Material.IRON_AXE, "Purchase Iron Axe", + "Buy an Iron Axe")); +// addGoal(new PurchaseGoal(this, Material.IRON_PICKAXE, "Purchase Iron Pickaxe", "Talk to the Pvp Gear NPC and purchase an Iron Pickaxe")); + + setStartMessageDelay(60); + } + + @Override + protected void customStart(Player player) + { + super.customStart(player); + + TutorialSession session = getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getPlugin().getPoint(session.getRegion(), ClansMainTutorial.Point.PVP_SHOP)); + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void update(UpdateEvent event) { + if(!event.getType().equals(UpdateType.SEC_05)) return; + + for (Player player : getActivePlayers()) + { + if (player == null || !player.isOnline()) continue; + List locations = getPlugin().getRegion(player).getLocationMap().getSpongeLocations(DyeColor.BROWN); + if (locations == null) continue; + for(Location loc : locations) + { + UtilFirework.playFirework(loc, FireworkEffect.Type.BURST, Color.AQUA, true, true); + } + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ShopsObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ShopsObjective.java new file mode 100644 index 000000000..84090b451 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/ShopsObjective.java @@ -0,0 +1,119 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.npc.Npc; +import mineplex.core.npc.NpcManager; +import mineplex.database.tables.records.NpcsRecord; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.OrderedObjective; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.HoldItemGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.shops.GoToShopsGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.shops.SellPotatoesGoal; + +public class ShopsObjective extends OrderedObjective +{ + private HashMap> _npcMap; + private NpcManager _npcManager; + + public ShopsObjective(ClansMainTutorial clansMainTutorial, NpcManager npcManager, JavaPlugin javaPlugin) + { + super(clansMainTutorial, javaPlugin, "Shops Tutorial", "Learn your way around our shops"); + + _npcMap = new HashMap<>(); + _npcManager = npcManager; + + addGoal(new HoldItemGoal( + this, + Material.MAP, + "Identify Shops on Map", + "Find the Blue Striped Area on your map", + "Shops are marked on the map by the " + C.cDAqua + "Blue Stripes" + C.mBody + ".", + 60L + )); + addGoal(new GoToShopsGoal(this)); + addGoal(new SellPotatoesGoal(this)); + + setStartMessageDelay(60); + } + + @Override + public void clean(Player player, TutorialRegion region) + { + super.clean(player, region); + + if (_npcMap.containsKey(player.getUniqueId())) + { + _npcMap.get(player.getUniqueId()).forEach(npc -> _npcManager.removeFakeNpc(npc)); + } + } + + @Override + protected void customLeave(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @Override + protected void customStart(Player player) + { + super.customStart(player); + + TutorialRegion region = getPlugin().getRegion(player); + + + ArrayList npcs = new ArrayList<>(); + // Spawn NPC's + Location pvpGear = getPlugin().getPoint(region, ClansMainTutorial.Point.PVP_SHOP); + Location energyShop = getPlugin().getPoint(region, ClansMainTutorial.Point.ENERGY_SHOP); + Location farmingShop = getPlugin().getPoint(region, ClansMainTutorial.Point.FARMING_SHOP); + Location miningShop = getPlugin().getPoint(region, ClansMainTutorial.Point.MINING_SHOP); + npcs.add(spawnNpc(pvpGear, "Pvp Gear")); + npcs.add(spawnNpc(energyShop, "Energy Shop")); + npcs.add(spawnNpc(farmingShop, "Organic Produce")); + npcs.add(spawnNpc(miningShop, "Mining Shop")); + _npcMap.put(player.getUniqueId(), npcs); + + TutorialSession session = getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getPlugin().getCenter(session.getRegion(), ClansMainTutorial.Bounds.SHOPS)); + + } + + private Npc spawnNpc(Location location, String name) + { + NpcsRecord npcsRecord = new NpcsRecord(); + npcsRecord.setServer(_npcManager.getServerName()); + npcsRecord.setName(name); + npcsRecord.setWorld(location.getWorld().getName()); + npcsRecord.setX(location.getX()); + npcsRecord.setY(location.getY()); + npcsRecord.setZ(location.getZ()); + npcsRecord.setRadius(0D); + npcsRecord.setEntityType(EntityType.VILLAGER.name()); + npcsRecord.setAdult(true); + + Npc npc = new Npc(_npcManager, npcsRecord); + _npcManager.spawnNpc(npc); + _npcManager.addFakeNpc(npc); + return npc; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/HoldItemGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/HoldItemGoal.java new file mode 100644 index 000000000..dde20c741 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/HoldItemGoal.java @@ -0,0 +1,75 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.DefaultHashMap; +import mineplex.core.common.util.EnclosedObject; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.tutorial.objective.Objective; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; + +public class HoldItemGoal extends ObjectiveGoal> +{ + private DefaultHashMap> _ticksHeld = new DefaultHashMap<>(key -> new EnclosedObject<>(Integer.valueOf(0))); + private Material _material; + private long _holdTicks; + + public HoldItemGoal(Objective objective, Material material, String name, String description, String helpText, int startDelay, long holdTicks) + { + super(objective, name, description, helpText, null); + + _material = material; + _holdTicks = holdTicks; +// setStartMessageDelay(startDelay); + } + + public HoldItemGoal(Objective objective, Material material, String name, String description, String helpText, long holdTicks) + { + this(objective, material, name, description, helpText, 120, holdTicks); + } + + @Override + protected void customStart(Player player) + { + + } + + @Override + protected void customFinish(Player player) + { + _ticksHeld.remove(player.getName()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + getActivePlayers().forEach(uuid -> + { + Player player = Bukkit.getPlayer(uuid); + + if (player != null && player.isOnline()) + { + if (player.getItemInHand() == null || player.getItemInHand().getType() != _material) + { + return; + } + + _ticksHeld.get(player.getName()).Set(Integer.valueOf(_ticksHeld.get(player.getName()).Get().intValue() + 1)); + + if (_ticksHeld.get(player.getName()).Get().intValue() >= 80) + { + finish(player); + } + } + }); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/BlowUpWallGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/BlowUpWallGoal.java new file mode 100644 index 000000000..ad7be8c42 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/BlowUpWallGoal.java @@ -0,0 +1,125 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy; + +import java.util.HashMap; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.fallingblock.FallingBlocks; +import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; + +public class BlowUpWallGoal extends ObjectiveGoal +{ + public BlowUpWallGoal(AttackEnemyObjective objective) + { + super( + objective, + "Blow up the Enemy Base", + "Left-Click to shoot TNT at the Enemy Base", + "TNT Cannons will rotate to the direction you are looking. Simply look at the Enemy Base, wait for it to rotate, and then FIRE!", + DyeColor.MAGENTA + ); + } + + @Override + protected void customStart(Player player) + { + TutorialSession session = getObjective().getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getObjective().getPlugin().getCenter(session.getRegion(), ClansMainTutorial.Bounds.ENEMY_ATTACK_AREA)); + } + + @EventHandler + public void siegeWeaponExplode(SiegeWeaponExplodeEvent event) + { + Player shooter = event.getProjectile().getShooter(); + + if (!contains(shooter)) + { + if (getObjective().getPlugin().isInTutorial(shooter)) + { + UtilPlayer.message(shooter, F.main("Clans", "No cheating! (:")); + event.setCancelled(true); + } + + return; + } + + Location center = event.getProjectile().getLocation(); + + TutorialRegion region = getObjective().getPlugin().getRegion(shooter); + + if (getObjective().getPlugin().isIn(center, region, ClansMainTutorial.Bounds.ENEMY_ATTACK_AREA)) + { + double radius = 5.2; + + HashMap blockList = new HashMap(); + int iR = (int) radius + 1; + + for (int x = -iR; x <= iR; x++) + { + for (int z = -iR; z <= iR; z++) + { + for (int y = -iR; y <= iR; y++) + { + Block curBlock = center.getBlock().getRelative(x, y, z); + + double offset = UtilMath.offset(center, curBlock.getLocation()); + + if (offset <= radius) + { + blockList.put(curBlock, Double.valueOf(offset)); + } + } + } + } + + blockList.forEach((block, dist) -> { + + if (block.getType() == Material.SMOOTH_BRICK + || block.getType() == Material.SMOOTH_STAIRS + || block.getType() == Material.IRON_DOOR_BLOCK) + + if (Math.random() < 0.2 + (dist.doubleValue() / 2.55) || dist.doubleValue() < 1.75) + { + block.setType(Material.AIR, false); + + if (block.getType() != Material.IRON_DOOR_BLOCK && block.getType().name().endsWith("BANNER")) + FallingBlocks.Instance.Spawn(block.getLocation(), block.getType(), block.getData(), center); + } + }); + + finish(shooter); + } + else + { + UtilPlayer.message(shooter, F.main("Clans", "You missed! Try to hit the enemy's front wall, that should make a nice big hole!")); + UtilInv.give(shooter, Material.TNT); + } + + event.setCancelled(true); + } + + @Override + protected void customFinish(Player player) + { + getObjective().getCannons().remove(player.getName()).kill(); //Kill cannon after goal complete + + getObjective().getShooters().get(player.getName()).forEach(Zombie::remove); + + getObjective().getShooters().get(player.getName()).clear(); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/ClanInfoGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/ClanInfoGoal.java new file mode 100644 index 000000000..f240f5c2a --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/ClanInfoGoal.java @@ -0,0 +1,92 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy; + + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClanRole; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.ClansPlayer; +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import mineplex.game.clans.core.repository.tokens.ClanToken; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import java.sql.Timestamp; +import java.util.UUID; + + +public class ClanInfoGoal extends ObjectiveGoal +{ + public ClanInfoGoal(AttackEnemyObjective objective) + { + super( + objective, + "Lookup Enemy Details", + "View info about the enemy clan by typing '/c EnemyClan'", + "You can lookup details about your enemy before going for an " + + "attack! This can give you a crucial advantage before " + + "you fight.", + null + ); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void onClanInfo(ClansCommandPreExecutedEvent event) + { + if (contains(event.getPlayer())) + { + if(event.getArguments().length < 1) return; + + event.setCancelled(true); + + if (!event.getArguments()[0].equalsIgnoreCase("EnemyClan")) + { + event.getPlayer().sendMessage(F.main("Clans", "That clan does not exist.")); + return; + } + + ClanToken token = new ClanToken(); + token.Name = "EnemyClan"; + token.Description = "Chiss"; + token.Home = ""; + token.Admin = false; + token.Energy = 4320; + token.Id = -1; + token.Kills = UtilMath.random.nextInt(100); + token.Murder = UtilMath.random.nextInt(100); + token.Deaths = UtilMath.random.nextInt(100); + token.WarWins = UtilMath.random.nextInt(100); + token.WarLosses = UtilMath.random.nextInt(100); + token.DateCreated = new Timestamp(System.currentTimeMillis() - (UtilTime.TimeUnit.DAYS.getMilliseconds() * 10)); + token.LastOnline = new Timestamp(System.currentTimeMillis() - (UtilTime.TimeUnit.DAYS.getMilliseconds() * 1)); + + ClanInfo clan = new ClanInfo(ClansManager.getInstance(), token); + + ClansPlayer chiss = new ClansPlayer("Chiss", UUID.fromString("1d2bfe61-7ebd-445d-ba7d-8354a0ffd1ea"), ClanRole.LEADER); + ClansPlayer jon = new ClansPlayer("defek7", UUID.fromString("89d463f7-23ec-470a-8244-457f0c8d861c"), ClanRole.MEMBER); + chiss.setOnline(true); + jon.setOnline(true); + + clan.getMembers().put(chiss.getUuid(), chiss); + clan.getMembers().put(jon.getUuid(), jon); + + ClansManager.getInstance().getClanShop().openClanWho(event.getPlayer(), clan); + finish(event.getPlayer()); + + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/GetMapGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/GetMapGoal.java new file mode 100644 index 000000000..c1301087f --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/GetMapGoal.java @@ -0,0 +1,57 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.game.clans.clans.map.events.PlayerGetMapEvent; +import mineplex.game.clans.clans.siege.weapon.Cannon; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; + +public class GetMapGoal extends ObjectiveGoal +{ + public GetMapGoal(AttackEnemyObjective objective) + { + super( + objective, + "Get a Map", + "Type '/map' to get a Map", + "You can get a Map any time you need one. The map will show you who " + + "owns the land around the map. Your clan is " + C.cAqua + "blue" + + C.mBody + ", your allies are " + C.cGreen + "green" + C.mBody + ", " + + "and your enemies are " + C.cRed + "red" + C.mBody + ".", + null + ); + +// setStartMessageDelay(120); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void onGetMap(PlayerGetMapEvent event) + { + if (getObjective().getPlugin().isInTutorial(event.getPlayer())) + { + event.setCancelled(true); + getObjective().getPlugin().getMapManager().setMap(event.getPlayer()); + + if (contains(event.getPlayer())) + { + finish(event.getPlayer()); + } + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/LoadCannonGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/LoadCannonGoal.java new file mode 100644 index 000000000..81ca051c6 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/LoadCannonGoal.java @@ -0,0 +1,46 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilInv; +import mineplex.game.clans.clans.siege.events.LoadSiegeWeaponEvent; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; + +public class LoadCannonGoal extends ObjectiveGoal +{ + public LoadCannonGoal(AttackEnemyObjective objective) + { + super( + objective, + "Load the Cannon", + "Right-Click while on the Cannon, and insert your TNT", + "TNT Cannons require TNT to be able to shoot. You can also change the range your cannon fires in the Cannon Menu.", + null + ); + } + + @Override + protected void customStart(Player player) + { + UtilInv.give(player, Material.TNT); + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void onSiegeWeaponLoad(LoadSiegeWeaponEvent event) + { + if (!contains(event.getPlayer())) + { + return; + } + + finish(event.getPlayer()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/MountCannonGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/MountCannonGoal.java new file mode 100644 index 000000000..a7d6c3562 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/MountCannonGoal.java @@ -0,0 +1,71 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilInv; +import mineplex.game.clans.clans.siege.SiegeManager; +import mineplex.game.clans.clans.siege.events.MountSiegeWeaponEvent; +import mineplex.game.clans.clans.siege.weapon.Cannon; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial.Point; +import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; + +public class MountCannonGoal extends ObjectiveGoal +{ + public MountCannonGoal(AttackEnemyObjective objective) + { + super( + objective, + "Get on the Cannon", + "Right-Click on the Cannon", + "You cannot break blocks in enemy territory, however you can blow them up! " + + "TNT Cannons are the best way to do destroy enemy bases!", + DyeColor.BLACK + ); + } + + @Override + protected void customStart(Player player) + { + getObjective().getCannons().put(player.getName(), SiegeManager.Instance.spawnCannon(player, getObjective().getPlugin().getPoint(getObjective().getPlugin().getRegion(player), Point.CANNON), false)); + getObjective().getCannons().get(player.getName()).SetForcedVelocity(0.4, 2.45); + getObjective().getCannons().get(player.getName()).setInvincible(true); + + TutorialSession session = getObjective().getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getObjective().getPlugin().getPoint(session.getRegion(), ClansMainTutorial.Point.CANNON)); + } + + @Override + protected void clean(Player player, TutorialRegion region) + { + // This cannon could be removed from the tutorial already in BlowUpWallGoal, we need to check if its null + Cannon cannon = getObjective().getCannons().remove(player.getName()); + if (cannon != null) + cannon.kill(); + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void onSiegeWeaponMount(MountSiegeWeaponEvent event) + { + if (!contains(event.getPlayer())) + { + return; + } + + finish(event.getPlayer()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/StealEnemyPotatoesGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/StealEnemyPotatoesGoal.java new file mode 100644 index 000000000..1f4261568 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/StealEnemyPotatoesGoal.java @@ -0,0 +1,129 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy; + +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; + +import mineplex.core.common.util.UtilBlock; +import org.bukkit.Bukkit; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.entity.EntityInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.DefaultHashMap; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; + +public class StealEnemyPotatoesGoal extends ObjectiveGoal +{ + private DefaultHashMap _playersMap = new DefaultHashMap<>(uuid -> new AtomicInteger()); + + public StealEnemyPotatoesGoal(AttackEnemyObjective objective) + { + super( + objective, + "Steal Potatoes", + "Steal potatoes from the Enemy Clan’s base", + "Raiding enemy bases is one of the best parts of Clans! There's nothing better than looting Legendary weapons from enemies!", + DyeColor.PURPLE + ); + } + + @Override + public String getDescription(Player player) + { + int count = _playersMap.get(player.getUniqueId()).get(); + return "Steal potatoes from the Enemy Clan’s base " + count + "/10"; + } + + @Override + protected void customStart(Player player) + { + _playersMap.put(player.getUniqueId(), new AtomicInteger(0)); + + TutorialSession session = getObjective().getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getObjective().getPlugin().getCenter(session.getRegion(), ClansMainTutorial.Bounds.ENEMY_LAND)); + + UtilBlock.getInRadius( + getObjective().getPlugin().getRegion(player).getLocationMap().getSpongeLocations(DyeColor.MAGENTA).get(0), 5). + keySet().stream().filter(block -> block.getType().name().contains("IRON_DOOR")).forEach(block -> + block.setType(Material.AIR) + ); + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void onEntityInteract(EntityInteractEvent event) + { + if (!(event.getEntity() instanceof Player)) + { + return; + } + + if (!getObjective().getPlugin().isInTutorial((Player) event.getEntity())) + { + return; + } + + if (event.getBlock().getType() == Material.SOIL && event.getEntity() instanceof Creature) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onBlockBreak(BlockDamageEvent event) + { + if (!contains(event.getPlayer()) || event.getBlock().getType() != Material.POTATO) + return; + + TutorialRegion region = getObjective().getPlugin().getRegion(event.getPlayer()); + if (getObjective().getPlugin().isIn(event.getBlock().getLocation().add(0, 1, 0), region, ClansMainTutorial.Bounds.ENEMY_LAND)) + { + event.setCancelled(true); + event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), new ItemStack(Material.POTATO_ITEM)); + event.getBlock().setType(Material.AIR); + + Bukkit.getServer().getScheduler().runTaskLater(getObjective().getJavaPlugin(), new Runnable() + { + @Override + public void run() + { + if (contains(event.getPlayer())) + { + event.getBlock().setType(Material.POTATO); + } + } + }, 20 * 10); + } + } + + @EventHandler + public void onItemPickup(PlayerPickupItemEvent event) + { + if (!contains(event.getPlayer())) + return; + + if (event.getItem().getItemStack().getType() == Material.POTATO_ITEM) + { + int count = _playersMap.get(event.getPlayer().getUniqueId()).incrementAndGet(); + if (count == 10) + finish(event.getPlayer()); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/BuildHouseGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/BuildHouseGoal.java new file mode 100644 index 000000000..4c26307cb --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/BuildHouseGoal.java @@ -0,0 +1,94 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; + +import java.util.List; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.inventory.ItemStack; + +import com.google.common.collect.Lists; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; + +public class BuildHouseGoal extends ObjectiveGoal +{ + private List _items = Lists.newArrayList( + new ItemStack(Material.SMOOTH_BRICK, 54), + new ItemStack(Material.TORCH, 2), + new ItemStack(Material.IRON_DOOR, 1) + ); + + + public BuildHouseGoal(ClanObjective objective) + { + super( + objective, + "Build a House", + "Build a House (place all your blocks)", + "The first thing you should do on your land is build a house, even " + + "if it’s made of dirt! This will give you a safe place to store your loot!", + DyeColor.ORANGE + ); + } + + @Override + protected void customStart(Player player) + { + _items.forEach(item -> { + player.getInventory().addItem(item); + }); + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler (priority = EventPriority.HIGHEST) + public void blockPlace(BlockPlaceEvent event) + { + if (!getObjective().getPlugin().isInTutorial(event.getPlayer())) + { + return; + } + + event.setCancelled(false); + + + if (getObjective().getPlugin().isInBuildArea(event.getPlayer(), event.getBlock())) + { + // Run 1 tick later because inventory doesn't get updated instantly + ClansManager.getInstance().runSync(() -> { + boolean ja = true; + for (ItemStack stack : event.getPlayer().getInventory().getContents()) + { + if (stack == null) + continue; + + for (ItemStack other : _items) + if (stack.getType() == other.getType()) + { + ja = false; + break; + } + } + + if (ja) // JA! + finish(event.getPlayer()); + }); + } + else + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You are not allowed to place blocks here.")); + event.setCancelled(true); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java new file mode 100644 index 000000000..93d82a088 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java @@ -0,0 +1,76 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; + +import java.util.List; + +import mineplex.core.common.util.C; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; +import org.bukkit.event.EventPriority; + +public class ClaimLandGoal extends ObjectiveGoal +{ + public ClaimLandGoal(ClanObjective objective) + { + super( + objective, + "Claim Land", + "Type '/c' to Claim Land using the Clan Menu", + "Clans are able to claim land for themselves. " + + "Once claimed, no one else can break or place blocks there! " + + "You must be inside the " + C.cAqua + "blue" + C.cGray + " outline to claim land.", + DyeColor.ORANGE + ); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + TutorialRegion region = getObjective().getPlugin().getRegion(player); + List blocks = region.getLocationMap().getGoldLocations(ClansMainTutorial.Bounds.LAND_CLAIM.getDataLocColor()); + UtilAlg.getBox(blocks.get(0).getBlock(), blocks.get(1).getBlock()).stream().filter(block -> block.getType() == Material.WOOL) + .forEach(block -> block.setType(Material.GLOWSTONE)); + } + + @EventHandler + public void onClaim(PlayerPreClaimTerritoryEvent event) + { + if (contains(event.getClaimer())) + { + if (getObjective().getPlugin().isIn(event.getClaimer(), ClansMainTutorial.Bounds.LAND_CLAIM)) + { + finish(event.getClaimer()); + } + else + { + UtilPlayer.message(event.getClaimer(), F.main("Tutorial", "You must claim the land inside the blue outline")); + } + + event.setCancelled(true); + } + } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Territory)) + event.setCancelled(false); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanDetailsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanDetailsGoal.java new file mode 100644 index 000000000..fed068ddf --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanDetailsGoal.java @@ -0,0 +1,63 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; + +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; +import org.bukkit.event.EventPriority; + +public class ClanDetailsGoal extends ObjectiveGoal +{ + public ClanDetailsGoal(ClanObjective objective) + { + super(objective, "View Clan Details", "View Clan Details with /c"); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @Override + public String getDescription(Player player) + { + ClanInfo clan = ClansManager.getInstance().getClan(player); + if (clan != null) + { + return "View Clan Details with /c " + clan.getName(); + } + else + { + return "View Clan Details"; + } + } + + @EventHandler + public void onClanInfo(ClansCommandExecutedEvent event) + { + if (contains(event.getPlayer())) + { + if (event.getCommand().equalsIgnoreCase("info")) + { + finish(event.getPlayer()); + } + } + } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && (event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Who))) + event.setCancelled(false); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanManagementGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanManagementGoal.java new file mode 100644 index 000000000..b74e7d678 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanManagementGoal.java @@ -0,0 +1,60 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; + +import mineplex.core.common.util.F; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +/** + * Created by Adam on 29/03/2016. + */ +public class ClanManagementGoal extends ObjectiveGoal +{ + public ClanManagementGoal(ClanObjective objective) + { + super( + objective, + "Open the Clan Menu", + "Type '/c' to open the Clan Menu", + "Clan Menu lets you do lots of Clans actions, and view information about your Clan. Take a moment to look at it all!", + null + ); + } + + @Override + protected void customStart(Player player) + { + player.sendMessage(F.main("Clans", "You can use the command /c to manage your clan.")); + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void onClanInfo(ClansCommandPreExecutedEvent event) + { + if (contains(event.getPlayer())) + { + if (event.getArguments() == null || event.getArguments().length == 0) + { + finish(event.getPlayer()); + } + } + } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Energy)) + event.setCancelled(false); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java new file mode 100644 index 000000000..693b7cda2 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java @@ -0,0 +1,61 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; + +import mineplex.core.common.util.F; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.ClanCreationCompleteEvent; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; +import org.bukkit.event.EventPriority; + +public class CreateClanGoal extends ObjectiveGoal +{ + public CreateClanGoal(ClanObjective objective) + { + super( + objective, + "Create a Clan", + "Type '/c create ' to create a new Clan", + F.elem("Clans") + " are groups of players that can claim land, build fortresses, " + + "and fight epic battles. Together they will challenge other clans for " + + "control of the land.", + null + ); + } + + @Override + protected void customStart(Player player) + { + + if (ClansManager.getInstance().getClan(player) != null) + { + finish(player); + } + } + + @Override + protected void customFinish(Player player) + { + + } + + @EventHandler + public void onClanCreate(ClanCreationCompleteEvent event) + { + if (contains(event.getFounder())) + { + finish(event.getFounder()); + ClansManager.getInstance().resetLeftTimer(event.getFounder().getUniqueId()); + } + } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Create)) + event.setCancelled(false); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java new file mode 100644 index 000000000..3de4a6674 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java @@ -0,0 +1,79 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; + +import java.util.HashSet; +import java.util.UUID; + +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import org.bukkit.Bukkit; +import org.bukkit.DyeColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; + +public class LeaveSpawnGoal extends ObjectiveGoal +{ + public LeaveSpawnGoal(ClanObjective objective) + { + super( + objective, + "Leave Spawn Island", + "Jump off Spawn Island", + F.elem("Spawn Island") + " is where you will respawn when you die. This area is " + + "a " + F.elem("Safe Zone") + ", meaning that players cannot hurt each other. " + + "From here, you can teleport to various places, as well as read some helpful " + + "hints.", + DyeColor.WHITE + ); + + // 2 seconds after start message + setStartMessageDelay(20 * 11); + } + + @Override + protected void setup(Player player, TutorialRegion region) + { + + } + + @Override + protected void customStart(Player player) + { + player.getInventory().clear(); + } + + @Override + protected void customFinish(Player player) + { + + } + + @EventHandler + public void onCommand(ClansCommandPreExecutedEvent event) + { + if(contains(event.getPlayer())) event.setCancelled(true); + } + + @EventHandler + public void checkRegion(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (UUID uuid : getActivePlayers()) + { + Player player = Bukkit.getPlayer(uuid); + if(player == null || !player.isOnline()) continue; + if (!getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN)) + { + finish(Bukkit.getPlayer(uuid)); + } + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/SetHomeGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/SetHomeGoal.java new file mode 100644 index 000000000..d8a8042f9 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/SetHomeGoal.java @@ -0,0 +1,75 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; + +import mineplex.core.common.util.UtilBlock; +import net.minecraft.server.v1_8_R3.EnumDirection; +import org.bukkit.DyeColor; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilWorld; +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; + +public class SetHomeGoal extends ObjectiveGoal +{ + public SetHomeGoal(ClanObjective objective) + { + super( + objective, + "Set Clan Home", + "Type '/c sethome' to set your Clan's Home", + "Your Clan Home is a special place in your base that you can teleport " + + "to from " + F.elem("Spawn Island") + " or at any time by typing " + F.elem("/c home") + ".", + DyeColor.ORANGE + ); + + setDisplayFinishMessage(false); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void onSetHome(ClansCommandPreExecutedEvent event) + { + if (contains(event.getPlayer()) && event.getArguments().length == 1 && event.getArguments()[0].equalsIgnoreCase("sethome")) + { + event.setCancelled(true); //before checking if bed placed + + if (getObjective().getPlugin().isIn(event.getPlayer(), ClansMainTutorial.Bounds.LAND_CLAIM)) + { + boolean bedPlaced = UtilBlock.placeBed(event.getPlayer().getLocation(), BlockFace.valueOf(EnumDirection.fromAngle(event.getPlayer().getLocation().getYaw()).name()), false, false); + + if (!bedPlaced) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "This is not a suitable place for a bed.")); + return; + } + + // we need to save this for later when the player teleports home! + getObjective().getPlugin().getTutorialSession(event.getPlayer()).setHomeLocation(event.getPlayer().getLocation()); + + finish(event.getPlayer()); + + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have successfully set your Clan's Home to " + UtilWorld.locToStrClean(event.getPlayer().getLocation()) + ".")); + } + else + { + UtilPlayer.message(event.getPlayer(), F.main("Tutorial", "You must set your home in your own land claim.")); + } + + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/EquipDefaultBuildGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/EquipDefaultBuildGoal.java new file mode 100644 index 000000000..9eb963c44 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/EquipDefaultBuildGoal.java @@ -0,0 +1,46 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective; +import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent; + +public class EquipDefaultBuildGoal extends ObjectiveGoal +{ + public EquipDefaultBuildGoal(ClassesObjective objective) + { + super( + objective, + "Equip Armor", + "Put on your Iron Armor", + "When you wear a full set of armor, it will equip a class! The Iron set makes you " + + "into a Knight. Each class has different skills and is strong in its own way.", + null + ); + +// setStartMessageDelay(120); + } + + @Override + protected void customStart(Player player) + { + + } + + @Override + protected void customFinish(Player player) + { + + } + + @EventHandler + public void classEquip(ClassEquipEvent event) + { + if (contains(event.getUser())) + { + finish(event.getUser()); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/OpenClassManagerGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/OpenClassManagerGoal.java new file mode 100644 index 000000000..a67f38855 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/OpenClassManagerGoal.java @@ -0,0 +1,59 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective; + +public class OpenClassManagerGoal extends ObjectiveGoal +{ + public OpenClassManagerGoal(ClassesObjective objective) + { + super( + objective, "Open Class Manager", + "Right-Click on the Enchantment Table", + "Each class has lots of different skills, and you can pick which ones you want to " + + "equip! Right-Click on an " + F.elem("Enchanting Table") + " to have a look at " + + "this menu.", + DyeColor.CYAN + ); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void interact(PlayerInteractEvent event) + { + if (!contains(event.getPlayer())) + { + return; + } + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + { + return; + } + + if (!event.getClickedBlock().getType().equals(Material.ENCHANTMENT_TABLE)) + { + return; + } + + finish(event.getPlayer()); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/SelectBullsChargeGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/SelectBullsChargeGoal.java new file mode 100644 index 000000000..bc31e43e6 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/SelectBullsChargeGoal.java @@ -0,0 +1,66 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.Skill.ISkill; + +public class SelectBullsChargeGoal extends ObjectiveGoal +{ + public SelectBullsChargeGoal(ClassesObjective objective) + { + super(objective, "Open Class Manager", "Using the Class Manager, choose Bulls Charge for your Axe Skill"); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + getActivePlayers().forEach(uuid -> { + Player player = UtilPlayer.searchExact(uuid); + + if (player == null || !player.isOnline()) + { + return; + } + + ClientClass client = ClansManager.getInstance().getClassManager().Get(player); + + if (client.GetGameClass() != null) + { + IPvpClass gameClass = client.GetGameClass(); + + for (ISkill skill : gameClass.GetSkills()) + { + if (skill.GetName().toLowerCase().contains("bulls charge")) + { + finish(player); + break; + } + } + } + }); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/UseBullsChargeGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/UseBullsChargeGoal.java new file mode 100644 index 000000000..6c17de60c --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/UseBullsChargeGoal.java @@ -0,0 +1,50 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective; +import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +public class UseBullsChargeGoal extends ObjectiveGoal { + public UseBullsChargeGoal(ClassesObjective objective) { + super( + objective, + "Use Bulls Charge", + "Right-Click with Axe to use Bulls Charge", + "One of your default abilities as Knight is Bulls Charge. This ability will make " + + "you run faster for a short time, and deal extra damage to enemies.", + null + ); + } + + @Override + protected void customStart(Player player) { + ClientClass client = ClansManager.getInstance().getClassManager().Get(player); + + client.ResetSkills(player); + client.SetActiveCustomBuild(client.GetGameClass(), client.GetGameClass().getDefaultBuild()); + } + + @Override + protected void customFinish(Player player) { + } + + @EventHandler + public void checkSkill(SkillTriggerEvent event) { + if (contains(event.GetPlayer())) { + finish(event.GetPlayer()); + } + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/BuyEnergyGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/BuyEnergyGoal.java new file mode 100644 index 000000000..40ab1a5cc --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/BuyEnergyGoal.java @@ -0,0 +1,64 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.game.clans.clans.ClansManager; +import org.bukkit.DyeColor; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.game.clans.clans.event.EnergyPageBuildEvent; +import mineplex.game.clans.clans.event.PreEnergyShopBuyEvent; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.EnergyObjective; + +public class BuyEnergyGoal extends ObjectiveGoal +{ + public BuyEnergyGoal(EnergyObjective objective) + { + super( + objective, + "Buy Energy", + "Buy Clan Energy from the Energy Shop", + "You can buy Clan Energy at the Shops.", + DyeColor.RED + ); + } + + @Override + protected void customStart(Player player) + { + ClansManager.getInstance().runSyncLater(() -> { + UtilPlayer.message(player, F.main("Clans", "WARNING: Clan Energy is running very low!")); + UtilTextMiddle.display("Clan Energy", "is running very low", 10, 100, 10, player); + + player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f); + }, 3L); + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void energyBuy(PreEnergyShopBuyEvent event) + { + if (contains(event.getPlayer())) + { + finish(event.getPlayer()); + event.getPlayer().closeInventory(); + } + } + + @EventHandler + public void energyBuild(EnergyPageBuildEvent event) + { + if (contains(event.getPlayer())) + { + event.setFree(true); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java new file mode 100644 index 000000000..f4267c521 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java @@ -0,0 +1,57 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy; + +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.EnergyObjective; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class ExplainEnergyGoal extends ObjectiveGoal +{ + public ExplainEnergyGoal(EnergyObjective objective) + { + super( + objective, + "Check your Clans Energy", + "Type '/c' to check your Clans Energy", + "Owning land isn’t free! You will need to buy Energy from the Shops to retain " + + "ownership of it. If your Clan Energy ever reaches 0, you will lose your " + + "land claims!", + null + ); + } + + @Override + protected void customStart(Player player) + { + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f); + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void onCommand(ClansCommandPreExecutedEvent event) + { + if(contains(event.getPlayer()) && event.getArguments().length == 0) + { + finish(event.getPlayer()); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Energy)) + event.setCancelled(false); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/GoToFieldsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/GoToFieldsGoal.java new file mode 100644 index 000000000..0e416501e --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/GoToFieldsGoal.java @@ -0,0 +1,75 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields; + +import java.util.UUID; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.UtilAlg; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective; + +public class GoToFieldsGoal extends ObjectiveGoal +{ + public GoToFieldsGoal(FieldsObjective objective) + { + super( + objective, + "Go to the Fields", + "Go to the Fields", + "The Fields are a very dangerous place where players come to fight and harvest " + + "resources!", + DyeColor.YELLOW + ); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void openGates(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + for (UUID uuid : getActivePlayers()) + { + if(UtilPlayer.searchExact(uuid) == null) return; + + getObjective().getPlugin().performGateCheck(UtilPlayer.searchExact(uuid), DyeColor.RED); + } + } + + @EventHandler + public void checkRegion(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (UUID uuid : getActivePlayers()) + { + Player player = UtilPlayer.searchExact(uuid); + if(player == null || !player.isOnline()) continue; + if (getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.FIELDS)) + { + finish(player); + } + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/IdentifyFieldsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/IdentifyFieldsGoal.java new file mode 100644 index 000000000..a4c9186e4 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/IdentifyFieldsGoal.java @@ -0,0 +1,64 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.DefaultHashMap; +import mineplex.core.common.util.EnclosedObject; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.map.events.PlayerGetMapEvent; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; +import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective; + +public class IdentifyFieldsGoal extends ObjectiveGoal +{ + private DefaultHashMap> _ticksHeld = new DefaultHashMap<>(key -> new EnclosedObject<>(Integer.valueOf(0))); + + public IdentifyFieldsGoal(FieldsObjective objective) + { + super(objective, "Identify The Fields", "By looking at your map, identify where the Fields are"); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + { + return; + } + + getActivePlayers().forEach(uuid -> { + Player player = Bukkit.getPlayer(uuid); + + if (player != null && player.isOnline()) + { + if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.MAP) + { + return; + } + + _ticksHeld.get(player.getName()).Set(Integer.valueOf(_ticksHeld.get(player.getName()).Get().intValue() + 1)); + + if (_ticksHeld.get(player.getName()).Get().intValue() >= 80) + { + finish(player); + } + } + }); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/MineDiamondsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/MineDiamondsGoal.java new file mode 100644 index 000000000..aca99b031 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/MineDiamondsGoal.java @@ -0,0 +1,112 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields; + +import java.util.HashMap; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; + +import org.bukkit.Bukkit; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective; + +public class MineDiamondsGoal extends ObjectiveGoal +{ + private HashMap _playersMap; + + public MineDiamondsGoal(FieldsObjective objective) + { + super( + objective, + "Mine Diamonds", + "Mine Diamonds in the Fields", + "Mining in the Fields is a great way to make lots of money! The ores will " + + "regenerate over time. Be careful of enemies though!", + DyeColor.LIME + ); + + _playersMap = new HashMap<>(); + } + + @Override + protected void customStart(Player player) + { + player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE)); + + _playersMap.put(player.getUniqueId(), new AtomicInteger(0)); + } + + @Override + protected void customFinish(Player player) + { + _playersMap.remove(player.getUniqueId()); + } + + @Override + protected void customLeave(Player player) + { + _playersMap.remove(player.getUniqueId()); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockBreak(BlockBreakEvent event) + { + if (!contains(event.getPlayer()) || event.getBlock().getType() != Material.DIAMOND_ORE) + return; + + TutorialRegion region = getObjective().getPlugin().getRegion(event.getPlayer()); + if (getObjective().getPlugin().isIn(event.getBlock().getLocation(), region, ClansMainTutorial.Bounds.FIELDS)) + { + event.setCancelled(true); + event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 1.5, 0.5), new ItemStack(Material.DIAMOND)); + event.getBlock().setType(Material.COBBLESTONE); + + Bukkit.getServer().getScheduler().runTaskLater(getObjective().getJavaPlugin(), new Runnable() + { + @Override + public void run() + { + if (contains(event.getPlayer())) + { + event.getBlock().setType(Material.DIAMOND_ORE); + } + } + }, 20 * 10); + } + } + + @EventHandler + public void onItemPickup(PlayerPickupItemEvent event) + { + if (!contains(event.getPlayer())) + return; + + if (event.getItem().getItemStack().getType() == Material.DIAMOND) + { + if(_playersMap.get(event.getPlayer().getUniqueId()) == null) return; + int count = _playersMap.get(event.getPlayer().getUniqueId()).incrementAndGet(); + if (count == 10) + finish(event.getPlayer()); + } + } + + @Override + public String getDescription(Player player) + { + AtomicInteger count = _playersMap.get(player.getUniqueId()); + if (count == null) + return "Search for some diamonds in the Fields and mine them"; + else + return "Mine Diamonds " + count.get() + "/10"; + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/SellDiamondsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/SellDiamondsGoal.java new file mode 100644 index 000000000..e1dd69eee --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/SellDiamondsGoal.java @@ -0,0 +1,61 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective; +import org.bukkit.event.EventPriority; + +public class SellDiamondsGoal extends ObjectiveGoal +{ + public SellDiamondsGoal(FieldsObjective objective) + { + super( + objective, + "Sell Diamonds", + "Sell your Diamonds to the Mining Shop", + "Go back to the Shops and sell your precious diamonds!", + DyeColor.SILVER + ); + } + + @Override + protected void customStart(Player player) + { + TutorialSession session = getObjective().getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getObjective().getPlugin().getPoint(session.getRegion(), ClansMainTutorial.Point.MINING_SHOP)); + } + + @Override + protected void customFinish(Player player) + { + // Close Middle Gate + getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.RED); + + // Close Fields Gate + getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.BLACK); + } + + @EventHandler (priority = EventPriority.HIGH) + public void onSell(ClansPlayerSellItemEvent event) + { + if (contains(event.getPlayer())) + { + if (event.getItem().getType() == Material.DIAMOND) + { + event.setCancelled(false); + UtilInv.removeAll(event.getPlayer(), Material.DIAMOND, (byte) 0); + finish(event.getPlayer()); + } + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java new file mode 100644 index 000000000..60a243659 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java @@ -0,0 +1,64 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj; + +import mineplex.game.clans.clans.event.ClanDisbandedEvent; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import mineplex.game.clans.tutorial.objective.Objective; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; +import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective; + +public class DisbandClanGoal extends ObjectiveGoal +{ + public DisbandClanGoal(FinalObjective objective) + { + super( + objective, + "Disband Clan", + "Type '/c' and Disband your Clan", + "Now that the tutorial is almost finished, let’s delete your Clan. Disbanding a " + + "Clan will delete it, and unclaim all of your land.", + null + ); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + ClansManager.getInstance().resetLeftTimer(player.getUniqueId()); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void teleport(ClanDisbandedEvent event) + { + if (!contains(event.getDisbander())) + { + return; + } + event.setCancelled(true); + + UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan.")); + ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getDisbander()), null); + ClansManager.getInstance().resetLeftTimer(event.getDisbander().getUniqueId()); + finish(event.getDisbander()); + } + + + @EventHandler (priority = EventPriority.HIGHEST) + public void onClick(ClansButtonClickEvent event) { + if(contains(event.getPlayer()) && event.getButtonType().equals(ClansButtonClickEvent.ButtonType.Disband)) + event.setCancelled(false); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/TpClanHomeGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/TpClanHomeGoal.java new file mode 100644 index 000000000..18c5b08a3 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/TpClanHomeGoal.java @@ -0,0 +1,91 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.delayedtask.DelayedTask; +import mineplex.core.delayedtask.DelayedTaskClient; +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; +import mineplex.game.clans.tutorial.objective.Objective; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective; + +public class TpClanHomeGoal extends ObjectiveGoal +{ + public TpClanHomeGoal(FinalObjective objective) + { + super( + objective, + "Teleport to Clan Home", + "Type '/c home' to teleport to Clan Home", + "You can teleport back to your Clan Home at any time! If enemies break your bed, then you cannot teleport to it!", + null + ); + +// setStartMessageDelay(120); + } + + @Override + protected void customStart(Player player) + { + } + + @Override + protected void customFinish(Player player) + { + } + + @EventHandler + public void teleport(ClansCommandPreExecutedEvent event) + { + if (event.getArguments().length != 1 || !event.getArguments()[0].equalsIgnoreCase("home")) + { + return; + } + + if (!contains(event.getPlayer())) + { + return; + } + + DelayedTask.Instance.doDelay( + event.getPlayer(), + "Tutorial Home Teleport", + new Callback() + { + @Override + public void run(DelayedTaskClient data) + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have teleported to your Clan's Home.")); + event.getPlayer().teleport(getObjective().getPlugin().getTutorialSession(event.getPlayer()).getHomeLocation()); + finish(event.getPlayer()); + } + }, + new Callback() + { + @Override + public void run(DelayedTaskClient data) + { + UtilTextMiddle.display("", "Teleporting to Clan Home in " + F.time(UtilTime.MakeStr(Math.max(0, data.getTimeLeft("Tutorial Home Teleport")))), 0, 5, 0, data.getPlayer()); + } + }, + new Callback() + { + @Override + public void run(DelayedTaskClient data) + { + UtilPlayer.message(data.getPlayer(), F.main("Clans", "Teleport has been cancelled due to movement.")); + } + }, + 15 * 1000, // 15 second cooldown + false + ); + + event.setCancelled(true); + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/GoToShopsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/GoToShopsGoal.java new file mode 100644 index 000000000..0177f3f9f --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/GoToShopsGoal.java @@ -0,0 +1,77 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.shops; + +import java.util.UUID; + +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAlg; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ShopsObjective; + +public class GoToShopsGoal extends ObjectiveGoal +{ + public GoToShopsGoal(ShopsObjective objective) + { + super( + objective, + "Go to the Shops", + "Walk to the Shops", + "The shops are the place where you can buy and sell all sorts of items! " + + "The Shops are a " + F.elem("Safe Zone") + ", meaning meaning that players cannot hurt each other.", + DyeColor.LIGHT_BLUE + ); + } + + @Override + protected void customStart(Player player) + { + + } + + @Override + protected void customFinish(Player player) + { + + } + + @EventHandler + public void openGates(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + { + return; + } + + for (UUID uuid : getActivePlayers()) + { + if(UtilPlayer.searchExact(uuid) == null) continue; + getObjective().getPlugin().performGateCheck(UtilPlayer.searchExact(uuid), DyeColor.BROWN); + } + } + + @EventHandler + public void checkRegion(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (UUID uuid : getActivePlayers()) + { + Player player = UtilPlayer.searchExact(uuid); + if(player == null || !player.isOnline()) continue; + if (getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SHOPS)) + { + finish(player); + } + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/PurchaseGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/PurchaseGoal.java new file mode 100644 index 000000000..a5ba6bc0a --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/PurchaseGoal.java @@ -0,0 +1,66 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.shops; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent; +import mineplex.game.clans.clans.event.ClansShopAddButtonEvent; +import mineplex.game.clans.tutorial.objective.Objective; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import org.bukkit.event.EventPriority; + +public class PurchaseGoal extends ObjectiveGoal +{ + private Material _material; + + public PurchaseGoal(Objective objective, Material material, String name, String description) + { + super(objective, name, description); + _material = material; + + setDisplayStartMessage(false); + setDisplayFinishMessage(false); + } + + public PurchaseGoal(Objective objective, Material material, String name, String description, + String helpText) + { + super(objective, name, description, helpText, null); + _material = material; + + setDisplayStartMessage(false); + setDisplayFinishMessage(false); + } + + @Override + protected void customStart(Player player) + { + + } + + @Override + protected void customFinish(Player player) + { + + } + + @EventHandler + public void button(ClansShopAddButtonEvent event) + { + if (contains(event.getPlayer()) && event.getMaterial() == _material) + { + event.setBuyPrice(0); + } + } + + @EventHandler (priority = EventPriority.HIGH) + public void buy(final ClansPlayerBuyItemEvent event) + { + if (contains(event.getPlayer()) && event.getItem().getType() == _material) + { + event.setCancelled(false); + finish(event.getPlayer()); + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/SellPotatoesGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/SellPotatoesGoal.java new file mode 100644 index 000000000..abfca5e9f --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/SellPotatoesGoal.java @@ -0,0 +1,59 @@ +package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.shops; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent; +import mineplex.game.clans.tutorial.TutorialSession; +import mineplex.game.clans.tutorial.objective.ObjectiveGoal; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; +import mineplex.game.clans.tutorial.tutorials.clans.objective.ShopsObjective; +import org.bukkit.event.EventPriority; + +public class SellPotatoesGoal extends ObjectiveGoal +{ + public SellPotatoesGoal(ShopsObjective objective) + { + super( + objective, + "Sell Potatoes", + "Sell your Potatoes to the " + F.elem("Organic Produce Shop"), + "Farming is a great way to make money in Clans. Build a farm in your land, " + + "harvest the crops, and sell it to the shops for profit!", + DyeColor.PINK + ); + } + + @Override + protected void customStart(Player player) + { + TutorialSession session = getObjective().getPlugin().getTutorialSession(player); + session.setMapTargetLocation(getObjective().getPlugin().getPoint(session.getRegion(), ClansMainTutorial.Point.FARMING_SHOP)); + } + + @Override + protected void customFinish(Player player) + { + // Shops Fences Closed + getObjective().getPlugin().spawnFences(getObjective().getPlugin().getRegion(player), DyeColor.BROWN); + + // Remove all potatoes from inventory + UtilInv.removeAll(player, Material.POTATO_ITEM, (byte) 0); + } + + @EventHandler (priority = EventPriority.HIGH) + public void onSell(ClansPlayerSellItemEvent event) + { + if (contains(event.getPlayer())) { + if (event.getItem().getType() == Material.POTATO_ITEM) { + event.setCancelled(false); + finish(event.getPlayer()); + } + } + } +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/repository/TutorialRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/repository/TutorialRepository.java new file mode 100644 index 000000000..415f9ae6e --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/repository/TutorialRepository.java @@ -0,0 +1,68 @@ +package mineplex.game.clans.tutorial.tutorials.clans.repository; + +import java.util.UUID; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.EnclosedObject; +import mineplex.core.common.util.UUIDFetcher; +import mineplex.core.database.MinecraftRepository; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnVarChar; + +public class TutorialRepository extends MinecraftRepository +{ + private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS clansTutorial (uuid VARCHAR(36), timesPlayed INT, PRIMARY KEY (uuid));"; + private static final String GET = "SELECT * FROM clansTutorial WHERE uuid = ?;"; + private static final String INSERT = "INSERT INTO clansTutorial (uuid, timesPlayed) VALUES (?, ?);"; + private static final String UPDATE = "UPDATE clansTutorial SET timesPlayed=? WHERE uuid=?;"; + + private CoreClientManager _clientManager; + + public TutorialRepository(CoreClientManager clientManager) + { + super(clientManager.getPlugin(), DBPool.getAccount()); + + _clientManager = clientManager; + } + + public void SetTimesPlayed(UUID uuid, int timesPlayed) + { + // Prevent duplicate entries for individuals + executeQuery(GET, result -> { + if (result.next()) + executeUpdate(UPDATE, new ColumnInt("timesPlayed", timesPlayed), new ColumnVarChar("uuid", 36, uuid.toString())); + else + executeUpdate(INSERT, new ColumnVarChar("uuid", 36, uuid.toString()), new ColumnInt("timesPlayed", timesPlayed)); + }, new ColumnVarChar("uuid", 36, uuid.toString())); + } + + public int GetTimesPlayed(UUID uuid) + { + EnclosedObject status = new EnclosedObject<>(); + + executeQuery(GET, result -> { + if (result.next()) + status.Set(Integer.valueOf(result.getInt("timesPlayed"))); + else + status.Set(Integer.valueOf(0)); + }, new ColumnVarChar("uuid", 36, uuid.toString())); + + return status.Get().intValue(); + } + + public int GetTimesPlayed(String name) + { + return GetTimesPlayed(UUIDFetcher.getUUIDOf(name)); + } + + protected void initialize() + { + executeUpdate(CREATE_TABLE); + } + + protected void update() + { + } + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/visual/VisualManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/visual/VisualManager.java new file mode 100644 index 000000000..9fd96caf5 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/visual/VisualManager.java @@ -0,0 +1,35 @@ +package mineplex.game.clans.tutorial.visual; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; + +public class VisualManager extends MiniPlugin +{ + public VisualManager(JavaPlugin plugin) + { + super("Visual", plugin); + } + + public void setTitleMessage(Player player, String message, String desc, int timer, boolean displayNow) + { + + } + + public void displayTitleMessage(Player player, String message, String desc) + { + + } + + public void playFinish(Player player) + { + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + } + + public void clear(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/event/OpenClassShopEvent.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/event/OpenClassShopEvent.java new file mode 100644 index 000000000..cd52d54e1 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/event/OpenClassShopEvent.java @@ -0,0 +1,18 @@ +package mineplex.minecraft.game.classcombat.shop.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class OpenClassShopEvent extends PlayerEvent +{ + private static final HandlerList handlers = new HandlerList(); + public static HandlerList getHandlerList() { return handlers; } + public HandlerList getHandlers() { return handlers; } + + public OpenClassShopEvent(Player who) + { + super(who); + } + +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupportRepository.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupportRepository.java new file mode 100644 index 000000000..877a4c71d --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupportRepository.java @@ -0,0 +1,25 @@ +package mineplex.staffServer.customerSupport; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.database.MinecraftRepository; +import mineplex.serverdata.database.DBPool; + +public class CustomerSupportRepository extends MinecraftRepository +{ + public CustomerSupportRepository(JavaPlugin plugin) + { + super(plugin, DBPool.getAccount()); + } + + @Override + protected void initialize() { } + + @Override + protected void update() { } + + public void loadBonusLogForAccountId(int accountId, CustomerSupport customerSupport) + { + executeQuery("SELECT accountId, items.name, itemChange, time FROM bonusLog INNER JOIN items ON itemId = items.id WHERE accountId = " + accountId + " ORDER BY bonusLog.id DESC;", customerSupport); + } +} From f030f78f08ee409a6d0c542cf58dff092aa0d634 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Wed, 6 Apr 2016 16:20:26 -0400 Subject: [PATCH 27/34] Add headers to new classes, so as to comply with coding standards. To that end, change methods to camel case and refactor them, so that the newly-renamed methods do not result in errors. --- .../src/mineplex/core/elo/EloPlayer.java | 5 + .../nautilus/game/arcade/ArcadeManager.java | 18 +-- .../src/nautilus/game/arcade/game/Game.java | 34 ++--- .../nautilus/game/arcade/game/GameTeam.java | 6 +- .../nautilus/game/arcade/game/TeamGame.java | 12 +- .../game/games/baconbrawl/BaconBrawl.java | 6 +- .../games/baconbrawl/kits/KitMamaPig.java | 4 +- .../game/games/barbarians/Barbarians.java | 38 ++--- .../game/games/bossbattles/BossBattles.java | 6 +- .../arcade/game/games/bouncyballs/Ball.java | 4 +- .../game/games/bouncyballs/BouncyBalls.java | 2 +- .../game/arcade/game/games/bridge/Bridge.java | 48 +++---- .../game/arcade/game/games/build/Build.java | 42 +++--- .../game/arcade/game/games/cards/Cards.java | 12 +- .../game/games/castlesiege/CastleSiege.java | 28 ++-- .../game/games/champions/ChampionsCTF.java | 8 +- .../games/champions/ChampionsDominate.java | 8 +- .../game/games/champions/ChampionsTDM.java | 8 +- .../game/games/christmas/Christmas.java | 12 +- .../arcade/game/games/christmas/Sleigh.java | 2 +- .../games/christmas/content/BossMobs.java | 4 +- .../christmas/content/BossSnowmanPattern.java | 4 +- .../games/christmas/content/CaveGiant.java | 4 +- .../games/christmas/content/PumpkinKing.java | 4 +- .../games/christmas/content/SnowmanBoss.java | 4 +- .../games/christmas/content/SnowmanMaze.java | 4 +- .../games/christmas/content/SnowmanWaveA.java | 4 +- .../games/christmas/content/SnowmanWaveB.java | 4 +- .../game/games/christmas/parts/Part.java | 4 +- .../game/games/christmas/parts/Part1.java | 4 +- .../game/games/christmas/parts/Part2.java | 4 +- .../game/games/christmas/parts/Part4.java | 4 +- .../game/games/common/CaptureTheFlag.java | 16 +-- .../arcade/game/games/common/Domination.java | 14 +- .../game/games/common/TeamDeathmatch.java | 6 +- .../arcade/game/games/deathtag/DeathTag.java | 8 +- .../game/games/dragonescape/DragonEscape.java | 14 +- .../games/dragonescape/DragonEscapeTeams.java | 10 +- .../game/games/dragonriders/DragonData.java | 4 +- .../game/games/dragonriders/DragonRiders.java | 4 +- .../arcade/game/games/dragons/Dragons.java | 10 +- .../game/games/dragons/DragonsTeams.java | 12 +- .../game/arcade/game/games/draw/Draw.java | 8 +- .../arcade/game/games/event/EventGame.java | 54 +++---- .../arcade/game/games/event/EventModule.java | 134 +++++++++--------- .../game/games/evolution/Evolution.java | 18 +-- .../game/games/gladiators/Gladiators.java | 24 ++-- .../arcade/game/games/gravity/Gravity.java | 12 +- .../game/games/gravity/GravityObject.java | 4 +- .../game/games/halloween/Halloween.java | 14 +- .../halloween/creatures/CreatureBase.java | 4 +- .../halloween/creatures/PumpkinKing.java | 8 +- .../game/games/halloween/waves/WaveBase.java | 4 +- .../games/halloween/waves/WaveVictory.java | 6 +- .../arcade/game/games/hideseek/HideSeek.java | 16 +-- .../game/games/holeinwall/HoleInTheWall.java | 14 +- .../game/games/lobbers/BombLobbers.java | 22 +-- .../game/arcade/game/games/micro/Micro.java | 12 +- .../arcade/game/games/milkcow/MilkCow.java | 18 +-- .../game/games/minestrike/MineStrike.java | 24 ++-- .../arcade/game/games/mineware/MineWare.java | 22 +-- .../challenges/ChallengeDragonEgg.java | 4 +- .../challenges/ChallengeHitTargets.java | 4 +- .../challenges/ChallengeMilkACow.java | 4 +- .../challenges/ChallengeNameThatSound.java | 4 +- .../challenges/ChallengeShootChickens.java | 8 +- .../mineware/challenges/ChallengeSkyFall.java | 4 +- .../challenges/ChallengeSmashOff.java | 4 +- .../challenges/ChallengeTntLauncher.java | 2 +- .../challenges/ChallengeVolleyPig.java | 8 +- .../game/arcade/game/games/moba/Moba.java | 6 +- .../arcade/game/games/monsterleague/Ball.java | 4 +- .../games/monsterleague/MonsterLeague.java | 10 +- .../arcade/game/games/monstermaze/Maze.java | 8 +- .../game/games/monstermaze/MonsterMaze.java | 12 +- .../game/games/oldmineware/OldMineWare.java | 26 ++-- .../game/games/oldmineware/order/Order.java | 8 +- .../games/oldmineware/order/OrderGather.java | 4 +- .../games/oldmineware/order/OrderPlace.java | 2 +- .../game/games/paintball/Paintball.java | 6 +- .../games/paintball/PlayerCopyPaintball.java | 4 +- .../game/arcade/game/games/quiver/Quiver.java | 20 +-- .../arcade/game/games/quiver/QuiverTeams.java | 16 +-- .../game/arcade/game/games/runner/Runner.java | 8 +- .../searchanddestroy/SearchAndDestroy.java | 18 +-- .../game/games/searchanddestroy/TeamBomb.java | 4 +- .../arcade/game/games/sheep/SheepGame.java | 12 +- .../arcade/game/games/skywars/Skywars.java | 50 +++---- .../game/games/skywars/SoloSkywars.java | 2 +- .../game/games/skywars/TeamSkywars.java | 8 +- .../game/games/smash/SoloSuperSmash.java | 2 +- .../arcade/game/games/smash/SuperSmash.java | 10 +- .../game/games/smash/TeamSuperSmash.java | 8 +- .../game/games/smash/kits/KitKnight.java | 4 +- .../game/games/smash/kits/KitSkySquid.java | 4 +- .../games/smash/perks/PerkCowAngryHerd.java | 4 +- .../game/arcade/game/games/snake/Snake.java | 16 +-- .../sneakyassassins/SneakyAssassins.java | 8 +- .../games/sneakyassassins/npc/NpcManager.java | 4 +- .../sneakyassassins/powerups/PowerUpItem.java | 4 +- .../game/games/snowfight/SnowFight.java | 4 +- .../games/speedbuilders/SpeedBuilders.java | 36 ++--- .../speedbuilders/data/RecreationData.java | 4 +- .../game/arcade/game/games/spleef/Spleef.java | 6 +- .../arcade/game/games/spleef/SpleefTeams.java | 6 +- .../game/games/squidshooter/SquidShooter.java | 10 +- .../arcade/game/games/stacker/Stacker.java | 4 +- .../survivalgames/SoloSurvivalGames.java | 2 +- .../games/survivalgames/SurvivalGames.java | 74 +++++----- .../survivalgames/SurvivalGamesTeams.java | 64 ++++----- .../survivalgames/TeamSurvivalGames.java | 10 +- .../game/arcade/game/games/tug/Tug.java | 14 +- .../game/games/turfforts/TurfForts.java | 18 +-- .../arcade/game/games/typewars/TypeWars.java | 50 +++---- .../typewars/tutorial/TutorialTypeWars.java | 4 +- .../game/arcade/game/games/uhc/UHC.java | 60 ++++---- .../game/games/valentines/Valentines.java | 14 +- .../tutorial/TutorialValentines.java | 8 +- .../game/games/wither/PlayerCopyWither.java | 4 +- .../arcade/game/games/wither/WitherGame.java | 24 ++-- .../arcade/game/games/wizards/Wizards.java | 22 +-- .../wizards/spells/SpellSummonWolves.java | 4 +- .../games/zombiesurvival/ZombieSurvival.java | 8 +- .../game/arcade/kit/perks/PerkBatWave.java | 4 +- .../game/arcade/kit/perks/PerkChicken.java | 4 +- .../arcade/kit/perks/PerkChickenRocket.java | 4 +- .../game/arcade/kit/perks/PerkCowBomb.java | 4 +- .../arcade/kit/perks/PerkEndermanDragon.java | 4 +- .../game/arcade/kit/perks/PerkHorsePet.java | 4 +- .../arcade/kit/perks/PerkMadScientist.java | 4 +- .../arcade/kit/perks/PerkNightLivingDead.java | 12 +- .../arcade/kit/perks/PerkPigBaconBomb.java | 4 +- .../arcade/kit/perks/PerkSheepHoming.java | 4 +- .../game/arcade/kit/perks/PerkSkeletons.java | 4 +- .../arcade/kit/perks/PerkSlimeRocket.java | 4 +- .../game/arcade/kit/perks/PerkSnowTurret.java | 4 +- .../arcade/kit/perks/PerkWitherImage.java | 4 +- .../arcade/kit/perks/PerkWitherMinion.java | 4 +- .../game/arcade/kit/perks/PerkWolf.java | 4 +- .../game/arcade/kit/perks/PerkWolfPack.java | 4 +- .../game/arcade/kit/perks/PerkWolfPet.java | 4 +- .../game/arcade/managers/GameFlagManager.java | 116 +++++++-------- .../arcade/managers/GameLobbyManager.java | 4 +- .../game/arcade/managers/GameManager.java | 10 +- .../game/arcade/managers/MiscManager.java | 2 +- 145 files changed, 934 insertions(+), 929 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index e34a03f15..71505f6ba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -18,4 +18,9 @@ public class EloPlayer _division = newDivision; } + public String getDivision() + { + return _division; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index c453f1be5..60d692182 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -571,15 +571,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (pA == null || pB == null) return false; - if (!_game.Damage.GetOption()) + if (!_game.Damage.getOption()) return false; - if (!_game.DamagePvP.GetOption()) + if (!_game.DamagePvP.getOption()) return false; // Self Damage if (pA.equals(pB)) - return _game.DamageSelf.GetOption(); + return _game.DamageSelf.getOption(); GameTeam tA = _game.GetTeam(pA); if (tA == null) @@ -589,10 +589,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (tB == null) return false; - if (tA.equals(tB) && !_game.DamageTeamSelf.GetOption()) + if (tA.equals(tB) && !_game.DamageTeamSelf.getOption()) return false; - if (!tA.equals(tB) && !_game.DamageTeamOther.GetOption()) + if (!tA.equals(tB) && !_game.DamageTeamOther.getOption()) return false; return true; @@ -703,7 +703,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (event.getJoinMessage() == null) return; - if (_game != null && _game.AnnounceJoinQuit.GetOption()) + if (_game != null && _game.AnnounceJoinQuit.getOption()) event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + name)); else @@ -724,7 +724,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (event.getQuitMessage() == null) return; - if (_game == null || _game.AnnounceJoinQuit.GetOption()) + if (_game == null || _game.AnnounceJoinQuit.getOption()) event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + name)); else event.setQuitMessage(null); @@ -850,7 +850,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation || _donationManager.Get(event.getPlayer().getName()).OwnsUnknownPackage(_serverConfig.ServerType + " ULTRA")) { - if (GetGame() != null && GetGame().DontAllowOverfill.GetOption()) + if (GetGame() != null && GetGame().DontAllowOverfill.getOption()) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes."); return; @@ -1230,7 +1230,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation } else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead) { - if (event.GetGame().GadgetsDisabled.GetOption()) + if (event.GetGame().GadgetsDisabled.getOption()) { if (getCosmeticManager().isShowingInterface()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 193106f3e..c922c3d09 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -716,11 +716,11 @@ public abstract class Game implements Listener public GameTeam ChooseTeam(Player player) { - if (FillTeamsInOrderToCount.GetOption() != -1) + if (FillTeamsInOrderToCount.getOption() != -1) { for (int i = 0; i < _teamList.size(); i++) { - if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount.GetOption()) + if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount.getOption()) { return _teamList.get(i); } @@ -743,7 +743,7 @@ public abstract class Game implements Listener public double GetKillsGems(Player killer, Player killed, boolean assist) { - if (DeathOut.GetOption()) + if (DeathOut.getOption()) { if (!assist) { @@ -1058,10 +1058,10 @@ public abstract class Game implements Listener public DeathMessageType GetDeathMessageType() { - if (!DeathMessages.GetOption()) + if (!DeathMessages.getOption()) return DeathMessageType.None; - if (this.DeathOut.GetOption()) + if (this.DeathOut.getOption()) return DeathMessageType.Detailed; return DeathMessageType.Simple; @@ -1131,7 +1131,7 @@ public abstract class Game implements Listener for (Player player : UtilServer.getPlayers()) AnnounceGame(player); - if (AnnounceSilence.GetOption()) + if (AnnounceSilence.getOption()) Manager.GetChat().Silence(PrepareTime, false); } @@ -1216,7 +1216,7 @@ public abstract class Game implements Listener UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); - if (AnnounceSilence.GetOption()) + if (AnnounceSilence.getOption()) Manager.GetChat().Silence(5000, false); } @@ -1273,13 +1273,13 @@ public abstract class Game implements Listener UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); - AdjustPlayerElo(places); + adjustPlayerElo(places); - if (AnnounceSilence.GetOption()) + if (AnnounceSilence.getOption()) Manager.GetChat().Silence(5000, false); } - public int CalculateEloMultiplier(int currentElo, int averageElo) + public int calculateEloMultiplier(int currentElo, int averageElo) { int eloDifference = averageElo - currentElo; @@ -1317,7 +1317,7 @@ public abstract class Game implements Listener return 0; } - public void AdjustPlayerElo(List places) + public void adjustPlayerElo(List places) { int averageElo = 0; for (Player player : UtilServer.getPlayers()) @@ -1332,7 +1332,7 @@ public abstract class Game implements Listener int currentElo = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); int lossMultiplier = 1; int sizeModifier = 3; - int eloMultiplier = CalculateEloMultiplier(currentElo, averageElo); + int eloMultiplier = calculateEloMultiplier(currentElo, averageElo); //nobody won, add 10 points to all players //Profitable enough see the match through to the end, but not enough for a stale-mate to be a more desirable outcome than 3rd place @@ -1650,7 +1650,7 @@ public abstract class Game implements Listener @EventHandler public void classCombatCreatureAllow(ClassCombatCreatureAllowSpawnEvent event) { - CreatureAllowOverride.SetOption(event.getAllowed()); + CreatureAllowOverride.setOption(event.getAllowed()); } public boolean isInsideMap(Player player) @@ -1671,17 +1671,17 @@ public abstract class Game implements Listener public void setItemMergeRadius(double mergeRadius) { - _itemMergeRadius.SetOption(mergeRadius); + _itemMergeRadius.setOption(mergeRadius); if (WorldData.World != null) { - ((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius.GetOption(); + ((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius.getOption(); } } public double getItemMergeRadius() { - return _itemMergeRadius.GetOption(); + return _itemMergeRadius.getOption(); } @EventHandler @@ -1690,7 +1690,7 @@ public abstract class Game implements Listener if (event.getWorld().getName().equals(WorldData.GetFolder())) { System.out.println("Setting item merge radius for game to " + _itemMergeRadius); - ((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius.GetOption(); + ((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius.getOption(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index ce24b3425..685996d3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -132,7 +132,7 @@ public class GameTeam public Location GetSpawn() { //Keep allies together - if (!Host.IsLive() && Host.SpawnNearAllies.GetOption()) + if (!Host.IsLive() && Host.SpawnNearAllies.getOption()) { //Find Location Nearest Ally Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true)); @@ -142,7 +142,7 @@ public class GameTeam //No allies existed spawned yet //Spawn near enemies (used for SG) - if (Host.SpawnNearEnemies.GetOption()) + if (Host.SpawnNearEnemies.getOption()) { loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); if (loc != null) @@ -159,7 +159,7 @@ public class GameTeam else { //Spawn near players - if (Host.SpawnNearEnemies.GetOption()) + if (Host.SpawnNearEnemies.getOption()) { Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); if (loc != null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java index 4fb1bc90d..3ee0a7e93 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -76,7 +76,7 @@ public abstract class TeamGame extends Game if (player.getWorld().getName().equalsIgnoreCase("world")) return; - if (!QuitOut.GetOption()) + if (!QuitOut.getOption()) { //Store _rejoinTime.put(player.getName(), System.currentTimeMillis()); @@ -97,7 +97,7 @@ public abstract class TeamGame extends Game @EventHandler(priority = EventPriority.LOWEST) public void PlayerLoginAllow(PlayerLoginEvent event) { - if (!InProgress() || QuitOut.GetOption()) + if (!InProgress() || QuitOut.getOption()) return; //Rejoined @@ -135,7 +135,7 @@ public abstract class TeamGame extends Game @EventHandler public void playerRejoinGame(PlayerJoinEvent event) { - if (!InProgress() || QuitOut.GetOption()) + if (!InProgress() || QuitOut.getOption()) return; Player player = event.getPlayer(); @@ -150,7 +150,7 @@ public abstract class TeamGame extends Game @EventHandler public void PlayerRejoinExpire(UpdateEvent event) { - if (event.getType() != UpdateType.SEC || QuitOut.GetOption()) + if (event.getType() != UpdateType.SEC || QuitOut.getOption()) return; Iterator rejoinIterator = _rejoinTime.keySet().iterator(); @@ -177,7 +177,7 @@ public abstract class TeamGame extends Game @EventHandler public void RejoinCommand(PlayerCommandPreprocessEvent event) { - if (!QuitOut.GetOption() && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin")) + if (!QuitOut.getOption() && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin")) { String[] toks = event.getMessage().split(" "); @@ -206,7 +206,7 @@ public abstract class TeamGame extends Game if (team.GetPlayers(true).size() > 0) teamsAlive.add(team); - if (!QuitOut.GetOption()) + if (!QuitOut.getOption()) { //Offline Player Team for (GameTeam team : RejoinTeam.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java index 3bfeeaac6..98592b21f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java @@ -35,9 +35,9 @@ public class BaconBrawl extends SoloGame "Last pig in the arena wins!" }); - DamageTeamSelf.SetOption(true); - HungerSet.SetOption(20); - PrepareFreeze.SetOption(false); + DamageTeamSelf.setOption(true); + HungerSet.setOption(20); + PrepareFreeze.setOption(false); registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java index 95c89247b..280233806 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java @@ -54,13 +54,13 @@ public class KitMamaPig extends Kit disguise.setCustomNameVisible(false); Manager.GetDisguise().disguise(disguise); - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); pig.setBaby(); pig.setAgeLock(true); pig.setCustomName(C.cYellow + player.getName()); pig.setCustomNameVisible(false); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); player.setPassenger(pig); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java index fe767cbb1..bfc8111bb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java @@ -39,27 +39,27 @@ public class Barbarians extends SoloGame "Last player alive wins!" }); - this.DamageTeamSelf.SetOption(true); + this.DamageTeamSelf.setOption(true); this.CompassEnabled = true; - this.BlockBreakAllow.GetOption().add(5); - this.BlockBreakAllow.GetOption().add(17); - this.BlockBreakAllow.GetOption().add(18); - this.BlockBreakAllow.GetOption().add(20); - this.BlockBreakAllow.GetOption().add(30); - this.BlockBreakAllow.GetOption().add(47); - this.BlockBreakAllow.GetOption().add(53); - this.BlockBreakAllow.GetOption().add(54); - this.BlockBreakAllow.GetOption().add(58); - this.BlockBreakAllow.GetOption().add(64); - this.BlockBreakAllow.GetOption().add(83); - this.BlockBreakAllow.GetOption().add(85); - this.BlockBreakAllow.GetOption().add(96); - this.BlockBreakAllow.GetOption().add(125); - this.BlockBreakAllow.GetOption().add(126); - this.BlockBreakAllow.GetOption().add(134); - this.BlockBreakAllow.GetOption().add(135); - this.BlockBreakAllow.GetOption().add(136); + this.BlockBreakAllow.getOption().add(5); + this.BlockBreakAllow.getOption().add(17); + this.BlockBreakAllow.getOption().add(18); + this.BlockBreakAllow.getOption().add(20); + this.BlockBreakAllow.getOption().add(30); + this.BlockBreakAllow.getOption().add(47); + this.BlockBreakAllow.getOption().add(53); + this.BlockBreakAllow.getOption().add(54); + this.BlockBreakAllow.getOption().add(58); + this.BlockBreakAllow.getOption().add(64); + this.BlockBreakAllow.getOption().add(83); + this.BlockBreakAllow.getOption().add(85); + this.BlockBreakAllow.getOption().add(96); + this.BlockBreakAllow.getOption().add(125); + this.BlockBreakAllow.getOption().add(126); + this.BlockBreakAllow.getOption().add(134); + this.BlockBreakAllow.getOption().add(135); + this.BlockBreakAllow.getOption().add(136); registerStatTrackers( new BlockBreakStatTracker(this, true) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java index 539c53c79..9f67efba4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java @@ -55,9 +55,9 @@ public class BossBattles extends TeamGame "Fight some bosses" }); - HungerSet.SetOption(20); - CreatureAllowOverride.SetOption(true); - PrepareFreeze.SetOption(false); + HungerSet.setOption(20); + CreatureAllowOverride.setOption(true); + PrepareFreeze.setOption(false); // registerChatStats(Kills); // Game giving constant errors when loading. diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java index 3a864b997..a06c94069 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java @@ -104,13 +104,13 @@ public class Ball _ball.remove(); //Spawn - _host.CreatureAllowOverride.SetOption(true); + _host.CreatureAllowOverride.setOption(true); _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); _ball.setSize(2); UtilEnt.Vegetate(_ball); UtilEnt.ghost(_ball, false, false); - _host.CreatureAllowOverride.SetOption(false); + _host.CreatureAllowOverride.setOption(false); _lastParticle = _ball.getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java index 18ad27ab4..ef68af398 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java @@ -35,7 +35,7 @@ public class BouncyBalls extends SoloGame "BOUNCE" }); - this.HungerSet.SetOption(20); + this.HungerSet.setOption(20); // registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index 3233c00f7..023b4388b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -175,45 +175,45 @@ public class Bridge extends TeamGame implements OreObsfucation _ore = new OreHider(); // Flags - GameTimeout.SetOption(Manager.IsTournamentServer() ? 5400000 : 3600000); + GameTimeout.setOption(Manager.IsTournamentServer() ? 5400000 : 3600000); Manager.GetExplosion().SetLiquidDamage(false); - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - DamageSelf.SetOption(true); + DamageSelf.setOption(true); - ItemDrop.SetOption(true); - ItemPickup.SetOption(true); + ItemDrop.setOption(true); + ItemPickup.setOption(true); - InventoryClick.SetOption(true); + InventoryClick.setOption(true); - AnnounceStay.SetOption(false); + AnnounceStay.setOption(false); - PrivateBlocks.SetOption(true); - BlockBreak.SetOption(true); - BlockPlace.SetOption(true); + PrivateBlocks.setOption(true); + BlockBreak.setOption(true); + BlockPlace.setOption(true); - InventoryOpenBlock.SetOption(true); - InventoryOpenChest.SetOption(true); + InventoryOpenBlock.setOption(true); + InventoryOpenChest.setOption(true); - WorldTimeSet.SetOption(2000); + WorldTimeSet.setOption(2000); - WorldWaterDamage.SetOption(0); - WorldBoundaryKill.SetOption(false); + WorldWaterDamage.setOption(0); + WorldBoundaryKill.setOption(false); CompassEnabled = true; - DeathDropItems.SetOption(true); + DeathDropItems.setOption(true); GemMultiplier = 2.5; - PrepareFreeze.SetOption(false); + PrepareFreeze.setOption(false); //Tournament if (Manager.IsTournamentServer()) { - QuitOut.SetOption(false); + QuitOut.setOption(false); _gameDesc = new String[] { @@ -273,10 +273,10 @@ public class Bridge extends TeamGame implements OreObsfucation if (!WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty()) { - WorldWaterDamage.SetOption(4); + WorldWaterDamage.setOption(4); } - if (WorldWaterDamage.GetOption() > 0) + if (WorldWaterDamage.getOption() > 0) { if (WorldData.MapName.equals("Volcanic Islands")) UtilTextMiddle.display(C.cRed + "Warning", "Water is Boiling Hot", 10, 60, 20); @@ -1084,14 +1084,14 @@ public class Bridge extends TeamGame implements OreObsfucation Entity ent; - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); if (rand > 0.66) ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Cow.class); else if (rand > 0.33) ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Pig.class); else ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Chicken.class); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); _animalSet.get(team).add(ent); } @@ -1395,7 +1395,7 @@ public class Bridge extends TeamGame implements OreObsfucation if (event.getBucket() != Material.WATER_BUCKET) return; - if (WorldWaterDamage.GetOption() > 0) + if (WorldWaterDamage.getOption() > 0) { UtilPlayer.message( event.getPlayer(), @@ -1597,7 +1597,7 @@ public class Bridge extends TeamGame implements OreObsfucation if (team.GetPlayers(true).size() > 0) teamsAlive.add(team); - if (!QuitOut.GetOption()) + if (!QuitOut.getOption()) { //Offline Player Team for (GameTeam team : RejoinTeam.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 826be9ca4..e7341d2a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -165,29 +165,29 @@ public class Build extends SoloGame "based on the build theme!" }); - this.StrictAntiHack.SetOption(true); - this.Damage.SetOption(false); - this.HungerSet.SetOption(20); - this.HealthSet.SetOption(20); + this.StrictAntiHack.setOption(true); + this.Damage.setOption(false); + this.HungerSet.setOption(20); + this.HealthSet.setOption(20); - this.BlockBreak.SetOption(true); - this.BlockPlace.SetOption(true); + this.BlockBreak.setOption(true); + this.BlockPlace.setOption(true); - this.ItemDrop.SetOption(true); - this.ItemPickup.SetOption(true); + this.ItemDrop.setOption(true); + this.ItemPickup.setOption(true); - this.InventoryClick.SetOption(true); + this.InventoryClick.setOption(true); - this.WorldTimeSet.SetOption(6000); + this.WorldTimeSet.setOption(6000); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); - this.CreatureAllow.SetOption(true); + this.CreatureAllow.setOption(true); - this.WorldFireSpread.SetOption(true); - this.WorldBoneMeal.SetOption(true); + this.WorldFireSpread.setOption(true); + this.WorldBoneMeal.setOption(true); - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); UtilServer.getServer().spigot().getConfig().set("view-distance", 4); @@ -275,7 +275,7 @@ public class Build extends SoloGame UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5); - this.WorldTimeSet.SetOption(-1); + this.WorldTimeSet.setOption(-1); } } @@ -353,13 +353,13 @@ public class Build extends SoloGame _buildStateTime = System.currentTimeMillis(); //Flags - this.BlockBreak.SetOption(false); - this.BlockPlace.SetOption(false); + this.BlockBreak.setOption(false); + this.BlockPlace.setOption(false); - this.ItemDrop.SetOption(false); - this.ItemPickup.SetOption(false); + this.ItemDrop.setOption(false); + this.ItemPickup.setOption(false); - this.InventoryClick.SetOption(false); + this.InventoryClick.setOption(false); UtilTextMiddle.display(null, C.cYellow + "TIME IS UP!", 0, 60, 5); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java index b6571ba79..735d7781f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java @@ -60,14 +60,14 @@ public class Cards extends SoloGame "based on the build theme!" }); - this.StrictAntiHack.SetOption(true); - this.Damage.SetOption(false); - this.HungerSet.SetOption(20); - this.HealthSet.SetOption(20); + this.StrictAntiHack.setOption(true); + this.Damage.setOption(false); + this.HungerSet.setOption(20); + this.HealthSet.setOption(20); - this.WorldTimeSet.SetOption(6000); + this.WorldTimeSet.setOption(6000); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); _cardFactory = new CardFactory(); 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 7f68a616e..3253d9c54 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 @@ -192,12 +192,12 @@ public class CastleSiege extends TeamGame }; - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - this.HungerSet.SetOption(20); - this.DeathOut.SetOption(false); - this.WorldTimeSet.SetOption(14000); //14000 - this.BlockPlaceAllow.GetOption().add(85); + this.HungerSet.setOption(20); + this.DeathOut.setOption(false); + this.WorldTimeSet.setOption(14000); //14000 + this.BlockPlaceAllow.getOption().add(85); _kingName = C.cYellow + C.Bold + "King Sparklez"; @@ -307,9 +307,9 @@ public class CastleSiege extends TeamGame if (GetKits().length <= 5 + i) continue; - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); Manager.GetLobby().AddKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("PINK").get(i)); } @@ -323,9 +323,9 @@ public class CastleSiege extends TeamGame for (Location loc : _horseSpawns) { - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Horse horse = loc.getWorld().spawn(loc, Horse.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); horse.setAdult(); horse.setAgeLock(true); @@ -387,7 +387,7 @@ public class CastleSiege extends TeamGame return; //Spawn King - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); _kingLoc = _kingLocs.get(UtilMath.r(_kingLocs.size())); @@ -404,7 +404,7 @@ public class CastleSiege extends TeamGame _king.setRemoveWhenFarAway(false); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } @EventHandler(priority = EventPriority.HIGH) @@ -555,7 +555,7 @@ public class CastleSiege extends TeamGame Scoreboard.Write(_kingHealth + " Health"); } - long timeLeft = 24000 - WorldTimeSet.GetOption(); + long timeLeft = 24000 - WorldTimeSet.getOption(); timeLeft = timeLeft / 20 * 1000; @@ -584,7 +584,7 @@ public class CastleSiege extends TeamGame if (!IsLive()) return; - if (this.WorldTimeSet.GetOption() > 24100) + if (this.WorldTimeSet.getOption() > 24100) { SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the siege!"); @@ -937,7 +937,7 @@ public class CastleSiege extends TeamGame if (event.getType() != UpdateType.TICK) return; - WorldTimeSet.SetOption(WorldTimeSet.GetOption() + 1); + WorldTimeSet.setOption(WorldTimeSet.getOption() + 1); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java index 7551da2e8..e268162f6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java @@ -67,16 +67,16 @@ public class ChampionsCTF extends CaptureTheFlag Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - InventoryOpenChest.SetOption(true); + InventoryOpenChest.setOption(true); EloRanking = false; EloStart = 1000; - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); - this.DisableKillCommand.SetOption(false); + this.DisableKillCommand.setOption(false); registerStatTrackers( new KillReasonStatTracker(this, "Backstab", "Assassination", false), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java index 975c7928c..50467553e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java @@ -62,16 +62,16 @@ public class ChampionsDominate extends Domination Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - InventoryOpenChest.SetOption(true); + InventoryOpenChest.setOption(true); EloRanking = false; EloStart = 1000; - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); - this.DisableKillCommand.SetOption(false); + this.DisableKillCommand.setOption(false); registerStatTrackers( new KillReasonStatTracker(this, "Backstab", "Assassination", false), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java index b89d8b19f..bc9333d5f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java @@ -63,13 +63,13 @@ public class ChampionsTDM extends TeamDeathmatch Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - InventoryOpenChest.SetOption(true); + InventoryOpenChest.setOption(true); - this.DisableKillCommand.SetOption(false); + this.DisableKillCommand.setOption(false); - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); registerStatTrackers( new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java index 48df41bf9..b8f295cb9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java @@ -148,10 +148,10 @@ public class Christmas extends SoloGame "Defeat the Thief who stole the Presents!" }); - BlockBreakAllow.GetOption().add(4); - HungerSet.SetOption(20); - WorldTimeSet.SetOption(2000); - PrepareFreeze.SetOption(false); + BlockBreakAllow.getOption().add(4); + HungerSet.setOption(20); + WorldTimeSet.setOption(2000); + PrepareFreeze.setOption(false); registerChatStats( DamageDealt, @@ -332,7 +332,7 @@ public class Christmas extends SoloGame Location loc = christmas.GetSleigh().GetLocation(); - christmas.CreatureAllowOverride.SetOption(true); + christmas.CreatureAllowOverride.setOption(true); for (int i=0 ; i<20 ; i++) { Location elfLoc = UtilBlock.getHighest(loc.getWorld(), (int)(loc.getX() + 20 - Math.random()*40), (int)(loc.getZ() + 20 - Math.random()*40)).getLocation().add(0.5, 0.5, 0.5); @@ -345,7 +345,7 @@ public class Christmas extends SoloGame elf.setCustomName("Elf"); } - christmas.CreatureAllowOverride.SetOption(false); + christmas.CreatureAllowOverride.setOption(false); } }, 20); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java index 9be9f4d2a..f94a384fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java @@ -46,7 +46,7 @@ public class Sleigh { Host = host; - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Target = loc.clone(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java index fcf9760b3..2561f05d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java @@ -55,9 +55,9 @@ public class BossMobs _lastSpawn = System.currentTimeMillis(); //Spawn - Host.Host.CreatureAllowOverride.SetOption(true); + Host.Host.CreatureAllowOverride.setOption(true); Creature ent = UtilAlg.Random(_spawns).getWorld().spawn(UtilAlg.Random(_spawns), Skeleton.class); - Host.Host.CreatureAllowOverride.SetOption(false); + Host.Host.CreatureAllowOverride.setOption(false); //Weapon double r = Math.random(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java index 8ebb2395d..878caf77c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java @@ -106,7 +106,7 @@ public class BossSnowmanPattern _lastSpawn = System.currentTimeMillis(); - Host.Host.CreatureAllowOverride.SetOption(true); + Host.Host.CreatureAllowOverride.setOption(true); //Spawn A for (int i=0 ; i<_spawnA.size() ; i++) @@ -134,7 +134,7 @@ public class BossSnowmanPattern _ents.add(new BossSnowman(ent, loc, _bDir)); } - Host.Host.CreatureAllowOverride.SetOption(false); + Host.Host.CreatureAllowOverride.setOption(false); } private void MoveDieHit() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java index 38412db30..a43ff2214 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java @@ -27,9 +27,9 @@ public class CaveGiant { Host = host; - Host.Host.CreatureAllowOverride.SetOption(true); + Host.Host.CreatureAllowOverride.setOption(true); _ent = loc.getWorld().spawn(loc, Giant.class); - Host.Host.CreatureAllowOverride.SetOption(false); + Host.Host.CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(_ent); _ent.setMaxHealth(300); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java index 42f0b5a05..f9c7d4178 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java @@ -44,9 +44,9 @@ public class PumpkinKing _grid = grid; - Host.Host.CreatureAllowOverride.SetOption(true); + Host.Host.CreatureAllowOverride.setOption(true); _ent = loc.getWorld().spawn(loc, Skeleton.class); - Host.Host.CreatureAllowOverride.SetOption(false); + Host.Host.CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(_ent); UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java index 62581c57d..b7419ff96 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java @@ -43,7 +43,7 @@ public class SnowmanBoss _minions = new ArrayList(); //Spawn - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); for (int i=0 ; i<14 ; i++) _minions.add(new SnowmanMinion(_spawn.getWorld().spawn(_spawn, Snowman.class))); @@ -53,7 +53,7 @@ public class SnowmanBoss _heart.setHealth(1400); UtilEnt.Vegetate(_heart); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); //Stack Entity base = null; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java index 8848fefd5..0bf9245fe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java @@ -258,9 +258,9 @@ public class SnowmanMaze { Location loc = UtilAlg.Random(_spawns); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java index a32869329..432e74691 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java @@ -93,9 +93,9 @@ public class SnowmanWaveA continue; Location loc = _spawns.get(i); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java index 7a1685db7..db4b36a6d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java @@ -90,9 +90,9 @@ public class SnowmanWaveB _lastPositions.add(i); Location loc = _spawns.get(i); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java index 4822fb771..85e4a9e70 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java @@ -71,9 +71,9 @@ public abstract class Part implements Listener Location standLoc = loc.clone().add(0, -1.45, 0); standLoc.setYaw(UtilMath.r(100)); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); ArmorStand stand = loc.getWorld().spawn(standLoc, ArmorStand.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); stand.setVisible(false); stand.setGravity(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java index ada7c6d0e..af69cf40e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java @@ -118,11 +118,11 @@ public class Part1 extends Part //Create Location loc = UtilAlg.Random(_skeletons); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Skeleton skel = loc.getWorld().spawn(loc, Skeleton.class); skel.getEquipment().setItemInHand(new ItemStack(Material.WOOD_HOE)); skel.setHealth(4); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); this.AddCreature(skel); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java index 717fd8b78..54971343e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java @@ -127,9 +127,9 @@ public class Part2 extends Part //Create Location loc = UtilAlg.Random(_spiders); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Skeleton ent = loc.getWorld().spawn(loc, Skeleton.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); DisguiseSpider disguise = new DisguiseSpider(ent); Host.Manager.GetDisguise().disguise(disguise); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java index f851ad316..e3e5b14b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java @@ -179,9 +179,9 @@ public class Part4 extends Part //Create Location loc = UtilAlg.Random(_mobSpawns); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Zombie ent = loc.getWorld().spawn(loc, Zombie.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); ent.getEquipment().setItemInHand(new ItemStack(Material.WOOD_PICKAXE)); ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java index fe48fdf18..f064d89be 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java @@ -98,12 +98,12 @@ public class CaptureTheFlag extends TeamGame }); - this.DeathOut.SetOption(false); - this.PrepareFreeze.SetOption(true); - this.HungerSet.SetOption(20); - this.WorldTimeSet.SetOption(2000); + this.DeathOut.setOption(false); + this.PrepareFreeze.setOption(true); + this.HungerSet.setOption(20); + this.WorldTimeSet.setOption(2000); - this.DeathSpectateSecs.SetOption(10); + this.DeathSpectateSecs.setOption(10); } @Override @@ -129,7 +129,7 @@ public class CaptureTheFlag extends TeamGame if (this instanceof ChampionsCTF) { - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("LIGHT_BLUE").size() && i < WorldData.GetDataLocs("PINK").size(); i++) { Entity ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); @@ -138,7 +138,7 @@ public class CaptureTheFlag extends TeamGame ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("LIGHT_BLUE").get(i)); Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("LIGHT_BLUE").get(i)); } - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); } //End kit spawning @@ -247,7 +247,7 @@ public class CaptureTheFlag extends TeamGame else { _suddenDeath = true; - this.DeathOut.SetOption(true); + this.DeathOut.setOption(true); UtilTextMiddle.display(C.cYellow + "Sudden Death", "Next Capture Wins! No Respawns!"); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index 547cb424a..72873ed9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -80,12 +80,12 @@ public class Domination extends TeamGame }); - this.DeathOut.SetOption(false); - this.PrepareFreeze.SetOption(true); - this.HungerSet.SetOption(20); - this.WorldTimeSet.SetOption(2000); + this.DeathOut.setOption(false); + this.PrepareFreeze.setOption(true); + this.HungerSet.setOption(20); + this.WorldTimeSet.setOption(2000); - this.DeathSpectateSecs.SetOption(10); + this.DeathSpectateSecs.setOption(10); //this.QuitOut = false; } @@ -113,7 +113,7 @@ public class Domination extends TeamGame //Spawn Kits if (this instanceof ChampionsDominate) { - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("RED").size() && i < WorldData.GetDataLocs("BLUE").size(); i++) { @@ -124,7 +124,7 @@ public class Domination extends TeamGame Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("BLUE").get(i)); } - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java index 1116a4a33..73e6d0311 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java @@ -74,9 +74,9 @@ public class TeamDeathmatch extends TeamGame }); - this.DeathOut.SetOption(true); - this.HungerSet.SetOption(20); - this.WorldTimeSet.SetOption(2000); + this.DeathOut.setOption(true); + this.HungerSet.setOption(20); + this.WorldTimeSet.setOption(2000); this.CompassEnabled = true; this.Manager.GetDamage().UseSimpleWeaponDamage = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index c7299df4c..e81cfc72f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -63,14 +63,14 @@ public class DeathTag extends SoloGame "The last Runner alive wins!" }); - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - this.DeathOut.SetOption(false); - this.HungerSet.SetOption(20); + this.DeathOut.setOption(false); + this.HungerSet.setOption(20); this.CompassEnabled = true; - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); registerStatTrackers(new ComeAtMeBroStatTracker(this)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 447ebe3b9..7edcc0bcd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -114,9 +114,9 @@ public class DragonEscape extends SoloGame "Last player alive wins!" }); - this.DamagePvP.SetOption(false); - this.HungerSet.SetOption(20); - this.BlockPlace.SetOption(true); + this.DamagePvP.setOption(false); + this.HungerSet.setOption(20); + this.BlockPlace.setOption(true); registerStatTrackers( new ParalympicsStatTracker(this), @@ -176,10 +176,10 @@ public class DragonEscape extends SoloGame _speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d; if (WorldData.MapName.contains("Hell")) - this.WorldTimeSet.SetOption(16000); + this.WorldTimeSet.setOption(16000); if (WorldData.MapName.contains("Pirate")) - this.WorldWaterDamage.SetOption(2); + this.WorldWaterDamage.setOption(2); } @EventHandler @@ -191,9 +191,9 @@ public class DragonEscape extends SoloGame for (Team team : GetScoreboard().GetScoreboard().getTeams()) team.setCanSeeFriendlyInvisibles(true); - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java index 07777fef5..fa3e14320 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java @@ -81,8 +81,8 @@ public class DragonEscapeTeams extends TeamGame "Last player alive wins!" }); - this.DamagePvP.SetOption(false); - this.HungerSet.SetOption(20); + this.DamagePvP.setOption(false); + this.HungerSet.setOption(20); this.TeamArmorHotbar = true; @@ -159,7 +159,7 @@ public class DragonEscapeTeams extends TeamGame _speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d; if (WorldData.MapName.contains("Hell")) - this.WorldTimeSet.SetOption(16000); + this.WorldTimeSet.setOption(16000); } @EventHandler @@ -174,9 +174,9 @@ public class DragonEscapeTeams extends TeamGame if (event.GetState() != GameState.Prepare) return; - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java index 8c8cd4e0b..57bcc8e69 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java @@ -39,10 +39,10 @@ public class DragonData Location = rider.getLocation(); //Spawn Dragon - manager.GetGame().CreatureAllowOverride.SetOption(true); + manager.GetGame().CreatureAllowOverride.setOption(true); Dragon = rider.getWorld().spawn(rider.getLocation(), EnderDragon.class); UtilEnt.Vegetate(Dragon); - manager.GetGame().CreatureAllowOverride.SetOption(false); + manager.GetGame().CreatureAllowOverride.setOption(false); rider.getWorld().playSound(rider.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java index 3470056e8..9ec44326e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java @@ -22,8 +22,8 @@ public class DragonRiders extends SoloGame }); - this.Damage.SetOption(false); - this.HungerSet.SetOption(20); + this.Damage.setOption(false); + this.HungerSet.setOption(20); //Chat stats registerChatStats(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java index 68eabad10..496a56664 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java @@ -59,9 +59,9 @@ public class Dragons extends SoloGame "Last player alive wins!" }); - this.DamagePvP.SetOption(false); - this.HungerSet.SetOption(20); - this.WorldWaterDamage.SetOption(4); + this.DamagePvP.setOption(false); + this.HungerSet.setOption(20); + this.WorldWaterDamage.setOption(4); registerStatTrackers( new SparklezStatTracker(this) @@ -153,10 +153,10 @@ public class Dragons extends SoloGame if (_dragons.size() < 7) { - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); UtilEnt.Vegetate(ent); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java index 66ff4f708..e981baadd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java @@ -66,10 +66,10 @@ public class DragonsTeams extends TeamGame "Team with longest time survived wins!" }); - this.DamagePvP.SetOption(false); - this.HungerSet.SetOption(20); - this.WorldWaterDamage.SetOption(4); - this.PrepareFreeze.SetOption(false); + this.DamagePvP.setOption(false); + this.HungerSet.setOption(20); + this.WorldWaterDamage.setOption(4); + this.PrepareFreeze.setOption(false); this.TeamArmor = true; this.TeamArmorHotbar = true; @@ -157,10 +157,10 @@ public class DragonsTeams extends TeamGame if (_dragons.size() < 7) { - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); UtilEnt.Vegetate(ent); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index 465ec1f06..5b1a39346 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -111,10 +111,10 @@ public class Draw extends SoloGame "Hints are given at top of screen", }); - this.StrictAntiHack.SetOption(true); - this.Damage.SetOption(false); - this.HungerSet.SetOption(20); - this.WorldTimeSet.SetOption(8000); + this.StrictAntiHack.setOption(true); + this.Damage.setOption(false); + this.HungerSet.setOption(20); + this.WorldTimeSet.setOption(8000); _words = new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index f64756d4c..0e8763fe6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -113,41 +113,41 @@ public class EventGame extends Game "" }); - this.JoinInProgress.SetOption(true); + this.JoinInProgress.setOption(true); - this.DamageTeamSelf.SetOption(true); - this.DamagePvP.SetOption(false); - this.DamageEvP.SetOption(false); - this.DamagePvE.SetOption(false); + this.DamageTeamSelf.setOption(true); + this.DamagePvP.setOption(false); + this.DamageEvP.setOption(false); + this.DamagePvE.setOption(false); - this.DeathMessages.SetOption(false); - this.DeathOut.SetOption(false); + this.DeathMessages.setOption(false); + this.DeathOut.setOption(false); this.CanAddStats = false; this.CanGiveLoot = false; - this.GadgetsDisabled.SetOption(false); + this.GadgetsDisabled.setOption(false); - this.TeleportsDisqualify.SetOption(false); + this.TeleportsDisqualify.setOption(false); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); - this.BlockPlaceCreative.SetOption(true); - this.BlockBreakCreative.SetOption(true); + this.BlockPlaceCreative.setOption(true); + this.BlockBreakCreative.setOption(true); - this.InventoryClick.SetOption(true); - this.InventoryOpenBlock.SetOption(true); - this.InventoryOpenChest.SetOption(true); + this.InventoryClick.setOption(true); + this.InventoryOpenBlock.setOption(true); + this.InventoryOpenChest.setOption(true); //Dont timeout - this.GameTimeout.SetOption(-1); + this.GameTimeout.setOption(-1); _mps = manager.GetGameHostManager(); _functionSigns = new HashMap<>(); _powerdedSigns = new ArrayList<>(); - this.CreatureAllow.SetOption(true); + this.CreatureAllow.setOption(true); _customAreas = new HashMap<>(); } @@ -989,13 +989,13 @@ public class EventGame extends Game if(Manager.GetEventModule().getDamagePlayers().contains(event.GetDamagerPlayer(true))) { - if(!Manager.GetGame().DamagePvP.GetOption()) + if(!Manager.GetGame().DamagePvP.getOption()) { - Manager.GetGame().Damage.SetOption(true); - Manager.GetGame().DamagePvP.SetOption(true); + Manager.GetGame().Damage.setOption(true); + Manager.GetGame().DamagePvP.setOption(true); Bukkit.getPluginManager().callEvent(event); - Manager.GetGame().DamagePvP.SetOption(false); - Manager.GetGame().Damage.SetOption(false); + Manager.GetGame().DamagePvP.setOption(false); + Manager.GetGame().Damage.setOption(false); } return; } @@ -1032,13 +1032,13 @@ public class EventGame extends Game continue; } } - if(!Manager.GetGame().DamagePvP.GetOption()) + if(!Manager.GetGame().DamagePvP.getOption()) { - Manager.GetGame().Damage.SetOption(true); - Manager.GetGame().DamagePvP.SetOption(true); + Manager.GetGame().Damage.setOption(true); + Manager.GetGame().DamagePvP.setOption(true); Bukkit.getPluginManager().callEvent(event); - Manager.GetGame().DamagePvP.SetOption(false); - Manager.GetGame().Damage.SetOption(false); + Manager.GetGame().DamagePvP.setOption(false); + Manager.GetGame().Damage.setOption(false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 78cdf0785..ca174447e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -303,28 +303,28 @@ public class EventModule extends MiniPlugin //XXX Settings else if (event.getMessage().toLowerCase().equals("/e damage all")) { - Manager.GetGame().Damage.SetOption(!Manager.GetGame().Damage.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage All", F.tf(Manager.GetGame().Damage.GetOption())))); + Manager.GetGame().Damage.setOption(!Manager.GetGame().Damage.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage All", F.tf(Manager.GetGame().Damage.getOption())))); } else if (event.getMessage().toLowerCase().equals("/e damage pvp")) { - Manager.GetGame().DamagePvP.SetOption(!Manager.GetGame().DamagePvP.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP.GetOption())))); + Manager.GetGame().DamagePvP.setOption(!Manager.GetGame().DamagePvP.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP.getOption())))); } else if (event.getMessage().toLowerCase().equals("/e damage pve")) { - Manager.GetGame().DamagePvE.SetOption(!Manager.GetGame().DamagePvE.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE.GetOption())))); + Manager.GetGame().DamagePvE.setOption(!Manager.GetGame().DamagePvE.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE.getOption())))); } else if (event.getMessage().toLowerCase().equals("/e damage evp")) { - Manager.GetGame().DamageEvP.SetOption(!Manager.GetGame().DamageEvP.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP.GetOption())))); + Manager.GetGame().DamageEvP.setOption(!Manager.GetGame().DamageEvP.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP.getOption())))); } else if (event.getMessage().toLowerCase().equals("/e damage fall")) { - Manager.GetGame().DamageFall.SetOption(!Manager.GetGame().DamageFall.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.GetOption())))); + Manager.GetGame().DamageFall.setOption(!Manager.GetGame().DamageFall.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.getOption())))); } else if (args[0].equalsIgnoreCase("health")) { @@ -336,18 +336,18 @@ public class EventModule extends MiniPlugin } else if (event.getMessage().toLowerCase().equals("/e item drop")) { - Manager.GetGame().ItemDrop.SetOption(!Manager.GetGame().ItemDrop.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop.GetOption())))); + Manager.GetGame().ItemDrop.setOption(!Manager.GetGame().ItemDrop.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop.getOption())))); } else if (event.getMessage().toLowerCase().equals("/e item pickup")) { - Manager.GetGame().ItemPickup.SetOption(!Manager.GetGame().ItemPickup.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup.GetOption())))); + Manager.GetGame().ItemPickup.setOption(!Manager.GetGame().ItemPickup.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup.getOption())))); } else if (event.getMessage().toLowerCase().equals("/e blockplace")) { - Manager.GetGame().BlockPlace.SetOption(!Manager.GetGame().BlockPlace.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Place", F.tf(Manager.GetGame().BlockPlace.GetOption())))); + Manager.GetGame().BlockPlace.setOption(!Manager.GetGame().BlockPlace.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Place", F.tf(Manager.GetGame().BlockPlace.getOption())))); } else if (args.length >= 4 && args[0].equalsIgnoreCase("blockplace") && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist"))) @@ -356,8 +356,8 @@ public class EventModule extends MiniPlugin } else if (event.getMessage().toLowerCase().equals("/e blockbreak")) { - Manager.GetGame().BlockBreak.SetOption(!Manager.GetGame().BlockBreak.GetOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Break", F.tf(Manager.GetGame().BlockBreak.GetOption())))); + Manager.GetGame().BlockBreak.setOption(!Manager.GetGame().BlockBreak.getOption()); + Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Break", F.tf(Manager.GetGame().BlockBreak.getOption())))); } else if (args.length >= 4 && args[0].equalsIgnoreCase("blockbreak") && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist"))) @@ -456,32 +456,32 @@ public class EventModule extends MiniPlugin public void listSettings(Player player) { - UtilPlayer.message(player, F.value("Damage All", F.tf(Manager.GetGame().Damage.GetOption()))); - UtilPlayer.message(player, F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP.GetOption()))); - UtilPlayer.message(player, F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE.GetOption()))); - UtilPlayer.message(player, F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP.GetOption()))); - UtilPlayer.message(player, F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.GetOption()))); + UtilPlayer.message(player, F.value("Damage All", F.tf(Manager.GetGame().Damage.getOption()))); + UtilPlayer.message(player, F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP.getOption()))); + UtilPlayer.message(player, F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE.getOption()))); + UtilPlayer.message(player, F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP.getOption()))); + UtilPlayer.message(player, F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.getOption()))); UtilPlayer.message(player, F.value("Health Set", Manager.GetGame().HealthSet+"")); UtilPlayer.message(player, F.value("Hunger Set", Manager.GetGame().HungerSet+"")); - UtilPlayer.message(player, F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup.GetOption()))); - UtilPlayer.message(player, F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop.GetOption()))); - UtilPlayer.message(player, F.value("Block Place Creative", F.tf(Manager.GetGame().BlockPlaceCreative.GetOption()))); - UtilPlayer.message(player, F.value("Block Break Creative", F.tf(Manager.GetGame().BlockBreakCreative.GetOption()))); - UtilPlayer.message(player, F.value("Block Place", F.tf(Manager.GetGame().BlockPlace.GetOption()))); - UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.GetOption(), true))); - UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.GetOption(), true))); - UtilPlayer.message(player, F.value("Block Break", F.tf(Manager.GetGame().BlockPlace.GetOption()))); - UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.GetOption(), true))); - UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.GetOption(), true))); + UtilPlayer.message(player, F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup.getOption()))); + UtilPlayer.message(player, F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop.getOption()))); + UtilPlayer.message(player, F.value("Block Place Creative", F.tf(Manager.GetGame().BlockPlaceCreative.getOption()))); + UtilPlayer.message(player, F.value("Block Break Creative", F.tf(Manager.GetGame().BlockBreakCreative.getOption()))); + UtilPlayer.message(player, F.value("Block Place", F.tf(Manager.GetGame().BlockPlace.getOption()))); + UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.getOption(), true))); + UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.getOption(), true))); + UtilPlayer.message(player, F.value("Block Break", F.tf(Manager.GetGame().BlockPlace.getOption()))); + UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.getOption(), true))); + UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.getOption(), true))); UtilPlayer.message(player, F.value("Time Set", Manager.GetGame().WorldTimeSet+"")); UtilPlayer.message(player, F.value("Mob griefing", F.tf(_mobGriefing))); } public void commandBlockBreakInCreative(Player player, String[] args) { - Manager.GetGame().BlockBreakCreative.SetOption(!Manager.GetGame().BlockBreakCreative.GetOption()); + Manager.GetGame().BlockBreakCreative.setOption(!Manager.GetGame().BlockBreakCreative.getOption()); - UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative.GetOption()))); + UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative.getOption()))); } public void commandStacker(Player player, String[] args) @@ -513,9 +513,9 @@ public class EventModule extends MiniPlugin public void commandBlockPlaceInCreative(Player player, String[] args) { - Manager.GetGame().BlockPlaceCreative.SetOption(!Manager.GetGame().BlockPlaceCreative.GetOption()); + Manager.GetGame().BlockPlaceCreative.setOption(!Manager.GetGame().BlockPlaceCreative.getOption()); - UtilPlayer.message(player, F.main("Settings", "BlockPlaceCreative: " + F.tf(Manager.GetGame().BlockPlaceCreative.GetOption()))); + UtilPlayer.message(player, F.main("Settings", "BlockPlaceCreative: " + F.tf(Manager.GetGame().BlockPlaceCreative.getOption()))); } public void commandMobGriefing(Player player, String[] args) @@ -535,44 +535,44 @@ public class EventModule extends MiniPlugin { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockPlaceAllow.GetOption().add(blockId); + Manager.GetGame().BlockPlaceAllow.getOption().add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockPlaceAllow.GetOption().remove(blockId); + Manager.GetGame().BlockPlaceAllow.getOption().remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockPlaceAllow.GetOption().clear(); + Manager.GetGame().BlockPlaceAllow.getOption().clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.GetOption(), true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.getOption(), true)))); } } else { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockPlaceDeny.GetOption().add(blockId); + Manager.GetGame().BlockPlaceDeny.getOption().add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockPlaceDeny.GetOption().remove(blockId); + Manager.GetGame().BlockPlaceDeny.getOption().remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockPlaceDeny.GetOption().clear(); + Manager.GetGame().BlockPlaceDeny.getOption().clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.GetOption(), true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.getOption(), true)))); } } @@ -596,44 +596,44 @@ public class EventModule extends MiniPlugin { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockBreakAllow.GetOption().add(blockId); + Manager.GetGame().BlockBreakAllow.getOption().add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockBreakAllow.GetOption().remove(blockId); + Manager.GetGame().BlockBreakAllow.getOption().remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockBreakAllow.GetOption().clear(); + Manager.GetGame().BlockBreakAllow.getOption().clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.GetOption(), true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.getOption(), true)))); } } else { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockBreakDeny.GetOption().add(blockId); + Manager.GetGame().BlockBreakDeny.getOption().add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockBreakDeny.GetOption().remove(blockId); + Manager.GetGame().BlockBreakDeny.getOption().remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockBreakDeny.GetOption().clear(); + Manager.GetGame().BlockBreakDeny.getOption().clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.GetOption(), true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.getOption(), true)))); } } @@ -660,9 +660,9 @@ public class EventModule extends MiniPlugin if (health > 20) health = 20; - Manager.GetGame().HealthSet.SetOption(health); + Manager.GetGame().HealthSet.setOption(health); - if (Manager.GetGame().HealthSet.GetOption() == -1) + if (Manager.GetGame().HealthSet.getOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", Manager.GetGame().HealthSet + ""))); @@ -691,9 +691,9 @@ public class EventModule extends MiniPlugin if (hunger > 20) hunger = 20; - Manager.GetGame().HungerSet.SetOption(hunger); + Manager.GetGame().HungerSet.setOption(hunger); - if (Manager.GetGame().HungerSet.GetOption() == -1) + if (Manager.GetGame().HungerSet.getOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", Manager.GetGame().HungerSet + ""))); @@ -722,9 +722,9 @@ public class EventModule extends MiniPlugin if (time > 24000) time = 24000; - Manager.GetGame().WorldTimeSet.SetOption(time); + Manager.GetGame().WorldTimeSet.setOption(time); - if (Manager.GetGame().WorldTimeSet.GetOption() == -1) + if (Manager.GetGame().WorldTimeSet.getOption() == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", Manager.GetGame().WorldTimeSet + ""))); @@ -1017,25 +1017,25 @@ public class EventModule extends MiniPlugin //Spec public void commandSpectators(Player player, String[] args) { - Manager.GetGame().JoinInProgress.SetOption(!Manager.GetGame().JoinInProgress.GetOption()); + Manager.GetGame().JoinInProgress.setOption(!Manager.GetGame().JoinInProgress.getOption()); - UtilPlayer.message(player, F.main("Settings", "Spectator Join: " + F.tf(Manager.GetGame().JoinInProgress.GetOption()))); + UtilPlayer.message(player, F.main("Settings", "Spectator Join: " + F.tf(Manager.GetGame().JoinInProgress.getOption()))); } //Deathout public void commandDeathout(Player player, String[] args) { - Manager.GetGame().DeathOut.SetOption(!Manager.GetGame().DeathOut.GetOption()); + Manager.GetGame().DeathOut.setOption(!Manager.GetGame().DeathOut.getOption()); - UtilPlayer.message(player, F.main("Settings", "Deathout: " + F.tf(Manager.GetGame().DeathOut.GetOption()))); + UtilPlayer.message(player, F.main("Settings", "Deathout: " + F.tf(Manager.GetGame().DeathOut.getOption()))); } //QuitOut public void commandQuitOut(Player player, String[] args) { - Manager.GetGame().QuitOut.SetOption(!Manager.GetGame().QuitOut.GetOption()); + Manager.GetGame().QuitOut.setOption(!Manager.GetGame().QuitOut.getOption()); - UtilPlayer.message(player, F.main("Settings", "QuitOut: " + F.tf(Manager.GetGame().QuitOut.GetOption()))); + UtilPlayer.message(player, F.main("Settings", "QuitOut: " + F.tf(Manager.GetGame().QuitOut.getOption()))); } //Double Jump @@ -1246,9 +1246,9 @@ public class EventModule extends MiniPlugin HashSet entSet = new HashSet(); for (int i = 0 ; i < count ; i++) { - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock((HashSet)null, 150).getLocation().add(0.5, 1, 0.5), type)); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); } //Search Vars diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index d5cc56300..246aebce5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -130,13 +130,13 @@ public class Evolution extends SoloGame "First to get through " + _mobKits.size() + " evolutions wins!" }; - DamageTeamSelf.SetOption(true); + DamageTeamSelf.setOption(true); - HungerSet.SetOption(20); + HungerSet.setOption(20); - DeathOut.SetOption(false); + DeathOut.setOption(false); - PrepareFreeze.SetOption(false); + PrepareFreeze.setOption(false); GemKillDeathRespawn = 2; GemAssistDeathRespawn = .5; @@ -144,13 +144,13 @@ public class Evolution extends SoloGame CompassEnabled = true; CompassGiveItem = false; - AutomaticRespawn.SetOption(false); - DeathSpectateSecs.SetOption(4.0); + AutomaticRespawn.setOption(false); + DeathSpectateSecs.setOption(4.0); - CreatureAllow.SetOption(false); - InventoryClick.SetOption(false); + CreatureAllow.setOption(false); + InventoryClick.setOption(false); - InventoryOpenBlock.SetOption(false); + InventoryOpenBlock.setOption(false); Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.Attack); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index 7013c46ce..c0c20bf6d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -103,18 +103,18 @@ public class Gladiators extends SoloGame "There is only one victor!" }); - Damage.SetOption(true); - DamageFall.SetOption(false); - DamagePvP.SetOption(true); - DamageSelf.SetOption(true); - DamageTeamSelf.SetOption(true); - HungerSet.SetOption(20); - DontAllowOverfill.SetOption(true); + Damage.setOption(true); + DamageFall.setOption(false); + DamagePvP.setOption(true); + DamageSelf.setOption(true); + DamageTeamSelf.setOption(true); + HungerSet.setOption(20); + DontAllowOverfill.setOption(true); EnableTutorials = false; - BlockBreakAllow.GetOption().add(Material.SUGAR_CANE_BLOCK.getId()); - BlockBreakAllow.GetOption().add(Material.DEAD_BUSH.getId()); - BlockBreakAllow.GetOption().add(Material.LONG_GRASS.getId()); + BlockBreakAllow.getOption().add(Material.SUGAR_CANE_BLOCK.getId()); + BlockBreakAllow.getOption().add(Material.DEAD_BUSH.getId()); + BlockBreakAllow.getOption().add(Material.LONG_GRASS.getId()); registerStatTrackers( new BrawlerTracker(this), @@ -156,10 +156,10 @@ public class Gladiators extends SoloGame e.getTutorial().getPhase(1).setLocation(white); e.getTutorial().getPhase(1).setTarget(orange); - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); Zombie zombie1 = (Zombie) WorldData.World.spawnEntity(spawn1, EntityType.ZOMBIE); Zombie zombie2 = (Zombie) WorldData.World.spawnEntity(spawn2, EntityType.ZOMBIE); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); for (Zombie zombie : Arrays.asList(zombie1, zombie2)) { GameProfile tiger = new ProfileLoader(UUIDFetcher.getUUIDOf("WilliamTiger").toString(), "WilliamTiger").loadProfile(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index ab9766157..799594a15 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -107,14 +107,14 @@ public class Gravity extends SoloGame "Restore Oxygen at the Emerald Blocks", }; - this.DamagePvP.SetOption(false); - this.HungerSet.SetOption(10); + this.DamagePvP.setOption(false); + this.HungerSet.setOption(10); - this.WorldTimeSet.SetOption(18000); + this.WorldTimeSet.setOption(18000); this.CompassEnabled = true; - this.WorldBoundaryKill.SetOption(false); + this.WorldBoundaryKill.setOption(false); registerChatStats( Kills, @@ -327,9 +327,9 @@ public class Gravity extends SoloGame //Projectile Vector velocity = player.getLocation().getDirection().multiply(0.4); - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Slime slime = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection().multiply(2)), Slime.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); slime.setSize(1); UtilEnt.Vegetate(slime, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java index 981f6f808..35c057b57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java @@ -47,9 +47,9 @@ public abstract class GravityObject else Vel = new Vector(0,0,0); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Base = ent.getWorld().spawn(ent.getLocation().subtract(0, 0, 0), Zombie.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); Base.setMaxHealth(60); Base.setHealth(60); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index 06371896b..e2f439b02 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -123,20 +123,20 @@ public class Halloween extends SoloGame "Kill the Pumpkin King" }); - this.DamagePvP.SetOption(false); + this.DamagePvP.setOption(false); - this.WorldTimeSet.SetOption(16000); + this.WorldTimeSet.setOption(16000); - this.ItemDrop.SetOption(false); - this.ItemPickup.SetOption(false); + this.ItemDrop.setOption(false); + this.ItemPickup.setOption(false); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); //this.HungerSet = 20; - this.WorldBoundaryKill.SetOption(false); + this.WorldBoundaryKill.setOption(false); - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); registerChatStats( DamageDealt, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java index da4bc9547..406168c3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java @@ -28,7 +28,7 @@ public abstract class CreatureBase Host = game; _name = name; - game.CreatureAllowOverride.SetOption(true); + game.CreatureAllowOverride.setOption(true); _ent = loc.getWorld().spawn(loc, mobClass); @@ -40,7 +40,7 @@ public abstract class CreatureBase SpawnCustom(_ent); - game.CreatureAllowOverride.SetOption(false); + game.CreatureAllowOverride.setOption(false); } public abstract void SpawnCustom(T ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java index 2626450aa..7786fa3de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java @@ -377,9 +377,9 @@ public class PumpkinKing extends CreatureBase for (int i=0 ; i<_minionsMax ; i++) { - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Skeleton skel = GetEntity().getWorld().spawn(GetEntity().getLocation(), Skeleton.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); Host.Manager.GetCondition().Factory().Invisible("Cloak", skel, skel, 999999, 0, false, false, false); @@ -642,13 +642,13 @@ public class PumpkinKing extends CreatureBase for (int i=0 ; i(); _allowedBlocks.add(Material.TNT); @@ -456,9 +456,9 @@ public class HideSeek extends TeamGame if (GetKits().length <= 5 + i) continue; - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("RED").get(i)); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); Manager.GetLobby().AddKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("RED").get(i)); } @@ -761,7 +761,7 @@ public class HideSeek extends TeamGame if (event.GetState() != GameState.Prepare) return; - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); for (Location loc : WorldData.GetDataLocs("WHITE")) _mobs.put(loc.getWorld().spawn(loc, Sheep.class), loc); @@ -775,7 +775,7 @@ public class HideSeek extends TeamGame for (Location loc : WorldData.GetDataLocs("BROWN")) _mobs.put(loc.getWorld().spawn(loc, Cow.class), loc); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } @EventHandler(priority = EventPriority.LOW) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java index fa5e1e6c3..dc360286d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java @@ -50,13 +50,13 @@ public class HoleInTheWall extends SoloGame "Hole in wall" }); - DamagePvP.SetOption(false); - DamagePvE.SetOption(false); - DamageEvP.SetOption(false); - DamageSelf.SetOption(false); - DamageFall.SetOption(false); - HungerSet.SetOption(20); - WorldTimeSet.SetOption(8000); + DamagePvP.setOption(false); + DamagePvE.setOption(false); + DamageEvP.setOption(false); + DamageSelf.setOption(false); + DamageFall.setOption(false); + HungerSet.setOption(20); + WorldTimeSet.setOption(8000); registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 3c4e6a2fb..4ddc7d6fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -92,28 +92,28 @@ public class BombLobbers extends TeamGame implements IThrown "Last team alive wins!" }); - DamageFall.SetOption(true); - DamageEvP.SetOption(true); + DamageFall.setOption(true); + DamageEvP.setOption(true); - WorldWaterDamage.SetOption(5); + WorldWaterDamage.setOption(5); - PrepareFreeze.SetOption(false); + PrepareFreeze.setOption(false); TeamArmor = true; TeamArmorHotbar = true; - InventoryOpenChest.SetOption(false); - InventoryOpenBlock.SetOption(false); + InventoryOpenChest.setOption(false); + InventoryOpenBlock.setOption(false); - ItemDrop.SetOption(false); + ItemDrop.setOption(false); - BlockPlace.SetOption(false); + BlockPlace.setOption(false); Manager.GetExplosion().SetLiquidDamage(false); - HungerSet.SetOption(20); + HungerSet.setOption(20); - WorldTimeSet.SetOption(6000); + WorldTimeSet.setOption(6000); registerStatTrackers( new Tracker6Kill(this), @@ -140,7 +140,7 @@ public class BombLobbers extends TeamGame implements IThrown if (WorldData.MapName.equalsIgnoreCase("Intergalactic")) { - WorldTimeSet.SetOption(18000); + WorldTimeSet.setOption(18000); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java index f27802b56..1a8e8b523 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -46,18 +46,18 @@ public class Micro extends TeamGame "Small game, big strategy!", }); - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); this.TeamArmor = true; this.TeamArmorHotbar = true; - this.InventoryClick.SetOption(true); + this.InventoryClick.setOption(true); - this.ItemDrop.SetOption(true); - this.ItemPickup.SetOption(true); + this.ItemDrop.setOption(true); + this.ItemPickup.setOption(true); - this.BlockBreak.SetOption(true); - this.BlockPlace.SetOption(true); + this.BlockBreak.setOption(true); + this.BlockPlace.setOption(true); registerStatTrackers( new KillsWithinGameStatTracker(this, 8, "Annihilation") diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index dd1d8a171..11be9b061 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -93,7 +93,7 @@ public class MilkCow extends SoloGame }); this.CompassEnabled = true; - this.DeathOut.SetOption(false); + this.DeathOut.setOption(false); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Milk", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); @@ -163,7 +163,7 @@ public class MilkCow extends SoloGame for (Location loc : _chickens) { - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Chicken ent = loc.getWorld().spawn(loc, Chicken.class); if (Math.random() > 0.75) { @@ -171,12 +171,12 @@ public class MilkCow extends SoloGame ent.setAgeLock(true); } - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } for (Location loc : _pigs) { - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Pig ent = loc.getWorld().spawn(loc, Pig.class); if (Math.random() > 0.75) { @@ -184,12 +184,12 @@ public class MilkCow extends SoloGame ent.setAgeLock(true); } - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } for (Location loc : _villager) { - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Villager ent = loc.getWorld().spawn(loc, Villager.class); if (Math.random() > 0.75) { @@ -197,7 +197,7 @@ public class MilkCow extends SoloGame ent.setCustomNameVisible(true); } - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } } @@ -249,7 +249,7 @@ public class MilkCow extends SoloGame while (_herd.size() < 5) { - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Cow cow = host.getWorld().spawn(host.getLocation(), Cow.class); if (Math.random() > 0.5) { @@ -258,7 +258,7 @@ public class MilkCow extends SoloGame } _herd.add(cow); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index d233a6e3f..35d520eaf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -260,21 +260,21 @@ public class MineStrike extends TeamGame _shopManager = new ShopManager(this); - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - AnnounceStay.SetOption(false); + AnnounceStay.setOption(false); - this.HungerSet.SetOption(20); + this.HungerSet.setOption(20); - this.ItemDrop.SetOption(true); + this.ItemDrop.setOption(true); - this.DeathTeleport.SetOption(false); + this.DeathTeleport.setOption(false); - this.InventoryClick.SetOption(true); + this.InventoryClick.setOption(true); - this.JoinInProgress.SetOption(true); + this.JoinInProgress.setOption(true); - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); @@ -2923,12 +2923,12 @@ public class MineStrike extends TeamGame if (event.getMessage().contains("god")) { - if (HealthSet.GetOption() == 20) - HealthSet.SetOption(-1); + if (HealthSet.getOption() == 20) + HealthSet.setOption(-1); else - HealthSet.SetOption(20); + HealthSet.setOption(20); - Announce(C.cPurple + C.Bold + "God Mode: " + ChatColor.RESET + (HealthSet.GetOption() == 20)); + Announce(C.cPurple + C.Bold + "God Mode: " + ChatColor.RESET + (HealthSet.getOption() == 20)); event.setCancelled(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java index 7788be444..cd68be98a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java @@ -70,16 +70,16 @@ public class MineWare extends SoloGame "Other players lose one life.", "Last player with lives wins!" }); - DamageTeamSelf.SetOption(true); - DamagePvP.SetOption(false); - DamagePvE.SetOption(false); - DamageEvP.SetOption(false); - DamageFall.SetOption(false); - InventoryClick.SetOption(true); - DamageSelf.SetOption(false); - DeathOut.SetOption(false); - AutomaticRespawn.SetOption(false); - DeathMessages.SetOption(false); + DamageTeamSelf.setOption(true); + DamagePvP.setOption(false); + DamagePvE.setOption(false); + DamageEvP.setOption(false); + DamageFall.setOption(false); + InventoryClick.setOption(true); + DamageSelf.setOption(false); + DeathOut.setOption(false); + AutomaticRespawn.setOption(false); + DeathMessages.setOption(false); Manager.GetCreature().SetDisableCustomDrops(true); @@ -298,7 +298,7 @@ public class MineWare extends SoloGame @EventHandler public void PlayerMoveCancel(PlayerMoveEvent event) { - if (!PrepareFreeze.GetOption()) + if (!PrepareFreeze.getOption()) return; if (!_orderWaiting) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java index 8a460e007..7bb69b813 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java @@ -81,7 +81,7 @@ public class ChallengeDragonEgg extends Challenge block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0, 11, ViewDist.MAX, UtilServer.getPlayers()); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); for (int i = 0; i < 10; i++) { @@ -106,7 +106,7 @@ public class ChallengeDragonEgg extends Challenge } } - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java index 265262f79..cb064206f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java @@ -100,13 +100,13 @@ public class ChallengeHitTargets extends Challenge @Override public void cleanupRoom() { - Host.DamagePvP.SetOption(false); + Host.DamagePvP.setOption(false); } @Override public void setupPlayers() { - Host.DamagePvP.SetOption(true); + Host.DamagePvP.setOption(true); ArrayList players = getChallengers(); for (Player player : players) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java index 69d03e553..b245d85b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java @@ -126,7 +126,7 @@ public class ChallengeMilkACow extends Challenge } } - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); _villager = (Villager) getCenter().getWorld().spawnEntity(getCenter().clone().add(0, 1, 0), EntityType.VILLAGER); _villager.setProfession(Profession.FARMER); _villager.setCustomName(C.Bold + "Farmer Joe"); @@ -156,7 +156,7 @@ public class ChallengeMilkACow extends Challenge _milked.put(cow, new ArrayList()); } - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java index 2c5b97c65..5ddb01042 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java @@ -184,7 +184,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms Collections.shuffle(entityType); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); int i = 0; @@ -205,7 +205,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms } } - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java index 18daa31ed..e96e53320 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java @@ -52,7 +52,7 @@ public class ChallengeShootChickens extends Challenge arrow.remove(); } - Host.DamagePvE.SetOption(false); + Host.DamagePvE.setOption(false); } @EventHandler @@ -140,9 +140,9 @@ public class ChallengeShootChickens extends Challenge { Location loc = getCenter().clone().add(UtilMath.r(20) - 10, 15, UtilMath.r(20) - 10); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); Chicken chicken = (Chicken) loc.getWorld().spawnEntity(loc, EntityType.CHICKEN); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); chicken.setMaxHealth(0.1); chicken.setHealth(0.1); @@ -164,7 +164,7 @@ public class ChallengeShootChickens extends Challenge _killedChickens.put(player.getName(), 0); } - Host.DamagePvE.SetOption(true); + Host.DamagePvE.setOption(true); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java index 921cf46d2..e531e11bb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java @@ -42,7 +42,7 @@ public class ChallengeSkyFall extends Challenge @Override public void cleanupRoom() { - Host.DamageEvP.SetOption(false); + Host.DamageEvP.setOption(false); } @EventHandler @@ -66,7 +66,7 @@ public class ChallengeSkyFall extends Challenge { setBorder(-50, 50, 0, 254, -50, 50); - Host.DamageEvP.SetOption(true); + Host.DamageEvP.setOption(true); for (Player player : getChallengers()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java index 709380e3d..ecc477c66 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java @@ -29,7 +29,7 @@ public class ChallengeSmashOff extends Challenge @Override public void cleanupRoom() { - Host.DamagePvP.SetOption(false); + Host.DamagePvP.setOption(false); for (Player player : getChallengers()) { @@ -40,7 +40,7 @@ public class ChallengeSmashOff extends Challenge @Override public void setupPlayers() { - Host.DamagePvP.SetOption(true); + Host.DamagePvP.setOption(true); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java index 1bb879edb..ed1281fb8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java @@ -46,7 +46,7 @@ public class ChallengeTntLauncher extends Challenge @Override public void cleanupRoom() { - Host.Damage.SetOption(true); + Host.Damage.setOption(true); for (Entity tnt : _tnt) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java index c8353412f..469e107c1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java @@ -62,7 +62,7 @@ public class ChallengeVolleyPig extends Challenge public void cleanupRoom() { _pig.remove(); - Host.DamagePvE.SetOption(false); + Host.DamagePvE.setOption(false); } @Override @@ -73,7 +73,7 @@ public class ChallengeVolleyPig extends Challenge player.getInventory().setItem(0, new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 1).build()); } - Host.DamagePvE.SetOption(true); + Host.DamagePvE.setOption(true); } @EventHandler(priority = EventPriority.LOW) @@ -203,12 +203,12 @@ public class ChallengeVolleyPig extends Challenge @Override public void generateRoom() { - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); _pig = getCenter().getWorld().spawnEntity(getCenter().add(0, 1, 0), EntityType.PIG); UtilEnt.Vegetate(_pig); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); for (int x = -6; x <= 6; x++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index 576c6a94b..354e2ac71 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -27,10 +27,10 @@ public class Moba extends TeamGame "..." }); - this.DeathOut.SetOption(false); - this.DeathSpectateSecs.SetOption(8); + this.DeathOut.setOption(false); + this.DeathSpectateSecs.setOption(8); - this.HungerSet.SetOption(20); + this.HungerSet.setOption(20); registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java index 892ef6ffe..d9f29d257 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java @@ -155,13 +155,13 @@ public class Ball if (_ballDeadTime > 0 && (_firstSpawn || UtilTime.elapsed(_ballDeadTime, 6000))) { //Spawn - _host.CreatureAllowOverride.SetOption(true); + _host.CreatureAllowOverride.setOption(true); _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); _ball.setSize(2); UtilEnt.Vegetate(_ball); UtilEnt.ghost(_ball, false, false); - _host.CreatureAllowOverride.SetOption(false); + _host.CreatureAllowOverride.setOption(false); _lastParticle = _ball.getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java index 65ec59c6a..0f90122e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java @@ -54,12 +54,12 @@ public class MonsterLeague extends TeamGame "CHEESE IZ DELISH" }); - this.PrepareFreeze.SetOption(false); - this.DamagePvP.SetOption(false); - this.HungerSet.SetOption(20); - this.HealthSet.SetOption(20); + this.PrepareFreeze.setOption(false); + this.DamagePvP.setOption(false); + this.HungerSet.setOption(20); + this.HealthSet.setOption(20); - this.DeathOut.SetOption(false); + this.DeathOut.setOption(false); this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java index 6dd593d4a..385e643c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java @@ -513,7 +513,7 @@ public class Maze implements Listener } Location loc = UtilAlg.Random(validSpawns); - _host.CreatureAllowOverride.SetOption(true); + _host.CreatureAllowOverride.setOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); DisguiseBase disguise = DisguiseFactory.createDisguise(ent, _host.getMonsterType()); @@ -528,7 +528,7 @@ public class Maze implements Listener ((DisguiseMagmaCube) disguise).SetSize(3); } - _host.CreatureAllowOverride.SetOption(false); + _host.CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(ent, true); UtilEnt.ghost(ent, true, false); @@ -551,7 +551,7 @@ public class Maze implements Listener while (spawned <= numToSpawn) { - _host.CreatureAllowOverride.SetOption(true); + _host.CreatureAllowOverride.setOption(true); Snowman ent = loc.getWorld().spawn(loc, Snowman.class); DisguiseBase disguise = DisguiseFactory.createDisguise(ent, _host.getMonsterType()); @@ -566,7 +566,7 @@ public class Maze implements Listener ((DisguiseMagmaCube) disguise).SetSize(3); } - _host.CreatureAllowOverride.SetOption(false); + _host.CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(ent, true); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index e7ae6ad50..ab5fb7a14 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -81,16 +81,16 @@ public class MonsterMaze extends SoloGame "Make it to a Safe Pad or be killed!" }); - DamagePvP.SetOption(false); - DamagePvE.SetOption(false); + DamagePvP.setOption(false); + DamagePvE.setOption(false); - DamageFall.SetOption(false); + DamageFall.setOption(false); - HungerSet.SetOption(20); + HungerSet.setOption(20); - PrepareFreeze.SetOption(false); + PrepareFreeze.setOption(false); - HungerSet.SetOption(20); + HungerSet.setOption(20); CompassEnabled = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java index 1345fca93..772d2769a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java @@ -73,19 +73,19 @@ public class OldMineWare extends SoloGame "Last player with lives wins!" }); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); - this.DamagePvP.SetOption(false); + this.DamagePvP.setOption(false); - this.BlockPlace.SetOption(true); - this.BlockBreak.SetOption(true); + this.BlockPlace.setOption(true); + this.BlockBreak.setOption(true); - this.ItemDrop.SetOption(true); - this.ItemPickup.SetOption(true); + this.ItemDrop.setOption(true); + this.ItemPickup.setOption(true); - InventoryOpenBlock.SetOption(true); - InventoryOpenChest.SetOption(true); - InventoryClick.SetOption(true); + InventoryOpenBlock.setOption(true); + InventoryOpenChest.setOption(true); + InventoryClick.setOption(true); PopulateOrders(); @@ -299,14 +299,14 @@ public class OldMineWare extends SoloGame Location loc = _mobLocs.get(UtilMath.r(_mobLocs.size())).clone().add(new Vector(0.5,1,0.5)); double r = Math.random(); - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Pig.class)); else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Cow.class)); else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Chicken.class)); else _mobs.add(loc.getWorld().spawn(loc, Sheep.class)); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } if (_ghast == null || !_ghast.isValid()) @@ -314,9 +314,9 @@ public class OldMineWare extends SoloGame if (_ghast != null) _ghast.remove(); - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); _ghast = _ghastLoc.getWorld().spawn(_ghastLoc, Ghast.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); _ghast.setMaxHealth(10000); _ghast.setHealth(_ghast.getMaxHealth()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java index 820649b8b..3dd7f69f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java @@ -48,10 +48,10 @@ public abstract class Order implements Listener public void EndOrder() { - Host.BlockBreakAllow.GetOption().clear(); - Host.BlockPlaceAllow.GetOption().clear(); - Host.ItemDropAllow.GetOption().clear(); - Host.ItemPickupAllow.GetOption().clear(); + Host.BlockBreakAllow.getOption().clear(); + Host.BlockPlaceAllow.getOption().clear(); + Host.ItemDropAllow.getOption().clear(); + Host.ItemPickupAllow.getOption().clear(); Uninitialize(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java index 59d3fccfe..acdece832 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java @@ -32,8 +32,8 @@ public abstract class OrderGather extends Order public void SubInitialize() { _counter.clear(); - Host.BlockBreakAllow.GetOption().add(_id); - Host.ItemPickupAllow.GetOption().add(_id); + Host.BlockBreakAllow.getOption().add(_id); + Host.ItemPickupAllow.getOption().add(_id); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java index 5a87f36da..5b82fdb9d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java @@ -30,7 +30,7 @@ public abstract class OrderPlace extends Order public void SubInitialize() { _counter.clear(); - Host.BlockPlaceAllow.GetOption().add(_id); + Host.BlockPlaceAllow.getOption().add(_id); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 041172ec1..887444531 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -100,11 +100,11 @@ public class Paintball extends TeamGame "Last team alive wins!" }); - StrictAntiHack.SetOption(true); + StrictAntiHack.setOption(true); - HungerSet.SetOption(20); + HungerSet.setOption(20); - InventoryClick.SetOption(false); + InventoryClick.setOption(false); TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java index d7e876cf0..107cbae90 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java @@ -39,9 +39,9 @@ public class PlayerCopyPaintball Location entLoc = owner.getLocation(); entLoc.setPitch(0F); - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); _ent = owner.getWorld().spawn(owner.getLocation(), ArmorStand.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java index 205f0e9be..8d89fa556 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java @@ -72,17 +72,17 @@ public class Quiver extends SoloGame "First player to 20 kills wins." }); - this.HungerSet.SetOption(20); - this.DeathOut.SetOption(false); - this.DamageSelf.SetOption(false); - this.DamageTeamSelf.SetOption(true); - this.PrepareFreeze.SetOption(false); - this.BlockBreakAllow.GetOption().add(102); - this.BlockBreakAllow.GetOption().add(20); - this.BlockBreakAllow.GetOption().add(Material.STAINED_GLASS_PANE.getId()); - this.BlockBreakAllow.GetOption().add(Material.STAINED_GLASS.getId()); + this.HungerSet.setOption(20); + this.DeathOut.setOption(false); + this.DamageSelf.setOption(false); + this.DamageTeamSelf.setOption(true); + this.PrepareFreeze.setOption(false); + this.BlockBreakAllow.getOption().add(102); + this.BlockBreakAllow.getOption().add(20); + this.BlockBreakAllow.getOption().add(Material.STAINED_GLASS_PANE.getId()); + this.BlockBreakAllow.getOption().add(Material.STAINED_GLASS.getId()); - this.DeathSpectateSecs.SetOption(1); + this.DeathSpectateSecs.setOption(1); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java index d2da9c1ff..dd8ebcc07 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java @@ -54,14 +54,14 @@ public class QuiverTeams extends TeamGame "First team to 60 kills wins." }); - this.HungerSet.SetOption(20); - this.DeathOut.SetOption(false); - this.DamageSelf.SetOption(false); - this.DamageTeamSelf.SetOption(false); - this.PrepareFreeze.SetOption(false); - this.BlockBreakAllow.GetOption().add(102); - this.BlockBreakAllow.GetOption().add(20); - this.BlockBreakAllow.GetOption().add(18); + this.HungerSet.setOption(20); + this.DeathOut.setOption(false); + this.DamageSelf.setOption(false); + this.DamageTeamSelf.setOption(false); + this.PrepareFreeze.setOption(false); + this.BlockBreakAllow.getOption().add(102); + this.BlockBreakAllow.getOption().add(20); + this.BlockBreakAllow.getOption().add(18); this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index dee6620dc..1fe284e99 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -60,11 +60,11 @@ public class Runner extends SoloGame implements IThrown "Last player alive wins!" }); - this.DamagePvP.SetOption(false); - this.HungerSet.SetOption(20); - this.WorldWaterDamage.SetOption(4); + this.DamagePvP.setOption(false); + this.HungerSet.setOption(20); + this.WorldWaterDamage.setOption(4); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); registerStatTrackers(new DistanceTraveledStatTracker(this, "MarathonRunner")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java index 55e47dc20..301fb8ee1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java @@ -62,14 +62,14 @@ public class SearchAndDestroy extends TeamGame setKits(_kitManager.get_kits()); _evolve = new KitEvolve(manager.getPlugin(), this, _kitManager.getUpgradeKits()); - InventoryClick.SetOption(true); - WorldTimeSet.SetOption(-1); - WorldBoundaryKill.SetOption(false); - HungerSet.SetOption(20); - AnnounceJoinQuit.SetOption(false); - DisableKillCommand.SetOption(false); + InventoryClick.setOption(true); + WorldTimeSet.setOption(-1); + WorldBoundaryKill.setOption(false); + HungerSet.setOption(20); + AnnounceJoinQuit.setOption(false); + DisableKillCommand.setOption(false); AllowParticles = false; - DamageSelf.SetOption(false); + DamageSelf.setOption(false); Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName); @@ -194,7 +194,7 @@ public class SearchAndDestroy extends TeamGame bomb.getBlockLocation().getWorld().playSound(bomb.getBlockLocation(), Sound.EXPLODE, 1000, 0); bomb.getBlockLocation().getWorld().playEffect(bomb.getBomb().getLocation(), Effect.EXPLOSION_HUGE, 0); bomb.removeBomb(); - DeathMessages.SetOption(false); + DeathMessages.setOption(false); for (Player player : this.GetPlayers(true)) { GameTeam pTeam = GetTeam(player); @@ -208,7 +208,7 @@ public class SearchAndDestroy extends TeamGame } } } - DeathMessages.SetOption(true); + DeathMessages.setOption(true); // TODO The code below could be used when a team is defeated. /* if (getBombs().size() == 1) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java index a4cd49c56..1cd8a00b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java @@ -107,9 +107,9 @@ class TeamBomb implements Comparable _bombEntity.remove(); loc = _bombEntity.getLocation(); } - _game.CreatureAllowOverride.SetOption(true); + _game.CreatureAllowOverride.setOption(true); EntityTNTPrimed entity = new EntityTNTPrimed(((CraftWorld) getBlockLocation().getWorld()).getHandle()); - _game.CreatureAllowOverride.SetOption(false); + _game.CreatureAllowOverride.setOption(false); double x = loc.getX(); double y = loc.getY() + 0.2; double z = loc.getZ(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java index 79d092cc2..f3d2bde59 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java @@ -141,12 +141,12 @@ public class SheepGame extends TeamGame "Most sheep at 5 minutes wins!" }); - this.DeathOut.SetOption(false); - this.DeathSpectateSecs.SetOption(6); + this.DeathOut.setOption(false); + this.DeathSpectateSecs.setOption(6); - this.HungerSet.SetOption(20); + this.HungerSet.setOption(20); - this.WorldTimeSet.SetOption(2000); + this.WorldTimeSet.setOption(2000); this.TeamArmor = true; this.TeamArmorHotbar = true; @@ -225,12 +225,12 @@ public class SheepGame extends TeamGame public void SheepSpawn() { //Spawn Sheep - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Sheep sheep = _sheepSpawns.get(0).getWorld().spawn(UtilAlg.Random(_sheepSpawns), Sheep.class); sheep.setAdult(); sheep.setMaxHealth(2048); sheep.setHealth(2048); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); _sheep.put(sheep, new SheepData(this, sheep)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 3a5b6ea8f..04c7b2a02 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -145,46 +145,46 @@ public abstract class Skywars extends Game }, description); - PrepareFreeze.SetOption(true); + PrepareFreeze.setOption(true); - AnnounceStay.SetOption(false); + AnnounceStay.setOption(false); HideTeamSheep = true; CompassEnabled = true; - StrictAntiHack.SetOption(true); + StrictAntiHack.setOption(true); - GameTimeout.SetOption(1500000L); + GameTimeout.setOption(1500000L); - DeathDropItems.SetOption(true); + DeathDropItems.setOption(true); - QuitDropItems.SetOption(true); + QuitDropItems.setOption(true); - WorldTimeSet.SetOption(0); - WorldBoundaryKill.SetOption(false); + WorldTimeSet.setOption(0); + WorldBoundaryKill.setOption(false); - DamageSelf.SetOption(true); - DamageTeamSelf.SetOption(true); - DamageEvP.SetOption(true); - Damage.SetOption(true); + DamageSelf.setOption(true); + DamageTeamSelf.setOption(true); + DamageEvP.setOption(true); + Damage.setOption(true); - DeathDropItems.SetOption(true); + DeathDropItems.setOption(true); - ItemDrop.SetOption(true); - ItemPickup.SetOption(true); + ItemDrop.setOption(true); + ItemPickup.setOption(true); - BlockBreak.SetOption(true); - BlockPlace.SetOption(true); + BlockBreak.setOption(true); + BlockPlace.setOption(true); - InventoryClick.SetOption(true); - InventoryOpenBlock.SetOption(true); - InventoryOpenChest.SetOption(true); + InventoryClick.setOption(true); + InventoryOpenBlock.setOption(true); + InventoryOpenChest.setOption(true); PlaySoundGameStart = true; PrepareTime = 10000L; - DontAllowOverfill.SetOption(true); + DontAllowOverfill.setOption(true); _oreHider = new OreHider(); @@ -265,14 +265,14 @@ public abstract class Skywars extends Game for (Location loc : WorldData.GetDataLocs("RED")) { //Spawn - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); Zombie zombie = (Zombie) loc.getWorld().spawn(loc, Zombie.class); zombie.setRemoveWhenFarAway(false); zombie.setCustomName(C.cDRed + "Zombie Guardian"); zombie.setCustomNameVisible(true); zombie.setMaxHealth(15); zombie.setHealth(15); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); // Armor - Make sure the player can't get it! zombie.getEquipment().setHelmet( @@ -474,7 +474,7 @@ public abstract class Skywars extends Game if (!UtilTime.elapsed(this.GetStateTime(), 5000)) return; - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); for (Location loc : GetTeamList().get(0).GetSpawns()) { Chicken chicken = loc.getWorld().spawn(loc.clone().add(0, 1, 0), Chicken.class); @@ -485,7 +485,7 @@ public abstract class Skywars extends Game chicken.setMaxHealth(4); chicken.setHealth(4); } - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); _lastChicken = System.currentTimeMillis(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java index 123bc41f3..6ae3c2b0f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java @@ -34,7 +34,7 @@ public class SoloSkywars extends Skywars "Last player alive wins!" }); - this.DamageTeamSelf.SetOption(true); + this.DamageTeamSelf.setOption(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java index 9108dbb06..5ba1b38a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java @@ -46,13 +46,13 @@ public class TeamSkywars extends Skywars "Last team alive wins!" }); - this.FillTeamsInOrderToCount.SetOption(2); + this.FillTeamsInOrderToCount.setOption(2); - this.SpawnNearAllies.SetOption(true); + this.SpawnNearAllies.setOption(true); - this.DamageTeamSelf.SetOption(false); + this.DamageTeamSelf.setOption(false); - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java index 273560f04..c29033dff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java @@ -32,7 +32,7 @@ public class SoloSuperSmash extends SuperSmash "Last player alive wins!" }); - this.DamageTeamSelf.SetOption(true); + this.DamageTeamSelf.setOption(true); registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 8294f0a3c..067831a54 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -116,13 +116,13 @@ public abstract class SuperSmash extends Game },description); - this.DeathOut.SetOption(false); + this.DeathOut.setOption(false); this.CompassEnabled = true; - this.DeathSpectateSecs.SetOption(4); + this.DeathSpectateSecs.setOption(4); - this.WorldWaterDamage.SetOption(1000); + this.WorldWaterDamage.setOption(1000); this.HideTeamSheep = true; @@ -241,9 +241,9 @@ public abstract class SuperSmash extends Game } else { - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); _powerup = _powerupTarget.getWorld().spawn(_powerupTarget, EnderCrystal.class); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); _powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 59569bcca..8bf949f6e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -46,14 +46,14 @@ public class TeamSuperSmash extends SuperSmash }); this.PlayersPerTeam = 2; - this.FillTeamsInOrderToCount.SetOption(2); + this.FillTeamsInOrderToCount.setOption(2); - this.SpawnNearAllies.SetOption(true); - this.DamageTeamSelf.SetOption(false); + this.SpawnNearAllies.setOption(true); + this.DamageTeamSelf.setOption(false); this.TeamArmorHotbar = true; - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java index 618efef23..440f9aeec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java @@ -116,9 +116,9 @@ public class KitKnight extends SmashKit Manager.GetDisguise().disguise(disguise); //Horse - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); final Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); //Owner horse.setTamed(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index ccd8b05ad..41ad6c563 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -132,7 +132,7 @@ public class KitSkySquid extends SmashKit @Override public void activateSuperCustom(Player player) { - Manager.GetGame().WorldWeatherEnabled.SetOption(true); + Manager.GetGame().WorldWeatherEnabled.setOption(true); Manager.GetGame().WorldData.World.setStorm(true); Manager.GetGame().WorldData.World.setThundering(true); Manager.GetGame().WorldData.World.setThunderDuration(9999); @@ -141,6 +141,6 @@ public class KitSkySquid extends SmashKit @Override public void deactivateSuperCustom(Player player) { - Manager.GetGame().WorldWeatherEnabled.SetOption(false); + Manager.GetGame().WorldWeatherEnabled.setOption(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java index 3a8cac7d9..1cb90b820 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java @@ -86,10 +86,10 @@ public class PerkCowAngryHerd extends SmashPerk loc.add(dir); loc.add(UtilAlg.getLeft(dir).multiply(i*1.5)); - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Class clazz = isSuperActive(player) ? MushroomCow.class : Cow.class; Cow cow = player.getWorld().spawn(loc, clazz); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); _active.add(new DataCowCharge(player, cow)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java index e22fe5911..f507f3786 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java @@ -147,9 +147,9 @@ public class Snake extends SoloGame "Last one alive wins!" }); - this.DamageTeamSelf.SetOption(true); + this.DamageTeamSelf.setOption(true); - this.HungerSet.SetOption(2); + this.HungerSet.setOption(2); this.GemMultiplier = 0.5; @@ -177,9 +177,9 @@ public class Snake extends SoloGame Player player = GetPlayers(true).get(i); _color.put(player, DyeColor.getByDyeData((byte) (i % 16))); - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Sheep sheep = player.getWorld().spawn(player.getLocation(), Sheep.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); sheep.setColor(DyeColor.getByDyeData((byte) (i % 16))); sheep.setPassenger(player); @@ -427,9 +427,9 @@ public class Snake extends SoloGame return; //Spawn - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Slime pig = loc.getWorld().spawn(loc, Slime.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); pig.setSize(2); UtilEnt.Vegetate(pig); @@ -491,9 +491,9 @@ public class Snake extends SoloGame loc.subtract(player.getLocation().getDirection().setY(0)); //Spawn - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Sheep tail = loc.getWorld().spawn(loc, Sheep.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); tail.setRemoveWhenFarAway(false); tail.setColor(_color.get(player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java index 52ff00399..5f9204063 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java @@ -72,12 +72,12 @@ public class SneakyAssassins extends SoloGame this._npcManager = new NpcManager(this, UtilMath.random); - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - this.DamageTeamSelf.SetOption(true); - this.PrepareFreeze.SetOption(false); + this.DamageTeamSelf.setOption(true); + this.PrepareFreeze.setOption(false); - this.HungerSet.SetOption(20); + this.HungerSet.setOption(20); this.CompassEnabled = true; this.CompassGiveItem = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java index 43fdb64f4..60ab6e669 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java @@ -48,12 +48,12 @@ public class NpcManager implements Listener { Location spawn = getNpcSpawn(); - getGame().CreatureAllowOverride.SetOption(true); + getGame().CreatureAllowOverride.setOption(true); LivingEntity npc = (LivingEntity) spawn.getWorld().spawn(spawn, getDisguiseType().getEntityClass()); npc.setCanPickupItems(false); npc.setRemoveWhenFarAway(false); UtilEnt.Vegetate(npc); - getGame().CreatureAllowOverride.SetOption(false); + getGame().CreatureAllowOverride.setOption(false); return npc; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java index d61bcb053..e53f49927 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java @@ -103,9 +103,9 @@ public class PowerUpItem UtilFirework.playFirework(itemLocation, effect); - _powerUpManager.getGame().CreatureAllowOverride.SetOption(true); + _powerUpManager.getGame().CreatureAllowOverride.setOption(true); _npc = itemLocation.getWorld().spawn(itemLocation, Skeleton.class); - _powerUpManager.getGame().CreatureAllowOverride.SetOption(false); + _powerUpManager.getGame().CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(_npc); UtilEnt.ghost(_npc, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index 7b15a109b..f25a2f0c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -95,9 +95,9 @@ public class SnowFight extends TeamGame "Last team alive wins!" }); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); - this.HungerSet.SetOption(20); + this.HungerSet.setOption(20); this.CompassEnabled = true; this.CompassGiveItem = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 6a92acc76..1088ec236 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -166,20 +166,20 @@ public class SpeedBuilders extends SoloGame "Last person left wins!" }); - Damage.SetOption(false); + Damage.setOption(false); - HungerSet.SetOption(20); - HealthSet.SetOption(20); + HungerSet.setOption(20); + HealthSet.setOption(20); - DontAllowOverfill.SetOption(true); + DontAllowOverfill.setOption(true); - DeathMessages.SetOption(false); + DeathMessages.setOption(false); FixSpawnFacing = false; AllowParticles = false; - InventoryClick.SetOption(true); + InventoryClick.setOption(true); registerStatTrackers( new DependableTracker(this), @@ -323,7 +323,7 @@ public class SpeedBuilders extends SoloGame } } - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); for (MobData mobData : buildData.Mobs) { @@ -337,16 +337,16 @@ public class SpeedBuilders extends SoloGame _middleMobs.add(entity); } - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); } public void spawnJudge() { - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); _judgeEntity = _judgeSpawn.getWorld().spawn(_judgeSpawn, ArmorStand.class); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); _judgeEntity.setVisible(false); _judgeEntity.setGravity(false); @@ -391,11 +391,11 @@ public class SpeedBuilders extends SoloGame if (_judgeLaserTarget != null) judgeTargetLocation(null); - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); _judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); _judgeLaserTarget.setVisible(false); _judgeLaserTarget.setGravity(false); @@ -787,8 +787,8 @@ public class SpeedBuilders extends SoloGame recreation.breakAndDropItems(); } - ItemPickup.SetOption(true); - BlockPlace.SetOption(true); + ItemPickup.setOption(true); + BlockPlace.setOption(true); _buildCountStage = 0; @@ -855,8 +855,8 @@ public class SpeedBuilders extends SoloGame _perfectBuild.clear(); - ItemPickup.SetOption(false); - BlockPlace.SetOption(false); + ItemPickup.setOption(false); + BlockPlace.setOption(false); RecreationData lowest = null; int lowestScore = -1; @@ -1589,14 +1589,14 @@ public class SpeedBuilders extends SoloGame if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block)) return; - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); Entity entity = block.getWorld().spawnEntity(block.getLocation().add(0.5, 0, 0.5), type); UtilEnt.Vegetate(entity, true); UtilEnt.ghost(entity, true, false); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); _buildRecreations.get(event.getPlayer()).Mobs.add(entity); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 79f5ddb3c..b922a9216 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -183,7 +183,7 @@ public class RecreationData } } - Game.CreatureAllowOverride.SetOption(true); + Game.CreatureAllowOverride.setOption(true); for (MobData mobData : buildData.Mobs) { @@ -197,7 +197,7 @@ public class RecreationData Mobs.add(entity); } - Game.CreatureAllowOverride.SetOption(false); + Game.CreatureAllowOverride.setOption(false); } public void breakAndDropItems() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index 85552c568..3723f3350 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -57,10 +57,10 @@ public class Spleef extends SoloGame "Last player alive wins!" }); - this.DamagePvP.SetOption(false); - this.WorldWaterDamage.SetOption(4); + this.DamagePvP.setOption(false); + this.WorldWaterDamage.setOption(4); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); registerStatTrackers(new SpleefBlockDestroyStatTracker(this)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java index b7972a822..dfe60b4ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java @@ -53,10 +53,10 @@ public class SpleefTeams extends TeamGame "Last team alive wins!" }); - this.DamagePvP.SetOption(false); - this.WorldWaterDamage.SetOption(4); + this.DamagePvP.setOption(false); + this.WorldWaterDamage.setOption(4); - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java index 5ee506997..6618bc8f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java @@ -44,12 +44,12 @@ public class SquidShooter extends SoloGame "First player to 20 kills wins." }); - this.DeathOut.SetOption(false); - this.DamageSelf.SetOption(false); - this.DamageTeamSelf.SetOption(true); - this.PrepareFreeze.SetOption(false); + this.DeathOut.setOption(false); + this.DamageSelf.setOption(false); + this.DamageTeamSelf.setOption(true); + this.PrepareFreeze.setOption(false); this.CompassEnabled = true; - this.KitRegisterState.SetOption(GameState.Prepare); + this.KitRegisterState.setOption(GameState.Prepare); registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java index 5a02afea4..8b4b2b5ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java @@ -70,9 +70,9 @@ public class Stacker extends SoloGame implements IThrown Location loc = GetTeamList().get(0).GetSpawns().get(UtilMath.r(GetTeamList().get(0).GetSpawns().size())); //Spawn - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Pig pig = loc.getWorld().spawn(loc, Pig.class); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java index 155de9049..6c25ba164 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java @@ -39,7 +39,7 @@ public class SoloSurvivalGames extends SurvivalGames "Last tribute alive wins!" }); - this.DamageTeamSelf.SetOption(true); + this.DamageTeamSelf.setOption(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 5a4d6c47b..9e852db0f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -184,60 +184,60 @@ public abstract class SurvivalGames extends Game // Manager.GetAntiStack().SetEnabled(false); - StrictAntiHack.SetOption(true); + StrictAntiHack.setOption(true); - AnnounceStay.SetOption(false); + AnnounceStay.setOption(false); HideTeamSheep = true; this.ReplaceTeamsWithKits = true; - GameTimeout.SetOption(1500000); + GameTimeout.setOption(1500000); - QuitDropItems.SetOption(true); + QuitDropItems.setOption(true); - WorldTimeSet.SetOption(0); - WorldBoundaryKill.SetOption(false); + WorldTimeSet.setOption(0); + WorldBoundaryKill.setOption(false); - DamageSelf.SetOption(true); - DamageTeamSelf.SetOption(true); + DamageSelf.setOption(true); + DamageTeamSelf.setOption(true); - DeathDropItems.SetOption(true); + DeathDropItems.setOption(true); - ItemDrop.SetOption(true); - ItemPickup.SetOption(true); + ItemDrop.setOption(true); + ItemPickup.setOption(true); - InventoryClick.SetOption(true); - InventoryOpenBlock.SetOption(true); - InventoryOpenChest.SetOption(true); + InventoryClick.setOption(true); + InventoryOpenBlock.setOption(true); + InventoryOpenChest.setOption(true); PlaySoundGameStart = false; PrepareTime = 15000; DeadBodies = true; - BlockBreakAllow.GetOption().add(Material.WEB.getId()); // Web - BlockPlaceAllow.GetOption().add(Material.WEB.getId()); + BlockBreakAllow.getOption().add(Material.WEB.getId()); // Web + BlockPlaceAllow.getOption().add(Material.WEB.getId()); - BlockBreakAllow.GetOption().add(Material.LEAVES.getId()); // Leaves - BlockBreakAllow.GetOption().add(Material.LEAVES_2.getId()); // Leaves + BlockBreakAllow.getOption().add(Material.LEAVES.getId()); // Leaves + BlockBreakAllow.getOption().add(Material.LEAVES_2.getId()); // Leaves - BlockPlaceAllow.GetOption().add(Material.CAKE_BLOCK.getId()); - BlockBreakAllow.GetOption().add(Material.CAKE_BLOCK.getId()); + BlockPlaceAllow.getOption().add(Material.CAKE_BLOCK.getId()); + BlockBreakAllow.getOption().add(Material.CAKE_BLOCK.getId()); - BlockBreakAllow.GetOption().add(Material.LONG_GRASS.getId()); - BlockBreakAllow.GetOption().add(Material.RED_ROSE.getId()); - BlockBreakAllow.GetOption().add(Material.YELLOW_FLOWER.getId()); - BlockBreakAllow.GetOption().add(Material.BROWN_MUSHROOM.getId()); - BlockBreakAllow.GetOption().add(Material.RED_MUSHROOM.getId()); - BlockBreakAllow.GetOption().add(Material.DEAD_BUSH.getId()); - BlockBreakAllow.GetOption().add(Material.CARROT.getId()); - BlockBreakAllow.GetOption().add(Material.POTATO.getId()); - BlockBreakAllow.GetOption().add(Material.DOUBLE_PLANT.getId()); - BlockBreakAllow.GetOption().add(Material.CROPS.getId()); - BlockBreakAllow.GetOption().add(Material.SAPLING.getId()); - BlockBreakAllow.GetOption().add(Material.VINE.getId()); - BlockBreakAllow.GetOption().add(Material.WATER_LILY.getId()); + BlockBreakAllow.getOption().add(Material.LONG_GRASS.getId()); + BlockBreakAllow.getOption().add(Material.RED_ROSE.getId()); + BlockBreakAllow.getOption().add(Material.YELLOW_FLOWER.getId()); + BlockBreakAllow.getOption().add(Material.BROWN_MUSHROOM.getId()); + BlockBreakAllow.getOption().add(Material.RED_MUSHROOM.getId()); + BlockBreakAllow.getOption().add(Material.DEAD_BUSH.getId()); + BlockBreakAllow.getOption().add(Material.CARROT.getId()); + BlockBreakAllow.getOption().add(Material.POTATO.getId()); + BlockBreakAllow.getOption().add(Material.DOUBLE_PLANT.getId()); + BlockBreakAllow.getOption().add(Material.CROPS.getId()); + BlockBreakAllow.getOption().add(Material.SAPLING.getId()); + BlockBreakAllow.getOption().add(Material.VINE.getId()); + BlockBreakAllow.getOption().add(Material.WATER_LILY.getId()); // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", // "chestsOpened"); @@ -452,14 +452,14 @@ public abstract class SurvivalGames extends Game if (time > 22000 || time < 14000) { - WorldTimeSet.SetOption((WorldTimeSet.GetOption() + 4) % 24000); + WorldTimeSet.setOption((WorldTimeSet.getOption() + 4) % 24000); } else { - WorldTimeSet.SetOption((WorldTimeSet.GetOption() + 16) % 24000); + WorldTimeSet.setOption((WorldTimeSet.getOption() + 16) % 24000); } - WorldData.World.setTime(WorldTimeSet.GetOption()); + WorldData.World.setTime(WorldTimeSet.getOption()); } @EventHandler @@ -635,7 +635,7 @@ public abstract class SurvivalGames extends Game { _deathMatchTeleported = true; - WorldTimeSet.SetOption(0); + WorldTimeSet.setOption(0); WorldData.World.setTime(15000); for (GameTeam team : GetTeamList()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index 7966a98e7..938279fc9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -172,51 +172,51 @@ public class SurvivalGamesTeams extends TeamGame setItemMerge(true); // Manager.GetAntiStack().SetEnabled(false); - this.GameTimeout.SetOption(9600000); + this.GameTimeout.setOption(9600000); - this.WorldTimeSet.SetOption(0); - this.WorldBoundaryKill.SetOption(false); + this.WorldTimeSet.setOption(0); + this.WorldBoundaryKill.setOption(false); - SpawnNearAllies.SetOption(true); - SpawnNearEnemies.SetOption(true); //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split. + SpawnNearAllies.setOption(true); + SpawnNearEnemies.setOption(true); //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split. - this.DamageSelf.SetOption(true); - this.DamageTeamSelf.SetOption(false); + this.DamageSelf.setOption(true); + this.DamageTeamSelf.setOption(false); - this.DeathDropItems.SetOption(true); + this.DeathDropItems.setOption(true); - this.ItemDrop.SetOption(true); - this.ItemPickup.SetOption(true); + this.ItemDrop.setOption(true); + this.ItemPickup.setOption(true); this.CompassEnabled = false; //XXX - this.InventoryClick.SetOption(true); - this.InventoryOpenBlock.SetOption(true); - this.InventoryOpenChest.SetOption(true); + this.InventoryClick.setOption(true); + this.InventoryOpenBlock.setOption(true); + this.InventoryOpenChest.setOption(true); //Blocks - this.BlockBreakAllow.GetOption().add(46); //TNT - this.BlockPlaceAllow.GetOption().add(46); + this.BlockBreakAllow.getOption().add(46); //TNT + this.BlockPlaceAllow.getOption().add(46); - this.BlockBreakAllow.GetOption().add(30); //Web - this.BlockPlaceAllow.GetOption().add(30); + this.BlockBreakAllow.getOption().add(30); //Web + this.BlockPlaceAllow.getOption().add(30); - this.BlockBreakAllow.GetOption().add(132); //Tripwire - this.BlockPlaceAllow.GetOption().add(132); + this.BlockBreakAllow.getOption().add(132); //Tripwire + this.BlockPlaceAllow.getOption().add(132); - this.BlockBreakAllow.GetOption().add(131); //Wire Hook - this.BlockPlaceAllow.GetOption().add(131); + this.BlockBreakAllow.getOption().add(131); //Wire Hook + this.BlockPlaceAllow.getOption().add(131); - this.BlockBreakAllow.GetOption().add(55); //Redstone Dust - this.BlockPlaceAllow.GetOption().add(55); + this.BlockBreakAllow.getOption().add(55); //Redstone Dust + this.BlockPlaceAllow.getOption().add(55); - this.BlockBreakAllow.GetOption().add(72); //Wood Pressure Plate - this.BlockPlaceAllow.GetOption().add(72); + this.BlockBreakAllow.getOption().add(72); //Wood Pressure Plate + this.BlockPlaceAllow.getOption().add(72); - this.BlockBreakAllow.GetOption().add(69); //Lever - this.BlockPlaceAllow.GetOption().add(69); + this.BlockBreakAllow.getOption().add(69); //Lever + this.BlockPlaceAllow.getOption().add(69); - this.BlockBreakAllow.GetOption().add(18); //Leaves + this.BlockBreakAllow.getOption().add(18); //Leaves //SPREAD _spreadType = 1;//UtilMath.r(3); @@ -255,7 +255,7 @@ public class SurvivalGamesTeams extends TeamGame //Tournament if (Manager.IsTournamentServer()) - QuitOut.SetOption(false); + QuitOut.setOption(false); } @Override @@ -1093,14 +1093,14 @@ public class SurvivalGamesTeams extends TeamGame if (time > 22000 || time < 14000) { - WorldTimeSet.SetOption((WorldTimeSet.GetOption() + 4)%24000); + WorldTimeSet.setOption((WorldTimeSet.getOption() + 4)%24000); } else { - WorldTimeSet.SetOption((WorldTimeSet.GetOption() + 16)%24000); + WorldTimeSet.setOption((WorldTimeSet.getOption() + 16)%24000); } - WorldData.World.setTime(WorldTimeSet.GetOption()); + WorldData.World.setTime(WorldTimeSet.getOption()); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java index 20d0d68cc..468167353 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java @@ -52,14 +52,14 @@ public class TeamSurvivalGames extends SurvivalGames }); this.PlayersPerTeam = 2; - this.FillTeamsInOrderToCount.SetOption(2); + this.FillTeamsInOrderToCount.setOption(2); - this.SpawnNearAllies.SetOption(true); - this.SpawnNearEnemies.SetOption(true); + this.SpawnNearAllies.setOption(true); + this.SpawnNearEnemies.setOption(true); - this.DamageTeamSelf.SetOption(false); + this.DamageTeamSelf.setOption(false); - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java index b1f625615..5c82ac8b8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java @@ -71,10 +71,10 @@ public class Tug extends TeamGame }); - this.HungerSet.SetOption(20); - this.DeathOut.SetOption(false); + this.HungerSet.setOption(20); + this.DeathOut.setOption(false); - this.DeathSpectateSecs.SetOption(20); + this.DeathSpectateSecs.setOption(20); registerChatStats(); } @@ -146,24 +146,24 @@ public class Tug extends TeamGame { if (_redCreatures.size() < 30) { - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Location loc = UtilAlg.Random(_redMobs); Creature ent = loc.getWorld().spawn(loc, Pig.class); ent.setMaxHealth(10); ent.setHealth(10); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); _redCreatures.add(new TugCreature(this, ent, _blueLives)); } if (_blueCreatures.size() < 30) { - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Location loc = UtilAlg.Random(_blueMobs); Creature ent = loc.getWorld().spawn(loc, Sheep.class); ent.setMaxHealth(10); ent.setHealth(10); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); _blueCreatures.add(new TugCreature(this, ent, _redLives)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 02c9a6ee7..0530d37ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -141,15 +141,15 @@ public class TurfForts extends TeamGame "Take over all the turf to win!" }); - this.StrictAntiHack.SetOption(true); - this.HungerSet.SetOption(20); - this.DeathOut.SetOption(false); - this.BlockPlaceAllow.GetOption().add(35); - this.BlockBreakAllow.GetOption().add(35); - this.ItemDrop.SetOption(false); - this.ItemPickup.SetOption(false); - this.DamageSelf.SetOption(false); - this.DeathSpectateSecs.SetOption(4); + this.StrictAntiHack.setOption(true); + this.HungerSet.setOption(20); + this.DeathOut.setOption(false); + this.BlockPlaceAllow.getOption().add(35); + this.BlockBreakAllow.getOption().add(35); + this.ItemDrop.setOption(false); + this.ItemPickup.setOption(false); + this.DamageSelf.setOption(false); + this.DeathSpectateSecs.setOption(4); _breakStatTracker = new BlockBreakStatTracker(this, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 742bc0783..dcd6195aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -116,28 +116,28 @@ public class TypeWars extends TeamGame new StaffKillMonitorManager(this); - this.DeathOut.SetOption(false); - this.DamageTeamSelf.SetOption(false); - this.DamageSelf.SetOption(false); - this.DamageTeamOther.SetOption(false); - this.DeathSpectateSecs.SetOption(0); - this.HungerSet.SetOption(20); - this.WorldBoundaryKill.SetOption(true); + this.DeathOut.setOption(false); + this.DamageTeamSelf.setOption(false); + this.DamageSelf.setOption(false); + this.DamageTeamOther.setOption(false); + this.DeathSpectateSecs.setOption(0); + this.HungerSet.setOption(20); + this.WorldBoundaryKill.setOption(true); this.CompassEnabled = false; this.TeamArmor = true; this.TeamArmorHotbar = false; - this.WorldTimeSet.SetOption(6000); - this.DamageEvP.SetOption(false); - this.DamagePvE.SetOption(false); - this.DamagePvP.SetOption(false); + this.WorldTimeSet.setOption(6000); + this.DamageEvP.setOption(false); + this.DamagePvE.setOption(false); + this.DamagePvP.setOption(false); this.TeamArmorHotbar = true; - this.Damage.SetOption(false); - this.CreatureAllow.SetOption(false); + this.Damage.setOption(false); + this.CreatureAllow.setOption(false); this.PrepareTime = 50000; - this.PrepareFreeze.SetOption(false); + this.PrepareFreeze.setOption(false); this.PlaySoundGameStart = false; this.EnableTutorials = true; - this.PrepareFreeze.SetOption(true); + this.PrepareFreeze.setOption(true); this.AllowParticles = false; _activeMinions = new ArrayList<>(); @@ -231,10 +231,10 @@ public class TypeWars extends TeamGame if(i == 1) loc = blue; - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Giant giant = loc.getWorld().spawn(loc, Giant.class); _giantLocs.put(giant, loc.clone()); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); giant.setRemoveWhenFarAway(false); UtilEnt.Vegetate(giant, true); UtilEnt.ghost(giant, true, false); @@ -492,10 +492,10 @@ public class TypeWars extends TeamGame continue; int rdm = UtilMath.r(_minionSpawns.get(teams).size()); - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, MinionSize.BOSS.getRandomType(), rdm); _activeMinions.add(minion); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); UtilPlayer.message(event.getPlayer(), F.main("Boss", "You have spawned a Boss")); } } @@ -531,14 +531,14 @@ public class TypeWars extends TeamGame return; } - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) - type.getCost()); UtilTextMiddle.display("", ChatColor.GRAY + "You bought a Minion.", event.getPlayer()); int rdm = UtilMath.r(_minionSpawns.get(teams).size()); Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type.getRandomType(), rdm); Bukkit.getPluginManager().callEvent(new SummonMinionEvent(event.getPlayer(), minion)); _activeMinions.add(minion); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } } return; @@ -576,7 +576,7 @@ public class TypeWars extends TeamGame { _lastSpawnedRed = System.currentTimeMillis(); - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(0)).size()); Minion minion = null; @@ -592,7 +592,7 @@ public class TypeWars extends TeamGame } _activeMinions.add(minion); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); if(_timeToSpawnRed > 5000 / (GetTeamList().get(1).GetPlayers(true).size() > 0 ? GetTeamList().get(1).GetPlayers(true).size() : 1)) _timeToSpawnRed = _timeToSpawnRed - 75; @@ -605,7 +605,7 @@ public class TypeWars extends TeamGame { _lastSpawnedBlue = System.currentTimeMillis(); - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(1)).size()); Minion minion = null; if(_minionsSpawned.get(GetTeamList().get(1)) >= 100) @@ -619,7 +619,7 @@ public class TypeWars extends TeamGame minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1), rdm); } _activeMinions.add(minion); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); if(_timeToSpawnBlue > 5000 / (GetTeamList().get(0).GetPlayers(true).size() > 0 ? GetTeamList().get(0).GetPlayers(true).size() : 1)) _timeToSpawnBlue = _timeToSpawnRed - 75; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index e4d7abbc9..7d1df558e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -36,11 +36,11 @@ public class TutorialTypeWars extends GameTutorial { ArrayList locations = UtilShapes.getLinesDistancedPoints(_typeWars.getMinionSpawns().get(getTeam()).get(4), _typeWars.getMinionSpawns().get(team).get(4), 1); _manager.GetCreature().SetForce(true); - _manager.GetGame().CreatureAllowOverride.SetOption(true); + _manager.GetGame().CreatureAllowOverride.setOption(true); Minion minion = new Minion(_manager, locations.get(locations.size() - 35), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); minion.changeName("Fishing"); ((TypeWars) _manager.GetGame()).getActiveMinions().add(minion); - _manager.GetGame().CreatureAllowOverride.SetOption(false); + _manager.GetGame().CreatureAllowOverride.setOption(false); _manager.GetCreature().SetForce(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 6349d2595..134497de9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -139,57 +139,57 @@ public class UHC extends TeamGame this.HideTeamSheep = true; - this.StrictAntiHack.SetOption(true); + this.StrictAntiHack.setOption(true); - AnnounceStay.SetOption(false); + AnnounceStay.setOption(false); - this.GameTimeout.SetOption(10800000); + this.GameTimeout.setOption(10800000); - this.DamagePvP.SetOption(false); + this.DamagePvP.setOption(false); - this.DeathDropItems.SetOption(true); + this.DeathDropItems.setOption(true); - this.ItemDrop.SetOption(true); - this.ItemPickup.SetOption(true); + this.ItemDrop.setOption(true); + this.ItemPickup.setOption(true); - this.BlockBreak.SetOption(true); - this.BlockPlace.SetOption(true); + this.BlockBreak.setOption(true); + this.BlockPlace.setOption(true); - this.InventoryOpenBlock.SetOption(true); - this.InventoryOpenChest.SetOption(true); - this.InventoryClick.SetOption(true); + this.InventoryOpenBlock.setOption(true); + this.InventoryOpenChest.setOption(true); + this.InventoryClick.setOption(true); - this.DeathOut.SetOption(true); - this.QuitOut.SetOption(false); + this.DeathOut.setOption(true); + this.QuitOut.setOption(false); - this.CreatureAllow.SetOption(true); + this.CreatureAllow.setOption(true); - this.AnnounceStay.SetOption(false); + this.AnnounceStay.setOption(false); - this.DisplayLobbySide.SetOption(true); + this.DisplayLobbySide.setOption(true); - this.DeathMessages.SetOption(false); + this.DeathMessages.setOption(false); this.SoupEnabled = false; this.CompassEnabled = true; this.CompassGiveItem = false; - this.WorldBoundaryKill.SetOption(false); + this.WorldBoundaryKill.setOption(false); - this.TickPerTeleport.SetOption(3); + this.TickPerTeleport.setOption(3); this.GemBoosterEnabled = false; this.GemDoubleEnabled = false; this.GemHunterEnabled = false; - this.WorldBoneMeal.SetOption(true); + this.WorldBoneMeal.setOption(true); - this.DontAllowOverfill.SetOption(true); + this.DontAllowOverfill.setOption(true); - this.GadgetsDisabled.SetOption(true); + this.GadgetsDisabled.setOption(true); - WorldTimeSet.SetOption(-1); + WorldTimeSet.setOption(-1); CraftRecipes(); @@ -564,9 +564,9 @@ public class UHC extends TeamGame for (Player player : UtilServer.getPlayers()) player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); - this.DamagePvP.SetOption(true); + this.DamagePvP.setOption(true); this.CompassGiveItem = true; - this.QuitOut.SetOption(true); + this.QuitOut.setOption(true); } } @@ -579,7 +579,7 @@ public class UHC extends TeamGame if (event.getType() != UpdateType.FAST) return; - if (DamagePvP.GetOption()) + if (DamagePvP.getOption()) return; WorldData.World.setTime(2000); @@ -748,7 +748,7 @@ public class UHC extends TeamGame if (!IsAlive(player)) return; - if (!QuitOut.GetOption()) + if (!QuitOut.getOption()) return; // Drop Items @@ -1216,7 +1216,7 @@ public class UHC extends TeamGame teamsAlive.add(team); // Offline Player Team - if (!QuitOut.GetOption()) + if (!QuitOut.getOption()) for (GameTeam team : RejoinTeam.values()) teamsAlive.add(team); @@ -1411,7 +1411,7 @@ public class UHC extends TeamGame if (damagerEnt instanceof Player) { // PvP - if (!DamagePvP.GetOption() && damagee != null) + if (!DamagePvP.getOption() && damagee != null) event.setCancelled(true); Player damager = (Player) damagerEnt; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java index d608eb873..8107bf6fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java @@ -122,9 +122,9 @@ public class Valentines extends SoloGame "Slowest players are eliminated!" }); - this.DamageTeamSelf.SetOption(true); - this.HungerSet.SetOption(20); - this.HealthSet.SetOption(20); + this.DamageTeamSelf.setOption(true); + this.HungerSet.setOption(20); + this.HealthSet.setOption(20); EnableTutorials = true; @@ -170,14 +170,14 @@ public class Valentines extends SoloGame { _playersOutPerRound = Math.max(1, (int)(GetPlayers(true).size()/8d)); - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); _cow = GetSpectatorLocation().getWorld().spawn(GetSpectatorLocation(), Cow.class); _cow.setCustomName(C.cGreen + C.Bold + _cowName); _cow.setCustomNameVisible(true); UtilEnt.Vegetate(_cow); UtilEnt.ghost(_cow, true, false); - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); } if (event.GetState() == GameState.End || event.GetState() == GameState.Dead) _music.cancel(); @@ -404,7 +404,7 @@ public class Valentines extends SoloGame public void pigSpawn() { - CreatureAllowOverride.SetOption(true); + CreatureAllowOverride.setOption(true); int toSpawn = Math.max(1, GetPlayers(true).size()-_playersOutPerRound); @@ -432,7 +432,7 @@ public class Valentines extends SoloGame } } - CreatureAllowOverride.SetOption(false); + CreatureAllowOverride.setOption(false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java index f9130465c..752d7c668 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java @@ -106,7 +106,7 @@ public class TutorialValentines extends GameTutorial //Spawn if (_pigs.size() < 5 && tick % 15 == 0) { - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); //Spawn Pig pig = _pigSpawn.getWorld().spawn(_pigSpawn, Pig.class); @@ -119,7 +119,7 @@ public class TutorialValentines extends GameTutorial _pigs.put(pig, 0);; - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); } //Move @@ -178,7 +178,7 @@ public class TutorialValentines extends GameTutorial } //Spawn Cows - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); _cowBoy = _pigSpawn.getWorld().spawn(Host.WorldData.GetDataLocs("BROWN").get(0), Cow.class); _cowBoy.setCustomName(C.cGreenB + "Calvin"); @@ -190,7 +190,7 @@ public class TutorialValentines extends GameTutorial _cowGirl.setCustomNameVisible(true); UtilEnt.Vegetate(_cowGirl); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); //Player Data diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java index 707e02d7f..f5cd3166d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java @@ -22,9 +22,9 @@ public class PlayerCopyWither _owner = owner; - Host.CreatureAllowOverride.SetOption(true); + Host.CreatureAllowOverride.setOption(true); _ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class); - Host.CreatureAllowOverride.SetOption(false); + Host.CreatureAllowOverride.setOption(false); UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index 198367b12..9767833e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -116,26 +116,26 @@ public class WitherGame extends TeamGame implements IBlockRestorer C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes", }); - this.DeathOut.SetOption(true); - this.DamageTeamSelf.SetOption(false); - this.DamageSelf.SetOption(false); - this.DeathSpectateSecs.SetOption(4); - this.HungerSet.SetOption(20); - this.WorldBoundaryKill.SetOption(false); + this.DeathOut.setOption(true); + this.DamageTeamSelf.setOption(false); + this.DamageSelf.setOption(false); + this.DeathSpectateSecs.setOption(4); + this.HungerSet.setOption(20); + this.WorldBoundaryKill.setOption(false); this.CompassEnabled = false; //Customizing for the Editor kit - this.BlockBreak.SetOption(true); - this.BlockPlace.SetOption(true); - this.ItemPickup.SetOption(true); + this.BlockBreak.setOption(true); + this.BlockPlace.setOption(true); + this.ItemPickup.setOption(true); - this.KitRegisterState.SetOption(GameState.Prepare); + this.KitRegisterState.setOption(GameState.Prepare); this.TeamArmor = true; this.TeamArmorHotbar = false; - this.InventoryClick.SetOption(false); - this.InventoryOpenBlock.SetOption(false); + this.InventoryClick.setOption(false); + this.InventoryOpenBlock.setOption(false); _help = new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index 19a12edfa..c125e7a37 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -155,17 +155,17 @@ public class Wizards extends SoloGame _wizard = new WizardSpellMenu("Wizard Spell Menu", getArcadeManager().getPlugin(), this); - AnnounceStay.SetOption(false); - BlockBreak.SetOption(true); - BlockPlace.SetOption(true); - ItemPickup.SetOption(true); - ItemDrop.SetOption(true); - InventoryOpenBlock.SetOption(true); - InventoryOpenChest.SetOption(true); - InventoryClick.SetOption(true); - DisableKillCommand.SetOption(false); + AnnounceStay.setOption(false); + BlockBreak.setOption(true); + BlockPlace.setOption(true); + ItemPickup.setOption(true); + ItemDrop.setOption(true); + InventoryOpenBlock.setOption(true); + InventoryOpenChest.setOption(true); + InventoryClick.setOption(true); + DisableKillCommand.setOption(false); SoupEnabled = false; - DamageTeamSelf.SetOption(true); + DamageTeamSelf.setOption(true); registerChatStats( Kills, @@ -1716,7 +1716,7 @@ public class Wizards extends SoloGame if (_endgameMessageCounter == 6) { - WorldTimeSet.SetOption(0); + WorldTimeSet.setOption(0); WorldData.World.setTime(15000); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java index 778070942..3ebcfa50c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java @@ -48,12 +48,12 @@ public class SpellSummonWolves extends Spell implements SpellClick, SpellClickBl for (int i = 0; i < getSpellLevel(player); i++) { - Wizards.CreatureAllowOverride.SetOption(true); + Wizards.CreatureAllowOverride.setOption(true); Wolf wolf = (Wolf) player.getWorld().spawnEntity( loc.clone().add(new Random().nextFloat() - 0.5F, 0, new Random().nextFloat() - 0.5F), EntityType.WOLF); - Wizards.CreatureAllowOverride.SetOption(false); + Wizards.CreatureAllowOverride.setOption(false); wolf.setCollarColor(DyeColor.YELLOW); wolf.setTamed(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java index f1710f6ad..f944598a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java @@ -67,8 +67,8 @@ public class ZombieSurvival extends SoloGame "The last Survivor alive wins!" }); - this.DeathOut.SetOption(false); - this.HungerSet.SetOption(20); + this.DeathOut.setOption(false); + this.HungerSet.setOption(20); this.CompassEnabled = true; @@ -230,10 +230,10 @@ public class ZombieSurvival extends SoloGame if (_mobs.size() < 50) { - this.CreatureAllowOverride.SetOption(true); + this.CreatureAllowOverride.setOption(true); Zombie zombie = _undead.GetSpawn().getWorld().spawn(_undead.GetSpawn(), Zombie.class); _mobs.put(zombie, new ZombieData(GetTargetLocation())); - this.CreatureAllowOverride.SetOption(false); + this.CreatureAllowOverride.setOption(false); } mobIterator = _mobs.keySet().iterator(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java index ccf6595f0..e3f5c7397 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java @@ -127,10 +127,10 @@ public class PerkBatWave extends SmashPerk for (int i=0 ; i<32 ; i++) { - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class); _bats.get(player).add(bat); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); } //Inform diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java index 289042c6b..34c3873b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java @@ -52,7 +52,7 @@ public class PerkChicken extends Perk return; } - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Location loc = player.getLocation(); Chicken c = loc.getWorld().spawn(loc.add(0, 1, 0), Chicken.class); @@ -67,7 +67,7 @@ public class PerkChicken extends Perk _activeKitHolders.put(player.getName(), c); _failedAttempts.put(player.getName(), 0); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java index 22ecf10d2..2397deb70 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java @@ -80,14 +80,14 @@ public class PerkChickenRocket extends SmashPerk if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) return; - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Chicken ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Chicken.class); ent.getLocation().setPitch(0); ent.getLocation().setYaw(player.getLocation().getYaw()); ent.setBaby(); ent.setAgeLock(true); UtilEnt.Vegetate(ent); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); _data.add(new ChickenMissileData(player, ent)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java index 7e548190e..feede4574 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java @@ -65,9 +65,9 @@ public class PerkCowBomb extends Perk implements IThrown UtilInv.Update(player); - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Cow ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Cow.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); ent.setBaby(); ent.setAgeLock(true); ent.setMaxHealth(100); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java index 807d4fb6c..4bc883afd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java @@ -41,10 +41,10 @@ public class PerkEndermanDragon extends SmashPerk @Override public void addSuperCustom(Player player) { - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); EnderDragon dragon = player.getWorld().spawn(player.getLocation().add(0, 5, 0), EnderDragon.class); UtilEnt.Vegetate(dragon); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); dragon.setCustomName(C.cYellow + player.getName() + "'s Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java index 1910ea8c9..3ea238e92 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java @@ -55,9 +55,9 @@ public class PerkHorsePet extends Perk if (!Manager.GetGame().IsAlive(player)) return; - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); horse.setAdult(); horse.setAgeLock(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java index a50ad1aa1..66639a23a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java @@ -221,7 +221,7 @@ public class PerkMadScientist extends Perk implements IThrown data.GetThrown().remove(); - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Zombie zombie = (Zombie) data.GetThrown().getWorld() .spawn(data.GetThrown().getLocation(), Zombie.class); @@ -275,7 +275,7 @@ public class PerkMadScientist extends Perk implements IThrown // // Manager.GetDisguise().disguise(disguise); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java index c2d63e2d9..9322ad543 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java @@ -50,13 +50,13 @@ public class PerkNightLivingDead extends SmashPerk if (event.getType() != UpdateType.TICK) return; - if (_night.isEmpty() && Manager.GetGame().WorldTimeSet.GetOption() != 12000) + if (_night.isEmpty() && Manager.GetGame().WorldTimeSet.getOption() != 12000) { - Manager.GetGame().WorldTimeSet.SetOption((Manager.GetGame().WorldTimeSet.GetOption() + 50)%24000); + Manager.GetGame().WorldTimeSet.setOption((Manager.GetGame().WorldTimeSet.getOption() + 50)%24000); } - else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet.GetOption() != 18000) + else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet.getOption() != 18000) { - Manager.GetGame().WorldTimeSet.SetOption((Manager.GetGame().WorldTimeSet.GetOption() + 50)%24000); + Manager.GetGame().WorldTimeSet.setOption((Manager.GetGame().WorldTimeSet.getOption() + 50)%24000); } } @@ -101,9 +101,9 @@ public class PerkNightLivingDead extends SmashPerk loc.subtract(0, 1, 0); //Spawn - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Zombie zombie = loc.getWorld().spawn(loc, Zombie.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); data.Zombies.add(zombie); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java index 49daa4385..dd63b07a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java @@ -96,11 +96,11 @@ public class PerkPigBaconBomb extends SmashPerk player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f); //Pig - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Pig pig = player.getWorld().spawn(player.getLocation(), Pig.class); pig.setHealth(5); pig.setVelocity(new Vector(0, -0.4, 0)); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); pig.setBaby(); UtilEnt.Vegetate(pig); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java index fe06341eb..83630a670 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java @@ -42,9 +42,9 @@ public class PerkSheepHoming extends SmashPerk if (target.equals(player)) continue; - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Sheep sheep = player.getWorld().spawn(player.getEyeLocation(), Sheep.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); sheep.setBaby(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index d9ef70386..02fb08c7f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -85,9 +85,9 @@ public class PerkSkeletons extends Perk Player killed = (Player) event.GetEvent().getEntity(); - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Skeleton skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); UtilEnt.removeGoalSelectors(skel); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index c74659ad3..b0bc11219 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -174,10 +174,10 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown double charge = Math.min(3, (double)(System.currentTimeMillis() - _charge.get(player))/1000d); //Spawn Slime - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class); slime.setSize(1); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); //Size slime.setSize(Math.max(1, (int)charge)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java index 213a260a6..84713ec24 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java @@ -50,9 +50,9 @@ public class PerkSnowTurret extends SmashPerk @Override public void addSuperCustom(Player player) { - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Snowman ent = player.getWorld().spawn(player.getEyeLocation(), Snowman.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index 1b56d1484..2d1465136 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -73,9 +73,9 @@ public class PerkWitherImage extends SmashPerk return; //Spawn - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Skeleton skel = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Skeleton.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); skel.setSkeletonType(SkeletonType.WITHER); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java index fc2ed29d8..52b715b79 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java @@ -74,7 +74,7 @@ public class PerkWitherMinion extends Perk event.setCancelled(true); - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); for (int i=0 ; i<2 ; i++) { @@ -99,7 +99,7 @@ public class PerkWitherMinion extends Perk UtilAction.velocity(skel, player.getLocation().getDirection().add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false); } - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java index fdf529255..52f6c15a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java @@ -87,9 +87,9 @@ public class PerkWolf extends SmashPerk return; //Get Nearest Wolf - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Wolf wolf = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Wolf.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); wolf.setBaby(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java index 2f08d7a59..b34fe6f33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java @@ -197,9 +197,9 @@ public class PerkWolfPack extends Perk public void MinionSpawn(Player cur) { - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); //wolf.setOwner(cur); //wolf.setCollarColor(DyeColor.GREEN); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index c6bd4602d..0b0258f98 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -95,9 +95,9 @@ public class PerkWolfPet extends Perk if (_wolfMap.get(cur).size() >= _max) continue; - Manager.GetGame().CreatureAllowOverride.SetOption(true); + Manager.GetGame().CreatureAllowOverride.setOption(true); Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); - Manager.GetGame().CreatureAllowOverride.SetOption(false); + Manager.GetGame().CreatureAllowOverride.setOption(false); wolf.setOwner(cur); wolf.setCollarColor(DyeColor.GREEN); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 554f59222..89247dfcd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -123,7 +123,7 @@ public class GameFlagManager implements Listener return; } - if (!game.Damage.GetOption()) + if (!game.Damage.getOption()) { event.SetCancelled("Damage Disabled"); return; @@ -147,7 +147,7 @@ public class GameFlagManager implements Listener return; } - if (event.GetCause() == DamageCause.FALL && !game.DamageFall.GetOption()) + if (event.GetCause() == DamageCause.FALL && !game.DamageFall.getOption()) { event.SetCancelled("Fall Damage Disabled"); return; @@ -168,7 +168,7 @@ public class GameFlagManager implements Listener //PvE else if (damager instanceof Player) { - if (!game.DamagePvE.GetOption()) + if (!game.DamagePvE.getOption()) { event.SetCancelled("PvE Disabled"); return; @@ -177,7 +177,7 @@ public class GameFlagManager implements Listener //EvP else if (damagee instanceof Player) { - if (!game.DamageEvP.GetOption()) + if (!game.DamageEvP.getOption()) { event.SetCancelled("EvP Disabled"); return; @@ -223,16 +223,16 @@ public class GameFlagManager implements Listener } - if (game.ItemPickup.GetOption()) + if (game.ItemPickup.getOption()) { - if (game.ItemPickupDeny.GetOption().contains(event.getItem().getItemStack().getTypeId())) + if (game.ItemPickupDeny.getOption().contains(event.getItem().getItemStack().getTypeId())) { event.setCancelled(true); } } else { - if (!game.ItemPickupAllow.GetOption().contains(event.getItem().getItemStack().getTypeId())) + if (!game.ItemPickupAllow.getOption().contains(event.getItem().getItemStack().getTypeId())) { event.setCancelled(true); } @@ -257,16 +257,16 @@ public class GameFlagManager implements Listener return; } - if (game.ItemDrop.GetOption()) + if (game.ItemDrop.getOption()) { - if (game.ItemDropDeny.GetOption().contains(event.getItemDrop().getItemStack().getTypeId())) + if (game.ItemDropDeny.getOption().contains(event.getItemDrop().getItemStack().getTypeId())) { event.setCancelled(true); } } else { - if (!game.ItemDropAllow.GetOption().contains(event.getItemDrop().getItemStack().getTypeId())) + if (!game.ItemDropAllow.getOption().contains(event.getItemDrop().getItemStack().getTypeId())) { event.setCancelled(true); } @@ -284,7 +284,7 @@ public class GameFlagManager implements Listener return; //normal inventories - if (!game.InventoryOpenBlock.GetOption()) + if (!game.InventoryOpenBlock.getOption()) { if (event.getInventory().getType() == InventoryType.ANVIL || event.getInventory().getType() == InventoryType.BEACON || @@ -316,7 +316,7 @@ public class GameFlagManager implements Listener } //deal with chests - if (!game.InventoryOpenChest.GetOption()) + if (!game.InventoryOpenChest.getOption()) { if (event.getInventory().getType() == InventoryType.CHEST) { @@ -339,7 +339,7 @@ public class GameFlagManager implements Listener if (!game.InProgress()) return; - if (game.InventoryClick.GetOption()) + if (game.InventoryClick.getOption()) return; Player player = UtilPlayer.searchExact(event.getWhoClicked().getName()); @@ -377,22 +377,22 @@ public class GameFlagManager implements Listener event.setCancelled(true); } // Event Server Allowance - else if (game.BlockPlaceCreative.GetOption() && player.getGameMode() == GameMode.CREATIVE) + else if (game.BlockPlaceCreative.getOption() && player.getGameMode() == GameMode.CREATIVE) { return; } else { - if (game.BlockPlace.GetOption()) + if (game.BlockPlace.getOption()) { - if (game.BlockPlaceDeny.GetOption().contains(event.getBlock().getTypeId())) + if (game.BlockPlaceDeny.getOption().contains(event.getBlock().getTypeId())) { event.setCancelled(true); } } else { - if (!game.BlockPlaceAllow.GetOption().contains(event.getBlock().getTypeId())) + if (!game.BlockPlaceAllow.getOption().contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -420,15 +420,15 @@ public class GameFlagManager implements Listener event.setCancelled(true); } // Event Server Allowance - else if (game.BlockBreakCreative.GetOption() && player.getGameMode() == GameMode.CREATIVE) + else if (game.BlockBreakCreative.getOption() && player.getGameMode() == GameMode.CREATIVE) { return; } else { - if (game.BlockBreak.GetOption()) + if (game.BlockBreak.getOption()) { - if (game.BlockBreakDeny.GetOption().contains(event.getBlock().getTypeId())) + if (game.BlockBreakDeny.getOption().contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -436,7 +436,7 @@ public class GameFlagManager implements Listener } else { - if (!game.BlockBreakAllow.GetOption().contains(event.getBlock().getTypeId())) + if (!game.BlockBreakAllow.getOption().contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -453,7 +453,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.GetOption()) + if (!game.PrivateBlocks.getOption()) return; if (event.isCancelled()) @@ -492,7 +492,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.GetOption()) + if (!game.PrivateBlocks.getOption()) return; if (event.isCancelled()) @@ -546,7 +546,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.GetOption()) + if (!game.PrivateBlocks.getOption()) return; if (event.isCancelled()) @@ -587,7 +587,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.GetOption()) + if (!game.PrivateBlocks.getOption()) return; if (event.getAction() != Action.RIGHT_CLICK_BLOCK) @@ -639,7 +639,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.GetOption()) + if (!game.PrivateBlocks.getOption()) return; if (event.isCancelled()) @@ -689,13 +689,13 @@ public class GameFlagManager implements Listener player.setFallDistance(0); //Drop Items - if (game.DeathDropItems.GetOption()) + if (game.DeathDropItems.getOption()) for (ItemStack stack : event.getDrops()) player.getWorld().dropItem(player.getLocation(), stack); event.getDrops().clear(); //DEATH OUT - if (game.GetState() == GameState.Live && game.DeathOut.GetOption()) + if (game.GetState() == GameState.Live && game.DeathOut.getOption()) { //Event PlayerDeathOutEvent outEvent = new PlayerDeathOutEvent(game, player); @@ -708,16 +708,16 @@ public class GameFlagManager implements Listener } //RESPAWN - if (game.DeathSpectateSecs.GetOption() <= 0 && (game.GetTeam(player) == null || game.GetTeam(player).GetRespawnTime() <= 0)) + if (game.DeathSpectateSecs.getOption() <= 0 && (game.GetTeam(player) == null || game.GetTeam(player).GetRespawnTime() <= 0)) { //Teleport - if (game.AutomaticRespawn.GetOption() && game.IsAlive(player)) + if (game.AutomaticRespawn.getOption() && game.IsAlive(player)) { game.RespawnPlayer(player); } else { - Manager.addSpectator(player, game.DeathTeleport.GetOption()); + Manager.addSpectator(player, game.DeathTeleport.getOption()); } Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() @@ -732,7 +732,7 @@ public class GameFlagManager implements Listener //TIMER else { - double time = game.DeathSpectateSecs.GetOption(); + double time = game.DeathSpectateSecs.getOption(); if (game.GetTeam(player) != null) if (game.GetTeam(player).GetRespawnTime() > time) time = game.GetTeam(player).GetRespawnTime(); @@ -752,7 +752,7 @@ public class GameFlagManager implements Listener if (!game.IsAlive(player)) { - Manager.addSpectator(player, game.DeathTeleport.GetOption()); + Manager.addSpectator(player, game.DeathTeleport.getOption()); return; } @@ -773,7 +773,7 @@ public class GameFlagManager implements Listener } else { - Manager.addSpectator(player, game.DeathTeleport.GetOption()); + Manager.addSpectator(player, game.DeathTeleport.getOption()); } player.setFireTicks(0); @@ -790,7 +790,7 @@ public class GameFlagManager implements Listener if (game == null) return; //Drop Items - if (game.QuitDropItems.GetOption()) + if (game.QuitDropItems.getOption()) if (game.IsLive()) if (game.IsAlive(event.getPlayer())) UtilInv.drop(event.getPlayer(), true); @@ -800,7 +800,7 @@ public class GameFlagManager implements Listener game.GetPlayerKits().remove(event.getPlayer()); game.GetPlayerGems().remove(event.getPlayer()); - if (!game.QuitOut.GetOption()) + if (!game.QuitOut.getOption()) return; GameTeam team = game.GetTeam(event.getPlayer()); @@ -821,7 +821,7 @@ public class GameFlagManager implements Listener if (game == null || game.GetState() != GameState.Prepare) return; - if (!game.PrepareFreeze.GetOption()) + if (!game.PrepareFreeze.getOption()) return; if (!game.IsAlive(event.getPlayer())) @@ -858,20 +858,20 @@ public class GameFlagManager implements Listener if (game == null || !game.IsLive()) return; - if (game.HungerSet.GetOption() != -1) + if (game.HungerSet.getOption() != -1) for (Player player : game.GetPlayers(true)) { if (Manager.GetCondition().HasCondition(player, ConditionType.ARCADE_HUNGER_DISABLE, null)) continue; - player.setFoodLevel(game.HungerSet.GetOption()); + player.setFoodLevel(game.HungerSet.getOption()); player.setSaturation(1F); } - if (game.HealthSet.GetOption() != -1) + if (game.HealthSet.getOption() != -1) for (Player player : game.GetPlayers(true)) { - player.setHealth(game.HealthSet.GetOption()); + player.setHealth(game.HealthSet.getOption()); } } @@ -897,7 +897,7 @@ public class GameFlagManager implements Listener ((CraftPlayer)player).getHandle().spectating = false; } - if (!game.WorldBoundaryKill.GetOption()) + if (!game.WorldBoundaryKill.getOption()) { UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!"); @@ -937,7 +937,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.CreatureAllow.GetOption() && !game.CreatureAllowOverride.GetOption()) + if (!game.CreatureAllow.getOption() && !game.CreatureAllowOverride.getOption()) { if (game.WorldData != null) { @@ -967,7 +967,7 @@ public class GameFlagManager implements Listener if (!(game.IsLive() || game.GetState() == GameState.Prepare)) return; - if (!game.TeleportsDisqualify.GetOption()) + if (!game.TeleportsDisqualify.getOption()) return; if (!game.IsAlive(event.getPlayer())) @@ -1000,13 +1000,13 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldTimeSet.GetOption() != -1) + if (game.WorldTimeSet.getOption() != -1) { if (game.WorldData != null) { if (game.WorldData.World != null) { - game.WorldData.World.setTime(game.WorldTimeSet.GetOption()); + game.WorldData.World.setTime(game.WorldTimeSet.getOption()); } } } @@ -1021,7 +1021,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.WorldWeatherEnabled.GetOption()) + if (!game.WorldWeatherEnabled.getOption()) { if (game.WorldData != null) { @@ -1046,11 +1046,11 @@ public class GameFlagManager implements Listener if (!game.IsLive()) return; - if (game.WorldWaterDamage.GetOption() <= 0) + if (game.WorldWaterDamage.getOption() <= 0) { if (!game.WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty()) { - game.WorldWaterDamage.SetOption(4); + game.WorldWaterDamage.setOption(4); } else { @@ -1065,7 +1065,7 @@ public class GameFlagManager implements Listener { //Damage Event Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.DROWNING, game.WorldWaterDamage.GetOption(), true, false, false, + DamageCause.DROWNING, game.WorldWaterDamage.getOption(), true, false, false, "Water", "Water Damage"); player.getWorld().playSound(player.getLocation(), @@ -1083,7 +1083,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldSoilTrample.GetOption()) + if (game.WorldSoilTrample.getOption()) return; if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL) @@ -1098,7 +1098,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldBlockBurn.GetOption()) + if (game.WorldBlockBurn.getOption()) return; event.setCancelled(true); @@ -1110,7 +1110,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldBlockGrow.GetOption()) + if (game.WorldBlockGrow.getOption()) return; event.setCancelled(true); @@ -1122,7 +1122,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldFireSpread.GetOption()) + if (game.WorldFireSpread.getOption()) return; event.setCancelled(true); @@ -1134,7 +1134,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldLeavesDecay.GetOption()) + if (game.WorldLeavesDecay.getOption()) return; event.setCancelled(true); @@ -1149,7 +1149,7 @@ public class GameFlagManager implements Listener if (Manager.GetGame() == null) return; - if (!Manager.GetGame().AnnounceStay.GetOption()) + if (!Manager.GetGame().AnnounceStay.getOption()) return; if (!Manager.GetGame().IsLive()) @@ -1176,7 +1176,7 @@ public class GameFlagManager implements Listener public void AntiHackStrict(GameStateChangeEvent event) { if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Live) - AntiHack.Instance.setStrict(event.GetGame().StrictAntiHack.GetOption()); + AntiHack.Instance.setStrict(event.GetGame().StrictAntiHack.getOption()); else AntiHack.Instance.setStrict(true); @@ -1188,7 +1188,7 @@ public class GameFlagManager implements Listener if (Manager.GetGame() == null) return; - if (!Manager.GetGame().DisableKillCommand.GetOption()) + if (!Manager.GetGame().DisableKillCommand.getOption()) return; if (event.getMessage().toLowerCase().startsWith("/kill")) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index 27667c295..04d273467 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -1045,7 +1045,7 @@ public class GameLobbyManager implements Listener if (event.getType() != UpdateType.FAST) return; - if (Manager.GetGame() != null && !Manager.GetGame().DisplayLobbySide.GetOption()) + if (Manager.GetGame() != null && !Manager.GetGame().DisplayLobbySide.getOption()) { return; } @@ -1318,7 +1318,7 @@ public class GameLobbyManager implements Listener if (Manager.GetGame() == null) return; - if (Manager.GetGame().GetState() != GameState.Recruit && Manager.GetGame().GadgetsDisabled.GetOption()) + if (Manager.GetGame().GetState() != GameState.Recruit && Manager.GetGame().GadgetsDisabled.getOption()) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index df4777940..32c4c88c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -388,7 +388,7 @@ public class GameManager implements Listener } else if (game.GetState() == GameState.Live) { - if (game.GameTimeout.GetOption() != -1 && UtilTime.elapsed(game.GetStateTime(), game.GameTimeout.GetOption()) && Manager.IsGameTimeout()) + if (game.GameTimeout.getOption() != -1 && UtilTime.elapsed(game.GetStateTime(), game.GameTimeout.getOption()) && Manager.IsGameTimeout()) { game.HandleTimeout(); } @@ -411,7 +411,7 @@ public class GameManager implements Listener return; //Disabling Cosmetics - if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled.GetOption()) + if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled.getOption()) { if (Manager.getCosmeticManager().isShowingInterface()) { @@ -484,7 +484,7 @@ public class GameManager implements Listener @EventHandler public void KitRegister(GameStateChangeEvent event) { - if (event.GetState() != event.GetGame().KitRegisterState.GetOption()) + if (event.GetState() != event.GetGame().KitRegisterState.getOption()) return; event.GetGame().RegisterKits(); @@ -761,7 +761,7 @@ public class GameManager implements Listener PlayerPrepareTeleportEvent playerStateEvent = new PlayerPrepareTeleportEvent(game, player); UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); } - }, i * game.TickPerTeleport.GetOption()); + }, i * game.TickPerTeleport.getOption()); } //Announce Game after every player is TP'd in @@ -776,7 +776,7 @@ public class GameManager implements Listener GamePrepareCountdownCommence event = new GamePrepareCountdownCommence(game); UtilServer.getServer().getPluginManager().callEvent(event); } - }, players.size() * game.TickPerTeleport.GetOption()); + }, players.size() * game.TickPerTeleport.getOption()); //Spectators Move for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java index 5298787f7..b926d5f47 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -50,7 +50,7 @@ public class MiscManager implements Listener Player player = event.getPlayer(); //BoneMeal - if (!Manager.GetGame().WorldBoneMeal.GetOption() && + if (!Manager.GetGame().WorldBoneMeal.getOption() && event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) From a07e71ba083a32997f2a85192c96bc9a9327bdb4 Mon Sep 17 00:00:00 2001 From: Joseph Prezioso Jr Date: Wed, 6 Apr 2016 18:10:31 -0400 Subject: [PATCH 28/34] GameOption takes a generic value to eliminate the need for more than the one GameOption class. Remove the--now unnecessary--classes that inherited from GameOption. Consequently, the creation and implementation of GameOptions should be much more efficient. Note: it may be necessary to add decimal points to doubles and to cast 'long' data types as 'long'. The above note generally applies to numerical values, but may apply to other values, as well. --- .../src/nautilus/game/arcade/game/Game.java | 134 +++++++++--------- .../game/arcade/game/GameOptionBoolean.java | 26 ---- .../game/arcade/game/GameOptionDouble.java | 25 ---- .../game/arcade/game/GameOptionGameState.java | 25 ---- .../game/arcade/game/GameOptionHashInt.java | 27 ---- .../game/arcade/game/GameOptionInteger.java | 25 ---- .../game/arcade/game/GameOptionItem.java | 26 ---- .../game/arcade/game/GameOptionLong.java | 25 ---- .../game/arcade/game/games/bridge/Bridge.java | 2 +- .../game/games/common/CaptureTheFlag.java | 2 +- .../arcade/game/games/common/Domination.java | 2 +- .../arcade/game/games/event/EventGame.java | 2 +- .../game/arcade/game/games/moba/Moba.java | 2 +- .../game/arcade/game/games/quiver/Quiver.java | 2 +- .../arcade/game/games/sheep/SheepGame.java | 2 +- .../arcade/game/games/smash/SuperSmash.java | 2 +- .../games/survivalgames/SurvivalGames.java | 2 +- .../survivalgames/SurvivalGamesTeams.java | 2 +- .../game/arcade/game/games/tug/Tug.java | 2 +- .../game/games/turfforts/TurfForts.java | 2 +- .../arcade/game/games/typewars/TypeWars.java | 2 +- .../game/arcade/game/games/uhc/UHC.java | 2 +- .../arcade/game/games/wither/WitherGame.java | 2 +- 23 files changed, 82 insertions(+), 261 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionGameState.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index c922c3d09..df6d6b7f5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -164,104 +164,104 @@ public abstract class Game implements Listener // Gameplay Flags //Note: If any descriptions are inaccurate, feel free to let me know and/or fix them. Thanks. ~Joe Prezioso - public GameOptionLong GameTimeout = new GameOptionLong(1200000, "Game Timeout", "Allotted time for game mode"); + public GameOption GameTimeout = new GameOption((long)1200000.0, "Game Timeout", "Allotted time for game mode"); - public GameOptionBoolean Damage = new GameOptionBoolean(true, "Damage", "Does damage matter in this game mode?"); - public GameOptionBoolean DamagePvP = new GameOptionBoolean(true, "Damage PVP", "Players allowed to damage other players?"); - public GameOptionBoolean DamagePvE = new GameOptionBoolean(true, "Damage PVE", "Players allowed to damage monsters?"); - public GameOptionBoolean DamageEvP = new GameOptionBoolean(true, "Damage EVP", "Monsters allowed to damage players?"); - public GameOptionBoolean DamageSelf = new GameOptionBoolean(true, "Damage Self", "Players allowed to harm themselves?"); - public GameOptionBoolean DamageFall = new GameOptionBoolean(true, "Damage Fall", "Can players be harmed by falling?"); - public GameOptionBoolean DamageTeamSelf = new GameOptionBoolean(false, "Damage Team, Self", "Can players damage teammates?"); - public GameOptionBoolean DamageTeamOther = new GameOptionBoolean(true, "Damage Team, Other", "Can players damage opposing team's players?"); + public GameOption Damage = new GameOption(true, "Damage", "Does damage matter in this game mode?"); + public GameOption DamagePvP = new GameOption(true, "Damage PVP", "Players allowed to damage other players?"); + public GameOption DamagePvE = new GameOption(true, "Damage PVE", "Players allowed to damage monsters?"); + public GameOption DamageEvP = new GameOption(true, "Damage EVP", "Monsters allowed to damage players?"); + public GameOption DamageSelf = new GameOption(true, "Damage Self", "Players allowed to harm themselves?"); + public GameOption DamageFall = new GameOption(true, "Damage Fall", "Can players be harmed by falling?"); + public GameOption DamageTeamSelf = new GameOption(false, "Damage Team, Self", "Can players damage teammates?"); + public GameOption DamageTeamOther = new GameOption(true, "Damage Team, Other", "Can players damage opposing team's players?"); - public GameOptionBoolean BlockBreak = new GameOptionBoolean(false, "Block Break", "Can players break blocks?"); + public GameOption BlockBreak = new GameOption(false, "Block Break", "Can players break blocks?"); //Really not sure about the description for this one... - public GameOptionBoolean BlockBreakCreative = new GameOptionBoolean(false, "Block Break, Creative", "Can players break blocks in creative mode?"); - public GameOptionHashInt BlockBreakAllow = new GameOptionHashInt(new HashSet(), "Block Break Allow", "Set of blocks players can break"); - public GameOptionHashInt BlockBreakDeny = new GameOptionHashInt(new HashSet(), "Block Break Deny", "Set of blocks players can't break"); + public GameOption BlockBreakCreative = new GameOption(false, "Block Break, Creative", "Can players break blocks in creative mode?"); + public GameOption> BlockBreakAllow = new GameOption>(new HashSet(), "Block Break Allow", "Set of blocks players can break"); + public GameOption> BlockBreakDeny = new GameOption>(new HashSet(), "Block Break Deny", "Set of blocks players can't break"); - public GameOptionBoolean BlockPlace = new GameOptionBoolean(false, "Block Place", "Can players place blocks?"); - public GameOptionBoolean BlockPlaceCreative = new GameOptionBoolean(false, "Block Place, Creative", "Can players place blocks in creative mode?"); - public GameOptionHashInt BlockPlaceAllow = new GameOptionHashInt(new HashSet(), "Block Place Allow", "Set of blocks players can place"); - public GameOptionHashInt BlockPlaceDeny = new GameOptionHashInt(new HashSet(), "Block Place Deny", "Set of blocks players cannot place"); + public GameOption BlockPlace = new GameOption(false, "Block Place", "Can players place blocks?"); + public GameOption BlockPlaceCreative = new GameOption(false, "Block Place, Creative", "Can players place blocks in creative mode?"); + public GameOption> BlockPlaceAllow = new GameOption>(new HashSet(), "Block Place Allow", "Set of blocks players can place"); + public GameOption> BlockPlaceDeny = new GameOption>(new HashSet(), "Block Place Deny", "Set of blocks players cannot place"); - public GameOptionBoolean ItemPickup = new GameOptionBoolean(false, "Item Pickup", "Are there items to pickup?"); - public GameOptionHashInt ItemPickupAllow = new GameOptionHashInt(new HashSet(), "Item Pickup, Allow", "Items players can pick up"); - public GameOptionHashInt ItemPickupDeny = new GameOptionHashInt(new HashSet(), "Item Pickup, Deny", "Items players cannot pick up"); + public GameOption ItemPickup = new GameOption(false, "Item Pickup", "Are there items to pickup?"); + public GameOption> ItemPickupAllow = new GameOption>(new HashSet(), "Item Pickup, Allow", "Items players can pick up"); + public GameOption> ItemPickupDeny = new GameOption>(new HashSet(), "Item Pickup, Deny", "Items players cannot pick up"); - public GameOptionBoolean ItemDrop = new GameOptionBoolean(false, "Item Drop", "Can items drop?"); - public GameOptionHashInt ItemDropAllow = new GameOptionHashInt(new HashSet(), "Item Drop Allow", "Set of items that can drop"); - public GameOptionHashInt ItemDropDeny = new GameOptionHashInt(new HashSet(), "Item Drop Deny", "Set of items that cannot drop"); + public GameOption ItemDrop = new GameOption(false, "Item Drop", "Can items drop?"); + public GameOption> ItemDropAllow = new GameOption>(new HashSet(), "Item Drop Allow", "Set of items that can drop"); + public GameOption> ItemDropDeny = new GameOption>(new HashSet(), "Item Drop Deny", "Set of items that cannot drop"); - public GameOptionBoolean InventoryOpenBlock = new GameOptionBoolean(false, "Inventory Open Block", "Can players open inventory from a block?"); - public GameOptionBoolean InventoryOpenChest = new GameOptionBoolean(false, "Inventory Open Chest", "Can players open inventory from a chest?"); - public GameOptionBoolean InventoryClick = new GameOptionBoolean(false, "Inventory Click", "Can players click on their inventory?"); + public GameOption InventoryOpenBlock = new GameOption(false, "Inventory Open Block", "Can players open inventory from a block?"); + public GameOption InventoryOpenChest = new GameOption(false, "Inventory Open Chest", "Can players open inventory from a chest?"); + public GameOption InventoryClick = new GameOption(false, "Inventory Click", "Can players click on their inventory?"); - public GameOptionBoolean PrivateBlocks = new GameOptionBoolean(false, "Private Blocks", "Can private blocks exist?"); + public GameOption PrivateBlocks = new GameOption(false, "Private Blocks", "Can private blocks exist?"); - public GameOptionBoolean DeathOut = new GameOptionBoolean(true, "Death Out", "Are players out of the game upon death?"); - public GameOptionBoolean DeathDropItems = new GameOptionBoolean(false, "Death Drop Items", "Do players drop items upon death?"); - public GameOptionBoolean DeathMessages = new GameOptionBoolean(true, "Death Messages", "Display message upon death?"); - public GameOptionBoolean AutomaticRespawn = new GameOptionBoolean(true, "Automatic Respawn", "Do players automatically respawn on death?"); + public GameOption DeathOut = new GameOption(true, "Death Out", "Are players out of the game upon death?"); + public GameOption DeathDropItems = new GameOption(false, "Death Drop Items", "Do players drop items upon death?"); + public GameOption DeathMessages = new GameOption(true, "Death Messages", "Display message upon death?"); + public GameOption AutomaticRespawn = new GameOption(true, "Automatic Respawn", "Do players automatically respawn on death?"); - public GameOptionDouble DeathSpectateSecs = new GameOptionDouble(0, "Death Spectate Secs", "How many seconds players may spectate match while dead"); - public GameOptionBoolean DeathTeleport = new GameOptionBoolean(true, "Death Teleport", "Do players teleport upon death?"); + public GameOption DeathSpectateSecs = new GameOption(0.0, "Death Spectate Secs", "How many seconds players may spectate match while dead"); + public GameOption DeathTeleport = new GameOption(true, "Death Teleport", "Do players teleport upon death?"); - public GameOptionBoolean QuitOut = new GameOptionBoolean(true, "Quit Out", "Are players allowed to quit?"); - public GameOptionBoolean QuitDropItems = new GameOptionBoolean(false, "Quit Drop Items", "Do players drop items if they quit?"); + public GameOption QuitOut = new GameOption(true, "Quit Out", "Are players allowed to quit?"); + public GameOption QuitDropItems = new GameOption(false, "Quit Drop Items", "Do players drop items if they quit?"); - public GameOptionBoolean IdleKickz = new GameOptionBoolean(true, "Idle Kickz", "Are idle players kicked?"); + public GameOption IdleKickz = new GameOption(true, "Idle Kickz", "Are idle players kicked?"); - public GameOptionBoolean CreatureAllow = new GameOptionBoolean(false, "Creature Allow", "Allow creatures to spawn?"); - public GameOptionBoolean CreatureAllowOverride = new GameOptionBoolean(false, "Creature Allow Override", "Can creatures spawn where they normally wouldn't?"); + public GameOption CreatureAllow = new GameOption(false, "Creature Allow", "Allow creatures to spawn?"); + public GameOption CreatureAllowOverride = new GameOption(false, "Creature Allow Override", "Can creatures spawn where they normally wouldn't?"); //Still not quite sure what the descriptions for 'World Block Burn' and 'World Water Damage' should be - public GameOptionInteger WorldTimeSet = new GameOptionInteger(12000, "World Time Set", "Set time in the world"); - public GameOptionBoolean WorldWeatherEnabled = new GameOptionBoolean(false, "Weather Enabled", "Is there weather in this game world?"); - public GameOptionInteger WorldWaterDamage = new GameOptionInteger(0, "Water Damage", "Can water hurt players?"); - public GameOptionBoolean WorldBoundaryKill = new GameOptionBoolean(true, "Boundary Kill", "Do players die when leaving the game's boundaries?"); - public GameOptionBoolean WorldBlockBurn = new GameOptionBoolean(false, "Block Burn", "Can world blocks burn?"); - public GameOptionBoolean WorldBlockGrow = new GameOptionBoolean(false, "Block Grow", "Do world blocks grow?"); - public GameOptionBoolean WorldFireSpread = new GameOptionBoolean(false, "Fire Spread", "Does fire spread to world blocks?"); - public GameOptionBoolean WorldLeavesDecay = new GameOptionBoolean(false, "Leaves Decay", "Do leaves decay?"); - public GameOptionBoolean WorldSoilTrample = new GameOptionBoolean(false, "Soil Trample", "Can soil be trampled?"); - public GameOptionBoolean WorldBoneMeal = new GameOptionBoolean(false, "Bone Meal", "Allow using bone meal?"); + public GameOption WorldTimeSet = new GameOption(12000, "World Time Set", "Set time in the world"); + public GameOption WorldWeatherEnabled = new GameOption(false, "Weather Enabled", "Is there weather in this game world?"); + public GameOption WorldWaterDamage = new GameOption(0, "Water Damage", "Can water hurt players?"); + public GameOption WorldBoundaryKill = new GameOption(true, "Boundary Kill", "Do players die when leaving the game's boundaries?"); + public GameOption WorldBlockBurn = new GameOption(false, "Block Burn", "Can world blocks burn?"); + public GameOption WorldBlockGrow = new GameOption(false, "Block Grow", "Do world blocks grow?"); + public GameOption WorldFireSpread = new GameOption(false, "Fire Spread", "Does fire spread to world blocks?"); + public GameOption WorldLeavesDecay = new GameOption(false, "Leaves Decay", "Do leaves decay?"); + public GameOption WorldSoilTrample = new GameOption(false, "Soil Trample", "Can soil be trampled?"); + public GameOption WorldBoneMeal = new GameOption(false, "Bone Meal", "Allow using bone meal?"); - public GameOptionInteger HungerSet = new GameOptionInteger(-1, "Hunger Set", "Default hunger for players"); - public GameOptionInteger HealthSet = new GameOptionInteger(-1, "Health Set", "Default Health for players"); + public GameOption HungerSet = new GameOption(-1, "Hunger Set", "Default hunger for players"); + public GameOption HealthSet = new GameOption(-1, "Health Set", "Default Health for players"); - public GameOptionBoolean PrepareFreeze = new GameOptionBoolean(true, "Prepare Freeze", "Freeze game while preparations are made?"); + public GameOption PrepareFreeze = new GameOption(true, "Prepare Freeze", "Freeze game while preparations are made?"); - private GameOptionDouble _itemMergeRadius = new GameOptionDouble(0, "Item Merge Radius", "Distance at which items merge"); + private GameOption _itemMergeRadius = new GameOption(0.0, "Item Merge Radius", "Distance at which items merge"); //really not sure what the descriptions should be for announcements ~JP - public GameOptionBoolean AnnounceStay = new GameOptionBoolean(true, "Announce Stay", "Send message to announce player is staying?"); - public GameOptionBoolean AnnounceJoinQuit = new GameOptionBoolean(true, "Announce Join Quit", "Send message to announce player has quit?"); - public GameOptionBoolean AnnounceSilence = new GameOptionBoolean(true, "Announce Silence", "Silence all announcements?"); + public GameOption AnnounceStay = new GameOption(true, "Announce Stay", "Send message to announce player is staying?"); + public GameOption AnnounceJoinQuit = new GameOption(true, "Announce Join Quit", "Send message to announce player has quit?"); + public GameOption AnnounceSilence = new GameOption(true, "Announce Silence", "Silence all announcements?"); - public GameOptionBoolean DisplayLobbySide = new GameOptionBoolean(true, "Display Lobby Side", "Show which side players are on in lobby?"); + public GameOption DisplayLobbySide = new GameOption(true, "Display Lobby Side", "Show which side players are on in lobby?"); - public GameOptionGameState KitRegisterState = new GameOptionGameState(GameState.Live, "Kit Register State", "State of registered kits"); + public GameOption KitRegisterState = new GameOption(GameState.Live, "Kit Register State", "State of registered kits"); - public GameOptionBoolean JoinInProgress = new GameOptionBoolean(false, "Join In Progress", "Allow players to join a game in progress?"); + public GameOption JoinInProgress = new GameOption(false, "Join In Progress", "Allow players to join a game in progress?"); - public GameOptionInteger TickPerTeleport = new GameOptionInteger(1, "Tick Per Teleport", "Number of ticks between teleports"); + public GameOption TickPerTeleport = new GameOption(1, "Tick Per Teleport", "Number of ticks between teleports"); - public GameOptionInteger FillTeamsInOrderToCount = new GameOptionInteger(-1, "Fill Teams In Order To Count", "Number to fill teams to in order to count players"); + public GameOption FillTeamsInOrderToCount = new GameOption(-1, "Fill Teams In Order To Count", "Number to fill teams to in order to count players"); - public GameOptionBoolean SpawnNearAllies = new GameOptionBoolean(false, "Spawn Near Allies", "Allow players to spawn near their allies?"); - public GameOptionBoolean SpawnNearEnemies = new GameOptionBoolean(false, "Spawn Near Enemies", "Allow players to spawn near their enemies?"); + public GameOption SpawnNearAllies = new GameOption(false, "Spawn Near Allies", "Allow players to spawn near their allies?"); + public GameOption SpawnNearEnemies = new GameOption(false, "Spawn Near Enemies", "Allow players to spawn near their enemies?"); - public GameOptionBoolean StrictAntiHack = new GameOptionBoolean(false, "Strict Anti-Hack", "Turn on Strict Anti-Hack?"); + public GameOption StrictAntiHack = new GameOption(false, "Strict Anti-Hack", "Turn on Strict Anti-Hack?"); - public GameOptionBoolean DisableKillCommand = new GameOptionBoolean(true, "Disable Kill Command", "Turn off kill command"); + public GameOption DisableKillCommand = new GameOption(true, "Disable Kill Command", "Turn off kill command"); - public GameOptionBoolean GadgetsDisabled = new GameOptionBoolean(true, "Gadgets Disabled", "Disable gadgets?"); + public GameOption GadgetsDisabled = new GameOption(true, "Gadgets Disabled", "Disable gadgets?"); - public GameOptionBoolean TeleportsDisqualify = new GameOptionBoolean(true, "Teleports Disqualify", "Teleporting disqualifies player?"); + public GameOption TeleportsDisqualify = new GameOption(true, "Teleports Disqualify", "Teleporting disqualifies player?"); - public GameOptionBoolean DontAllowOverfill = new GameOptionBoolean(false, "Don't Allow Overfill", "Don't let players overfill teams?"); + public GameOption DontAllowOverfill = new GameOption(false, "Don't Allow Overfill", "Don't let players overfill teams?"); // Addons public boolean CompassEnabled = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java deleted file mode 100644 index 02ae04f3d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionBoolean.java +++ /dev/null @@ -1,26 +0,0 @@ -package nautilus.game.arcade.game; - -public class GameOptionBoolean extends GameOption -{ - - //Set boolean to true by default for ease of use - private Boolean _optionSetting; - - public GameOptionBoolean(Boolean optOnOff, String optName, String optType) - { - super(optName, optType); - // TODO Auto-generated constructor stub - _optionSetting = optOnOff; - } - - public Boolean GetOption() - { - return _optionSetting; - } - - public void SetOption(Boolean newOptionSetting) - { - _optionSetting = newOptionSetting; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java deleted file mode 100644 index 0c47b927b..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionDouble.java +++ /dev/null @@ -1,25 +0,0 @@ -package nautilus.game.arcade.game; - -public class GameOptionDouble extends GameOption -{ - - private double _optionDouble; - - public GameOptionDouble(double optDouble, String optName, String optDesc) - { - super(optName, optDesc); - // TODO Auto-generated constructor stub - _optionDouble = optDouble; - } - - public double GetOption() - { - return _optionDouble; - } - - public void SetOption(double newOptionSetting) - { - _optionDouble = newOptionSetting; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionGameState.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionGameState.java deleted file mode 100644 index 93aa3d2d3..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionGameState.java +++ /dev/null @@ -1,25 +0,0 @@ -package nautilus.game.arcade.game; - -import nautilus.game.arcade.game.Game.GameState; - -public class GameOptionGameState extends GameOption { - - GameState _optionGameState; - - public GameOptionGameState(GameState optGS,String optName, String optDesc) { - super(optName, optDesc); - // TODO Auto-generated constructor stub - _optionGameState = optGS; - } - - public GameState GetOption() - { - return _optionGameState; - } - - public void SetOption(GameState newOptionSetting) - { - _optionGameState = newOptionSetting; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java deleted file mode 100644 index 0e835da4c..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionHashInt.java +++ /dev/null @@ -1,27 +0,0 @@ -package nautilus.game.arcade.game; - -import java.util.HashSet; - -public class GameOptionHashInt extends GameOption -{ - - private HashSet _optionHash; - - public GameOptionHashInt(HashSet optHash, String optName, String optDesc) - { - super(optName, optDesc); - // TODO Auto-generated constructor stub - _optionHash = optHash; - } - - public HashSet GetOption() - { - return _optionHash; - } - - public void SetOption(HashSet optHash) - { - _optionHash = optHash; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java deleted file mode 100644 index 778e898de..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionInteger.java +++ /dev/null @@ -1,25 +0,0 @@ -package nautilus.game.arcade.game; - -public class GameOptionInteger extends GameOption -{ - - private int _optionInt; - - public GameOptionInteger(int optInt, String optName, String optType) - { - super(optName, optType); - // TODO Auto-generated constructor stub - _optionInt = optInt; - } - - public int GetOption() - { - return _optionInt; - } - - public void SetOption(int newOptionSetting) - { - _optionInt = newOptionSetting; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java deleted file mode 100644 index 1805678c9..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionItem.java +++ /dev/null @@ -1,26 +0,0 @@ -package nautilus.game.arcade.game; - -import org.bukkit.material.MaterialData; - -public class GameOptionItem extends GameOption { - - private MaterialData _optionMaterialData; - - //GameOptionItem will be the parent class of any materials/tools/etc. that may need to be created as GameOptions - public GameOptionItem(MaterialData _optMat, String optName, String optDesc) { - super(optName, optDesc); - // TODO Auto-generated constructor stub - _optionMaterialData = _optMat; - } - - public MaterialData GetOption() - { - return _optionMaterialData; - } - - public void setOption(MaterialData _optMatData) - { - _optionMaterialData = _optMatData; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java deleted file mode 100644 index 2ac3a9c69..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameOptionLong.java +++ /dev/null @@ -1,25 +0,0 @@ -package nautilus.game.arcade.game; - -public class GameOptionLong extends GameOption -{ - - private long _optionLong; - - public GameOptionLong(long optLong, String optName, String optDesc) - { - super(optName, optDesc); - // TODO Auto-generated constructor stub - _optionLong = optLong; - } - - public long GetOption() - { - return _optionLong; - } - - public void SetOption(long newOptionSetting) - { - _optionLong = newOptionSetting; - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index 023b4388b..473a84494 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -175,7 +175,7 @@ public class Bridge extends TeamGame implements OreObsfucation _ore = new OreHider(); // Flags - GameTimeout.setOption(Manager.IsTournamentServer() ? 5400000 : 3600000); + GameTimeout.setOption((long)(Manager.IsTournamentServer() ? 5400000 : 3600000)); Manager.GetExplosion().SetLiquidDamage(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java index f064d89be..4d5952c8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java @@ -103,7 +103,7 @@ public class CaptureTheFlag extends TeamGame this.HungerSet.setOption(20); this.WorldTimeSet.setOption(2000); - this.DeathSpectateSecs.setOption(10); + this.DeathSpectateSecs.setOption(10.0); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index 72873ed9a..deb71df59 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -85,7 +85,7 @@ public class Domination extends TeamGame this.HungerSet.setOption(20); this.WorldTimeSet.setOption(2000); - this.DeathSpectateSecs.setOption(10); + this.DeathSpectateSecs.setOption(10.0); //this.QuitOut = false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 0e8763fe6..369d6fe40 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -141,7 +141,7 @@ public class EventGame extends Game //Dont timeout - this.GameTimeout.setOption(-1); + this.GameTimeout.setOption((long)-1); _mps = manager.GetGameHostManager(); _functionSigns = new HashMap<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index 354e2ac71..5d22a199a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -28,7 +28,7 @@ public class Moba extends TeamGame }); this.DeathOut.setOption(false); - this.DeathSpectateSecs.setOption(8); + this.DeathSpectateSecs.setOption(8.0); this.HungerSet.setOption(20); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java index 8d89fa556..388c48650 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java @@ -82,7 +82,7 @@ public class Quiver extends SoloGame this.BlockBreakAllow.getOption().add(Material.STAINED_GLASS_PANE.getId()); this.BlockBreakAllow.getOption().add(Material.STAINED_GLASS.getId()); - this.DeathSpectateSecs.setOption(1); + this.DeathSpectateSecs.setOption(1.0); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java index f3d2bde59..847de358d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java @@ -142,7 +142,7 @@ public class SheepGame extends TeamGame }); this.DeathOut.setOption(false); - this.DeathSpectateSecs.setOption(6); + this.DeathSpectateSecs.setOption(6.0); this.HungerSet.setOption(20); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 067831a54..1529c6c67 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -120,7 +120,7 @@ public abstract class SuperSmash extends Game this.CompassEnabled = true; - this.DeathSpectateSecs.setOption(4); + this.DeathSpectateSecs.setOption(4.0); this.WorldWaterDamage.setOption(1000); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index 9e852db0f..ea758c1b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -192,7 +192,7 @@ public abstract class SurvivalGames extends Game this.ReplaceTeamsWithKits = true; - GameTimeout.setOption(1500000); + GameTimeout.setOption((long)1500000); QuitDropItems.setOption(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index 938279fc9..e28cba94b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -172,7 +172,7 @@ public class SurvivalGamesTeams extends TeamGame setItemMerge(true); // Manager.GetAntiStack().SetEnabled(false); - this.GameTimeout.setOption(9600000); + this.GameTimeout.setOption((long)9600000); this.WorldTimeSet.setOption(0); this.WorldBoundaryKill.setOption(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java index 5c82ac8b8..5d4a47253 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java @@ -74,7 +74,7 @@ public class Tug extends TeamGame this.HungerSet.setOption(20); this.DeathOut.setOption(false); - this.DeathSpectateSecs.setOption(20); + this.DeathSpectateSecs.setOption(20.0); registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 0530d37ed..d41ae6e31 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -149,7 +149,7 @@ public class TurfForts extends TeamGame this.ItemDrop.setOption(false); this.ItemPickup.setOption(false); this.DamageSelf.setOption(false); - this.DeathSpectateSecs.setOption(4); + this.DeathSpectateSecs.setOption(4.0); _breakStatTracker = new BlockBreakStatTracker(this, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index dcd6195aa..eb746548a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -120,7 +120,7 @@ public class TypeWars extends TeamGame this.DamageTeamSelf.setOption(false); this.DamageSelf.setOption(false); this.DamageTeamOther.setOption(false); - this.DeathSpectateSecs.setOption(0); + this.DeathSpectateSecs.setOption(0.0); this.HungerSet.setOption(20); this.WorldBoundaryKill.setOption(true); this.CompassEnabled = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 134497de9..787e5d9d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -143,7 +143,7 @@ public class UHC extends TeamGame AnnounceStay.setOption(false); - this.GameTimeout.setOption(10800000); + this.GameTimeout.setOption((long)10800000); this.DamagePvP.setOption(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index 9767833e5..27465af58 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -119,7 +119,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer this.DeathOut.setOption(true); this.DamageTeamSelf.setOption(false); this.DamageSelf.setOption(false); - this.DeathSpectateSecs.setOption(4); + this.DeathSpectateSecs.setOption(4.0); this.HungerSet.setOption(20); this.WorldBoundaryKill.setOption(false); this.CompassEnabled = false; From 59001bdef6c4bf1a85be3382bbf741528ae9faad Mon Sep 17 00:00:00 2001 From: "Joseph Prezioso Jr." Date: Thu, 7 Apr 2016 16:40:30 -0400 Subject: [PATCH 29/34] Fix merge-related errors Fix, polish, and re-implement Elo code. --- .../src/mineplex/bungee/motd/MotdManager.java | 4 +- .../mineplex/cache/player/PlayerCache.java | 2 +- .../common/block/schematic/Schematic.java | 68 +++- .../mineplex/core/common/skin/SkinData.java | 4 +- .../core/common/util/ProfileLoader.java | 2 +- .../mineplex/core/common/util/UtilAlg.java | 40 ++ .../mineplex/core/common/util/UtilBlock.java | 17 + .../mineplex/core/common/util/UtilEnt.java | 90 ++++- .../core/common/util/UtilFirework.java | 14 +- .../mineplex/core/common/util/UtilInv.java | 16 + .../mineplex/core/common/util/UtilServer.java | 12 +- .../src/mineplex/core/MiniPlugin.java | 9 +- .../core/account/CoreClientManager.java | 1 + .../account/repository/AccountRepository.java | 16 +- .../mineplex/core/bonuses/BonusManager.java | 17 +- .../core/bonuses/BonusRepository.java | 37 +- .../src/mineplex/core/chat/Chat.java | 8 +- .../src/mineplex/core/elo/EloManager.java | 59 +-- .../src/mineplex/core/elo/EloPlayer.java | 14 - .../src/mineplex/core/game/GameDisplay.java | 4 - .../core/incognito/IncognitoManager.java | 36 +- .../events/IncognitoHidePlayerEvent.java | 47 +++ .../mineplex/core/message/MessageManager.java | 117 +++--- .../core/message/commands/AdminCommand.java | 13 +- .../src/mineplex/core/npc/NpcManager.java | 11 + .../resourcepack/ResourcePackManager.java | 2 - .../src/mineplex/core/updater/UpdateType.java | 6 +- .../repository/tokens/SimpleClanToken.java | 4 +- .../src/mineplex/game/clans/Clans.java | 25 +- .../game/clans/clans/ClanEnergyTracker.java | 2 +- .../mineplex/game/clans/clans/ClansAdmin.java | 2 +- .../clans/clans/ClansDataAccessLayer.java | 37 +- .../game/clans/clans/ClansManager.java | 247 +++++++++---- .../game/clans/clans/ClansUtility.java | 2 +- .../game/clans/clans/ban/ClansBanManager.java | 98 +++-- .../clans/clans/ban/ClansBanRepository.java | 43 ++- .../clans/clans/commands/ClansCommand.java | 13 +- .../clans/clans/event/IronDoorOpenEvent.java | 58 +++ .../event/PlayerEnterTerritoryEvent.java | 1 + .../clans/gui/button/ClanAddAllyButton.java | 6 +- .../gui/button/ClanAddTrustedButton.java | 5 + .../clans/gui/button/ClanAddWarButton.java | 4 + .../clans/gui/button/ClanCreateButton.java | 7 +- .../clans/gui/button/ClanDisbandButton.java | 4 + .../clans/gui/button/ClanEnergyButton.java | 4 +- .../clans/gui/button/ClanInviteButton.java | 4 + .../clans/gui/button/ClanJoinButton.java | 4 + .../clans/gui/button/ClanLeaveButton.java | 21 +- .../clans/gui/button/ClanMemeberButton.java | 4 + .../clans/gui/button/ClanTerritoryButton.java | 4 + .../clans/clans/gui/button/ClanWhoButton.java | 4 + .../clans/clans/gui/page/ClanMainPage.java | 2 +- .../game/clans/clans/map/ItemMapManager.java | 40 +- .../game/clans/clans/map/ItemMapRenderer.java | 78 ++-- .../game/clans/clans/playtime/Playtime.java | 1 - .../clans/clans/regions/ClansRegions.java | 46 +-- .../clans/clans/siege/outpost/Outpost.java | 17 + .../clans/clans/siege/weapon/SiegeWeapon.java | 19 +- .../tntGenerator/TntGeneratorManager.java | 2 +- .../clans/warpoints/WarPointEvasion.java | 73 ++-- .../clans/worldevent/kinghill/KingHill.java | 16 +- .../clans/worldevent/undead/UndeadCamp.java | 20 +- .../game/clans/economy/GoldManager.java | 4 +- .../game/clans/gameplay/Gameplay.java | 100 ++--- .../game/clans/items/GearManager.java | 2 + .../src/mineplex/game/clans/shop/PvpItem.java | 2 +- .../game/clans/shop/ShopItemButton.java | 2 + .../clans/shop/energy/EnergyShopButton.java | 15 +- .../src/mineplex/game/clans/spawn/Spawn.java | 8 +- .../game/clans/spawn/travel/TravelButton.java | 5 + .../game/clans/spawn/travel/TravelPage.java | 30 +- .../clans/tutorial/command/FinishCommand.java | 2 +- .../tutorial/command/TutorialCommand.java | 2 +- .../clans/objective/LeaveSpawnObjective.java | 48 --- .../goals/attackenemy/BlowUpWallGoal.java | 6 +- .../Mineplex.Hub/src/mineplex/hub/Hub.java | 4 +- .../src/mineplex/hub/HubManager.java | 15 +- .../mineplex/hub/server/ServerManager.java | 45 ++- .../src/mineplex/hub/server/ServerSorter.java | 8 + .../hub/server/ui/ServerGameMenu.java | 4 +- .../server/ui/clans/ClanMoveServerShop.java | 1 - .../hub/server/ui/clans/ClansServerPage.java | 47 ++- .../hub/server/ui/clans/ClansServerShop.java | 10 +- .../classcombat/Skill/Brute/BlockToss.java | 1 + .../minecraft/game/core/boss/WorldEvent.java | 6 +- .../game/core/condition/ConditionEffect.java | 2 +- .../mineplex/serverdata/database/DBPool.java | 5 +- .../serverdata/database/RepositoryBase.java | 2 +- .../src/mineplex/staffServer/StaffServer.java | 15 +- .../customerSupport/CustomerSupport.java | 222 ++++++----- .../customerSupport/checkCommand.java | 2 +- .../src/nautilus/game/arcade/Arcade.java | 6 +- .../nautilus/game/arcade/ArcadeManager.java | 69 +++- .../src/nautilus/game/arcade/GameType.java | 1 - .../src/nautilus/game/arcade/game/Game.java | 345 +++++------------- .../nautilus/game/arcade/game/GameTeam.java | 6 +- .../nautilus/game/arcade/game/TeamGame.java | 12 +- .../game/games/baconbrawl/BaconBrawl.java | 6 +- .../games/baconbrawl/kits/KitMamaPig.java | 4 +- .../game/games/barbarians/Barbarians.java | 38 +- .../game/games/bossbattles/BossBattles.java | 6 +- .../arcade/game/games/bouncyballs/Ball.java | 4 +- .../game/games/bouncyballs/BouncyBalls.java | 2 +- .../game/arcade/game/games/bridge/Bridge.java | 48 +-- .../game/arcade/game/games/build/Build.java | 42 +-- .../game/arcade/game/games/cards/Cards.java | 12 +- .../game/games/castlesiege/CastleSiege.java | 28 +- .../game/games/champions/ChampionsCTF.java | 8 +- .../games/champions/ChampionsDominate.java | 8 +- .../game/games/champions/ChampionsTDM.java | 8 +- .../game/games/christmas/Christmas.java | 12 +- .../arcade/game/games/christmas/Sleigh.java | 2 +- .../games/christmas/content/BossMobs.java | 4 +- .../christmas/content/BossSnowmanPattern.java | 4 +- .../games/christmas/content/CaveGiant.java | 4 +- .../games/christmas/content/PumpkinKing.java | 4 +- .../games/christmas/content/SnowmanBoss.java | 4 +- .../games/christmas/content/SnowmanMaze.java | 4 +- .../games/christmas/content/SnowmanWaveA.java | 4 +- .../games/christmas/content/SnowmanWaveB.java | 4 +- .../game/games/christmas/parts/Part.java | 4 +- .../game/games/christmas/parts/Part1.java | 4 +- .../game/games/christmas/parts/Part2.java | 4 +- .../game/games/christmas/parts/Part4.java | 4 +- .../game/games/common/CaptureTheFlag.java | 16 +- .../arcade/game/games/common/Domination.java | 14 +- .../game/games/common/TeamDeathmatch.java | 6 +- .../arcade/game/games/deathtag/DeathTag.java | 8 +- .../game/games/dragonescape/DragonEscape.java | 14 +- .../games/dragonescape/DragonEscapeTeams.java | 10 +- .../game/games/dragonriders/DragonData.java | 4 +- .../game/games/dragonriders/DragonRiders.java | 4 +- .../arcade/game/games/dragons/Dragons.java | 10 +- .../game/games/dragons/DragonsTeams.java | 12 +- .../game/arcade/game/games/draw/Draw.java | 8 +- .../arcade/game/games/event/EventGame.java | 54 +-- .../arcade/game/games/event/EventModule.java | 134 +++---- .../game/games/evolution/Evolution.java | 18 +- .../game/games/gladiators/Gladiators.java | 24 +- .../arcade/game/games/gravity/Gravity.java | 12 +- .../game/games/gravity/GravityObject.java | 4 +- .../game/games/halloween/Halloween.java | 14 +- .../halloween/creatures/CreatureBase.java | 4 +- .../halloween/creatures/PumpkinKing.java | 8 +- .../game/games/halloween/waves/WaveBase.java | 4 +- .../games/halloween/waves/WaveVictory.java | 6 +- .../arcade/game/games/hideseek/HideSeek.java | 16 +- .../game/games/holeinwall/HoleInTheWall.java | 14 +- .../game/games/lobbers/BombLobbers.java | 22 +- .../game/arcade/game/games/micro/Micro.java | 12 +- .../arcade/game/games/milkcow/MilkCow.java | 18 +- .../game/games/minestrike/MineStrike.java | 24 +- .../arcade/game/games/mineware/MineWare.java | 22 +- .../challenges/ChallengeDragonEgg.java | 4 +- .../challenges/ChallengeHitTargets.java | 4 +- .../challenges/ChallengeMilkACow.java | 4 +- .../challenges/ChallengeNameThatSound.java | 4 +- .../challenges/ChallengeShootChickens.java | 8 +- .../mineware/challenges/ChallengeSkyFall.java | 4 +- .../challenges/ChallengeSmashOff.java | 4 +- .../challenges/ChallengeTntLauncher.java | 2 +- .../challenges/ChallengeVolleyPig.java | 8 +- .../game/arcade/game/games/moba/Moba.java | 6 +- .../arcade/game/games/monsterleague/Ball.java | 4 +- .../games/monsterleague/MonsterLeague.java | 10 +- .../arcade/game/games/monstermaze/Maze.java | 8 +- .../game/games/monstermaze/MonsterMaze.java | 12 +- .../game/games/oldmineware/OldMineWare.java | 26 +- .../game/games/oldmineware/order/Order.java | 8 +- .../games/oldmineware/order/OrderGather.java | 4 +- .../games/oldmineware/order/OrderPlace.java | 2 +- .../game/games/paintball/Paintball.java | 6 +- .../games/paintball/PlayerCopyPaintball.java | 4 +- .../game/arcade/game/games/quiver/Quiver.java | 20 +- .../arcade/game/games/quiver/QuiverTeams.java | 16 +- .../game/arcade/game/games/runner/Runner.java | 8 +- .../searchanddestroy/SearchAndDestroy.java | 18 +- .../game/games/searchanddestroy/TeamBomb.java | 4 +- .../arcade/game/games/sheep/SheepGame.java | 12 +- .../arcade/game/games/skywars/Skywars.java | 50 +-- .../game/games/skywars/SoloSkywars.java | 2 +- .../game/games/skywars/TeamSkywars.java | 8 +- .../game/games/smash/SoloSuperSmash.java | 2 +- .../arcade/game/games/smash/SuperSmash.java | 10 +- .../game/games/smash/TeamSuperSmash.java | 8 +- .../game/games/smash/kits/KitKnight.java | 4 +- .../game/games/smash/kits/KitSkySquid.java | 4 +- .../games/smash/perks/PerkCowAngryHerd.java | 4 +- .../game/arcade/game/games/snake/Snake.java | 16 +- .../sneakyassassins/SneakyAssassins.java | 8 +- .../games/sneakyassassins/npc/NpcManager.java | 4 +- .../sneakyassassins/powerups/PowerUpItem.java | 4 +- .../game/games/snowfight/SnowFight.java | 4 +- .../games/speedbuilders/SpeedBuilders.java | 36 +- .../speedbuilders/data/RecreationData.java | 4 +- .../game/arcade/game/games/spleef/Spleef.java | 6 +- .../arcade/game/games/spleef/SpleefTeams.java | 6 +- .../game/games/squidshooter/SquidShooter.java | 10 +- .../arcade/game/games/stacker/Stacker.java | 4 +- .../survivalgames/SoloSurvivalGames.java | 2 +- .../games/survivalgames/SurvivalGames.java | 74 ++-- .../survivalgames/SurvivalGamesTeams.java | 64 ++-- .../survivalgames/TeamSurvivalGames.java | 10 +- .../game/arcade/game/games/tug/Tug.java | 14 +- .../game/games/turfforts/TurfForts.java | 18 +- .../arcade/game/games/typewars/TypeWars.java | 50 +-- .../typewars/tutorial/TutorialTypeWars.java | 4 +- .../game/arcade/game/games/uhc/UHC.java | 60 +-- .../game/games/valentines/Valentines.java | 14 +- .../tutorial/TutorialValentines.java | 8 +- .../game/games/wither/PlayerCopyWither.java | 4 +- .../arcade/game/games/wither/WitherGame.java | 24 +- .../arcade/game/games/wizards/Wizards.java | 22 +- .../wizards/spells/SpellSummonWolves.java | 4 +- .../games/zombiesurvival/ZombieSurvival.java | 8 +- .../game/arcade/kit/perks/PerkBatWave.java | 4 +- .../game/arcade/kit/perks/PerkChicken.java | 4 +- .../arcade/kit/perks/PerkChickenRocket.java | 4 +- .../game/arcade/kit/perks/PerkCowBomb.java | 4 +- .../arcade/kit/perks/PerkEndermanDragon.java | 4 +- .../game/arcade/kit/perks/PerkHorsePet.java | 4 +- .../arcade/kit/perks/PerkMadScientist.java | 4 +- .../arcade/kit/perks/PerkNightLivingDead.java | 12 +- .../arcade/kit/perks/PerkPigBaconBomb.java | 4 +- .../arcade/kit/perks/PerkSheepHoming.java | 4 +- .../game/arcade/kit/perks/PerkSkeletons.java | 4 +- .../arcade/kit/perks/PerkSlimeRocket.java | 4 +- .../game/arcade/kit/perks/PerkSnowTurret.java | 4 +- .../arcade/kit/perks/PerkWitherImage.java | 4 +- .../arcade/kit/perks/PerkWitherMinion.java | 4 +- .../game/arcade/kit/perks/PerkWolf.java | 4 +- .../game/arcade/kit/perks/PerkWolfPack.java | 4 +- .../game/arcade/kit/perks/PerkWolfPet.java | 4 +- .../game/arcade/managers/GameFlagManager.java | 116 +++--- .../arcade/managers/GameLobbyManager.java | 4 +- .../game/arcade/managers/GameManager.java | 10 +- .../game/arcade/managers/MiscManager.java | 2 +- 237 files changed, 2512 insertions(+), 1913 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/incognito/events/IncognitoHidePlayerEvent.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/IronDoorOpenEvent.java delete mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/LeaveSpawnObjective.java diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index 324da4b52..1f5bc2b09 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -56,12 +56,12 @@ public class MotdManager implements Listener, Runnable //String motdLine = "§f§l◄ §c§lMaintenance§f§l ►"; //String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►"; // String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f"; - String motdLine = " §f❄ §2§lMerry Christmas §f❄ §2§lElf Presents §f❄"; + String motdLine = " §f> §4§lCLANS BETA §f- §c§lOpen to Everyone §f<"; // String motdLine = " §f❄ §2§lServer Maintenance §f❄ §2§lBe Back Soon §f❄"; //String motdLine = " §d§lRank Sale §a§l40% Off"); //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); - updateMainMotd(" §c§m §f§m §c§m §f§m §2§l§m[ §r §c§lMineplex§r §f§lGames§r §2§l§m ]§f§m §c§m §f§m §c§m §r", motdLine); + updateMainMotd(" §f§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§f§m §r", motdLine); System.out.println("Updated Bungee MOTD"); } } diff --git a/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java index da02123eb..804515ad2 100644 --- a/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java +++ b/Plugins/Mineplex.Cache/src/mineplex/cache/player/PlayerCache.java @@ -69,7 +69,7 @@ public class PlayerCache PlayerInfo info = getPlayer(uuid); return info == null ? -1 : info.getAccountId(); } - + public void clean() { _repository.clean(); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java index 089101fe3..43e8d5c8e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/block/schematic/Schematic.java @@ -3,9 +3,9 @@ package mineplex.core.common.block.schematic; import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.block.Block; import mineplex.core.common.block.DataLocationMap; +import mineplex.core.common.util.UtilBlock; public class Schematic { @@ -24,7 +24,7 @@ public class Schematic _blockData = blockData; } - public DataLocationMap paste(Location originLocation) + public DataLocationMap paste(Location originLocation, boolean ignoreAir) { DataLocationMap locationMap = new DataLocationMap(); @@ -43,31 +43,46 @@ public class Schematic // not sure why but the math.abs is my simple fix int materialId = Math.abs(_blocks[index]); - Material material = Material.getMaterial(materialId); - if (material == null) + if (ignoreAir && materialId == 0) // Air { - System.err.println("Schematic: Could not find Material [id: " + materialId + " data: " + _blockData[index] + "]"); continue; } - else if (material == Material.GOLD_PLATE) + else if (materialId == 147) // Gold Plate { // Check for data wool at location below the gold plate - if (addDataWool(locationMap, originLocation, x, y - 1, z)) + if (addDataWool(locationMap, true, originLocation, x, y - 1, z)) continue; } - else if (material == Material.WOOL) + else if (materialId == 148) // Iron Plate + { + // Check for data wool at location below the gold plate + if (addDataWool(locationMap, false, originLocation, x, y - 1, z)) + continue; + } + else if (materialId == Material.SPONGE.getId()) + { + if (addSpongeLocation(locationMap, originLocation, x, y + 1, z)) + continue; + } + else if (materialId == 35) { // Check if this is a dataloc so we can skip setting the block int aboveIndex = getIndex(x, y + 1, z); if (hasIndex(aboveIndex)) { - if (Math.abs(_blocks[aboveIndex]) == Material.GOLD_PLATE.getId()) + if (Math.abs(_blocks[aboveIndex]) == Material.GOLD_PLATE.getId() || Math.abs(_blocks[aboveIndex]) == Material.IRON_PLATE.getId()) + continue; + } + int belowIndex = getIndex(x, y - 1, z); + if (hasIndex(belowIndex)) + { + if(Math.abs(_blocks[belowIndex]) == Material.SPONGE.getId()) continue; } } - Block block = originLocation.getWorld().getBlockAt(startX + x, startY + y, startZ + z); - block.setTypeIdAndData(materialId, _blockData[index], false); + + UtilBlock.setQuick(originLocation.getWorld(), startX + x, startY + y, startZ + z, materialId, _blockData[index]); } } } @@ -80,7 +95,7 @@ public class Schematic * * @return true if a location was added to the DataLocationMap */ - private boolean addDataWool(DataLocationMap map, Location origin, int x, int y, int z) + private boolean addDataWool(DataLocationMap map, boolean gold, Location origin, int x, int y, int z) { int index = getIndex(x, y, z); if (hasIndex(index)) @@ -92,7 +107,34 @@ public class Schematic DyeColor color = DyeColor.getByWoolData(data); if (color != null) { - map.addLocation(color, origin.clone().add(x + 0.5, y + 0.5, z + 0.5)); + if (gold) + { + map.addGoldLocation(color, origin.clone().add(x, y, z)); + } + else + { + map.addIronLocation(color, origin.clone().add(x, y, z)); + } + return true; + } + } + } + return false; + } + + private boolean addSpongeLocation(DataLocationMap map, Location origin, int x, int y, int z) + { + int index = getIndex(x, y, z); + if (hasIndex(index)) + { + int materialId = Math.abs(_blocks[index]); + if (materialId == 35) // WOOL + { + byte data = _blockData[index]; + DyeColor color = DyeColor.getByWoolData(data); + if (color != null) + { + map.addSpongeLocation(color, origin.clone().add(x, y - 1, z)); return true; } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index ebc0fdb1b..7aa895666 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -19,7 +19,6 @@ import net.minecraft.server.v1_8_R3.NBTTagString; public class SkinData { - private static long _nameCount = -99999999999999L; public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ="); @@ -33,6 +32,9 @@ public class SkinData public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0="); public final static SkinData SECRET_PACKAGE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAzNzE3OTIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyNWI5YTRjOWRhOThkZTliZmIwZDNjOWI1M2MzMjJhMjgxN2IyMTMxOTQzY2E1YWM2NTBjZThmMzEzZjdhIn19fQ==", "Wb5T0Zhp1RVt78V/i8dYrwZCNT0xZIRe3LvL0bngH498f8Jrl43KHgTi4f299zE9giVynkTogGhJ8inq/xqFCRctl7Nn9L3LVu78uQwt+fs+o+kw/Qc+lggFSjEIc+fc13AZndpec0Df46Kh/OGD7NXbtbLb6TE/0dU2RwQlvZrZ/QHYJb8OJ6aUcnHvAZim8NUtG/nlZtSClepHVSuKdNnfzoF9rFVFA/x4jTr6mZYPZ33YgQd2oTAPk+qE3iN+0InjZQNs2YLoKFmFrgzn+tGvNApC0siF0HEZGQCFIwJOtnBsasGoxujIrln/ZdOil+5ac4VWInXr8lKgY0Q3Ocy8/0cJl+E/XqB+ztG29zhB8B1zdHBfJr+MgeSIqBCPx4SCtY6r7gnMlQYG+uVx5NP3S5aJW/cEfDyXmpCykIcBPzeErnKC0SiAqXkCVNjWJpX6qRWvWMXqS69w6ht6qHvEY2GxlZUb5AP+JgFlsl3hJDms6EPvM4zNL0Ko4oWIBzwYRQXiemrP9TGgyo0aL1RcQ0JgBFO2hSo37PK0YL3tUPgteJXzm21wu0TiZLkLCWSgMUfYfvVnhTa+xzod0xvfujpN6Y1DUTdcf8WS8TRYw2JigSkWrRW0fXPBCtTtQN5jiwM5/HrTpNLzg03J6SpfZ+rr8Rhq0S/8beQOMas="); + public final static SkinData CHISS = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI5NjgyNDEsInByb2ZpbGVJZCI6IjFkMmJmZTYxN2ViZDQ0NWRiYTdkODM1NGEwZmZkMWVhIiwicHJvZmlsZU5hbWUiOiJDaGlzcyIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg3MmNkMzRjY2IzMTIxYjRjNmEzOGFjM2JmOGVkM2UwMzk3YmQ2YTg4NDI4YjdhZmM2ZTUyNTI4NTVhMzQzIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "hNTLRA2acZYx2dM90lnJN8FMK/ceD3+AxKNdD5FrXzxGtYL4C1Jr/vbTE0UosmwFP3wScNEW/fuDOjeZRjZHMJdvgDZMlMK/5KDhOY6sj/RS9RckztsgummSyjH/hdDn7TWWfhZLMbiia/K0VReI9eq2yD6zGQpvMlz5hB/5SX5YHWXvCah3TL4UzYSlSVDlwY/Q3sVuIZUr8m/LIXJwniJKLGo6tUgtiJd9eseOsbBpVjzCUtLD8A9WBe2/eODgmLfqEvXESIoDRG8vL2nPSXWma/YolYHIl32/i+ZxVD7dRRaXQFYSiLI24EtzX1pPhMjyaTLazP9abH43J6J31w02pKM7N/xTa62020L/YfRRKGT5lygEDb1NMoSpAjszPxah+Ra2/L+yUWEI8cMES6I4mIJ00tclPjWK01xhIn3tqg+y2gqsGHwPhu/7vmF5NirNfKFw0qciKNBfbCAF7ae+mkUKjmAPuvBUBqQb7BOcpNVWsCo/XvzmiZZYsf5P4Uwz8LqUK4uH6V/5dg7lY2Xg3+IUylsrDqLGFDI8iy/NdjIQMbuRadh4IDO6DcmxBri2Ax4JNBPBTnRezge8uq37MZcft/IXQgFWKB9RtidVEACaTOkRj27k+Ojnkki+j44k0wZB47hiXFUHMCHl3a0SVdQe15ZbVsQj/HAvAS0="); + public final static SkinData DEFEK7 = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI3ODkwNTksInByb2ZpbGVJZCI6Ijg5ZDQ2M2Y3MjNlYzQ3MGE4MjQ0NDU3ZjBjOGQ4NjFjIiwicHJvZmlsZU5hbWUiOiJkZWZlazciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmYWNjOWM4ZjhlY2E1OWU0NTE4MTUxZmE4OGFiMDZjOTFmNjM3OTE2NzJmMTRlNGYzODY3YTI2OTVlN2NmYmYifSwiQ0FQRSI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIyYjljNWVhNzYzYzg2ZmM1Y2FlYTMzZDgyYjBmYTY1YTdjMjI4ZmQzMjFiYTU0NzY2ZWE5NWEzZDBiOTc5MyJ9fX0=", "jBoRvkhQXz+nap8yJJIZ+4HClMItWODumeSOYjXytP3WWKHK0UMq0xC/keXsnmvo89lMRdRbknPt2ZX5Flgyjgr4Rt0KtDvpL/hG4BUsTWryUZZMKxdd6DkZXYRtTogLUfHeDYIz+cZQ0aXGMtvX/ZYTXJfMi6FYbIHY/qEEDnWhDX5y+SPpaJaZByPsvzi+qbfcFGnJ6nqi9ccyZYnYpnI2IVBM/yO/VRXWHxfqvJ0VVvv5KsGmVbko2Jxo0SDCxUL2UTH2+eol53FxhkkC+m2geC14k1zsZQLHDF3BgAG9+kFJ4UEoYRKF2Gy1FxeDCJtjYNdrYR8fdaUKRMcpBgEs+ZGe2U9EVVS/ZcBCjB7S+1Ne2bPzPFzTQPuBoMgggo1xbxBmQ5NyhYo4gwgj/xjSLIhb+5h7ioN1URfSRcfYdVv6RRO9l/u9l09jEom8y/jGRviefpEr+/e9iAl5Dd/6nzQgosBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60="); + private Property _skinProperty; public SkinData(String value, String signature) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ProfileLoader.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ProfileLoader.java index bcc4ffb42..dffb82f70 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ProfileLoader.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/ProfileLoader.java @@ -88,7 +88,7 @@ public class ProfileLoader } catch (Exception e) { - ; // Failed to load skin + e.printStackTrace(); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index a5d7d5532..ebf5f7f8d 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -2,11 +2,14 @@ package mineplex.core.common.util; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.List; +import java.util.Random; import java.util.Set; import java.util.TreeSet; +import java.util.stream.Stream; import org.bukkit.Location; import org.bukkit.block.Block; @@ -168,6 +171,34 @@ public class UtilAlg return element; } + public static List getBox(Block cornerA, Block cornerB) + { + if (cornerA == null || cornerB == null || (cornerA.getWorld() != cornerB.getWorld())) + return Collections.emptyList(); + + ArrayList list = new ArrayList<>(); + + int minX = Math.min(cornerA.getX(), cornerB.getX()); + int minY = Math.min(cornerA.getY(), cornerB.getY()); + int minZ = Math.min(cornerA.getZ(), cornerB.getZ()); + int maxX = Math.max(cornerA.getX(), cornerB.getX()); + int maxY = Math.max(cornerA.getY(), cornerB.getY()); + int maxZ = Math.max(cornerA.getZ(), cornerB.getZ()); + + for (int x = minX; x <= maxX; x++) + { + for (int y = minY; y <= maxY; y++) + { + for (int z = minZ; z <= maxZ; z++) + { + list.add(cornerA.getWorld().getBlockAt(x, y, z)); + } + } + } + + return list; + } + public static boolean inBoundingBox(Location loc, Location cornerA, Location cornerB) { if (loc.getX() <= Math.min(cornerA.getX(), cornerB.getX())) return false; @@ -582,4 +613,13 @@ public class UtilAlg return new Location(location.getWorld(), x, location.getY(), z, location.getYaw(), location.getPitch()); } + + public static Location getRandomLocation(Location center, int radius) + { + Random r = new Random(); + int x = r.nextInt(radius * 2) - radius; + int y = r.nextInt(radius * 2) - radius; + int z = r.nextInt(radius * 2) - radius; + return center.clone().add(x, y, z); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index ae33d5ccf..c0f271c51 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -3,6 +3,7 @@ package mineplex.core.common.util; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.Queue; import org.bukkit.Location; import org.bukkit.Material; @@ -30,6 +31,7 @@ import org.bukkit.material.Bed; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_8_R3.EnumDirection; +import net.minecraft.server.v1_8_R3.IBlockData; import net.minecraft.server.v1_8_R3.Item; import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.MinecraftKey; @@ -1463,4 +1465,19 @@ public class UtilBlock return state.update(false, false); } + + public static void setQuick(World world, int x, int y, int z, int type, byte data) + { + int cx = x >> 4; + int cz = z >> 4; + if (!world.isChunkLoaded(cx, cz)) + { + world.loadChunk(cx, cz, true); + } + + net.minecraft.server.v1_8_R3.Chunk chunk = ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4); + BlockPosition pos = new BlockPosition(x, y, z); + IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getById(type).fromLegacyData(data); + chunk.a(pos, ibd); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 93febea55..4b479fb52 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -5,24 +5,6 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import net.minecraft.server.v1_8_R3.AxisAlignedBB; -import net.minecraft.server.v1_8_R3.EntityBat; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.EntityEnderDragon; -import net.minecraft.server.v1_8_R3.EntityHuman; -import net.minecraft.server.v1_8_R3.EntityInsentient; -import net.minecraft.server.v1_8_R3.EntityLiving; -import net.minecraft.server.v1_8_R3.EntityTrackerEntry; -import net.minecraft.server.v1_8_R3.NavigationAbstract; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_8_R3.PathfinderGoal; -import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer; -import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction; -import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround; -import net.minecraft.server.v1_8_R3.PathfinderGoalSelector; -import net.minecraft.server.v1_8_R3.WorldServer; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -40,8 +22,29 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.util.Vector; +import net.minecraft.server.v1_8_R3.AxisAlignedBB; +import net.minecraft.server.v1_8_R3.EntityBat; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.EntityEnderDragon; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityInsentient; +import net.minecraft.server.v1_8_R3.EntityLiving; +import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.NavigationAbstract; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_8_R3.PathfinderGoal; +import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer; +import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction; +import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround; +import net.minecraft.server.v1_8_R3.PathfinderGoalSelector; +import net.minecraft.server.v1_8_R3.WorldServer; + public class UtilEnt { @@ -255,6 +258,34 @@ public class UtilEnt } } + public static void Rotate(LivingEntity entity, float yaw, float pitch) + { + EntityLiving handle = ((CraftLivingEntity) entity).getHandle(); + + while (yaw < -180.0F) yaw += 360.0F; + while (yaw >= 180.0F) yaw -= 360.0F; + + handle.yaw = yaw; + handle.aK = yaw; + handle.aI = yaw; + handle.aL = yaw; + handle.pitch = pitch; + } + + public static void LookAt(LivingEntity entity, Location location) + { + if (!(entity.getWorld().equals(location.getWorld()))) + return; + + Vector dir = entity.getEyeLocation().toVector().subtract(location.toVector()).normalize(); + Location loc = entity.getEyeLocation().clone(); + + loc.setYaw(180 - (float) Math.toDegrees(Math.atan2(dir.getX(), dir.getZ()))); + loc.setPitch(90 - (float) Math.toDegrees(Math.acos(dir.getY()))); + + Rotate(entity, loc.getYaw(), loc.getPitch()); + } + public static void populate() { if (creatureMap.isEmpty()) @@ -825,4 +856,27 @@ public class UtilEnt { return ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9; } + + public static void SetMetadata(Entity entity, String key, Object value) + { + entity.setMetadata(key, new FixedMetadataValue(UtilServer.getPlugin(), value)); + } + + // Nicer than doing entity.getMetadata(key).get(0); + public static Object GetMetadata(Entity entity, String key) + { + if (!entity.hasMetadata(key)) + { + return null; + } + + return entity.getMetadata(key).get(0); + } + + public static void SetItemInHand(LivingEntity entity, ItemStack item) + { + EntityEquipment equipment = entity.getEquipment(); + equipment.setItemInHand(item); + } + } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java index c017bab66..ba7e00bb9 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java @@ -74,10 +74,10 @@ public class UtilFirework public static void packetPlayFirework(Player player, Location loc, Type type, Color color, boolean flicker, boolean trail) { - Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class); + Firework firework = loc.getWorld().spawn(loc, Firework.class); FireworkEffect effect = FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build(); - FireworkMeta data = (FireworkMeta) firework.getFireworkMeta(); + FireworkMeta data = firework.getFireworkMeta(); data.clearEffects(); data.setPower(1); data.addEffect(effect); @@ -98,4 +98,14 @@ public class UtilFirework UtilPlayer.sendPacket(viewing, packet); } } + + public static void spawnRandomFirework(Location location) + { + playFirework(location, + Type.values()[UtilMath.r(Type.values().length)], + Color.fromRGB(UtilMath.r(256), UtilMath.r(256), UtilMath.r(256)), + UtilMath.random.nextBoolean(), + UtilMath.random.nextBoolean() + ); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java index 6a75d2e99..ac42f9ad4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -437,4 +437,20 @@ public class UtilInv return false; } + + public static void give(Player player, Material material) + { + give(player, material, 1); + } + + public static void give(Player player, Material material, int amount) + { + give(player, material, amount, (byte) 0); + } + + public static void give(Player shooter, Material material, int amount, byte data) + { + shooter.getInventory().addItem(new ItemStack(material, amount, data)); + } + } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java index abcd0d772..2b574345e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java @@ -22,6 +22,8 @@ import org.bukkit.scheduler.BukkitRunnable; import com.google.common.collect.Lists; +import mineplex.core.common.events.PlayerRecieveBroadcastEvent; + public class UtilServer { // Quite hacky. would be nice if we could have a "MineplexPlugin" interface @@ -68,7 +70,10 @@ public class UtilServer public static void broadcast(String message) { for (Player cur : getPlayers()) - UtilPlayer.message(cur, message); + { + if (!UtilServer.CallEvent(new PlayerRecieveBroadcastEvent(cur, message)).isCancelled()) + UtilPlayer.message(cur, message); + } } public static void broadcast(LinkedList messages) @@ -209,4 +214,9 @@ public class UtilServer return _serverName; } + + public static Collection GetPlayers() + { + return Lists.newArrayList(getPlayers()); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java index 2e4764090..5bb0abae4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java @@ -1,5 +1,8 @@ package mineplex.core; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + import org.bukkit.Bukkit; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; @@ -22,14 +25,14 @@ public abstract class MiniPlugin implements Listener protected NautHashMap _commands; protected long _initializedTime; - - public MiniPlugin(String moduleName, JavaPlugin plugin) + + public MiniPlugin(String moduleName, JavaPlugin plugin) { _moduleName = moduleName; _plugin = plugin; _initializedTime = System.currentTimeMillis(); - + _commands = new NautHashMap(); onEnable(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 2f33620bb..6b6e119ca 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -375,6 +375,7 @@ public class CoreClientManager extends MiniPlugin runAsync(new Runnable() { + @Override public void run() { client.setAccountId(_repository.login(_loginProcessors, uuid, client.GetPlayerName())); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java index 8ec8ecb31..856c5e8a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -60,17 +60,11 @@ public class AccountRepository extends MinecraftRepository public int login(final List loginProcessors, final UUID uuid, final String name) { // First we try to grab the account id from cache - this saves an extra trip to database - int accountId = -1; + int accountId = PlayerCache.getInstance().getAccountId(uuid); try (Connection connection = getConnection(); Statement statement = connection.createStatement()) { - int cachedId = PlayerCache.getInstance().getAccountId(uuid); - if (cachedId > 0) - { - accountId = cachedId; - System.out.println("Loaded Account ID From Cache [" + name + " - " + accountId + "]"); - } - else + if (accountId <= 0) { // Player was not found in cache, we need to grab the account id from database statement.execute("SELECT id FROM accounts WHERE accounts.uuid = '" + uuid + "' LIMIT 1;"); @@ -100,6 +94,10 @@ public class AccountRepository extends MinecraftRepository accountId = tempList.get(0); } } + else + { + System.out.println(name + " Loaded Account ID From Cache [" + name + " - " + accountId + "]"); + } final int finalId = accountId; final String uuidString = uuid.toString(); @@ -109,7 +107,7 @@ public class AccountRepository extends MinecraftRepository loginString += loginProcessors.parallelStream().map(processor -> processor.getQuery(finalId, uuidString, name)).collect(Collectors.joining()); statement.execute(loginString); - + statement.getUpdateCount(); statement.getMoreResults(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 9410fb7a3..d497d7caa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -33,6 +33,7 @@ import mineplex.core.donation.GiveDonorData; import mineplex.core.facebook.FacebookManager; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; +import mineplex.core.inventory.ClientItem; import mineplex.core.inventory.InventoryManager; import mineplex.core.npc.Npc; import mineplex.core.npc.NpcManager; @@ -474,6 +475,7 @@ public class BonusManager extends MiniClientPlugin implements I { if (timeTillRankBonus(player) > 0) result.run(false); + getRepository().attemptRankBonus(player, new Callback() { @Override @@ -734,31 +736,35 @@ public class BonusManager extends MiniClientPlugin implements I if (oldChests > 0) { - _inventoryManager.addItemToInventory(player, TreasureType.OLD.getItemName(), oldChests); + //_inventoryManager.addItemToInventory(player, TreasureType.OLD.getItemName(), oldChests); UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(oldChests + " Old Chests"))); + _inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.OLD.getItemName()), mythicalChests)); } if (ancientChests > 0) { UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(ancientChests + " Ancient Chests"))); - _inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), ancientChests); + //_inventoryManager.addItemToInventory(player, TreasureType.ANCIENT.getItemName(), ancientChests); + _inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.ANCIENT.getItemName()), mythicalChests)); } if (mythicalChests > 0) { UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(mythicalChests + " Mythical Chests"))); - _inventoryManager.addItemToInventory(player, TreasureType.MYTHICAL.getItemName(), mythicalChests); + //_inventoryManager.addItemToInventory(player, TreasureType.MYTHICAL.getItemName(), mythicalChests); + _inventoryManager.Get(player).addItem(new ClientItem(_inventoryManager.getItem(TreasureType.MYTHICAL.getItemName()), mythicalChests)); } if (gems > 0) { UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gems + " Gems"))); - _gemQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), gems)); + //_gemQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), gems)); } if (gold > 0) { UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gold + " Gold"))); + /* _donationManager.rewardGold(new Callback() { @Override @@ -773,12 +779,13 @@ public class BonusManager extends MiniClientPlugin implements I } } }, "Earned", player.getName(), coreClient.getAccountId(), gold, true); + */ } if (coins > 0) { UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Treasure Shards"))); - _coinQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), coins)); + //_coinQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), coins)); } if (tickets > 0) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java index a00e6373e..594dff4e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java @@ -259,42 +259,48 @@ public class BonusRepository extends MinecraftRepository public void attemptRankBonus(final Player player, final Callback result) { - if (!Recharge.Instance.usable(player, "AttemptRankBonus")) { + if (!Recharge.Instance.usable(player, "AttemptRankBonus")) + { result.run(false); return; } + final int accountId = _manager.getClientManager().Get(player).getAccountId(); final int coins = _manager.getRankBonusAmount(player).getCoins(); + final int gems = _manager.getRankBonusAmount(player).getGems(); + final int mythicalChestChange = _manager.getRankBonusAmount(player).getMythicalChests(); - if (!_manager.getRankBonusAmount(player).isGreaterThanZero()) { + if (!_manager.getRankBonusAmount(player).isGreaterThanZero()) + { result.run(false); return; } final JavaPlugin plug = _manager.getPlugin(); - Bukkit.getScheduler().runTaskAsynchronously(plug, new Runnable() { - + Bukkit.getScheduler().runTaskAsynchronously(plug, new Runnable() + { @Override public void run() { - try (Connection connection = getConnection(); - CallableStatement callableStatement = connection.prepareCall("{call check_rank(?, ?, ?, ?, ?)}")) { + CallableStatement callableStatement = connection.prepareCall("{call rankBonus(?, ?, ?, ?, ?, ?)}")) + { callableStatement.setInt(1, accountId); callableStatement.setInt(2, coins); - callableStatement.setInt(3, 0); - callableStatement.registerOutParameter(4, java.sql.Types.BOOLEAN); - callableStatement.registerOutParameter(5, java.sql.Types.DATE); + callableStatement.setInt(3, gems); + callableStatement.setInt(4, mythicalChestChange); + callableStatement.registerOutParameter(5, java.sql.Types.BOOLEAN); + callableStatement.registerOutParameter(6, java.sql.Types.DATE); callableStatement.executeUpdate(); - final boolean pass = callableStatement.getBoolean(4); + final boolean pass = callableStatement.getBoolean(5); - final Date date = callableStatement.getDate(5); - - Bukkit.getScheduler().runTask(plug, new Runnable() { + final Date date = callableStatement.getDate(6); + Bukkit.getScheduler().runTask(plug, new Runnable() + { @Override public void run() { @@ -311,9 +317,12 @@ public class BonusRepository extends MinecraftRepository } } }); - } catch (Exception e) { + } + catch (Exception e) + { Recharge.Instance.use(player, "AttemptRankBonus", 1000 * 30, false, false); e.printStackTrace(); + System.out.println("Error : " + e.getMessage()); result.run(false); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index b0d9d7448..fcdb2aafa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -58,6 +58,7 @@ public class Chat extends MiniPlugin private CoreClientManager _clientManager; private PreferencesManager _preferences; private AchievementManager _achievements; + private IncognitoManager _incognitoManager; private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"}; private String _filterUrl = "https://chat.mineplex.com:8003/content/item/moderate"; @@ -74,10 +75,11 @@ public class Chat extends MiniPlugin private HashMap _playerLastMessage = new HashMap(); - public Chat(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences, AchievementManager achievements, String serverName) + public Chat(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences, AchievementManager achievements, String serverName) { super("Chat", plugin); - + + _incognitoManager = incognitoManager; _clientManager = clientManager; _serverName = serverName; _preferences = preferences; @@ -308,7 +310,7 @@ public class Chat extends MiniPlugin Player sender = event.getPlayer(); - if (IncognitoManager.Instance.Get(sender).Status) + if (_incognitoManager != null && _incognitoManager.Get(sender).Status) { UtilPlayer.message(sender, C.cYellow + "You can not chat while incognito."); event.setCancelled(true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index c20b8a942..d1c44b6d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -2,8 +2,6 @@ package mineplex.core.elo; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; import java.util.UUID; import mineplex.core.MiniDbClientPlugin; @@ -32,7 +30,7 @@ public class EloManager extends MiniDbClientPlugin public int getElo(UUID uuid, String gameType) { - int elo = 1400; + int elo = 1000; synchronized (_playerEloLock) { @@ -48,61 +46,6 @@ public class EloManager extends MiniDbClientPlugin return elo; } - //get a player's Division - public String getPlayerDivision(UUID uuid, String gameType) - { - //get playerElo for gameType (need to store this to check it against other Elo's) - int playerElo = getElo(uuid, gameType); - //this list will be filled with ELO's from other players (but only for the same game type - ArrayList allElos = new ArrayList(); - - for(int i = 0; i < _playerElos.size(); i++) - { - //we're only concerned with this Game Type - if(_playerElos.containsKey(gameType)) - { - //add elo's to the list - allElos.add(_playerElos.get(uuid.toString()).get(gameType)); - } - } - //sort list of Elos (needed for percentile calculations) - Collections.sort(allElos); - - //Calculate how much going up one spot is worth - double individualValue = (100/allElos.size()); - - /* lastIndexOf gets the last instance of player's Elo - * Consequently, it should be easier for rank to go up than down - * and everyone at the same Elo should be in the same division - */ - double percentile = allElos.lastIndexOf(playerElo) * individualValue; - - - return CalculateDivision(playerElo, percentile); - } - - public String CalculateDivision(int playerElo, double divPercent) - { - if (playerElo >= 3500 && divPercent > 99) return "Diamond"; - if (playerElo >= 3500) return "Emerald 3"; - if (playerElo < 3500 && playerElo >= 3300) return "Emerald 2"; - if (playerElo < 3300 && playerElo >= 3100) return "Emerald 1"; - if (playerElo < 3100 && playerElo >= 2900) return "Lapis 3"; - if (playerElo < 2900 && playerElo >= 2700) return "Lapis 2"; - if (playerElo < 2700 && playerElo >= 2500) return "Lapis 1"; - if (playerElo < 2500 && playerElo >= 2300) return "Gold 3"; - if (playerElo < 2300 && playerElo >= 2100) return "Gold 2"; - if (playerElo < 2100 && playerElo >= 1900) return "Gold 1"; - if (playerElo < 1900 && playerElo >= 1700) return "Iron 3"; - if (playerElo < 1700 && playerElo >= 1500) return "Iron 2"; - if (playerElo < 1500 && playerElo >= 1300) return "Iron 1"; - if (playerElo < 1300 && playerElo >= 800) return "Coal 3"; - if (playerElo < 800 && playerElo >= 600) return "Coal 2"; - if (playerElo < 600 && playerElo >= 400) return "Coal 1"; - - return "Result not found"; - } - public EloTeam getNewRatings(EloTeam teamA, EloTeam teamB, GameResult result) { EloTeam newTeam = new EloTeam(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index 71505f6ba..a2661fee3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -5,22 +5,8 @@ public class EloPlayer public String UniqueId; public int Rating; - //String to hold division player is currently in - private String _division; - public void printInfo() { System.out.println(UniqueId + "'s elo is " + Rating); } - - public void setDivision(String newDivision) - { - _division = newDivision; - } - - public String getDivision() - { - return _division; - } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index a4c46c218..d14d5c35b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -3,8 +3,6 @@ package mineplex.core.game; import org.bukkit.DyeColor; import org.bukkit.Material; -import mineplex.core.elo.EloSettings; - public enum GameDisplay { //Mini @@ -91,8 +89,6 @@ public enum GameDisplay private int _gameId; // Unique identifying id for this gamemode (used for statistics) public int getGameId() { return _gameId; } - private EloSettings EloSetting = new EloSettings(0); - GameDisplay(String name, Material mat, byte data, GameCategory gameCategory, int gameId) { this(name, name, mat, data, gameCategory, gameId); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java index 91d873faa..afb328093 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java @@ -17,6 +17,7 @@ import com.google.common.base.Function; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -90,30 +91,45 @@ public class IncognitoManager extends MiniDbClientPlugin @EventHandler(priority = EventPriority.HIGHEST) public void Join(PlayerJoinEvent event) { + Player player = event.getPlayer(); + + if (Get(event.getPlayer()).Status && !_clientManager.hasRank(event.getPlayer(), Rank.HELPER)) + { + Get(event.getPlayer()).Status = false; + runAsync(() -> _repository.setStatus(_clientManager.getAccountId(player), false)); + return; + } + if (Get(event.getPlayer()).Status) { event.setJoinMessage(null); - informIncognito(event.getPlayer()); + informIncognito(player); } - IncognitoHidePlayerEvent customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(event.getPlayer())); + IncognitoHidePlayerEvent customEvent = null; - UtilServer.getPlayersCollection().forEach(player -> { - if (!customEvent.isCancelled() && Get(event.getPlayer()).Status && !_clientManager.hasRank(player, _clientManager.Get(event.getPlayer()).GetRank())) + if (Get(event.getPlayer()).Status) + { + customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(player)); + } + + for (Player other : UtilServer.getPlayers()) + { + if (customEvent != null && !customEvent.isCancelled() && !_clientManager.hasRank(other, _clientManager.Get(player).GetRank())) { - player.hidePlayer(event.getPlayer()); + other.hidePlayer(player); } - if (Get(player).Status) + if (Get(other).Status) { - IncognitoHidePlayerEvent customEvent2 = UtilServer.CallEvent(new IncognitoHidePlayerEvent(player)); + IncognitoHidePlayerEvent customEvent2 = UtilServer.CallEvent(new IncognitoHidePlayerEvent(other)); - if (!customEvent2.isCancelled() && !_clientManager.hasRank(event.getPlayer(), _clientManager.Get(player).GetRank())) + if (!customEvent2.isCancelled() && !_clientManager.hasRank(player, _clientManager.Get(other).GetRank())) { - event.getPlayer().hidePlayer(player); + player.hidePlayer(other); } } - }); + } } @EventHandler(priority = EventPriority.HIGHEST) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/events/IncognitoHidePlayerEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/events/IncognitoHidePlayerEvent.java new file mode 100644 index 000000000..54dabeebc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/events/IncognitoHidePlayerEvent.java @@ -0,0 +1,47 @@ +package mineplex.core.incognito.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * Called when an Incognito player is getting hidden from all other players. + */ +public class IncognitoHidePlayerEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private boolean _cancelled; + + public IncognitoHidePlayerEvent(Player player) + { + _player = player; + } + + public Player getPlayer() + { + return _player; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index a9635e8bb..a84ed8cdf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -27,7 +27,12 @@ import mineplex.core.friend.data.FriendData; import mineplex.core.friend.data.FriendStatus; import mineplex.core.ignore.IgnoreManager; import mineplex.core.incognito.IncognitoManager; -import mineplex.core.message.commands.*; +import mineplex.core.message.commands.AdminCommand; +import mineplex.core.message.commands.AnnounceCommand; +import mineplex.core.message.commands.MessageAdminCommand; +import mineplex.core.message.commands.MessageCommand; +import mineplex.core.message.commands.ResendAdminCommand; +import mineplex.core.message.commands.ResendCommand; import mineplex.core.message.redis.AnnouncementHandler; import mineplex.core.message.redis.MessageHandler; import mineplex.core.message.redis.RedisMessage; @@ -45,6 +50,8 @@ public class MessageManager extends MiniClientPlugin private CoreClientManager _clientManager; private FriendManager _friendsManager; private IgnoreManager _ignoreManager; + private IncognitoManager _incognitoManager; + private HashMap _messageTimeouts = new HashMap(); private PreferencesManager _preferences; private Punish _punish; @@ -52,11 +59,12 @@ public class MessageManager extends MiniClientPlugin private ArrayList _randomMessage; private String _serverName; - public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences, + public MessageManager(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences, IgnoreManager ignoreManager, Punish punish, FriendManager friendManager, Chat chat) { super("Message", plugin); - + + _incognitoManager = incognitoManager; _clientManager = clientManager; _preferences = preferences; _ignoreManager = ignoreManager; @@ -86,7 +94,7 @@ public class MessageManager extends MiniClientPlugin addCommand(new AnnounceCommand(this)); //addCommand(new GlobalCommand(this)); - addCommand(new AdminCommand(this)); + addCommand(new AdminCommand(this, _incognitoManager)); } @Override @@ -466,7 +474,6 @@ public class MessageManager extends MiniClientPlugin if (!adminMessage) { - for (FriendStatus friendInfo : friends.getFriends()) { @@ -524,7 +531,7 @@ public class MessageManager extends MiniClientPlugin // If this is a message inside the server if (to != null) { - if (IncognitoManager.Instance.Get(to).Status) + if (_incognitoManager.Get(to).Status) { UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "].")); return; @@ -549,51 +556,63 @@ public class MessageManager extends MiniClientPlugin // If this is a admin message, or the sender isn't muted/ignoring the target if (adminMessage || canSenderMessageThem(sender, playerTarget)) { - if (IncognitoManager.Instance.getRepository().GetStatus(playerTarget)) - { - UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "].")); - return; - } - - // Construct the command to send to redis - RedisMessage globalMessage = new RedisMessage(_serverName, - - sender.getName(), - - adminMessage ? null : friend.ServerName, - - playerTarget, - - message, - - // Include the sender's rank if this is a admin message. So we can format the receivers chat. - adminMessage ? F.rank(_clientManager.Get(sender).GetRank()) : null); - - final UUID uuid = globalMessage.getUUID(); - - // A backup for the rare case where the message fails to deliver. Server doesn't respond - BukkitRunnable runnable = new BukkitRunnable() - { - public void run() + runAsync(new Runnable() { - _messageTimeouts.remove(uuid); - - // Inform the player that the message failed to deliver - UtilPlayer.message( - sender, - F.main((adminMessage ? "Admin " : "") + "Message", C.mBody + " Failed to send message to [" - + C.mElem + playerTarget + C.mBody + "].")); + @Override + public void run() + { + // TODO Newgarbo wrote this stuff inefficiently and for sake of time and thousands of players i'm going to just comment this out + /* + if (IncognitoManager.Instance.getRepository().GetStatus(playerTarget)) + { + UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "].")); + return; + } + */ + + runSync(new Runnable() + { + public void run() + { + // Construct the command to send to redis + RedisMessage globalMessage = new RedisMessage(_serverName, + sender.getName(), + adminMessage ? null : friend.ServerName, + playerTarget, + message, + // Include the sender's rank if this is a admin message. So we can format the receivers chat. + adminMessage ? F.rank(_clientManager.Get(sender).GetRank()) : null); + + final UUID uuid = globalMessage.getUUID(); + + // A backup for the rare case where the message fails to deliver. Server doesn't respond + BukkitRunnable runnable = new BukkitRunnable() + { + public void run() + { + _messageTimeouts.remove(uuid); + + // Inform the player that the message failed to deliver + UtilPlayer.message( + sender, + F.main((adminMessage ? "Admin " : "") + "Message", C.mBody + " Failed to send message to [" + + C.mElem + playerTarget + C.mBody + "].")); + } + }; + + // This will activate in 2 seconds + runnable.runTaskLater(getPlugin(), 40); + + // The key is the UUID its trading between servers + _messageTimeouts.put(uuid, runnable); + + // Time to send the message! + globalMessage.publish(); + } + }); + } } - }; - - // This will activate in 2 seconds - runnable.runTaskLater(getPlugin(), 40); - - // The key is the UUID its trading between servers - _messageTimeouts.put(uuid, runnable); - - // Time to send the message! - globalMessage.publish(); + ); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java index f9c2242d1..be869c072 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java @@ -9,14 +9,18 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.incognito.IncognitoManager; import mineplex.core.message.MessageManager; -import mineplex.core.visibility.VisibilityManager; public class AdminCommand extends CommandBase { - public AdminCommand(MessageManager plugin) + private IncognitoManager _incognitoManager; + + public AdminCommand(MessageManager plugin, IncognitoManager incognitoManager) { super(plugin, Rank.ALL, "a","admin"); + + _incognitoManager = incognitoManager; } @Override @@ -51,6 +55,11 @@ public class AdminCommand extends CommandBase { if (Plugin.GetClientManager().Get(to).GetRank().has(Rank.HELPER)) { + if (_incognitoManager.Get(to).Status) + { + continue; + } + if (!to.equals(caller)) UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index a94be37fe..87c84076d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -478,6 +478,17 @@ public class NpcManager extends MiniPlugin } } + public void addFakeNpc(Npc npc) + { + _npcs.add(npc); + } + + public void removeFakeNpc(Npc npc) + { + _npcs.remove(npc); + npc.getEntity().remove(); + } + public void loadNpcs() throws SQLException { String serverType = getServerName(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java index 0cc20fd4f..2ba415206 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java @@ -60,13 +60,11 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback if (entry.getLeft() == version || entry.getLeft() == MinecraftVersion.ALL) { player.setResourcePack(entry.getRight()); - player.sendMessage("A: " + entry.getRight()); return; } } player.setResourcePack(_resourcePackUrls[0].getRight()); - player.sendMessage("B: " + _resourcePackUrls[0].getRight()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java b/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java index 419ace87c..68f1634b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/updater/UpdateType.java @@ -53,9 +53,13 @@ public enum UpdateType */ SLOWEST(32000), /** - * ONce every 30 seconds + * Once every 30 seconds */ SEC_30(30000), + /** + * Once every 20 seconds + */ + SEC_20(20000), /** * Once every 16 seconds */ diff --git a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/SimpleClanToken.java b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/SimpleClanToken.java index 70757bd98..e7fd13ca0 100644 --- a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/SimpleClanToken.java +++ b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/SimpleClanToken.java @@ -3,7 +3,7 @@ package mineplex.game.clans.core.repository.tokens; public class SimpleClanToken { - private String _clanName; + private String _clanName = ""; public String getClanName() { return _clanName; } private String _clanRole; @@ -22,4 +22,6 @@ public class SimpleClanToken _homeServer = homeServer; _clanId = clanId; } + + public SimpleClanToken() { } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index e698387d9..a9e32d2dd 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -7,16 +7,20 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.CustomTagFix; import mineplex.core.FoodDupeFix; +import mineplex.core.PacketsInteractionFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; +import mineplex.core.common.MinecraftVersion; +import mineplex.core.common.Pair; import mineplex.core.common.events.ServerShutdownEvent; import mineplex.core.delayedtask.DelayedTask; import mineplex.core.donation.DonationManager; import mineplex.core.explosion.Explosion; +import mineplex.core.fallingblock.FallingBlocks; import mineplex.core.friend.FriendManager; import mineplex.core.give.Give; import mineplex.core.hologram.HologramManager; @@ -41,7 +45,6 @@ import mineplex.core.teleport.Teleport; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.core.visibility.VisibilityManager; -import mineplex.game.clans.analytics.Profiler; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ban.ClansBanManager; import mineplex.game.clans.items.GearManager; @@ -66,9 +69,6 @@ public class Clans extends JavaPlugin @Override public void onEnable() { - // Initialize Profiler - new Profiler(); - // Configs getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); @@ -93,6 +93,8 @@ public class Clans extends JavaPlugin _donationManager = new DonationManager(this, _clientManager, webServerAddress); + new FallingBlocks(this); + new ServerConfiguration(this, _clientManager); PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); @@ -107,7 +109,7 @@ public class Clans extends JavaPlugin Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName()); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); - new ClansBanManager(this, _clientManager, _donationManager); +// ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager); PacketHandler packetHandler = new PacketHandler(this); Punish punish = new Punish(this, webServerAddress, _clientManager); @@ -122,23 +124,26 @@ public class Clans extends JavaPlugin StatsManager statsManager = new StatsManager(this, _clientManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager); - Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); - new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat); + Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); + new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat); new MemoryFix(this); new FoodDupeFix(this); new Explosion(this, blockRestore); - new FriendManager(this, _clientManager, preferenceManager, portal); new InventoryManager(this, _clientManager); ResourcePackManager resourcePackManager = new ResourcePackManager(this, portal); - resourcePackManager.setResourcePack("http://garblox.com/b:ResClans.zip", "http://garblox.com/b:ResClans19.zip", true); + resourcePackManager.setResourcePack(new Pair[] + { + Pair.create(MinecraftVersion.Version1_8, "http://phinary.ca/ResClans.zip"), + Pair.create(MinecraftVersion.Version1_9, "http://phinary.ca/ResClans19.zip") + }, true); // Enable custom-gear related managers new CustomTagFix(this, packetHandler); GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager); HologramManager hologram = new HologramManager(this, packetHandler); - _clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress); + _clansManager = new ClansManager(this, /*clansBans,*/ serverStatusManager.getCurrentServerName(), packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, webServerAddress); new Recipes(this); new Farming(this); new BuildingShop(_clansManager, _clientManager, _donationManager); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyTracker.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyTracker.java index 307768c84..e7a2a998a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyTracker.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyTracker.java @@ -61,7 +61,7 @@ public class ClanEnergyTracker extends MiniPlugin Triple energyBounds = _updateMap.get(type); - if (energyBounds != null && energyRemaining > energyBounds.getLeft() && energyRemaining < energyBounds.getMiddle()) + if (energyBounds != null && energyRemaining > energyBounds.getLeft().longValue() && energyRemaining < energyBounds.getMiddle().longValue()) { _clans.middleTextClan(clan, energyBounds.getRight()[0], energyBounds.getRight()[1], 20, 200, 80); _clans.sendTipToClan(clan, TipType.ENERGY); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansAdmin.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansAdmin.java index f9c28fc95..b7d073814 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansAdmin.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansAdmin.java @@ -245,7 +245,7 @@ public class ClansAdmin { public void run() { - if (nameExists) + if (nameExists.booleanValue()) UtilPlayer.message(caller, F.main("Clans Admin", "Clan name cannot be a Player name.")); else { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java index 53427e151..b5cb35043 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java @@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilWorld; import mineplex.game.clans.clans.event.ClanCreatedEvent; +import mineplex.game.clans.clans.event.ClanCreationCompleteEvent; import mineplex.game.clans.clans.event.ClanDeleteEvent; import mineplex.game.clans.clans.event.ClanJoinEvent; import mineplex.game.clans.clans.event.ClanLeaveEvent; @@ -195,6 +196,9 @@ public class ClansDataAccessLayer } if (callback != null) callback.run(clanInfo); + + ClanCreationCompleteEvent event = new ClanCreationCompleteEvent(token, Bukkit.getPlayer(creator)); + UtilServer.getServer().getPluginManager().callEvent(event); } }); } @@ -781,8 +785,14 @@ public class ClansDataAccessLayer // Memory claim.Safe = !claim.Safe; - // Save - _repository.updateTerritoryClaim(claim.Chunk, claim.Safe); + runAsync(new Runnable() + { + @Override + public void run() + { + _repository.updateTerritoryClaim(claim.Chunk, claim.Safe); + } + }); // Log _manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "]."); @@ -803,7 +813,28 @@ public class ClansDataAccessLayer public void clanExists(String clanName, Callback callback) { - _repository.clanExists(clanName, callback); + runAsync(new Runnable() + { + @Override + public void run() + { + _repository.clanExists(clanName, new Callback() + { + @Override + public void run(Boolean data) + { + runSync(new Runnable() + { + @Override + public void run() + { + if (callback != null) callback.run(data); + } + }); + } + }); + } + }); } public ClanRepository getRepository() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index bb276ccfe..66bf8b575 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -57,6 +57,7 @@ import mineplex.core.explosion.Explosion; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; import mineplex.core.incognito.IncognitoManager; +import mineplex.core.incognito.events.IncognitoHidePlayerEvent; import mineplex.core.incognito.events.IncognitoStatusChangeEvent; import mineplex.core.movement.Movement; import mineplex.core.npc.NpcManager; @@ -93,7 +94,6 @@ import mineplex.game.clans.clans.nether.NetherManager; import mineplex.game.clans.clans.observer.ObserverManager; import mineplex.game.clans.clans.playtime.Playtime; import mineplex.game.clans.clans.potato.PotatoManager; -import mineplex.game.clans.clans.pvptimer.PvpTimer; import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler; import mineplex.game.clans.clans.redis.ClanLoadCommandHandler; import mineplex.game.clans.clans.regions.ClansRegions; @@ -170,12 +170,15 @@ public class ClansManager extends MiniClientPluginimplements IRelati private DonationManager _donationManager; private NetherManager _netherManager; private DamageManager _damageManager; + private SiegeManager _siegeManager; + private IncognitoManager _incognitoManager; private ClansBlacklist _blacklist; private Playtime _playTracker; - - private mineplex.game.clans.legacytutorial.TutorialManager _tutorialManager; + + private TutorialManager _tutorial; + private mineplex.game.clans.legacytutorial.TutorialManager _legacyTutorial; private ClassManager _classManager; @@ -196,7 +199,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati private WarPointEvasion _warPointEvasion; private ObserverManager _observerManager; private Punish _punish; - private PvpTimer _pvpTimer; + private TaskManager _taskManager; private int _inviteExpire = 2; private int _nameMin = 3; @@ -218,18 +221,22 @@ public class ClansManager extends MiniClientPluginimplements IRelati public String UserDataDir = UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "CLANS_USER_DATA" + File.separator; + /*private ClansBanManager _clansBans;*/ + public ClanTips ClanTips; // Spawn area - public ClansManager(JavaPlugin plugin, String serverName, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress) + public ClansManager(JavaPlugin plugin/*, ClansBanManager clansBans*/, String serverName, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, StatsManager statsManager, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress) { super("Clans Manager", plugin); _instance = this; + /*_clansBans = clansBans;*/ _punish = punish; + _incognitoManager = new IncognitoManager(plugin, clientManager, packetHandler); _serverName = serverName; _clientManager = clientManager; _combatManager = new CombatManager(plugin); @@ -258,7 +265,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati _worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null); - TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress); + _taskManager = new TaskManager(plugin, _clientManager, webServerAddress); ClanTips = new ClanTips(plugin, this, preferencesManager); @@ -269,7 +276,8 @@ public class ClansManager extends MiniClientPluginimplements IRelati _clanDisplay = new ClansDisplay(plugin, this); _clanGame = new ClansGame(plugin, this); _clanUtility = new ClansUtility(this); - _itemMapManager = new ItemMapManager(this, _worldEvent); + _tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, _npcManager, _taskManager); + _itemMapManager = new ItemMapManager(this, _tutorial, _worldEvent); new TntGeneratorManager(plugin, this); new SupplyDropManager(plugin, this); @@ -299,7 +307,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati new ClanEnergyTracker(plugin, this); // new StuckManager(this); - new ClansBetaManager(this, taskManager); + new ClansBetaManager(this, _taskManager); new PotatoManager(plugin, this); @@ -324,8 +332,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati // Register redis based server commands ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler()); ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler()); - - StatsManager statsManager = new StatsManager(plugin, _clientManager); + AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager); ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager); _classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop"); @@ -333,12 +340,10 @@ public class ClansManager extends MiniClientPluginimplements IRelati new ClanEnergyManager(plugin, this, clientManager, donationManager); _playTracker = new Playtime(this, statsManager); - _pvpTimer = new PvpTimer(this, statsManager); - _tutorialManager = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler); - TutorialManager tutorial = new TutorialManager(plugin, clientManager, donationManager, chat); + _legacyTutorial = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, _taskManager, donationManager, preferencesManager, this, packetHandler); - _scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, tutorial, clientManager, donationManager); + _scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, _tutorial, clientManager, donationManager); _clanDataAccess = new ClansDataAccessLayer(this, _scoreboard); for (ClanToken token : _clanDataAccess.getRepository().retrieveClans()) @@ -357,30 +362,27 @@ public class ClansManager extends MiniClientPluginimplements IRelati List jumpOffHolograms = Arrays.asList( // West Spawn - new Location(Spawn.getSpawnWorld(), -295.5, 204, 36.5), - new Location(Spawn.getSpawnWorld(), -295.5, 204, -26.5), - new Location(Spawn.getSpawnWorld(), -331.5, 204, 6.5), - new Location(Spawn.getSpawnWorld(), -266.5, 204, 6.5), + new Location(Spawn.getSpawnWorld(), 8, 200, 359), + new Location(Spawn.getSpawnWorld(), 34, 200, 390), + new Location(Spawn.getSpawnWorld(), 8, 200, 418), + new Location(Spawn.getSpawnWorld(), -25, 200, 390), // East Spawn - new Location(Spawn.getSpawnWorld(), 304.5, 207, -26.5), - new Location(Spawn.getSpawnWorld(), 332.5, 207, 6.5), - new Location(Spawn.getSpawnWorld(), 304.5, 207, 36.5), - new Location(Spawn.getSpawnWorld(), 268.5, 207, 6.5) + new Location(Spawn.getSpawnWorld(), 34, 200, -393), + new Location(Spawn.getSpawnWorld(), 8, 200, -365), + new Location(Spawn.getSpawnWorld(), -25, 200, -393), + new Location(Spawn.getSpawnWorld(), 8, 200, -424) ); List welcomeHolograms = Arrays.asList( - // West Spawn - new Location(Spawn.getSpawnWorld(), -304.5, 204, 6.5), - new Location(Spawn.getSpawnWorld(), -295.5, 204, 15.5), - new Location(Spawn.getSpawnWorld(), -286.5, 204, 6.5), - new Location(Spawn.getSpawnWorld(), -295.5, 204, -2.5), - - // East Spawn - new Location(Spawn.getSpawnWorld(), 295.5, 207, 6.5), - new Location(Spawn.getSpawnWorld(), 304.5, 207, -2.5), - new Location(Spawn.getSpawnWorld(), 313.5, 207, 6.5), - new Location(Spawn.getSpawnWorld(), 304.5, 207, 15.5) + new Location(Spawn.getSpawnWorld(), 17, 200, 390), + new Location(Spawn.getSpawnWorld(), 8, 200, 399), + new Location(Spawn.getSpawnWorld(), 0, 200, 390), + new Location(Spawn.getSpawnWorld(), 8, 200, 381), + new Location(Spawn.getSpawnWorld(), 8, 200, -384), + new Location(Spawn.getSpawnWorld(), 0, 200, -393), + new Location(Spawn.getSpawnWorld(), 8, 200, -402), + new Location(Spawn.getSpawnWorld(), 17, 200, -393) ); for (Location location : jumpOffHolograms) @@ -403,7 +405,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "Replay|Restrict"); - new SiegeManager(this); + _siegeManager = new SiegeManager(this); // _netherManager = new NetherManager(this); } @@ -438,9 +440,14 @@ public class ClansManager extends MiniClientPluginimplements IRelati return _disguiseManager; } - public mineplex.game.clans.legacytutorial.TutorialManager getTutorials() + public mineplex.game.clans.legacytutorial.TutorialManager getLegacyTutorial() { - return _tutorialManager; + return _legacyTutorial; + } + + public TutorialManager getTutorial() + { + return _tutorial; } public NpcManager getNPCManager() @@ -573,7 +580,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati } } } - + @EventHandler public void StaffIncognito(IncognitoStatusChangeEvent event) { @@ -587,51 +594,100 @@ public class ClansManager extends MiniClientPluginimplements IRelati } } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.HIGHEST) public void Join(PlayerJoinEvent event) { - if (IncognitoManager.Instance.Get(event.getPlayer()).Status) + event.setJoinMessage(null); + + /*if (_clansBans.willBeKicked(event.getPlayer())) + { + return; + }*/ + + if (_incognitoManager.Get(event.getPlayer()).Status) { - event.setJoinMessage(null); return; } - if (event.getJoinMessage() != null) + /*_clansBans.runAfterLoad(event.getPlayer().getName(), () -> { + if (_clansBans.Get(event.getPlayer().getName()).isBanned()) + { + return; + }*/ + + for (Player other : UtilServer.getPlayers()) + { + if (_tutorial.inTutorial(other)) + { + // Don't display join message if player in tutorial. + continue; + } + + other.sendMessage(F.sys("Join", event.getPlayer().getName())); + } + /*});*/ + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void Quit(PlayerQuitEvent event) + { + event.setQuitMessage(null); + + if (_incognitoManager.Get(event.getPlayer()).Status) { - event.setJoinMessage(null); - UtilServer.broadcast(F.sys("Join", event.getPlayer().getName())); + return; + } + + /*if (_clansBans.willBeKicked(event.getPlayer())) + { + return; + }*/ + + for (Player other : UtilServer.getPlayers()) + { + if (_tutorial.inTutorial(other)) + { + // Don't display quit message if player in tutorial. + continue; + } + + other.sendMessage(F.sys("Quit", event.getPlayer().getName())); } } - @EventHandler(priority = EventPriority.LOWEST) - public void Quit(PlayerQuitEvent event) + @EventHandler(priority = EventPriority.HIGHEST) + public void Kick(PlayerKickEvent event) { - if (IncognitoManager.Instance.Get(event.getPlayer()).Status) + if (_incognitoManager.Get(event.getPlayer()).Status) { - event.setQuitMessage(null); + event.setLeaveMessage(null); return; } - if (event.getQuitMessage() != null) + /*if (_clansBans.willBeKicked(event.getPlayer())) { - event.setQuitMessage(null); - UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName())); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void Kick(PlayerKickEvent event) - { - if (IncognitoManager.Instance.Get(event.getPlayer()).Status) + return; + }*/ + + if (event.getReason().contains("You are banned from Clans")) { - event.setLeaveMessage(null); return; } if (event.getLeaveMessage() != null) { event.setLeaveMessage(null); - UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName())); + + for (Player other : UtilServer.getPlayers()) + { + if (_tutorial.inTutorial(other)) + { + // Don't display leave message if player in tutorial. + continue; + } + + other.sendMessage(F.sys("Leave", event.getPlayer().getName())); + } } } @@ -672,7 +728,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati clanInfo.playerOnline(player); } - if (_clientManager.hasRank(player, Rank.DEVELOPER) || player.getUniqueId().toString().equals("d8646a35-33a8-43c6-9e7c-2e871a6b86c9")) + if (_clientManager.hasRank(player, Rank.DEVELOPER)) { player.setOp(true); } @@ -798,9 +854,14 @@ public class ClansManager extends MiniClientPluginimplements IRelati } List recipients = new ArrayList<>(); + + String message = event.getMessage();//_chat.getFilteredMessage(event.getPlayer(), event.getMessage()); - for (Player other : UtilServer.getPlayers()) + for (Player other : event.getRecipients()) { + if (_tutorial.inTutorial(other)) + continue; + ClanInfo otherClan = _clanUtility.getClanByPlayer(other); if (otherClan == null) @@ -809,14 +870,12 @@ public class ClansManager extends MiniClientPluginimplements IRelati } else { - String message = _chat.getFilteredMessage(event.getPlayer(), event.getMessage()); ClanRelation rel = _clanUtility.rel(clan, otherClan); - other.sendMessage(rank + rel.getColor(true) + clan.getName() + " " + rel.getColor(false) + event.getPlayer().getName() + " " + C.cWhite + message); } } - recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), event.getMessage()))); + recipients.forEach(p -> p.sendMessage(String.format(rank + C.cGold + clan.getName() + " " + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), message))); recipients.clear(); } @@ -1142,22 +1201,36 @@ public class ClansManager extends MiniClientPluginimplements IRelati @EventHandler(priority = EventPriority.HIGHEST) public void onJoin(PlayerLoginEvent event) { - if (true) + Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); + + if (rank.has(Rank.HELPER)) { + event.allow(); + event.setResult(PlayerLoginEvent.Result.ALLOWED); return; } + + int online = 0; - Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); - if (!event.getPlayer().isOp() && !event.getPlayer().isWhitelisted() && !rank.has(Rank.LEGEND)) + for (Player player : UtilServer.getPlayers()) { - event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans is currently in Legend+ only Alpha!"); - // event.setKickMessage("This server is whitelisted!"); - event.setKickMessage("Clans is currently in Legend+ only Alpha!"); + if (_clientManager.hasRank(player, Rank.HELPER)) + { + continue; + } + + online++; } - else if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp()) + + if (online >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp()) { - event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Alpha is full! Try again soon"); - event.setKickMessage("Clans Alpha is full! Try again soon"); + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Beta is full! Try again soon"); + event.setKickMessage("Clans Beta is full! Try again soon"); + } + else + { + event.allow(); + event.setResult(PlayerLoginEvent.Result.ALLOWED); } } @@ -1228,6 +1301,14 @@ public class ClansManager extends MiniClientPluginimplements IRelati @EventHandler(priority = EventPriority.HIGH) public void handleClansDeath(PlayerDeathEvent event) { + event.setDeathMessage(null); + + for(Player player : UtilServer.getPlayers()) + { + if(!_tutorial.inTutorial(player)) + player.sendMessage(event.getDeathMessage()); + } + PlayerClan playerClan; PlayerClan killerClan = null; @@ -1289,20 +1370,28 @@ public class ClansManager extends MiniClientPluginimplements IRelati UtilPlayer.message(player, F.main("Clans", message)); } - public boolean masterBypass(Player player) - { - return player.getName().equals("NewGarbo"); - } - public DamageManager getDamageManager() { return _damageManager; } - public PvpTimer getPvpTimer() { return _pvpTimer; } + public boolean hasTimer(Player player) + { + return false; + } public ClansBlacklist getBlacklist() { return _blacklist; } + + public SiegeManager getSiegeManager() + { + return _siegeManager; + } + + public IncognitoManager getIncognitoManager() + { + return _incognitoManager; + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java index c0fc17a69..bb9567721 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansUtility.java @@ -557,7 +557,7 @@ public class ClansUtility public boolean isBorderlands(Location loc) { - return Math.abs(loc.getBlockX()) > ClansManager.CLAIMABLE_RADIUS || Math.abs(loc.getBlockZ()) > ClansManager.CLAIMABLE_RADIUS; + return (Math.abs(loc.getBlockX()) > ClansManager.CLAIMABLE_RADIUS || Math.abs(loc.getBlockZ()) > ClansManager.CLAIMABLE_RADIUS) && loc.getWorld().getName().equalsIgnoreCase("world"); } /** diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanManager.java index 0b3c63045..b0c5d4601 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanManager.java @@ -1,5 +1,8 @@ package mineplex.game.clans.clans.ban; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -10,8 +13,6 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -20,25 +21,32 @@ import com.google.common.collect.Lists; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.account.ILoginProcessor; +import mineplex.core.common.DefaultHashMap; import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.donation.DonationManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ban.commands.ClansBanCommand; import mineplex.game.clans.clans.ban.ui.ClansBanShop; -public class ClansBanManager extends MiniPlugin +public class ClansBanManager extends MiniPlugin implements ILoginProcessor { private CoreClientManager _clientManager; private ClansBanRepository _repository; private Map _clients; private Map> _cache; + private DefaultHashMap> _runAfterLoad; private ClansBanShop _shop; + private Map _toKick = new HashMap<>(); + private Object _lock = new Object(); public ClansBanManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) @@ -51,8 +59,10 @@ public class ClansBanManager extends MiniPlugin _clients = new HashMap<>(); _cache = new HashMap<>(); - + _runAfterLoad = new DefaultHashMap<>(name -> new ArrayList<>()); _shop = new ClansBanShop(this, clientManager, donationManager); + + clientManager.addStoredProcedureLoginProcessor(this); } @Override @@ -64,6 +74,20 @@ public class ClansBanManager extends MiniPlugin @EventHandler public void clearOldClients(UpdateEvent event) { + if (event.getType().equals(UpdateType.SEC)) + { + _toKick.forEach((name, reason) -> { + Player player = UtilPlayer.searchExact(name); + + if (player == null) + { + return; + } + + player.kickPlayer(reason); + }); + } + if (!event.getType().equals(UpdateType.MIN_01)) { return; @@ -96,26 +120,6 @@ public class ClansBanManager extends MiniPlugin return _repository; } - @EventHandler - public void onPlayerJoin(AsyncPlayerPreLoginEvent event) - { - LoadClient(event.getName(), client -> { - if (client.isBanned()) - { - String time = UtilTime.convertString(client.getLongestBan().getTimeLeft(), 0, TimeUnit.FIT); - - if (client.getLongestBan().isPermanent()) - time = "Permanent"; - - String reason = C.cRedB + "You are banned from Clans for " + time + - "\n" + C.cWhite + client.getLongestBan().getReason(); - - event.disallow(Result.KICK_BANNED, reason); - event.setKickMessage(reason); - } - }); - } - @EventHandler(priority = EventPriority.LOWEST) public void onPlayerQuit(PlayerQuitEvent event) { @@ -229,4 +233,50 @@ public class ClansBanManager extends MiniPlugin LoadClient(name, callback); } + + public boolean willBeKicked(Player player) + { + return _toKick.containsKey(player.getName()); + } + + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + _repository.loadBans(playerName, client -> { + if (client.isBanned()) + { + String time = UtilTime.convertString(client.getLongestBan().getTimeLeft(), 0, TimeUnit.FIT); + + if (client.getLongestBan().isPermanent()) + time = "Permanent"; + + String reason = C.cRedB + "You are banned from Clans for " + time + + "\n" + C.cWhite + client.getLongestBan().getReason(); + + _toKick.put(playerName, reason); + + ClansManager.getInstance().runSyncLater(() -> { + if (Bukkit.getPlayer(playerName) != null) + { + Bukkit.getPlayer(playerName).kickPlayer(_toKick.remove(playerName)); + } + else + { + _runAfterLoad.get(playerName).forEach(Runnable::run); + _runAfterLoad.get(playerName).clear(); + } + }, 5L); + + } + }); + } + + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT * FROM clanBans WHERE uuid = '" + uuid + "';"; + } + + public void runAfterLoad(String playerName, Runnable run) + { + _runAfterLoad.get(playerName).add(run); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanRepository.java index 81513e371..0c4efadf1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ban/ClansBanRepository.java @@ -1,5 +1,6 @@ package mineplex.game.clans.clans.ban; +import java.sql.ResultSet; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; @@ -47,15 +48,10 @@ public class ClansBanRepository extends MinecraftRepository public void loadBans(final String name, final Callback callback) { - System.out.println(">> Attempting to load Clans Bans for \"" + name + "\""); loadClientByName(name, client -> { - System.out.println("> Successfully loaded CoreClient"); - String uuid = UUIDFetcher.getUUIDOf(client.GetPlayerName()).toString(); executeQuery(GET_ALL_BANS, resultSet -> { - System.out.println("> Successfully executed query, result set object: " + resultSet); - final List list = new ArrayList(); while (resultSet.next()) @@ -70,18 +66,47 @@ public class ClansBanRepository extends MinecraftRepository boolean removed = resultSet.getBoolean(8); list.add(new ClansBan(id, UUID.fromString(ruuid), admin, reason, banTime, unbanTime, permanent, removed)); - - System.out.println("Got ban for " + name); } callback.run(new ClansBanClient(uuid, list)); - System.out.println("> Successfully handled result"); - System.out.println(">> FINISH"); }, new ColumnVarChar("uuid", 36, uuid)); }); } + public void loadBans(final String name, final String uuid, final ResultSet resultSet, final Callback callback) + { + try + { + final List list = new ArrayList(); + + while (resultSet.next()) + { + int id = resultSet.getInt(1); + String ruuid = resultSet.getString(2); + String admin = resultSet.getString(3); + String reason = resultSet.getString(4); + Timestamp banTime = resultSet.getTimestamp(5); + Timestamp unbanTime = resultSet.getTimestamp(6); + boolean permanent = resultSet.getBoolean(7); + boolean removed = resultSet.getBoolean(8); + + list.add(new ClansBan(id, UUID.fromString(ruuid), admin, reason, banTime, unbanTime, permanent, removed)); + + System.out.println("Got ban for " + name); + } + + callback.run(new ClansBanClient(uuid, list)); + + System.out.println("> Successfully handled result"); + System.out.println(">> FINISH"); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + private void loadClientByName(String name, Callback client) { if (_manager.getClientManager().Contains(name)) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java index 55d4d6022..741fc365a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/ClansCommand.java @@ -37,6 +37,7 @@ import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClientClan; import mineplex.game.clans.clans.event.ClanJoinEvent; import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; +import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.game.clans.spawn.Spawn; import net.minecraft.server.v1_8_R3.EnumDirection; @@ -54,6 +55,9 @@ public class ClansCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { + if (UtilServer.CallEvent(new ClansCommandPreExecutedEvent(caller, args)).isCancelled()) + return; + if (args == null || args.length == 0) { _clansManager.getClanShop().attemptShopOpen(caller); @@ -105,10 +109,6 @@ public class ClansCommand extends CommandBase else if (args[0].equalsIgnoreCase("unclaim") || args[0].equalsIgnoreCase("uc")) unclaim(caller, args); - - else if (args[0].equalsIgnoreCase("map") || args[0].equalsIgnoreCase("m")) - map(caller, args); - else if (args[0].equalsIgnoreCase("home") || args[0].equalsIgnoreCase("h")) home(caller, args); @@ -138,7 +138,7 @@ public class ClansCommand extends CommandBase private void forceJoin(Player caller, String[] args) { - if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.getUniqueId().toString().equals("d8646a35-33a8-43c6-9e7c-2e871a6b86c9") /* My UUID (NewGarbo) */) + if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN)) { UtilPlayer.message(caller, F.main("Clans", "This requires ADMIN+ permission.")); return; @@ -219,7 +219,6 @@ public class ClansCommand extends CommandBase UtilPlayer.message(caller, F.help("/c create ", "Create new Clan", Rank.ALL)); UtilPlayer.message(caller, F.help("/c join ", "Join a Clan", Rank.ALL)); UtilPlayer.message(caller, F.help("/c leave ", "Leave your Clan", Rank.ALL)); - UtilPlayer.message(caller, F.help("/c map ", "View Clan Map", Rank.ALL)); UtilPlayer.message(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL)); UtilPlayer.message(caller, F.help("/c stuck", "Teleports you to the nearest Wilderness location", Rank.ALL)); @@ -358,7 +357,7 @@ public class ClansCommand extends CommandBase } Player target = UtilPlayer.searchOnline(caller, args[1], true); - if (target == null || IncognitoManager.Instance.Get(target).Status) return; + if (target == null || _clansManager.getIncognitoManager().Get(target).Status) return; Plugin.getClanUtility().invite(caller, clan, target); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/IronDoorOpenEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/IronDoorOpenEvent.java new file mode 100644 index 000000000..5c22c5229 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/IronDoorOpenEvent.java @@ -0,0 +1,58 @@ +package mineplex.game.clans.clans.event; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * Called before an iron door is opened by right clicking. + * + * (Custom mechanic in Clans) + */ +public class IronDoorOpenEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private Block _block; + + private boolean _cancelled; + + public IronDoorOpenEvent(Player player, Block block) + { + _player = player; + _block = block; + } + + public Player getPlayer() + { + return _player; + } + + public Block getBlock() + { + return _block; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerEnterTerritoryEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerEnterTerritoryEvent.java index 80e9a4a4d..ef243563e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerEnterTerritoryEvent.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/event/PlayerEnterTerritoryEvent.java @@ -22,6 +22,7 @@ public class PlayerEnterTerritoryEvent extends Event _lastTerritory = lastTerritory; _newTerritory = newTerritory; _safe = safe; + _sendMessage = sendMessage; } public Player getPlayer() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddAllyButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddAllyButton.java index 58b7d88c3..0ffc86737 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddAllyButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddAllyButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -13,8 +15,10 @@ public class ClanAddAllyButton implements IButton @Override public void onClick(Player player, ClickType clickType) { - player.closeInventory(); + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddAlly)).isCancelled()) + return; + player.closeInventory(); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to add an Ally").click(ClickEvent.SUGGEST_COMMAND, "/c ally "); message.sendToPlayer(player); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddTrustedButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddTrustedButton.java index 505eb674b..6a8d8a552 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddTrustedButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddTrustedButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -13,6 +15,9 @@ public class ClanAddTrustedButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddTrusted)).isCancelled()) + return; + player.closeInventory(); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to trust a clan").click(ClickEvent.SUGGEST_COMMAND, "/c trust "); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddWarButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddWarButton.java index 22e4ce7ef..d0faaa721 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddWarButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanAddWarButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -13,6 +15,8 @@ public class ClanAddWarButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.AddWar)).isCancelled()) + return; player.closeInventory(); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to war a clan").click(ClickEvent.SUGGEST_COMMAND, "/war "); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanCreateButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanCreateButton.java index 5776f58b0..39815a0f8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanCreateButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanCreateButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -18,9 +20,6 @@ public class ClanCreateButton implements IButton @Override public void onClick(Player player, ClickType clickType) { - player.closeInventory(); - - JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to create a clan").click(ClickEvent.SUGGEST_COMMAND, "/c create "); - message.sendToPlayer(player); + UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Create)); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanDisbandButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanDisbandButton.java index 5450e21a8..6165d054b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanDisbandButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanDisbandButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -18,6 +20,8 @@ public class ClanDisbandButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Disband)).isCancelled()) + return; getPlayer().closeInventory(); getClansManager().getClanUtility().delete(getPlayer()); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java index ae2d56236..20038637d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanEnergyButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -18,6 +20,6 @@ public class ClanEnergyButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { - + UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Energy)); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanInviteButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanInviteButton.java index afd3eff2b..f32e20b19 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanInviteButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanInviteButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -23,6 +25,8 @@ public class ClanInviteButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Invite)).isCancelled()) + return; getShop().openPageForPlayer(getPlayer(), new ClanInvitePage(getClansManager(), getShop(), getClansManager().getClientManager(), _donationManager, player)); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanJoinButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanJoinButton.java index f3e451d0a..fb8c78623 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanJoinButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanJoinButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -21,6 +23,8 @@ public class ClanJoinButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Join)).isCancelled()) + return; player.closeInventory(); _clansManager.getClanUtility().join(player, _clanInfo); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanLeaveButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanLeaveButton.java index 114f3eb79..fbf261c8e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanLeaveButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanLeaveButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -18,7 +20,22 @@ public class ClanLeaveButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { - getPlayer().closeInventory(); - getClansManager().getClanUtility().leave(getPlayer()); + if(clickType.equals(ClickType.SHIFT_RIGHT)) //disband + { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Disband)).isCancelled()) + return; + + getPlayer().closeInventory(); + getClansManager().getClanUtility().delete(getPlayer()); + + }else if(clickType.equals(ClickType.SHIFT_LEFT)) //leave + { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Leave)).isCancelled()) + return; + + getPlayer().closeInventory(); + getClansManager().getClanUtility().leave(getPlayer()); + } + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanMemeberButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanMemeberButton.java index da1194fe2..0570693d2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanMemeberButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanMemeberButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -24,6 +26,8 @@ public class ClanMemeberButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Member)).isCancelled()) + return; if (clickType == ClickType.LEFT) { // Promote diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanTerritoryButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanTerritoryButton.java index 27c4ac02e..363c78f01 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanTerritoryButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanTerritoryButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.ChatColor; import org.bukkit.Chunk; import org.bukkit.entity.Player; @@ -23,6 +25,8 @@ public class ClanTerritoryButton extends ClanButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Territory)).isCancelled()) + return; // if (_clansManager.getNetherManager().isInNether(player)) // { // _clansManager.message(player, "You are not allowed to do anything with Territory while in " + F.clansNether("The Nether") + "."); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanWhoButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanWhoButton.java index 20385402b..ce482aeed 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanWhoButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/button/ClanWhoButton.java @@ -1,5 +1,7 @@ package mineplex.game.clans.clans.gui.button; +import mineplex.core.common.util.UtilServer; +import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -13,6 +15,8 @@ public class ClanWhoButton implements IButton @Override public void onClick(Player player, ClickType clickType) { + if (UtilServer.CallEvent(new ClansButtonClickEvent(player, ClansButtonClickEvent.ButtonType.Who)).isCancelled()) + return; player.closeInventory(); JsonMessage message = new JsonMessage(C.cRed + C.Bold + "Click here to lookup a clan").click(ClickEvent.SUGGEST_COMMAND, "/c who "); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanMainPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanMainPage.java index f85de461b..a1cde46af 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanMainPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanMainPage.java @@ -52,7 +52,7 @@ public class ClanMainPage extends ClanPageBase public void buildNoClan() { // Clan Create - ShopItem clanCreate = new ShopItem(Material.BOOK_AND_QUILL, "Create Clan", new String[] {}, 1, false, false); + ShopItem clanCreate = new ShopItem(Material.BOOK_AND_QUILL, "Create Clan", new String[] {C.cGray + "To create a clan type", C.cRed + "/c create "}, 1, false, false); addButton(21, clanCreate, new ClanCreateButton()); // Clan Join diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java index ad18709cb..76c2cc1ba 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapManager.java @@ -10,10 +10,10 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; -import java.util.List; -import java.util.Map; import java.util.Map.Entry; +import mineplex.game.clans.tutorial.TutorialManager; +import mineplex.game.clans.tutorial.map.TutorialMapManager; import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -34,6 +34,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.map.MapRenderer; @@ -55,11 +56,11 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.portal.ServerTransferEvent; -import mineplex.core.timing.TimingManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansUtility; +import mineplex.game.clans.clans.map.events.PlayerGetMapEvent; import mineplex.game.clans.clans.worldevent.WorldEventManager; import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_8_R3.BlockPosition; @@ -83,13 +84,15 @@ public class ItemMapManager extends MiniPlugin private ArrayList> _scanList = new ArrayList>(); private World _world; private WorldEventManager _eventManager; + private TutorialManager _tutorial; - public ItemMapManager(ClansManager clansManager, WorldEventManager eventManager) + public ItemMapManager(ClansManager clansManager, TutorialManager tutorial, WorldEventManager eventManager) { super("ItemMapManager", clansManager.getPlugin()); _clansUtility = clansManager.getClanUtility(); _eventManager = eventManager; + _tutorial = tutorial; _comparator = new Comparator>() { @@ -244,7 +247,7 @@ public class ItemMapManager extends MiniPlugin view.removeRenderer(renderer); } - view.addRenderer(new ItemMapRenderer(this, _eventManager)); + view.addRenderer(new ItemMapRenderer(this, _eventManager, _tutorial)); } @EventHandler @@ -616,9 +619,25 @@ public class ItemMapManager extends MiniPlugin info.setInfo(1, calcMapCenter(zoom, loc.getBlockX()), calcMapCenter(zoom, loc.getBlockZ())); _mapInfo.put(player.getName(), info); - if (UtilInv.getItems(player).isEmpty()) +// if (UtilInv.getItems(player).isEmpty()) +// { +// setMap(player); +// } + } + + @EventHandler + public void onWorldChange(PlayerTeleportEvent event) + { + if (event.getFrom().getWorld() != event.getTo().getWorld() && event.getTo().getWorld().equals("world")) { - setMap(player); + runSyncLater(new Runnable() + { + @Override + public void run() + { + setMap(event.getPlayer()); + } + }, 20); } } @@ -745,6 +764,9 @@ public class ItemMapManager extends MiniPlugin { Collections.sort(_scanList, _comparator); } + + if (_scanList.isEmpty()) + return; Entry entry = _scanList.remove(0); @@ -866,6 +888,10 @@ public class ItemMapManager extends MiniPlugin public void setMap(Player player) { + PlayerGetMapEvent event = UtilServer.CallEvent(new PlayerGetMapEvent(player)); + if (event.isCancelled()) + return; + for (ItemStack item : UtilInv.getItems(player)) { if (item.getType() == Material.MAP && (item.getDurability() >= _mapId && item.getDurability() <= _mapId + 100)) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapRenderer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapRenderer.java index bf85c900d..746f48e7e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapRenderer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/map/ItemMapRenderer.java @@ -1,11 +1,18 @@ package mineplex.game.clans.clans.map; import java.awt.Color; +import java.util.List; import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClansUtility; import mineplex.game.clans.clans.worldevent.WorldEventManager; +import mineplex.game.clans.tutorial.TutorialManager; +import mineplex.game.clans.tutorial.TutorialRegion; +import mineplex.game.clans.tutorial.TutorialType; +import mineplex.game.clans.tutorial.map.TutorialMapManager; +import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; import mineplex.minecraft.game.core.boss.EventState; import mineplex.minecraft.game.core.boss.WorldEvent; @@ -22,18 +29,38 @@ import org.bukkit.map.MapView; public class ItemMapRenderer extends MapRenderer { private ItemMapManager _manager; + private TutorialManager _tutorial; private WorldEventManager _eventManager; - public ItemMapRenderer(ItemMapManager itemMapManager, WorldEventManager eventManager) + public ItemMapRenderer(ItemMapManager itemMapManager, WorldEventManager eventManager, TutorialManager tutorial) { super(true); _manager = itemMapManager; + _tutorial = tutorial; _eventManager = eventManager; } @Override public void render(MapView mapView, MapCanvas canvas, Player player) + { +// if (_tutorial.inTutorial(player)) +// { +// renderTutorialMap(mapView, canvas, player); +// } +// else +// { + renderNormalMap(mapView, canvas, player); +// } + } + + private void renderTutorialMap(MapView mapView, MapCanvas canvas, Player player) + { + + } + + + private void renderNormalMap(MapView mapView, MapCanvas canvas, Player player) { MapInfo info = _manager.getMap(player); @@ -87,7 +114,7 @@ public class ItemMapRenderer extends MapRenderer boolean colorAll = scale > 0; Color clanColor = null; Color clanColor2 = null; - + if (owningClan == clan) { clanColor = Color.CYAN; @@ -95,16 +122,16 @@ public class ItemMapRenderer extends MapRenderer else { ClansUtility.ClanRelation relation = _manager.getClansUtility().rel(clan, owningClan); - + if (owningClan.isAdmin()) { colorAll = false; - + if (owningClan.getName().equals("Shops")) { clanColor = Color.WHITE; clanColor2 = new Color(50, 150, 255); - + if (_manager.getClansUtility().relPT(player, chunk) == ClansUtility.ClanRelation.SAFE) clanColor2 = new Color(50, 150, 255); } @@ -157,25 +184,25 @@ public class ItemMapRenderer extends MapRenderer //Border if (colorAll || - ((chunkBX == 0 || zoom == 13) && - - owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 - 1) + "," + chunkZ1)) - - || ((chunkBZ == 0 || zoom == 13) && - - owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 - 1))) - - || ((chunkBX + zoom > 15 || zoom == 13) && - - owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 + 1) + "," + chunkZ1)) - - || ((chunkBZ + zoom > 15 || zoom == 13) && - - owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1)))) + ((chunkBX == 0 || zoom == 13) && + + owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 - 1) + "," + chunkZ1)) + + || ((chunkBZ == 0 || zoom == 13) && + + owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 - 1))) + + || ((chunkBX + zoom > 15 || zoom == 13) && + + owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 + 1) + "," + chunkZ1)) + + || ((chunkBZ + zoom > 15 || zoom == 13) && + + owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1)))) { Color cColor = MapPalette.getColor(color); double clans = colorAll ? 1 : 0.8;// 0.65; - + //Use clanColor2 no matter what for admins Color drawColor = clanColor; if (owningClan.isAdmin() && clanColor2 != null) @@ -183,16 +210,15 @@ public class ItemMapRenderer extends MapRenderer drawColor = clanColor2; clans = 1; } - + double base = 1 - clans; - + int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans)); int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans)); color = MapPalette.matchColor(r, g, b); } - //Inside @@ -201,7 +227,7 @@ public class ItemMapRenderer extends MapRenderer Color cColor = MapPalette.getColor(color); double clans = 0.065; - + //Stripes boolean checker = (mapX + (mapZ % 4)) % 4 == 0; Color drawColor = clanColor; @@ -210,7 +236,7 @@ public class ItemMapRenderer extends MapRenderer drawColor = clanColor2; clans = 1; } - + double base = 1 - clans; int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java index 806a00fa1..52c3dfeba 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java @@ -13,7 +13,6 @@ import mineplex.core.task.TaskManager; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansPlayerStats; import mineplex.game.clans.clans.playtime.command.PlayTimeCommand; -import mineplex.game.clans.clans.playtime.command.cemde; public class Playtime extends MiniClientPlugin { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/regions/ClansRegions.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/regions/ClansRegions.java index e129da1c8..ee09e4677 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/regions/ClansRegions.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/regions/ClansRegions.java @@ -42,7 +42,7 @@ public class ClansRegions extends MiniPlugin public final static int SPAWN_RADIUS = 3; // Radius of spawn claim area (measured in chunks) public final static int SHOP_RADIUS = 5; // Radius of shop claim area (measured in chunks) public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks) - public final static int BORDERLANDS_RADIUS = 50; // Radius of borderlands claim area (measured in chunks) + public final static int BORDERLANDS_RADIUS = 85; // Radius of borderlands claim area (measured in chunks) public static final int BORDER_RADIUS = 1319; private ClansManager _manager; @@ -69,7 +69,7 @@ public class ClansRegions extends MiniPlugin claimArea("Spawn", SPAWN_RADIUS, 0, false, true, new Location[] { Spawn.getNorthSpawn(), Spawn.getSouthSpawn() }); claimArea("Shops", 2, 0, true, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()}); - claimArea("Shops", SHOP_RADIUS, 2, false, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()}); + claimArea("Shops", SHOP_RADIUS, 3, false, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()}); // Initialize Fields and Borderlands factions and claims claimArea("Fields", FIELDS_RADIUS, 0, false, true, worldCenter); @@ -144,39 +144,8 @@ public class ClansRegions extends MiniPlugin { final ClanInfo clan = _manager.getClan(clanName); - // Only claim if the clan doesn't have claims. Speeds up startup time - if (clan == null || clan.getClaimSet().size() == 0) + if (clan == null) { - if (clan != null) - { - _manager.getClanDataAccess().delete(clan, status -> { - _manager.getClanDataAccess().create("ClansRegions", clanName, true, new Callback() - { - @Override - public void run(ClanInfo data) - { - if (data != null) - { - for (Location location : locations) - { - claimArea(data, location, chunkRadius, claimOffset, addNegative, safe); - log(String.format("Initialized %s faction territory and creation!", clanName)); - } - - debugClan(clanName); - } - else - { - System.out.println("Clans Regions error!"); - System.out.println("Seek out help!"); - } - } - }); - }); - - return; - } - _manager.getClanDataAccess().create("ClansRegions", clanName, true, new Callback() { @Override @@ -189,7 +158,7 @@ public class ClansRegions extends MiniPlugin claimArea(data, location, chunkRadius, claimOffset, addNegative, safe); log(String.format("Initialized %s faction territory and creation!", clanName)); } - + debugClan(clanName); } else @@ -200,6 +169,13 @@ public class ClansRegions extends MiniPlugin } }); } + else + { + for (Location location : locations) + { + claimArea(clan, location, chunkRadius, claimOffset, addNegative, safe); + } + } } /*private void claimArea(String clanName, int chunkRadius, int claimOffset, boolean safe, Location... locations) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java index f8dbbe9cb..6f2a19718 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java @@ -53,6 +53,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.event.ClansWaterPlaceEvent; +import mineplex.game.clans.clans.event.IronDoorOpenEvent; import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent; import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent; import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock; @@ -561,6 +562,22 @@ public class Outpost implements Listener _ownerClan.inform("Your Clan's Outpost has been destroyed.", null); } + @EventHandler + public void doorOpen(IronDoorOpenEvent event) + { + if (!UtilAlg.inBoundingBox(event.getBlock().getLocation(), _startCorner.clone().subtract(.5, 0, .5), _endCorner)) + { + return; + } + + if (_ownerClan.isMember(event.getPlayer())) + { + return; + } + + event.setCancelled(true); + } + @EventHandler public void onSiegeWeaponExplode(SiegeWeaponExplodeEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java index 11520d2dc..ba9089851 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java @@ -162,15 +162,16 @@ public abstract class SiegeWeapon implements Listener _infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth()); _infoHologram.start(); -// _infoHologram.setInteraction((player, type) -> { -// if (player.equals(_rider)) -// { -// if (type.equals(ClickType.LEFT)) -// { -// handleLeftClick(player); -// } -// } -// }); + _infoHologram.setInteraction((player, type) -> { + if (type.equals(ClickType.LEFT)) + { + handleLeftClick(player); + } + else if (type.equals(ClickType.RIGHT)) + { + handleRightClick(player); + } + }); UtilServer.RegisterEvents(this); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGeneratorManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGeneratorManager.java index 22a370533..cf57f77d1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGeneratorManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGeneratorManager.java @@ -12,7 +12,7 @@ import mineplex.game.clans.clans.ClansManager; public class TntGeneratorManager extends MiniPlugin { - public static final int SECONDS_PER_TNT = 30;//60 * 60 * 10; // 10 Hours + public static final int SECONDS_PER_TNT = 60 * 60 * 12; // 12 Hours public static final int MAX_GENERATOR_STOCK = 3; private ClansManager _clansManager; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/warpoints/WarPointEvasion.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/warpoints/WarPointEvasion.java index e3f066e3c..dee5e2ac6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/warpoints/WarPointEvasion.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/warpoints/WarPointEvasion.java @@ -3,8 +3,6 @@ package mineplex.game.clans.clans.warpoints; import com.google.common.collect.Maps; import mineplex.core.MiniPlugin; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -12,75 +10,102 @@ import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.event.*; import org.bukkit.Bukkit; import org.bukkit.Chunk; -import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; import java.util.HashMap; +import java.util.Iterator; import java.util.UUID; -public class WarPointEvasion extends MiniPlugin{ +public class WarPointEvasion extends MiniPlugin +{ private HashMap _chunkCooldown; private HashMap _playerCooldown; private final long COOLDOWN_TIME = 1000 * 60 * 10; - public WarPointEvasion(JavaPlugin plugin) { + public WarPointEvasion(JavaPlugin plugin) + { super("WP Evasion", plugin); + _chunkCooldown = Maps.newHashMap(); _playerCooldown = Maps.newHashMap(); } @EventHandler - public void updateCooldown(UpdateEvent event) { + public void updateCooldown(UpdateEvent event) + { if(!event.getType().equals(UpdateType.SEC)) return; - _chunkCooldown.keySet().stream().filter(chunk -> UtilTime.elapsed(_chunkCooldown.get(chunk), COOLDOWN_TIME)).forEach(chunk -> _chunkCooldown.remove(chunk)); + for (Iterator chunkIterator = _chunkCooldown.keySet().iterator(); chunkIterator.hasNext();) + { + Chunk chunk = chunkIterator.next(); + + if (UtilTime.elapsed(_chunkCooldown.get(chunk), COOLDOWN_TIME)) + chunkIterator.remove(); + } - _playerCooldown.keySet().stream().filter(player -> UtilTime.elapsed(_playerCooldown.get(player), COOLDOWN_TIME)).forEach(player -> { - _playerCooldown.remove(player); - if(Bukkit.getOfflinePlayer(player).isOnline()) { - if(ClansManager.getInstance().getClan(Bukkit.getPlayer(player)) == null) { - Bukkit.getPlayer(player).sendMessage(F.main("Clans", "You can now create a clan.")); + + for (Iterator uuidIterator = _playerCooldown.keySet().iterator(); uuidIterator.hasNext();) + { + UUID uuid = uuidIterator.next(); + + if (UtilTime.elapsed(_playerCooldown.get(uuid), COOLDOWN_TIME)) + { + uuidIterator.remove(); + + Player player = Bukkit.getPlayer(uuid); + if (player.isOnline()) + { + if(ClansManager.getInstance().getClan(player) == null) + { + player.sendMessage(F.main("Clans", "You can now create a clan.")); + } } - } - }); + } + } } @EventHandler - public void onClaim(PlayerPreClaimTerritoryEvent event) { + public void onClaim(PlayerPreClaimTerritoryEvent event) + { Chunk chunk = event.getClaimedChunk(); - if(_chunkCooldown.containsKey(chunk)) { + + if(_chunkCooldown.containsKey(chunk)) + { event.setCancelled(true); event.getClaimer().sendMessage(F.main("Clans", "You cannot claim this chunk for another " + UtilTime.convertString(COOLDOWN_TIME - (System.currentTimeMillis() - _chunkCooldown.get(chunk)), 1, UtilTime.TimeUnit.MINUTES))); } } @EventHandler - public void onunClaim(PlayerUnClaimTerritoryEvent event) { - Chunk chunk = event.getUnClaimedChunk(); - _chunkCooldown.put(chunk, System.currentTimeMillis()); - + public void onunClaim(PlayerUnClaimTerritoryEvent event) + { + _chunkCooldown.put(event.getUnClaimedChunk(), System.currentTimeMillis()); } @EventHandler - public void onClanDisband(ClanDisbandedEvent event) { + public void onClanDisband(ClanDisbandedEvent event) + { _playerCooldown.put(event.getDisbander().getUniqueId(), System.currentTimeMillis()); } @EventHandler - public void onClanLeave(ClanLeaveEvent event) { + public void onClanLeave(ClanLeaveEvent event) + { _playerCooldown.put(event.getPlayer().getUuid(), System.currentTimeMillis()); } @EventHandler - public void onClanCreate(ClanCreatedEvent event) { + public void onClanCreate(ClanCreatedEvent event) + { if (event.getFounder() == null) return; - if (_playerCooldown.containsKey(event.getFounder().getUniqueId())) { + if (_playerCooldown.containsKey(event.getFounder().getUniqueId())) + { event.setCancelled(true); event.getFounder().sendMessage(F.main("Clans", "You cannot create a clan for another " + UtilTime.convertString(COOLDOWN_TIME - (System.currentTimeMillis() - _playerCooldown.get(event.getFounder().getUniqueId())), 1, UtilTime.TimeUnit.MINUTES))); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java index 6d08c9e19..6b14c395f 100755 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java @@ -6,14 +6,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import mineplex.core.common.util.*; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; import mineplex.core.scoreboard.ScoreboardManager; import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClansManager; @@ -184,4 +181,15 @@ public class KingHill extends WorldEvent { public int TicksOnHill; } + + @Override + public void announceStart() + { + for(Player player : UtilServer.getPlayers()) { + if(_clansManager.getTutorial().inTutorial(player)) continue; + + UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40, player); + player.sendMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation())))); + } + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java index a3a746469..6ccc12bfa 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java @@ -4,22 +4,18 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import mineplex.core.common.util.*; import mineplex.game.clans.clans.ClansManager; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerInteractEvent; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilWorld; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -509,4 +505,16 @@ public class UndeadCamp extends WorldEvent } } } + + + @Override + public void announceStart() + { + for(Player player : UtilServer.getPlayers()) { + if(ClansManager.getInstance().getTutorial().inTutorial(player)) continue; + + UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40, player); + player.sendMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation())))); + } + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldManager.java index a7649a2fa..96cbf228b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/economy/GoldManager.java @@ -217,7 +217,9 @@ public class GoldManager extends MiniPlugin public void deductGold(Callback resultCallback, Player player, int amount) { - if (amount >= 0) + if (amount == 0) + resultCallback.run(true); + if (amount > 0) _donationManager.rewardGold(resultCallback, "GoldManager", player, -amount); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java index 8d1490ccf..5a212665d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/Gameplay.java @@ -54,6 +54,7 @@ import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -67,6 +68,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.event.ClansWaterPlaceEvent; +import mineplex.game.clans.clans.event.IronDoorOpenEvent; import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.minecraft.game.classcombat.Class.ClientClass; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; @@ -246,11 +248,6 @@ public class Gameplay extends MiniPlugin @EventHandler(priority = EventPriority.LOWEST) public void ObsidianCancel(BlockPlaceEvent event) { - if (_clansManager.masterBypass(event.getPlayer())) - { - return; - } - if (event.getBlock().getType() == Material.OBSIDIAN) { UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Obsidian") + ".")); @@ -436,7 +433,7 @@ public class Gameplay extends MiniPlugin { return; } - + Block block = event.getClickedBlock(); // Knock @@ -453,6 +450,13 @@ public class Gameplay extends MiniPlugin // Open else { + IronDoorOpenEvent customEvent = UtilServer.CallEvent(new IronDoorOpenEvent(event.getPlayer(), block)); + + if (customEvent.isCancelled()) + { + return; + } + if (block.getData() >= 8) block = block.getRelative(BlockFace.DOWN); if (block.getData() < 4) @@ -587,46 +591,50 @@ public class Gameplay extends MiniPlugin } } -// @EventHandler(priority = EventPriority.LOWEST) -// public void replantTree(BlockBreakEvent event) -// { -// final Block block = event.getBlock(); -// -// if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null) -// { -// return; -// } -// -// if (!UtilItem.isLog(block.getType())) -// { -// return; -// } -// -// if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType())) -// { -// return; -// } -// -// if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType())) -// { -// return; -// } -// -// if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS) -// { -// return; -// } -// -// final byte data = block.getData(); -// -// UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { -// public void run() -// { -// block.setType(Material.SAPLING); -// block.setData(data); -// } -// }, 20 * 5); -// } + @EventHandler(priority = EventPriority.LOWEST) + public void replantTree(BlockBreakEvent event) + { + final Block block = event.getBlock(); + + if (_clansManager.getClanUtility().getClaim(block.getLocation()) != null) + { + return; + } + + if (!UtilItem.isLog(block.getType())) + { + return; + } + + if (UtilItem.isLog(block.getRelative(BlockFace.DOWN).getType())) + { + return; + } + + if (UtilItem.isLeaf(block.getRelative(BlockFace.DOWN).getType())) + { + return; + } + + if (block.getRelative(BlockFace.DOWN).getType() != Material.DIRT && block.getRelative(BlockFace.DOWN).getType() != Material.GRASS) + { + return; + } + + final byte data = block.getData(); + + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { + public void run() + { + Material mat = block.getRelative(BlockFace.DOWN).getType(); + if (mat == Material.DIRT || mat == Material.GRASS) + { + block.setType(Material.SAPLING); + block.setData(data); + } + } + }, 20 * 10); + } @EventHandler public void killRain(WeatherChangeEvent event) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java index aa7bbf777..071aebc74 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java @@ -364,6 +364,8 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable attribute = sampleAttribute; // Select valid attribute to // add } + + attempts++; } container.addAttribute(attribute); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpItem.java index 1dd6c2183..a62f2ad89 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpItem.java @@ -29,7 +29,7 @@ public class PvpItem extends ShopItem super(type, data, name, new String[] { C.cWhite + " ", LEFT_CLICK_BUY, - C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free" : buyPrice + "g"), + C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free (Tutorial)" : buyPrice + "g"), C.cWhite + " ", UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount, UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ", diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/ShopItemButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/ShopItemButton.java index 5b879737a..9ea38cf70 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/ShopItemButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/ShopItemButton.java @@ -133,6 +133,8 @@ public class ShopItemButton> implements IButton GoldManager.notify(player, "You cannot afford that item! Please relog to update your gold count."); _page.playDenySound(player); } + + _page.refresh(); } }, player, cost); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyShopButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyShopButton.java index cd548e9fe..fb2550d38 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyShopButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyShopButton.java @@ -1,22 +1,16 @@ package mineplex.game.clans.shop.energy; -import org.bukkit.Bukkit; -import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import mineplex.core.common.CurrencyType; -import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilTime; -import mineplex.core.donation.DonationManager; -import mineplex.core.energy.Energy; -import mineplex.core.shop.ShopBase; +import mineplex.core.common.util.UtilServer; import mineplex.core.shop.item.IButton; import mineplex.core.shop.page.ConfirmationPage; import mineplex.game.clans.clans.ClanEnergyManager; import mineplex.game.clans.clans.ClanInfo; -import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.event.PreEnergyShopBuyEvent; public class EnergyShopButton implements IButton { @@ -38,6 +32,11 @@ public class EnergyShopButton implements IButton @Override public void onClick(final Player player, ClickType clickType) { + if (UtilServer.CallEvent(new PreEnergyShopBuyEvent(player, _energyToPurchase, _cost)).isCancelled()) + { + return; + } + _page.getShop().openPageForPlayer(player, new ConfirmationPage( _page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable() { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java index 433c4f1bf..aa44d5d2f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/Spawn.java @@ -281,10 +281,7 @@ public class Spawn extends MiniPlugin event.setRespawnLocation(getSpawnLocation()); } - /** - * Ensure player spawns into a Spawn location if it's their first time on the server. - * @param event - */ + /* @EventHandler public void onPlayerFirstJoin(PlayerJoinEvent event) { @@ -293,6 +290,7 @@ public class Spawn extends MiniPlugin teleport(event.getPlayer(), getSpawnLocation(), 2); // Teleport player to spawn after 2-tick delay to prevent on-join bug } } + */ /** * Prevent creatures from spawning inside Spawn @@ -493,7 +491,7 @@ public class Spawn extends MiniPlugin return _clansManager.getCondition().HasCondition(player, ConditionType.CUSTOM, COMBAT_TAG_NAME); } - private void teleport(final Player player, final Location location, int delay) + public void teleport(final Player player, final Location location, int delay) { Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() { @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelButton.java index 27e0e51b0..6e6dc9b87 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelButton.java @@ -58,6 +58,11 @@ public class TravelButton implements IButton return; } + if (_location == null) + { + return; + } + if (player.getLocation().distance(_location) <= 64) { return; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java index c90d27172..6140d1ad2 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/spawn/travel/TravelPage.java @@ -12,7 +12,6 @@ import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemBuilder; @@ -23,6 +22,8 @@ import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClanRole; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.gui.ClanIcon; +import mineplex.game.clans.clans.siege.outpost.Outpost; +import mineplex.game.clans.shop.ClansShopItem; import mineplex.game.clans.spawn.Spawn; public class TravelPage extends ShopPageBase @@ -37,7 +38,7 @@ public class TravelPage extends ShopPageBase @Override protected void buildPage() { - addTravelLocation(Spawn.getNorthSpawn(), getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "East Spawn", new String[] { + addTravelLocation(Spawn.getNorthSpawn(), getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "North Spawn", new String[] { C.cWhite + "Spawns are locations where", C.cWhite + "you respawn after dying.", " ", @@ -45,9 +46,9 @@ public class TravelPage extends ShopPageBase C.cWhite + "as they are Safe Zones.", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "", getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? C.cRed + "You are already here." : "", - }, 14 + 10, getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? (byte) 3 : (byte) 0); + }, 4, getPlayer().getLocation().distance(Spawn.getNorthSpawn()) <= 64 ? (byte) 3 : (byte) 0); - addTravelLocation(Spawn.getSouthSpawn(), getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "West Spawn", new String[] { + addTravelLocation(Spawn.getSouthSpawn(), getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, (getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRedB : C.cGreenB) + "South Spawn", new String[] { C.cWhite + "Spawns are locations where", C.cWhite + "you respawn after dying.", " ", @@ -55,27 +56,36 @@ public class TravelPage extends ShopPageBase C.cWhite + "as they are Safe Zones.", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? " " : "", getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? C.cRed + "You are already here." : "", - }, 12 + 8, getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? (byte) 3 : (byte) 0); + }, 22 + 9 + 9, getPlayer().getLocation().distance(Spawn.getSouthSpawn()) <= 64 ? (byte) 3 : (byte) 0); - addTravelLocation(Spawn.getWestTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "North Shop", new String[] { + addTravelLocation(Spawn.getWestTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "West Shop", new String[] { C.cWhite + "Shops are locations where you", C.cWhite + "can buy and sell all sorts of goods.", " ", C.cWhite + "You cannot be attacked here,", C.cWhite + "as they are Safe Zones.", - }, 4, ClanIcon.CASTLE.getData()); + }, 12 + 8, ClanIcon.CASTLE.getData()); - addTravelLocation(Spawn.getEastTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "South Shop", new String[] { + addTravelLocation(Spawn.getEastTown(), ClanIcon.CASTLE.getMaterial(), C.cDGreenB + "East Shop", new String[] { C.cWhite + "Shops are locations where you", C.cWhite + "can buy and sell all sorts of goods.", " ", C.cWhite + "You cannot be attacked here,", C.cWhite + "as they are Safe Zones.", - }, 22 + 9 + 9, ClanIcon.CASTLE.getData()); + }, 14 + 10, ClanIcon.CASTLE.getData()); + + final ClanInfo clan = _plugin.getClan(getPlayer()); + Outpost outpost = _plugin.getSiegeManager().getOutpostManager().Get(clan); + + addTravelLocation(outpost == null ? null : outpost.getCoreLocation().clone().add(0, 1, 0), ClansShopItem.OUTPOST.getMaterial(), (outpost == null ? C.cRedB : C.cDGreenB) + "Outpost", new String[] { + C.cWhite + "Teleport to your Clan's currently", + C.cWhite + "active Outpost.", + " ", + (outpost == null ? C.cRed + "Your Clan does not have an Outpost." : ""), + }, 8, ClanIcon.CASTLE.getData()); - final ClanInfo clan = getPlugin().getClan(getPlayer()); final ItemStack item = new ItemStack(Material.BED, 1); ItemMeta meta = item.getItemMeta(); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java index 92decfb05..954db2c0d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/FinishCommand.java @@ -10,7 +10,7 @@ public class FinishCommand extends CommandBase { public FinishCommand(TutorialManager plugin) { - super(plugin, Rank.DEVELOPER, "finish", "end"); + super(plugin, Rank.JNR_DEV, "finish", "end"); } @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java index cf38bd009..c9722a1bf 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/command/TutorialCommand.java @@ -13,7 +13,7 @@ public class TutorialCommand extends MultiCommandBase { public TutorialCommand(TutorialManager plugin) { - super(plugin, Rank.DEVELOPER, "tutorial", "tut"); + super(plugin, Rank.JNR_DEV, "tutorial", "tut"); AddCommand(new StartCommand(plugin)); AddCommand(new FinishCommand(plugin)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/LeaveSpawnObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/LeaveSpawnObjective.java deleted file mode 100644 index c4b9c494a..000000000 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/LeaveSpawnObjective.java +++ /dev/null @@ -1,48 +0,0 @@ -package mineplex.game.clans.tutorial.tutorials.clans.objective; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.java.JavaPlugin; - -import mineplex.core.common.objective.SingleObjective; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial; - -public class LeaveSpawnObjective extends SingleObjective -{ - public LeaveSpawnObjective(ClansMainTutorial plugin, JavaPlugin javaPlugin) - { - super(plugin, javaPlugin, "Leave Spawn", "Exit the tutorial spawn area"); - } - - @Override - protected void customStart(Player player) - { - } - - @Override - protected void customLeave(Player player) - { - } - - @Override - protected void customFinish(Player player) - { - } - - @EventHandler - public void checkRegion(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player player : getActivePlayers()) - { - if (!getPlugin().isInSpawn(player)) - { - finish(player); - } - } - } -} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/BlowUpWallGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/BlowUpWallGoal.java index ad7be8c42..23488e15a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/BlowUpWallGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/BlowUpWallGoal.java @@ -101,16 +101,16 @@ public class BlowUpWallGoal extends ObjectiveGoal FallingBlocks.Instance.Spawn(block.getLocation(), block.getType(), block.getData(), center); } }); - + + event.setCancelled(true); finish(shooter); } else { UtilPlayer.message(shooter, F.main("Clans", "You missed! Try to hit the enemy's front wall, that should make a nice big hole!")); UtilInv.give(shooter, Material.TNT); + event.setCancelled(true); } - - event.setCancelled(true); } @Override diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index e87cd18d4..b663e7f1d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -143,8 +143,8 @@ public class Hub extends JavaPlugin implements IRelation IncognitoManager incognito = new IncognitoManager(this, clientManager, packetHandler); new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager); - Chat chat = new Chat(this, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); - new MessageManager(this, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); + Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); + new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); new MemoryFix(this); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new CustomTagFix(this, packetHandler); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 985e8c5f3..da9d102aa 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -9,8 +9,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Random; -import mineplex.core.reward.RewardManager; -import mineplex.core.valentines.ValentinesGiftManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -74,8 +72,8 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.HologramManager; +import mineplex.core.incognito.events.IncognitoHidePlayerEvent; import mineplex.core.inventory.InventoryManager; import mineplex.core.message.PrivateMessageEvent; import mineplex.core.mount.MountManager; @@ -97,12 +95,14 @@ import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; +import mineplex.core.reward.RewardManager; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; import mineplex.core.task.TaskManager; import mineplex.core.treasure.TreasureManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.valentines.ValentinesGiftManager; import mineplex.hub.commands.DisguiseCommand; import mineplex.hub.commands.ForcefieldRadius; import mineplex.hub.commands.GadgetToggle; @@ -574,6 +574,15 @@ public class HubManager extends MiniClientPlugin event.setCancelled(true); } } + + @EventHandler + public void Incog(IncognitoHidePlayerEvent event) + { + if (!_clientManager.hasRank(event.getPlayer(), Rank.ADMIN)) + { + event.setCancelled(true); + } + } @EventHandler public void PlayerChat(AsyncPlayerChatEvent event) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index d6a21481f..66d8f06a4 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -1,5 +1,7 @@ package mineplex.hub.server; +import java.sql.ResultSet; +import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -26,7 +28,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; -import mineplex.core.MiniPlugin; +import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -48,10 +50,10 @@ import mineplex.core.shop.ShopBase; import mineplex.core.status.ServerStatusManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.core.repository.tokens.SimpleClanToken; import mineplex.hub.HubManager; import mineplex.hub.modules.StackerManager; import mineplex.hub.queue.QueueManager; -import mineplex.hub.queue.ui.QueueShop; import mineplex.hub.server.ui.LobbyShop; import mineplex.hub.server.ui.QuickShop; import mineplex.hub.server.ui.ServerCountSorter; @@ -61,7 +63,7 @@ import mineplex.serverdata.Region; import mineplex.serverdata.data.MinecraftServer; import mineplex.serverdata.data.ServerGroup; -public class ServerManager extends MiniPlugin +public class ServerManager extends MiniDbClientPlugin { private static final Long FREE_PORTAL_TIMER = 20000L; private static final Long BETA_PORTAL_TIMER = 120000L; @@ -77,8 +79,6 @@ public class ServerManager extends MiniPlugin private PartyManager _partyManager; private ServerStatusManager _statusManager; private HubManager _hubManager; - private StackerManager _stackerManager; - private QueueManager _queueManager; private NautHashMap _queueCooldowns = new NautHashMap(); private NautHashMap> _serverKeyInfoMap = new NautHashMap>(); @@ -93,7 +93,6 @@ public class ServerManager extends MiniPlugin // Join Time for Free Players Timer private NautHashMap _joinTime = new NautHashMap(); - private QueueShop _domShop; private QuickShop _quickShop; private LobbyShop _lobbyShop; @@ -103,7 +102,7 @@ public class ServerManager extends MiniPlugin public ServerManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Portal portal, PartyManager partyManager, ServerStatusManager statusManager, HubManager hubManager, StackerManager stackerManager, QueueManager queueManager) { - super("Server Manager", plugin); + super("Server Manager", plugin, clientManager); _clientManager = clientManager; _donationManager = donationManager; @@ -111,8 +110,6 @@ public class ServerManager extends MiniPlugin _partyManager = partyManager; _statusManager = statusManager; _hubManager = hubManager; - _stackerManager = stackerManager; - _queueManager = queueManager; plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord"); @@ -120,7 +117,6 @@ public class ServerManager extends MiniPlugin _quickShop = new QuickShop(this, clientManager, donationManager, "Quick Menu"); _lobbyShop = new LobbyShop(this, clientManager, donationManager, "Lobby Menu"); - //_domShop = new new QueueShop(_queueManager, clientManager, donationManager, "Dominate"); // TODO: Find more appropriate place to initialize Clans server shop? _clansShop = new ClansServerShop(this, _clientManager, _donationManager); @@ -918,4 +914,33 @@ public class ServerManager extends MiniPlugin { return _serverNpcShopMap.get("Valentines Vendetta"); } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT clans.name, accountClan.clanRole, clanServer.serverName, clans.id FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId INNER JOIN clanServer ON clans.serverId = clanServer.id WHERE accountClan.accountId = " + accountId + ";"; + } + + @Override + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + SimpleClanToken clanToken = new SimpleClanToken(); + + while (resultSet.next()) + { + String clanName = resultSet.getString(1); + String clanRole = resultSet.getString(2); + String homeServer = resultSet.getString(3); + int clanId = resultSet.getInt(4); + clanToken = new SimpleClanToken(clanName, clanRole, homeServer, clanId); + } + + Set(playerName, clanToken); + } + + @Override + protected SimpleClanToken AddPlayer(String player) + { + return new SimpleClanToken(); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerSorter.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerSorter.java index ac874017c..325ae80c6 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerSorter.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerSorter.java @@ -52,6 +52,14 @@ public class ServerSorter implements Comparator } } + if (a.Name.contains("Clans") && b.Name.contains("Clans")) + { + if (Integer.parseInt(a.Name.split("-")[1]) < Integer.parseInt(b.Name.split("-")[1])) + return -1; + else if (Integer.parseInt(a.Name.split("-")[1]) > Integer.parseInt(b.Name.split("-")[1])) + return 1; + } + if (a.MaxPlayers - a.CurrentPlayers < _requiredSlots && b.MaxPlayers - b.CurrentPlayers >= _requiredSlots) return -1; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 246b93fc2..20764ef6b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -272,9 +272,9 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "the games you want, when you want.", }).setHideInfo(true).build(), new SelectPLAYERButton(this)); - addButton(40, new ItemBuilder(Material.IRON_DOOR).setTitle(C.cYellowB + "Mineplex Clans " + C.cGray + "Champions Teams").addLore(new String[] + addButton(40, new ItemBuilder(Material.IRON_DOOR).setTitle(C.cYellowB + "Mineplex Clans " + C.cGray + "Factions PvP").addLore(new String[] { - (_extraValue ? C.cAquaB : C.cWhiteB) + "ALPHA RELEASE", + (_extraValue ? C.cAquaB : C.cWhiteB) + "BETA RELEASE", C.Reset + "", C.Reset + "Equip custom skills and builds", C.Reset + "and join your clan to destroy", diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClanMoveServerShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClanMoveServerShop.java index d8fb30e91..e85528ee8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClanMoveServerShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClanMoveServerShop.java @@ -4,7 +4,6 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.donation.DonationManager; import mineplex.core.party.Party; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerPage.java index 137fa6322..fe5ceaeea 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerPage.java @@ -1,6 +1,8 @@ package mineplex.hub.server.ui.clans; import java.util.Collection; +import java.util.Comparator; +import java.util.TreeSet; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -10,6 +12,7 @@ import org.bukkit.event.inventory.ClickType; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilAlg; import mineplex.core.donation.DonationManager; import mineplex.core.shop.item.DisplayButton; import mineplex.core.shop.item.IButton; @@ -24,18 +27,10 @@ import mineplex.serverdata.data.DataRepository; public class ClansServerPage extends ShopPageBase { - - //private DataRepository _repository; // Stores the name of the last Clans server a player was on - private ClanRepository _repository; - private int _accountId; - public ClansServerPage(ServerManager plugin, ClansServerShop shop, CoreClientManager clientManager, - DonationManager donationManager, Player player, ClanRepository repository) + DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Clans Alpha", player, 27); - - _repository = repository; - _accountId = clientManager.getAccountId(player); + super(plugin, shop, clientManager, donationManager, "Clans Beta", player, 54); buildPage(); } @@ -43,21 +38,14 @@ public class ClansServerPage extends ShopPageBase() - { - @Override - public void run(SimpleClanToken data) - { - if (data != null) - { - buildClanPage(data); - } - else - { - buildNoClanPage(); - } - } - }); + if (!getPlugin().Get(_player).getClanName().isEmpty()) + { + buildClanPage(getPlugin().Get(_player)); + } + else + { + buildNoClanPage(); + } } private void buildClanPage(SimpleClanToken clan) @@ -72,7 +60,14 @@ public class ClansServerPage extends ShopPageBase servers = getPlugin().getServerList("Clans"); + Collection servers = UtilAlg.sortSet(getPlugin().getServerList("Clans"), new Comparator() + { + @Override + public int compare(ServerInfo o1, ServerInfo o2) + { + return o1.Name.compareTo(o2.Name); + } + }); int currentSlot = 9; for (ServerInfo server : servers) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java index a3241e2cc..f5590b095 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/clans/ClansServerShop.java @@ -2,29 +2,23 @@ package mineplex.hub.server.ui.clans; import org.bukkit.Sound; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.donation.DonationManager; import mineplex.core.party.Party; import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; import mineplex.game.clans.core.repository.ClanRepository; -import mineplex.game.clans.core.repository.tokens.SimpleClanToken; import mineplex.hub.server.ServerManager; public class ClansServerShop extends ShopBase { - private ClanRepository _repository; public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager) { - super(plugin, clientManager, donationManager, "Clans Alpha"); + super(plugin, clientManager, donationManager, "Clans Beta"); _repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName()); } @@ -32,7 +26,7 @@ public class ClansServerShop extends ShopBase @Override protected ShopPageBase> buildPagesFor(Player player) { - return new ClansServerPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _repository); + return new ClansServerPage(getPlugin(), this, getClientManager(), getDonationManager(), player); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java index cde190a34..c25d056b8 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -70,6 +70,7 @@ public class BlockToss extends SkillCharge implements IThrown Material.STONE_BUTTON, Material.WOOD_BUTTON, Material.LEVER, + Material.BARRIER, }; public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/WorldEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/WorldEvent.java index 3781f2a5b..f1cd8424b 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/WorldEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/WorldEvent.java @@ -263,12 +263,12 @@ public abstract class WorldEvent implements Listener, ScoreboardElement HandlerList.unregisterAll(creature); _creatures.remove(creature); } - + public void announceStart() { UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40); - - Bukkit.broadcastMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation())))); + + UtilServer.broadcast(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation())))); } public void clearCreatures() diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java index 74e3f7473..718434d95 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java @@ -379,7 +379,7 @@ public class ConditionEffect implements Listener Manager.getDamagerManager().NewDamageEvent(ent, condition.GetSource(), null, DamageCause.CUSTOM, 0.1, false, true, false, - condition.GetSource().getName(), "Poison"); + condition.GetSource() != null ? condition.GetSource().getName() : "The Mighty Defek7", "Poison"); } } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java index f69fabe62..acc786379 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/DBPool.java @@ -24,13 +24,14 @@ public final class DBPool BasicDataSource source = new BasicDataSource(); source.addConnectionProperty("autoReconnect", "true"); source.addConnectionProperty("allowMultiQueries", "true"); + source.addConnectionProperty("zeroDateTimeBehavior", "convertToNull"); source.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); source.setDriverClassName("com.mysql.jdbc.Driver"); source.setUrl(url); source.setUsername(username); source.setPassword(password); - source.setMaxTotal(3); - source.setMaxIdle(3); + source.setMaxTotal(4); + source.setMaxIdle(4); source.setTimeBetweenEvictionRunsMillis(180 * 1000); source.setSoftMinEvictableIdleTimeMillis(180 * 1000); diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/RepositoryBase.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/RepositoryBase.java index e4b2d688c..28650bc01 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/RepositoryBase.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/database/RepositoryBase.java @@ -143,7 +143,7 @@ public abstract class RepositoryBase } protected void executeQuery(String query, ResultSetCallable callable, Column...columns) - { + { // Automatic resource management for handling/closing objects. try ( Connection connection = getConnection(); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index cdb02169a..33e1eb2d5 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -2,6 +2,12 @@ package mineplex.staffServer; import java.util.UUID; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.plugin.java.JavaPlugin; + +import com.mojang.authlib.GameProfile; + import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; @@ -9,6 +15,7 @@ import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; import mineplex.core.creature.Creature; import mineplex.core.donation.DonationManager; +import mineplex.core.incognito.IncognitoManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.memory.MemoryFix; import mineplex.core.monitor.LagMeter; @@ -26,12 +33,6 @@ import mineplex.staffServer.customerSupport.CustomerSupport; import mineplex.staffServer.salespackage.SalesPackageManager; import net.minecraft.server.v1_8_R3.MinecraftServer; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.plugin.java.JavaPlugin; - -import com.mojang.authlib.GameProfile; - public class StaffServer extends JavaPlugin { private String WEB_CONFIG = "webServer"; @@ -60,7 +61,7 @@ public class StaffServer extends JavaPlugin preferenceManager.GiveItem = false; Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName()); - new Chat(this, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager), serverStatusManager.getCurrentServerName()); + new Chat(this, null, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager), serverStatusManager.getCurrentServerName()); new MemoryFix(this); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 58e91b517..85502fd37 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -1,6 +1,10 @@ package mineplex.staffServer.customerSupport; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClient; @@ -13,6 +17,7 @@ import mineplex.core.donation.DonationManager; import mineplex.core.donation.Donor; import mineplex.core.donation.repository.token.CoinTransactionToken; import mineplex.core.donation.repository.token.TransactionToken; +import mineplex.serverdata.database.ResultSetCallable; import mineplex.staffServer.salespackage.SalesPackageManager; import org.bukkit.GameMode; @@ -27,13 +32,15 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -public class CustomerSupport extends MiniPlugin +public class CustomerSupport extends MiniPlugin implements ResultSetCallable { private CoreClientManager _clientManager; private DonationManager _donationManager; private SalesPackageManager _salesPackageManager; + private CustomerSupportRepository _repository; private NautHashMap> _agentCacheMap = new NautHashMap>(); + private NautHashMap> _accountBonusLog = new NautHashMap<>(); public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager) { @@ -42,6 +49,7 @@ public class CustomerSupport extends MiniPlugin _clientManager = clientManager; _donationManager = donationManager; _salesPackageManager = salesPackageManager; + _repository = new CustomerSupportRepository(getPlugin()); } @EventHandler @@ -94,98 +102,124 @@ public class CustomerSupport extends MiniPlugin { CoreClient client = _clientManager.Get(playerName); Donor donor = _donationManager.Get(playerName); + CustomerSupport instance = this; - caller.sendMessage(C.cDGreen + C.Strike + "============================================="); - caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName); - caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name))); - caller.sendMessage(C.cBlue + "Coins : " + C.cYellow + donor.getCoins()); - caller.sendMessage(C.cBlue + "Gems : " + C.cYellow + donor.GetGems()); - - int enjinCoinsReceived = 0; - int oldChestsReceived = 0; - int ancientChestsReceived = 0; - int mythicalChestsReceived = 0; - int winterChestsReceived = 0; - int valentinesGiftsReceived = 0; - - for (CoinTransactionToken transaction : donor.getCoinTransactions()) + runAsync(new Runnable() { - if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Halloween Pumpkin") || transaction.Source.equalsIgnoreCase("Treasure Chest") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward") || transaction.Source.contains("purchase")) + public void run() { - if (transaction.Source.contains("purchase")) - enjinCoinsReceived += transaction.Amount; - } - } + _repository.loadBonusLogForAccountId(client.getAccountId(), instance); + + runSync(new Runnable() + { + public void run() + { + caller.sendMessage(C.cDGreen + C.Strike + "============================================="); + caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName); + caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name))); + caller.sendMessage(C.cBlue + "Coins : " + C.cYellow + donor.getCoins()); + caller.sendMessage(C.cBlue + "Gems : " + C.cYellow + donor.GetGems()); - for (TransactionToken transaction : donor.getTransactions()) - { - if (transaction.SalesPackageName.startsWith("Old Chest")) - { - if (transaction.Coins == 0 && transaction.Gems == 0) - { - if (transaction.SalesPackageName.split(" ").length == 3) - oldChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); - else if (transaction.SalesPackageName.split(" ").length == 2) - oldChestsReceived += 1; - } - - } - if (transaction.SalesPackageName.startsWith("Ancient Chest")) - { - if (transaction.Coins == 0 && transaction.Gems == 0) - { - if (transaction.SalesPackageName.split(" ").length == 3) - ancientChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); - else if (transaction.SalesPackageName.split(" ").length == 2) - ancientChestsReceived += 1; - } - - } - if (transaction.SalesPackageName.startsWith("Mythical Chest")) - { - if (transaction.Coins == 0 && transaction.Gems == 0) - { - if (transaction.SalesPackageName.split(" ").length == 3) - mythicalChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); - else if (transaction.SalesPackageName.split(" ").length == 2) - mythicalChestsReceived += 1; - } - - } - if (transaction.SalesPackageName.startsWith("Winter Chest")) - { - if (transaction.Coins == 0 && transaction.Gems == 0) - { - if (transaction.SalesPackageName.split(" ").length == 3) - winterChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); - else if (transaction.SalesPackageName.split(" ").length == 2) - winterChestsReceived += 1; - } + int enjinCoinsReceived = 0; + int oldChestsReceived = 0; + int ancientChestsReceived = 0; + int mythicalChestsReceived = 0; + int winterChestsReceived = 0; + int valentinesGiftsReceived = 0; + + for (CoinTransactionToken transaction : donor.getCoinTransactions()) + { + if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Halloween Pumpkin") || transaction.Source.equalsIgnoreCase("Treasure Chest") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward") || transaction.Source.contains("purchase")) + { + if (transaction.Source.contains("purchase")) + enjinCoinsReceived += transaction.Amount; + } + } - } - if (transaction.SalesPackageName.startsWith("Valentines Gift")) - { - if (transaction.Coins == 0 && transaction.Gems == 0) - { - if (transaction.SalesPackageName.split(" ").length == 3) - valentinesGiftsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); - else if (transaction.SalesPackageName.split(" ").length == 2) - valentinesGiftsReceived += 1; - } + for (TransactionToken transaction : donor.getTransactions()) + { + if (transaction.SalesPackageName.startsWith("Old Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + oldChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + oldChestsReceived += 1; + } + + } + if (transaction.SalesPackageName.startsWith("Ancient Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + ancientChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + ancientChestsReceived += 1; + } + + } + if (transaction.SalesPackageName.startsWith("Mythical Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + mythicalChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + mythicalChestsReceived += 1; + } + + } + if (transaction.SalesPackageName.startsWith("Winter Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + winterChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + winterChestsReceived += 1; + } + } + if (transaction.SalesPackageName.startsWith("Valentines Gift")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + valentinesGiftsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + valentinesGiftsReceived += 1; + } + + } + } + + caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived); + caller.sendMessage(C.cBlue + "Old Chests Received : " + C.cYellow + oldChestsReceived); + caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived); + caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived); + caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived); + caller.sendMessage(C.cBlue + "Valentines Gifts Received : " + C.cYellow + valentinesGiftsReceived); + caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):"); + + if (_accountBonusLog.containsKey(client.getAccountId())) + { + for (String logEntry : _accountBonusLog.get(client.getAccountId())) + { + caller.sendMessage(C.cYellow + logEntry); + } + } + + caller.sendMessage(C.cDGreen + C.Strike + "============================================="); + _salesPackageManager.displaySalesPackages(caller, playerName); + caller.sendMessage(C.cDGreen + C.Strike + "============================================="); + + _accountBonusLog.remove(client.getAccountId()); + } + }); } - } - - caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived); - caller.sendMessage(C.cBlue + "Old Chests Received : " + C.cYellow + oldChestsReceived); - caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived); - caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived); - caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived); - caller.sendMessage(C.cBlue + "Valentines Gifts Received : " + C.cYellow + valentinesGiftsReceived); - - caller.sendMessage(C.cDGreen + C.Strike + "============================================="); - _salesPackageManager.displaySalesPackages(caller, playerName); - caller.sendMessage(C.cDGreen + C.Strike + "============================================="); + }); } @EventHandler @@ -215,4 +249,20 @@ public class CustomerSupport extends MiniPlugin event.setCancelled(true); } + + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + List log = new ArrayList(); + int accountId = 0; + + while (resultSet.next() && log.size() < 6) + { + accountId = resultSet.getInt(1); + log.add("Received " + resultSet.getInt(3) + " " + resultSet.getString(2) + " on " + resultSet.getDate(4)); + } + + if (accountId != 0) + _accountBonusLog.put(accountId, log); + } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/checkCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/checkCommand.java index c548351ca..b6303f8b3 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/checkCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/checkCommand.java @@ -34,8 +34,8 @@ public class checkCommand extends CommandBase { public void run() { - Plugin.addAgentMapping(caller, name); Plugin.showPlayerInfo(caller, name); + Plugin.addAgentMapping(caller, name); } }); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 35d44e8cd..72b1024b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -134,8 +134,8 @@ public class Arcade extends JavaPlugin StatsManager statsManager = new StatsManager(this, _clientManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager); FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal); - Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); - new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); + Chat chat = new Chat(this, incognito, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); + new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat); BlockRestore blockRestore = new BlockRestore(this); @@ -157,7 +157,7 @@ public class Arcade extends JavaPlugin //Arcade Manager PollManager pollManager = new PollManager(this, _clientManager, _donationManager); - _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish); + _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish); new MemoryFix(this); new CustomTagFix(this, packetHandler); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 06d782c97..6dd245b99 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -34,6 +34,8 @@ import mineplex.core.facebook.FacebookManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.hologram.HologramManager; +import mineplex.core.incognito.IncognitoManager; +import mineplex.core.incognito.events.IncognitoStatusChangeEvent; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.movement.Movement; @@ -86,7 +88,6 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.event.EventModule; import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.managers.GameAchievementManager; -import nautilus.game.arcade.managers.chat.GameChatManager; import nautilus.game.arcade.managers.GameCreationManager; import nautilus.game.arcade.managers.GameFlagManager; import nautilus.game.arcade.managers.GameGemManager; @@ -100,9 +101,9 @@ import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTestingManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; -import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; +import nautilus.game.arcade.managers.chat.GameChatManager; import nautilus.game.arcade.player.ArcadePlayer; import nautilus.game.arcade.shop.ArcadeShop; import net.minecraft.server.v1_8_R3.EntityLiving; @@ -190,6 +191,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation private ResourcePackManager _resourcePackManager; private CustomDataManager _customDataManager; private Punish _punishmentManager; + + private IncognitoManager _incognitoManager; private TaskManager _taskManager; private PacketHandler _packetHandler; @@ -211,7 +214,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, - StatsManager statsManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, + StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, NpcManager npcManager, CustomDataManager customDataManager, Punish punish) @@ -223,6 +226,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation // Modules _blockRestore = new BlockRestore(plugin); + _incognitoManager = incognitoManager; + _blood = blood; _preferencesManager = preferences; @@ -610,6 +615,41 @@ public class ArcadeManager extends MiniPlugin implements IRelation return true; } + @EventHandler + public void StaffIncognito(IncognitoStatusChangeEvent event) + { + if (event.getNewState() && _game != null && _game.IsPlaying(event.getPlayer()) && _game.IsLive()) + { + addSpectator(event.getPlayer(), true); + event.setCancelled(true); + return; + } + + if (event.getNewState()) + { + UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName())); + + if (_game == null || _game.GetState() != GameState.Live) + { + _specList.add(event.getPlayer()); + } + } + else + { + UtilServer.broadcast(F.sys("Join", event.getPlayer().getName())); + + if (_game != null && isSpectator(event.getPlayer())) + { + if (_game.GetState() != GameState.Live) + { + _specList.remove(event.getPlayer()); + } + + event.show(false); + } + } + } + @EventHandler public void MessageMOTD(ServerListPingEvent event) { @@ -674,6 +714,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation { String name = event.getPlayer().getName(); + if (_incognitoManager.Get(event.getPlayer()).Status) + { + event.setJoinMessage(null); + return; + } + + if (event.getJoinMessage() == null) + return; + if (_game != null && _game.AnnounceJoinQuit) event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + name)); @@ -684,8 +733,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation @EventHandler public void MessageQuit(PlayerQuitEvent event) { + if (_incognitoManager.Get(event.getPlayer()).Status) + { + event.setQuitMessage(null); + return; + } + String name = event.getPlayer().getName(); + if (event.getQuitMessage() == null) + return; + if (_game == null || _game.AnnounceJoinQuit) event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + name)); else @@ -1084,6 +1142,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation public boolean IsObserver(Player player) { + if (_incognitoManager.Get(player).Status) + { + _specList.add(player); + } + return _specList.contains(player); } 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 e3e5cdadd..41dcec1e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -264,5 +264,4 @@ public enum GameType { return _display.getKitGameName(); } - } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index c7c255778..f65ac2c78 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -55,7 +55,6 @@ import mineplex.core.common.util.UtilTabTitle; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.elo.EloSettings; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; @@ -162,106 +161,101 @@ public abstract class Game implements Listener protected String[] _help; // Gameplay Flags + public long GameTimeout = 1200000; + + public boolean Damage = true; + public boolean DamagePvP = true; + public boolean DamagePvE = true; + public boolean DamageEvP = true; + public boolean DamageSelf = true; + public boolean DamageFall = true; + public boolean DamageTeamSelf = false; + public boolean DamageTeamOther = true; + + public boolean BlockBreak = false; + public boolean BlockBreakCreative = false; + public HashSet BlockBreakAllow = new HashSet(); + public HashSet BlockBreakDeny = new HashSet(); + + public boolean BlockPlace = false; + public boolean BlockPlaceCreative = false; + public HashSet BlockPlaceAllow = new HashSet(); + public HashSet BlockPlaceDeny = new HashSet(); + + public boolean ItemPickup = false; + public HashSet ItemPickupAllow = new HashSet(); + public HashSet ItemPickupDeny = new HashSet(); + + public boolean ItemDrop = false; + public HashSet ItemDropAllow = new HashSet(); + public HashSet ItemDropDeny = new HashSet(); + + public boolean InventoryOpenBlock = false; + public boolean InventoryOpenChest = false; + public boolean InventoryClick = false; + + public boolean PrivateBlocks = false; + + public boolean DeathOut = true; + public boolean DeathDropItems = false; + public boolean DeathMessages = true; + public boolean AutomaticRespawn = true; + + public double DeathSpectateSecs = 0; + public boolean DeathTeleport = true; - //Note: If any descriptions are inaccurate, feel free to let me know and/or fix them. Thanks. ~Joe Prezioso - public GameOption GameTimeout = new GameOption((long)1200000.0, "Game Timeout", "Allotted time for game mode"); + public boolean QuitOut = true; + public boolean QuitDropItems = false; - public GameOption Damage = new GameOption(true, "Damage", "Does damage matter in this game mode?"); - public GameOption DamagePvP = new GameOption(true, "Damage PVP", "Players allowed to damage other players?"); - public GameOption DamagePvE = new GameOption(true, "Damage PVE", "Players allowed to damage monsters?"); - public GameOption DamageEvP = new GameOption(true, "Damage EVP", "Monsters allowed to damage players?"); - public GameOption DamageSelf = new GameOption(true, "Damage Self", "Players allowed to harm themselves?"); - public GameOption DamageFall = new GameOption(true, "Damage Fall", "Can players be harmed by falling?"); - public GameOption DamageTeamSelf = new GameOption(false, "Damage Team, Self", "Can players damage teammates?"); - public GameOption DamageTeamOther = new GameOption(true, "Damage Team, Other", "Can players damage opposing team's players?"); + public boolean IdleKickz = true; - public GameOption BlockBreak = new GameOption(false, "Block Break", "Can players break blocks?"); - //Really not sure about the description for this one... - public GameOption BlockBreakCreative = new GameOption(false, "Block Break, Creative", "Can players break blocks in creative mode?"); - public GameOption> BlockBreakAllow = new GameOption>(new HashSet(), "Block Break Allow", "Set of blocks players can break"); - public GameOption> BlockBreakDeny = new GameOption>(new HashSet(), "Block Break Deny", "Set of blocks players can't break"); + public boolean CreatureAllow = false; + public boolean CreatureAllowOverride = false; - public GameOption BlockPlace = new GameOption(false, "Block Place", "Can players place blocks?"); - public GameOption BlockPlaceCreative = new GameOption(false, "Block Place, Creative", "Can players place blocks in creative mode?"); - public GameOption> BlockPlaceAllow = new GameOption>(new HashSet(), "Block Place Allow", "Set of blocks players can place"); - public GameOption> BlockPlaceDeny = new GameOption>(new HashSet(), "Block Place Deny", "Set of blocks players cannot place"); + public int WorldTimeSet = 12000; + public boolean WorldWeatherEnabled = false; + public int WorldWaterDamage = 0; + public boolean WorldBoundaryKill = true; + public boolean WorldBlockBurn = false; + public boolean WorldBlockGrow = false; + public boolean WorldFireSpread = false; + public boolean WorldLeavesDecay = false; + public boolean WorldSoilTrample = false; + public boolean WorldBoneMeal = false; - public GameOption ItemPickup = new GameOption(false, "Item Pickup", "Are there items to pickup?"); - public GameOption> ItemPickupAllow = new GameOption>(new HashSet(), "Item Pickup, Allow", "Items players can pick up"); - public GameOption> ItemPickupDeny = new GameOption>(new HashSet(), "Item Pickup, Deny", "Items players cannot pick up"); + public int HungerSet = -1; + public int HealthSet = -1; - public GameOption ItemDrop = new GameOption(false, "Item Drop", "Can items drop?"); - public GameOption> ItemDropAllow = new GameOption>(new HashSet(), "Item Drop Allow", "Set of items that can drop"); - public GameOption> ItemDropDeny = new GameOption>(new HashSet(), "Item Drop Deny", "Set of items that cannot drop"); + public boolean PrepareFreeze = true; - public GameOption InventoryOpenBlock = new GameOption(false, "Inventory Open Block", "Can players open inventory from a block?"); - public GameOption InventoryOpenChest = new GameOption(false, "Inventory Open Chest", "Can players open inventory from a chest?"); - public GameOption InventoryClick = new GameOption(false, "Inventory Click", "Can players click on their inventory?"); + private double _itemMergeRadius = 0; - public GameOption PrivateBlocks = new GameOption(false, "Private Blocks", "Can private blocks exist?"); + public boolean AnnounceStay = true; + public boolean AnnounceJoinQuit = true; + public boolean AnnounceSilence = true; - public GameOption DeathOut = new GameOption(true, "Death Out", "Are players out of the game upon death?"); - public GameOption DeathDropItems = new GameOption(false, "Death Drop Items", "Do players drop items upon death?"); - public GameOption DeathMessages = new GameOption(true, "Death Messages", "Display message upon death?"); - public GameOption AutomaticRespawn = new GameOption(true, "Automatic Respawn", "Do players automatically respawn on death?"); + public boolean DisplayLobbySide = true; - public GameOption DeathSpectateSecs = new GameOption(0.0, "Death Spectate Secs", "How many seconds players may spectate match while dead"); - public GameOption DeathTeleport = new GameOption(true, "Death Teleport", "Do players teleport upon death?"); - - public GameOption QuitOut = new GameOption(true, "Quit Out", "Are players allowed to quit?"); - public GameOption QuitDropItems = new GameOption(false, "Quit Drop Items", "Do players drop items if they quit?"); + public GameState KitRegisterState = GameState.Live; - public GameOption IdleKickz = new GameOption(true, "Idle Kickz", "Are idle players kicked?"); + public boolean JoinInProgress = false; - public GameOption CreatureAllow = new GameOption(false, "Creature Allow", "Allow creatures to spawn?"); - public GameOption CreatureAllowOverride = new GameOption(false, "Creature Allow Override", "Can creatures spawn where they normally wouldn't?"); - - //Still not quite sure what the descriptions for 'World Block Burn' and 'World Water Damage' should be - public GameOption WorldTimeSet = new GameOption(12000, "World Time Set", "Set time in the world"); - public GameOption WorldWeatherEnabled = new GameOption(false, "Weather Enabled", "Is there weather in this game world?"); - public GameOption WorldWaterDamage = new GameOption(0, "Water Damage", "Can water hurt players?"); - public GameOption WorldBoundaryKill = new GameOption(true, "Boundary Kill", "Do players die when leaving the game's boundaries?"); - public GameOption WorldBlockBurn = new GameOption(false, "Block Burn", "Can world blocks burn?"); - public GameOption WorldBlockGrow = new GameOption(false, "Block Grow", "Do world blocks grow?"); - public GameOption WorldFireSpread = new GameOption(false, "Fire Spread", "Does fire spread to world blocks?"); - public GameOption WorldLeavesDecay = new GameOption(false, "Leaves Decay", "Do leaves decay?"); - public GameOption WorldSoilTrample = new GameOption(false, "Soil Trample", "Can soil be trampled?"); - public GameOption WorldBoneMeal = new GameOption(false, "Bone Meal", "Allow using bone meal?"); + public int TickPerTeleport = 1; - public GameOption HungerSet = new GameOption(-1, "Hunger Set", "Default hunger for players"); - public GameOption HealthSet = new GameOption(-1, "Health Set", "Default Health for players"); + public int FillTeamsInOrderToCount = -1; - public GameOption PrepareFreeze = new GameOption(true, "Prepare Freeze", "Freeze game while preparations are made?"); + public boolean SpawnNearAllies = false; + public boolean SpawnNearEnemies = false; - private GameOption _itemMergeRadius = new GameOption(0.0, "Item Merge Radius", "Distance at which items merge"); + public boolean StrictAntiHack = false; - //really not sure what the descriptions should be for announcements ~JP - public GameOption AnnounceStay = new GameOption(true, "Announce Stay", "Send message to announce player is staying?"); - public GameOption AnnounceJoinQuit = new GameOption(true, "Announce Join Quit", "Send message to announce player has quit?"); - public GameOption AnnounceSilence = new GameOption(true, "Announce Silence", "Silence all announcements?"); + public boolean DisableKillCommand = true; - public GameOption DisplayLobbySide = new GameOption(true, "Display Lobby Side", "Show which side players are on in lobby?"); + public boolean GadgetsDisabled = true; - public GameOption KitRegisterState = new GameOption(GameState.Live, "Kit Register State", "State of registered kits"); + public boolean TeleportsDisqualify = true; - public GameOption JoinInProgress = new GameOption(false, "Join In Progress", "Allow players to join a game in progress?"); - - public GameOption TickPerTeleport = new GameOption(1, "Tick Per Teleport", "Number of ticks between teleports"); - - public GameOption FillTeamsInOrderToCount = new GameOption(-1, "Fill Teams In Order To Count", "Number to fill teams to in order to count players"); - - public GameOption SpawnNearAllies = new GameOption(false, "Spawn Near Allies", "Allow players to spawn near their allies?"); - public GameOption SpawnNearEnemies = new GameOption(false, "Spawn Near Enemies", "Allow players to spawn near their enemies?"); - - public GameOption StrictAntiHack = new GameOption(false, "Strict Anti-Hack", "Turn on Strict Anti-Hack?"); - - public GameOption DisableKillCommand = new GameOption(true, "Disable Kill Command", "Turn off kill command"); - - public GameOption GadgetsDisabled = new GameOption(true, "Gadgets Disabled", "Disable gadgets?"); - - public GameOption TeleportsDisqualify = new GameOption(true, "Teleports Disqualify", "Teleporting disqualifies player?"); - - public GameOption DontAllowOverfill = new GameOption(false, "Don't Allow Overfill", "Don't let players overfill teams?"); + public boolean DontAllowOverfill = false; // Addons public boolean CompassEnabled = false; @@ -316,11 +310,8 @@ public abstract class Game implements Listener public String Winner = "Nobody"; public GameTeam WinnerTeam = null; - //EloSetting - experimental (0 = disabled, 1 = background, 2 = full) - public EloSettings EloSetting = new EloSettings(0); - public boolean EloRanking = false; - public int EloStart = 1400; + public int EloStart = 1000; public boolean CanAddStats = true; public boolean CanGiveLoot = true; @@ -716,11 +707,11 @@ public abstract class Game implements Listener public GameTeam ChooseTeam(Player player) { - if (FillTeamsInOrderToCount.getOption() != -1) + if (FillTeamsInOrderToCount != -1) { for (int i = 0; i < _teamList.size(); i++) { - if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount.getOption()) + if (_teamList.get(i).GetSize() < FillTeamsInOrderToCount) { return _teamList.get(i); } @@ -743,7 +734,7 @@ public abstract class Game implements Listener public double GetKillsGems(Player killer, Player killed, boolean assist) { - if (DeathOut.getOption()) + if (DeathOut) { if (!assist) { @@ -1058,10 +1049,10 @@ public abstract class Game implements Listener public DeathMessageType GetDeathMessageType() { - if (!DeathMessages.getOption()) + if (!DeathMessages) return DeathMessageType.None; - if (this.DeathOut.getOption()) + if (this.DeathOut) return DeathMessageType.Detailed; return DeathMessageType.Simple; @@ -1131,7 +1122,7 @@ public abstract class Game implements Listener for (Player player : UtilServer.getPlayers()) AnnounceGame(player); - if (AnnounceSilence.getOption()) + if (AnnounceSilence) Manager.GetChat().Silence(PrepareTime, false); } @@ -1216,7 +1207,7 @@ public abstract class Game implements Listener UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); - if (AnnounceSilence.getOption()) + if (AnnounceSilence) Manager.GetChat().Silence(5000, false); } @@ -1272,166 +1263,10 @@ public abstract class Game implements Listener } UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); - - adjustPlayerElo(places); - if (AnnounceSilence.getOption()) + if (AnnounceSilence) Manager.GetChat().Silence(5000, false); } - - public int calculateEloMultiplier(int currentElo, int averageElo) - { - - int eloDifference = averageElo - currentElo; - - if (Math.abs(eloDifference) <= 50) - { - return 0; - } - if (eloDifference >= 200) - { - return 3; - } - if (eloDifference >= 100) - { - return 2; - } - if (eloDifference > 50) - { - return 1; - } - if (eloDifference <= -200) - { - return -3; - } - if (eloDifference <= -100) - { - return -2; - } - if (eloDifference < -50) - { - return -1; - } - - - return 0; - } - - public void adjustPlayerElo(List places) - { - int averageElo = 0; - for (Player player : UtilServer.getPlayers()) - { - averageElo += Manager.getEloManager().getElo(player.getUniqueId(), GetName()); - } - //average Elo of all players - averageElo = averageElo/places.size(); - - for (Player player : UtilServer.getPlayers()) - { - int currentElo = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); - int lossMultiplier = 1; - int sizeModifier = 3; - int eloMultiplier = calculateEloMultiplier(currentElo, averageElo); - - //nobody won, add 10 points to all players - //Profitable enough see the match through to the end, but not enough for a stale-mate to be a more desirable outcome than 3rd place - if (places == null || places.isEmpty()) - { - int newElo = currentElo + 10; - Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); - } - //Top 3 players get 25, 20, and 15 points, respectively - else - { - if (places.size() >= 1) - { - if (player.getUniqueId() == places.get(0).getUniqueId()) - { - int newElo = currentElo + 25 + (5 * eloMultiplier); - Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); - } - } - if (places.size() >= 5) - { - if (player.getUniqueId() == places.get(1).getUniqueId()) - { - int newElo = currentElo + 20 + (5 * eloMultiplier); - Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); - } - } - if (places.size() >= 6) - { - if (player.getUniqueId() == places.get(2).getUniqueId()) - { - if (eloMultiplier < -2) - { - eloMultiplier = -2; - } - - int newElo = currentElo + 15 + (5 * eloMultiplier); - Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); - } - - } - if (places.size() > 6 && places.size() <= 7) - { - if (player.getUniqueId() == places.get(5).getUniqueId()) - { - if(eloMultiplier > 1) - { - eloMultiplier = 0; - } - - int newElo = currentElo - 5 + (5 * eloMultiplier); - Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); - } - } - if (places.size() == 7) - { - if (player.getUniqueId() == places.get(6).getUniqueId()) - { - if(eloMultiplier > 2) - { - eloMultiplier = 2; - } - - int newElo = currentElo - 10 + (5 * eloMultiplier); - Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); - } - } - if (places.size() >= 8) - { - //for games with 8+ players, this if statement is just going to run 3 times to check 3 different places - while(lossMultiplier != 0) - { - if (player.getUniqueId() == places.get(places.size() - sizeModifier).getUniqueId()) - { - if(eloMultiplier > lossMultiplier) - { - eloMultiplier = lossMultiplier; - } - - int newElo = currentElo - (5 * lossMultiplier) + (5 * eloMultiplier); - Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); - - if(sizeModifier >= 1) - { - lossMultiplier++; - sizeModifier--; - } - else - { - lossMultiplier = 0; - } - } - } - } - - } - - } - } public void Announce(String message) { @@ -1650,7 +1485,7 @@ public abstract class Game implements Listener @EventHandler public void classCombatCreatureAllow(ClassCombatCreatureAllowSpawnEvent event) { - CreatureAllowOverride.setOption(event.getAllowed()); + CreatureAllowOverride = event.getAllowed(); } public boolean isInsideMap(Player player) @@ -1671,17 +1506,17 @@ public abstract class Game implements Listener public void setItemMergeRadius(double mergeRadius) { - _itemMergeRadius.setOption(mergeRadius); + _itemMergeRadius = mergeRadius; if (WorldData.World != null) { - ((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius.getOption(); + ((CraftWorld) WorldData.World).getHandle().spigotConfig.itemMerge = _itemMergeRadius; } } public double getItemMergeRadius() { - return _itemMergeRadius.getOption(); + return _itemMergeRadius; } @EventHandler @@ -1690,7 +1525,7 @@ public abstract class Game implements Listener if (event.getWorld().getName().equals(WorldData.GetFolder())) { System.out.println("Setting item merge radius for game to " + _itemMergeRadius); - ((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius.getOption(); + ((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index 685996d3a..256771fdb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -132,7 +132,7 @@ public class GameTeam public Location GetSpawn() { //Keep allies together - if (!Host.IsLive() && Host.SpawnNearAllies.getOption()) + if (!Host.IsLive() && Host.SpawnNearAllies) { //Find Location Nearest Ally Location loc = UtilAlg.getLocationNearPlayers(_spawns, GetPlayers(true), Host.GetPlayers(true)); @@ -142,7 +142,7 @@ public class GameTeam //No allies existed spawned yet //Spawn near enemies (used for SG) - if (Host.SpawnNearEnemies.getOption()) + if (Host.SpawnNearEnemies) { loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); if (loc != null) @@ -159,7 +159,7 @@ public class GameTeam else { //Spawn near players - if (Host.SpawnNearEnemies.getOption()) + if (Host.SpawnNearEnemies) { Location loc = UtilAlg.getLocationNearPlayers(_spawns, Host.GetPlayers(true), Host.GetPlayers(true)); if (loc != null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java index 3ee0a7e93..48ae4e9de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -76,7 +76,7 @@ public abstract class TeamGame extends Game if (player.getWorld().getName().equalsIgnoreCase("world")) return; - if (!QuitOut.getOption()) + if (!QuitOut) { //Store _rejoinTime.put(player.getName(), System.currentTimeMillis()); @@ -97,7 +97,7 @@ public abstract class TeamGame extends Game @EventHandler(priority = EventPriority.LOWEST) public void PlayerLoginAllow(PlayerLoginEvent event) { - if (!InProgress() || QuitOut.getOption()) + if (!InProgress() || QuitOut) return; //Rejoined @@ -135,7 +135,7 @@ public abstract class TeamGame extends Game @EventHandler public void playerRejoinGame(PlayerJoinEvent event) { - if (!InProgress() || QuitOut.getOption()) + if (!InProgress() || QuitOut) return; Player player = event.getPlayer(); @@ -150,7 +150,7 @@ public abstract class TeamGame extends Game @EventHandler public void PlayerRejoinExpire(UpdateEvent event) { - if (event.getType() != UpdateType.SEC || QuitOut.getOption()) + if (event.getType() != UpdateType.SEC || QuitOut) return; Iterator rejoinIterator = _rejoinTime.keySet().iterator(); @@ -177,7 +177,7 @@ public abstract class TeamGame extends Game @EventHandler public void RejoinCommand(PlayerCommandPreprocessEvent event) { - if (!QuitOut.getOption() && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin")) + if (!QuitOut && event.getPlayer().isOp() && event.getMessage().startsWith("/allowrejoin")) { String[] toks = event.getMessage().split(" "); @@ -206,7 +206,7 @@ public abstract class TeamGame extends Game if (team.GetPlayers(true).size() > 0) teamsAlive.add(team); - if (!QuitOut.getOption()) + if (!QuitOut) { //Offline Player Team for (GameTeam team : RejoinTeam.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java index 98592b21f..adc29452f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java @@ -35,9 +35,9 @@ public class BaconBrawl extends SoloGame "Last pig in the arena wins!" }); - DamageTeamSelf.setOption(true); - HungerSet.setOption(20); - PrepareFreeze.setOption(false); + DamageTeamSelf = true; + HungerSet = 20; + PrepareFreeze = false; registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java index 280233806..c285f9c53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java @@ -54,13 +54,13 @@ public class KitMamaPig extends Kit disguise.setCustomNameVisible(false); Manager.GetDisguise().disguise(disguise); - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); pig.setBaby(); pig.setAgeLock(true); pig.setCustomName(C.cYellow + player.getName()); pig.setCustomNameVisible(false); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; player.setPassenger(pig); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java index bfc8111bb..c48e919eb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java @@ -39,27 +39,27 @@ public class Barbarians extends SoloGame "Last player alive wins!" }); - this.DamageTeamSelf.setOption(true); + this.DamageTeamSelf = true; this.CompassEnabled = true; - this.BlockBreakAllow.getOption().add(5); - this.BlockBreakAllow.getOption().add(17); - this.BlockBreakAllow.getOption().add(18); - this.BlockBreakAllow.getOption().add(20); - this.BlockBreakAllow.getOption().add(30); - this.BlockBreakAllow.getOption().add(47); - this.BlockBreakAllow.getOption().add(53); - this.BlockBreakAllow.getOption().add(54); - this.BlockBreakAllow.getOption().add(58); - this.BlockBreakAllow.getOption().add(64); - this.BlockBreakAllow.getOption().add(83); - this.BlockBreakAllow.getOption().add(85); - this.BlockBreakAllow.getOption().add(96); - this.BlockBreakAllow.getOption().add(125); - this.BlockBreakAllow.getOption().add(126); - this.BlockBreakAllow.getOption().add(134); - this.BlockBreakAllow.getOption().add(135); - this.BlockBreakAllow.getOption().add(136); + this.BlockBreakAllow.add(5); + this.BlockBreakAllow.add(17); + this.BlockBreakAllow.add(18); + this.BlockBreakAllow.add(20); + this.BlockBreakAllow.add(30); + this.BlockBreakAllow.add(47); + this.BlockBreakAllow.add(53); + this.BlockBreakAllow.add(54); + this.BlockBreakAllow.add(58); + this.BlockBreakAllow.add(64); + this.BlockBreakAllow.add(83); + this.BlockBreakAllow.add(85); + this.BlockBreakAllow.add(96); + this.BlockBreakAllow.add(125); + this.BlockBreakAllow.add(126); + this.BlockBreakAllow.add(134); + this.BlockBreakAllow.add(135); + this.BlockBreakAllow.add(136); registerStatTrackers( new BlockBreakStatTracker(this, true) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java index 9f67efba4..0ecfe91f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bossbattles/BossBattles.java @@ -55,9 +55,9 @@ public class BossBattles extends TeamGame "Fight some bosses" }); - HungerSet.setOption(20); - CreatureAllowOverride.setOption(true); - PrepareFreeze.setOption(false); + HungerSet = 20; + CreatureAllowOverride = true; + PrepareFreeze = false; // registerChatStats(Kills); // Game giving constant errors when loading. diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java index a06c94069..c8ab8f459 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/Ball.java @@ -104,13 +104,13 @@ public class Ball _ball.remove(); //Spawn - _host.CreatureAllowOverride.setOption(true); + _host.CreatureAllowOverride = true; _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); _ball.setSize(2); UtilEnt.Vegetate(_ball); UtilEnt.ghost(_ball, false, false); - _host.CreatureAllowOverride.setOption(false); + _host.CreatureAllowOverride = false; _lastParticle = _ball.getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java index ef68af398..ce464297f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bouncyballs/BouncyBalls.java @@ -35,7 +35,7 @@ public class BouncyBalls extends SoloGame "BOUNCE" }); - this.HungerSet.setOption(20); + this.HungerSet = 20; // registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index fe8cec342..810812772 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -175,45 +175,45 @@ public class Bridge extends TeamGame implements OreObsfucation _ore = new OreHider(); // Flags - GameTimeout.setOption((long)(Manager.IsTournamentServer() ? 5400000 : 3600000)); + GameTimeout = Manager.IsTournamentServer() ? 5400000 : 3600000; Manager.GetExplosion().SetLiquidDamage(false); - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - DamageSelf.setOption(true); + DamageSelf = true; - ItemDrop.setOption(true); - ItemPickup.setOption(true); + ItemDrop = true; + ItemPickup = true; - InventoryClick.setOption(true); + InventoryClick = true; - AnnounceStay.setOption(false); + AnnounceStay = false; - PrivateBlocks.setOption(true); - BlockBreak.setOption(true); - BlockPlace.setOption(true); + PrivateBlocks = true; + BlockBreak = true; + BlockPlace = true; - InventoryOpenBlock.setOption(true); - InventoryOpenChest.setOption(true); + InventoryOpenBlock = true; + InventoryOpenChest = true; - WorldTimeSet.setOption(2000); + WorldTimeSet = 2000; - WorldWaterDamage.setOption(0); - WorldBoundaryKill.setOption(false); + WorldWaterDamage = 0; + WorldBoundaryKill = false; CompassEnabled = true; - DeathDropItems.setOption(true); + DeathDropItems = true; GemMultiplier = 2.5; - PrepareFreeze.setOption(false); + PrepareFreeze = false; //Tournament if (Manager.IsTournamentServer()) { - QuitOut.setOption(false); + QuitOut = false; _gameDesc = new String[] { @@ -273,10 +273,10 @@ public class Bridge extends TeamGame implements OreObsfucation if (!WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty()) { - WorldWaterDamage.setOption(4); + WorldWaterDamage = 4; } - if (WorldWaterDamage.getOption() > 0) + if (WorldWaterDamage > 0) { if (WorldData.MapName.equals("Volcanic Islands")) UtilTextMiddle.display(C.cRed + "Warning", "Water is Boiling Hot", 10, 60, 20); @@ -1084,14 +1084,14 @@ public class Bridge extends TeamGame implements OreObsfucation Entity ent; - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; if (rand > 0.66) ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Cow.class); else if (rand > 0.33) ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Pig.class); else ent = team.GetSpawn().getWorld().spawn(team.GetSpawn(), Chicken.class); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; _animalSet.get(team).add(ent); } @@ -1401,7 +1401,7 @@ public class Bridge extends TeamGame implements OreObsfucation if (event.getBucket() != Material.WATER_BUCKET) return; - if (WorldWaterDamage.getOption() > 0) + if (WorldWaterDamage > 0) { UtilPlayer.message( event.getPlayer(), @@ -1603,7 +1603,7 @@ public class Bridge extends TeamGame implements OreObsfucation if (team.GetPlayers(true).size() > 0) teamsAlive.add(team); - if (!QuitOut.getOption()) + if (!QuitOut) { //Offline Player Team for (GameTeam team : RejoinTeam.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index e7341d2a6..5828ce042 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -165,29 +165,29 @@ public class Build extends SoloGame "based on the build theme!" }); - this.StrictAntiHack.setOption(true); - this.Damage.setOption(false); - this.HungerSet.setOption(20); - this.HealthSet.setOption(20); + this.StrictAntiHack = true; + this.Damage = false; + this.HungerSet = 20; + this.HealthSet = 20; - this.BlockBreak.setOption(true); - this.BlockPlace.setOption(true); + this.BlockBreak = true; + this.BlockPlace = true; - this.ItemDrop.setOption(true); - this.ItemPickup.setOption(true); + this.ItemDrop = true; + this.ItemPickup = true; - this.InventoryClick.setOption(true); + this.InventoryClick = true; - this.WorldTimeSet.setOption(6000); + this.WorldTimeSet = 6000; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; - this.CreatureAllow.setOption(true); + this.CreatureAllow = true; - this.WorldFireSpread.setOption(true); - this.WorldBoneMeal.setOption(true); + this.WorldFireSpread = true; + this.WorldBoneMeal = true; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; UtilServer.getServer().spigot().getConfig().set("view-distance", 4); @@ -275,7 +275,7 @@ public class Build extends SoloGame UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5); - this.WorldTimeSet.setOption(-1); + this.WorldTimeSet = -1; } } @@ -353,13 +353,13 @@ public class Build extends SoloGame _buildStateTime = System.currentTimeMillis(); //Flags - this.BlockBreak.setOption(false); - this.BlockPlace.setOption(false); + this.BlockBreak = false; + this.BlockPlace = false; - this.ItemDrop.setOption(false); - this.ItemPickup.setOption(false); + this.ItemDrop = false; + this.ItemPickup = false; - this.InventoryClick.setOption(false); + this.InventoryClick = false; UtilTextMiddle.display(null, C.cYellow + "TIME IS UP!", 0, 60, 5); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java index 735d7781f..e890a34a2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java @@ -60,14 +60,14 @@ public class Cards extends SoloGame "based on the build theme!" }); - this.StrictAntiHack.setOption(true); - this.Damage.setOption(false); - this.HungerSet.setOption(20); - this.HealthSet.setOption(20); + this.StrictAntiHack = true; + this.Damage = false; + this.HungerSet = 20; + this.HealthSet = 20; - this.WorldTimeSet.setOption(6000); + this.WorldTimeSet = 6000; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; _cardFactory = new CardFactory(); 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 3253d9c54..2aced88d1 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 @@ -192,12 +192,12 @@ public class CastleSiege extends TeamGame }; - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - this.HungerSet.setOption(20); - this.DeathOut.setOption(false); - this.WorldTimeSet.setOption(14000); //14000 - this.BlockPlaceAllow.getOption().add(85); + this.HungerSet = 20; + this.DeathOut = false; + this.WorldTimeSet = 14000; //14000 + this.BlockPlaceAllow.add(85); _kingName = C.cYellow + C.Bold + "King Sparklez"; @@ -307,9 +307,9 @@ public class CastleSiege extends TeamGame if (GetKits().length <= 5 + i) continue; - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; Manager.GetLobby().AddKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("PINK").get(i)); } @@ -323,9 +323,9 @@ public class CastleSiege extends TeamGame for (Location loc : _horseSpawns) { - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Horse horse = loc.getWorld().spawn(loc, Horse.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; horse.setAdult(); horse.setAgeLock(true); @@ -387,7 +387,7 @@ public class CastleSiege extends TeamGame return; //Spawn King - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; _kingLoc = _kingLocs.get(UtilMath.r(_kingLocs.size())); @@ -404,7 +404,7 @@ public class CastleSiege extends TeamGame _king.setRemoveWhenFarAway(false); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } @EventHandler(priority = EventPriority.HIGH) @@ -555,7 +555,7 @@ public class CastleSiege extends TeamGame Scoreboard.Write(_kingHealth + " Health"); } - long timeLeft = 24000 - WorldTimeSet.getOption(); + long timeLeft = 24000 - WorldTimeSet; timeLeft = timeLeft / 20 * 1000; @@ -584,7 +584,7 @@ public class CastleSiege extends TeamGame if (!IsLive()) return; - if (this.WorldTimeSet.getOption() > 24100) + if (this.WorldTimeSet > 24100) { SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the siege!"); @@ -937,7 +937,7 @@ public class CastleSiege extends TeamGame if (event.getType() != UpdateType.TICK) return; - WorldTimeSet.setOption(WorldTimeSet.getOption() + 1); + WorldTimeSet = (WorldTimeSet + 1); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java index e268162f6..c2633e3b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsCTF.java @@ -67,16 +67,16 @@ public class ChampionsCTF extends CaptureTheFlag Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - InventoryOpenChest.setOption(true); + InventoryOpenChest = true; EloRanking = false; EloStart = 1000; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; - this.DisableKillCommand.setOption(false); + this.DisableKillCommand = false; registerStatTrackers( new KillReasonStatTracker(this, "Backstab", "Assassination", false), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java index 50467553e..83b44d9de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java @@ -62,16 +62,16 @@ public class ChampionsDominate extends Domination Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - InventoryOpenChest.setOption(true); + InventoryOpenChest = true; EloRanking = false; EloStart = 1000; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; - this.DisableKillCommand.setOption(false); + this.DisableKillCommand = false; registerStatTrackers( new KillReasonStatTracker(this, "Backstab", "Assassination", false), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java index bc9333d5f..73bbb3812 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java @@ -63,13 +63,13 @@ public class ChampionsTDM extends TeamDeathmatch Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - InventoryOpenChest.setOption(true); + InventoryOpenChest = true; - this.DisableKillCommand.setOption(false); + this.DisableKillCommand = false; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; registerStatTrackers( new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java index b8f295cb9..5e68140ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Christmas.java @@ -148,10 +148,10 @@ public class Christmas extends SoloGame "Defeat the Thief who stole the Presents!" }); - BlockBreakAllow.getOption().add(4); - HungerSet.setOption(20); - WorldTimeSet.setOption(2000); - PrepareFreeze.setOption(false); + BlockBreakAllow.add(4); + HungerSet = 20; + WorldTimeSet = 2000; + PrepareFreeze = false; registerChatStats( DamageDealt, @@ -332,7 +332,7 @@ public class Christmas extends SoloGame Location loc = christmas.GetSleigh().GetLocation(); - christmas.CreatureAllowOverride.setOption(true); + christmas.CreatureAllowOverride = true; for (int i=0 ; i<20 ; i++) { Location elfLoc = UtilBlock.getHighest(loc.getWorld(), (int)(loc.getX() + 20 - Math.random()*40), (int)(loc.getZ() + 20 - Math.random()*40)).getLocation().add(0.5, 0.5, 0.5); @@ -345,7 +345,7 @@ public class Christmas extends SoloGame elf.setCustomName("Elf"); } - christmas.CreatureAllowOverride.setOption(false); + christmas.CreatureAllowOverride = false; } }, 20); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java index f94a384fc..26ef62540 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java @@ -46,7 +46,7 @@ public class Sleigh { Host = host; - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Target = loc.clone(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java index 2561f05d2..39cce1f42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java @@ -55,9 +55,9 @@ public class BossMobs _lastSpawn = System.currentTimeMillis(); //Spawn - Host.Host.CreatureAllowOverride.setOption(true); + Host.Host.CreatureAllowOverride = true; Creature ent = UtilAlg.Random(_spawns).getWorld().spawn(UtilAlg.Random(_spawns), Skeleton.class); - Host.Host.CreatureAllowOverride.setOption(false); + Host.Host.CreatureAllowOverride = false; //Weapon double r = Math.random(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java index 878caf77c..0b0909fd9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java @@ -106,7 +106,7 @@ public class BossSnowmanPattern _lastSpawn = System.currentTimeMillis(); - Host.Host.CreatureAllowOverride.setOption(true); + Host.Host.CreatureAllowOverride = true; //Spawn A for (int i=0 ; i<_spawnA.size() ; i++) @@ -134,7 +134,7 @@ public class BossSnowmanPattern _ents.add(new BossSnowman(ent, loc, _bDir)); } - Host.Host.CreatureAllowOverride.setOption(false); + Host.Host.CreatureAllowOverride = false; } private void MoveDieHit() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java index a43ff2214..65c5b40d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/CaveGiant.java @@ -27,9 +27,9 @@ public class CaveGiant { Host = host; - Host.Host.CreatureAllowOverride.setOption(true); + Host.Host.CreatureAllowOverride = true; _ent = loc.getWorld().spawn(loc, Giant.class); - Host.Host.CreatureAllowOverride.setOption(false); + Host.Host.CreatureAllowOverride = false; UtilEnt.Vegetate(_ent); _ent.setMaxHealth(300); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java index f9c7d4178..1397465e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/PumpkinKing.java @@ -44,9 +44,9 @@ public class PumpkinKing _grid = grid; - Host.Host.CreatureAllowOverride.setOption(true); + Host.Host.CreatureAllowOverride = true; _ent = loc.getWorld().spawn(loc, Skeleton.class); - Host.Host.CreatureAllowOverride.setOption(false); + Host.Host.CreatureAllowOverride = false; UtilEnt.Vegetate(_ent); UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java index b7419ff96..82b334134 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java @@ -43,7 +43,7 @@ public class SnowmanBoss _minions = new ArrayList(); //Spawn - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; for (int i=0 ; i<14 ; i++) _minions.add(new SnowmanMinion(_spawn.getWorld().spawn(_spawn, Snowman.class))); @@ -53,7 +53,7 @@ public class SnowmanBoss _heart.setHealth(1400); UtilEnt.Vegetate(_heart); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; //Stack Entity base = null; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java index 0bf9245fe..e65212177 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanMaze.java @@ -258,9 +258,9 @@ public class SnowmanMaze { Location loc = UtilAlg.Random(_spawns); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java index 432e74691..db9a10f0d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java @@ -93,9 +93,9 @@ public class SnowmanWaveA continue; Location loc = _spawns.get(i); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java index db4b36a6d..0e2568a54 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java @@ -90,9 +90,9 @@ public class SnowmanWaveB _lastPositions.add(i); Location loc = _spawns.get(i); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Snowman ent = loc.getWorld().spawn(loc, Snowman.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); _ents.add(ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java index 85e4a9e70..80c3a276e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java @@ -71,9 +71,9 @@ public abstract class Part implements Listener Location standLoc = loc.clone().add(0, -1.45, 0); standLoc.setYaw(UtilMath.r(100)); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; ArmorStand stand = loc.getWorld().spawn(standLoc, ArmorStand.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; stand.setVisible(false); stand.setGravity(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java index af69cf40e..6839ff135 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part1.java @@ -118,11 +118,11 @@ public class Part1 extends Part //Create Location loc = UtilAlg.Random(_skeletons); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Skeleton skel = loc.getWorld().spawn(loc, Skeleton.class); skel.getEquipment().setItemInHand(new ItemStack(Material.WOOD_HOE)); skel.setHealth(4); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; this.AddCreature(skel); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java index 54971343e..debb76643 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part2.java @@ -127,9 +127,9 @@ public class Part2 extends Part //Create Location loc = UtilAlg.Random(_spiders); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Skeleton ent = loc.getWorld().spawn(loc, Skeleton.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; DisguiseSpider disguise = new DisguiseSpider(ent); Host.Manager.GetDisguise().disguise(disguise); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java index e3e5b14b4..26b282b57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part4.java @@ -179,9 +179,9 @@ public class Part4 extends Part //Create Location loc = UtilAlg.Random(_mobSpawns); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Zombie ent = loc.getWorld().spawn(loc, Zombie.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; ent.getEquipment().setItemInHand(new ItemStack(Material.WOOD_PICKAXE)); ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java index 4d5952c8d..d2d8dd2e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java @@ -98,12 +98,12 @@ public class CaptureTheFlag extends TeamGame }); - this.DeathOut.setOption(false); - this.PrepareFreeze.setOption(true); - this.HungerSet.setOption(20); - this.WorldTimeSet.setOption(2000); + this.DeathOut = false; + this.PrepareFreeze = true; + this.HungerSet = 20; + this.WorldTimeSet = 2000; - this.DeathSpectateSecs.setOption(10.0); + this.DeathSpectateSecs = 10; } @Override @@ -129,7 +129,7 @@ public class CaptureTheFlag extends TeamGame if (this instanceof ChampionsCTF) { - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("LIGHT_BLUE").size() && i < WorldData.GetDataLocs("PINK").size(); i++) { Entity ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); @@ -138,7 +138,7 @@ public class CaptureTheFlag extends TeamGame ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("LIGHT_BLUE").get(i)); Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("LIGHT_BLUE").get(i)); } - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; } //End kit spawning @@ -247,7 +247,7 @@ public class CaptureTheFlag extends TeamGame else { _suddenDeath = true; - this.DeathOut.setOption(true); + this.DeathOut = true; UtilTextMiddle.display(C.cYellow + "Sudden Death", "Next Capture Wins! No Respawns!"); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index deb71df59..c92af3e1f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -80,12 +80,12 @@ public class Domination extends TeamGame }); - this.DeathOut.setOption(false); - this.PrepareFreeze.setOption(true); - this.HungerSet.setOption(20); - this.WorldTimeSet.setOption(2000); + this.DeathOut = false; + this.PrepareFreeze = true; + this.HungerSet = 20; + this.WorldTimeSet = 2000; - this.DeathSpectateSecs.setOption(10.0); + this.DeathSpectateSecs = 10; //this.QuitOut = false; } @@ -113,7 +113,7 @@ public class Domination extends TeamGame //Spawn Kits if (this instanceof ChampionsDominate) { - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("RED").size() && i < WorldData.GetDataLocs("BLUE").size(); i++) { @@ -124,7 +124,7 @@ public class Domination extends TeamGame Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("BLUE").get(i)); } - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java index 73e6d0311..1e26628f7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java @@ -74,9 +74,9 @@ public class TeamDeathmatch extends TeamGame }); - this.DeathOut.setOption(true); - this.HungerSet.setOption(20); - this.WorldTimeSet.setOption(2000); + this.DeathOut = true; + this.HungerSet = 20; + this.WorldTimeSet = 2000; this.CompassEnabled = true; this.Manager.GetDamage().UseSimpleWeaponDamage = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index e81cfc72f..859257fcb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -63,14 +63,14 @@ public class DeathTag extends SoloGame "The last Runner alive wins!" }); - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - this.DeathOut.setOption(false); - this.HungerSet.setOption(20); + this.DeathOut = false; + this.HungerSet = 20; this.CompassEnabled = true; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; registerStatTrackers(new ComeAtMeBroStatTracker(this)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 7edcc0bcd..3cbd0c28d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -114,9 +114,9 @@ public class DragonEscape extends SoloGame "Last player alive wins!" }); - this.DamagePvP.setOption(false); - this.HungerSet.setOption(20); - this.BlockPlace.setOption(true); + this.DamagePvP = false; + this.HungerSet = 20; + this.BlockPlace = true; registerStatTrackers( new ParalympicsStatTracker(this), @@ -176,10 +176,10 @@ public class DragonEscape extends SoloGame _speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d; if (WorldData.MapName.contains("Hell")) - this.WorldTimeSet.setOption(16000); + this.WorldTimeSet = 16000; if (WorldData.MapName.contains("Pirate")) - this.WorldWaterDamage.setOption(2); + this.WorldWaterDamage = 2; } @EventHandler @@ -191,9 +191,9 @@ public class DragonEscape extends SoloGame for (Team team : GetScoreboard().GetScoreboard().getTeams()) team.setCanSeeFriendlyInvisibles(true); - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java index fa3e14320..0b6764bb5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscapeTeams.java @@ -81,8 +81,8 @@ public class DragonEscapeTeams extends TeamGame "Last player alive wins!" }); - this.DamagePvP.setOption(false); - this.HungerSet.setOption(20); + this.DamagePvP = false; + this.HungerSet = 20; this.TeamArmorHotbar = true; @@ -159,7 +159,7 @@ public class DragonEscapeTeams extends TeamGame _speedMult = WorldData.GetDataLocs("GREEN").get(0).getX()/100d; if (WorldData.MapName.contains("Hell")) - this.WorldTimeSet.setOption(16000); + this.WorldTimeSet = 16000; } @EventHandler @@ -174,9 +174,9 @@ public class DragonEscapeTeams extends TeamGame if (event.GetState() != GameState.Prepare) return; - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java index 57bcc8e69..50df5fe35 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java @@ -39,10 +39,10 @@ public class DragonData Location = rider.getLocation(); //Spawn Dragon - manager.GetGame().CreatureAllowOverride.setOption(true); + manager.GetGame().CreatureAllowOverride = true; Dragon = rider.getWorld().spawn(rider.getLocation(), EnderDragon.class); UtilEnt.Vegetate(Dragon); - manager.GetGame().CreatureAllowOverride.setOption(false); + manager.GetGame().CreatureAllowOverride = false; rider.getWorld().playSound(rider.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java index 9ec44326e..bccf6f3a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonRiders.java @@ -22,8 +22,8 @@ public class DragonRiders extends SoloGame }); - this.Damage.setOption(false); - this.HungerSet.setOption(20); + this.Damage = false; + this.HungerSet = 20; //Chat stats registerChatStats(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java index 496a56664..2ec7e7daa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/Dragons.java @@ -59,9 +59,9 @@ public class Dragons extends SoloGame "Last player alive wins!" }); - this.DamagePvP.setOption(false); - this.HungerSet.setOption(20); - this.WorldWaterDamage.setOption(4); + this.DamagePvP = false; + this.HungerSet = 20; + this.WorldWaterDamage = 4; registerStatTrackers( new SparklezStatTracker(this) @@ -153,10 +153,10 @@ public class Dragons extends SoloGame if (_dragons.size() < 7) { - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); UtilEnt.Vegetate(ent); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java index e981baadd..9743a5aaf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/DragonsTeams.java @@ -66,10 +66,10 @@ public class DragonsTeams extends TeamGame "Team with longest time survived wins!" }); - this.DamagePvP.setOption(false); - this.HungerSet.setOption(20); - this.WorldWaterDamage.setOption(4); - this.PrepareFreeze.setOption(false); + this.DamagePvP = false; + this.HungerSet = 20; + this.WorldWaterDamage = 4; + this.PrepareFreeze = false; this.TeamArmor = true; this.TeamArmorHotbar = true; @@ -157,10 +157,10 @@ public class DragonsTeams extends TeamGame if (_dragons.size() < 7) { - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class); UtilEnt.Vegetate(ent); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; ent.getWorld().playSound(ent.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index 5b1a39346..cc87cc712 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -111,10 +111,10 @@ public class Draw extends SoloGame "Hints are given at top of screen", }); - this.StrictAntiHack.setOption(true); - this.Damage.setOption(false); - this.HungerSet.setOption(20); - this.WorldTimeSet.setOption(8000); + this.StrictAntiHack = true; + this.Damage = false; + this.HungerSet = 20; + this.WorldTimeSet = 8000; _words = new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 369d6fe40..f90b48ed1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -113,41 +113,41 @@ public class EventGame extends Game "" }); - this.JoinInProgress.setOption(true); + this.JoinInProgress = true; - this.DamageTeamSelf.setOption(true); - this.DamagePvP.setOption(false); - this.DamageEvP.setOption(false); - this.DamagePvE.setOption(false); + this.DamageTeamSelf = true; + this.DamagePvP = false; + this.DamageEvP = false; + this.DamagePvE = false; - this.DeathMessages.setOption(false); - this.DeathOut.setOption(false); + this.DeathMessages = false; + this.DeathOut = false; this.CanAddStats = false; this.CanGiveLoot = false; - this.GadgetsDisabled.setOption(false); + this.GadgetsDisabled = false; - this.TeleportsDisqualify.setOption(false); + this.TeleportsDisqualify = false; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; - this.BlockPlaceCreative.setOption(true); - this.BlockBreakCreative.setOption(true); + this.BlockPlaceCreative = true; + this.BlockBreakCreative = true; - this.InventoryClick.setOption(true); - this.InventoryOpenBlock.setOption(true); - this.InventoryOpenChest.setOption(true); + this.InventoryClick = true; + this.InventoryOpenBlock = true; + this.InventoryOpenChest = true; //Dont timeout - this.GameTimeout.setOption((long)-1); + this.GameTimeout = -1; _mps = manager.GetGameHostManager(); _functionSigns = new HashMap<>(); _powerdedSigns = new ArrayList<>(); - this.CreatureAllow.setOption(true); + this.CreatureAllow = true; _customAreas = new HashMap<>(); } @@ -989,13 +989,13 @@ public class EventGame extends Game if(Manager.GetEventModule().getDamagePlayers().contains(event.GetDamagerPlayer(true))) { - if(!Manager.GetGame().DamagePvP.getOption()) + if(!Manager.GetGame().DamagePvP) { - Manager.GetGame().Damage.setOption(true); - Manager.GetGame().DamagePvP.setOption(true); + Manager.GetGame().Damage = true; + Manager.GetGame().DamagePvP = true; Bukkit.getPluginManager().callEvent(event); - Manager.GetGame().DamagePvP.setOption(false); - Manager.GetGame().Damage.setOption(false); + Manager.GetGame().DamagePvP = false; + Manager.GetGame().Damage = false; } return; } @@ -1032,13 +1032,13 @@ public class EventGame extends Game continue; } } - if(!Manager.GetGame().DamagePvP.getOption()) + if(!Manager.GetGame().DamagePvP) { - Manager.GetGame().Damage.setOption(true); - Manager.GetGame().DamagePvP.setOption(true); + Manager.GetGame().Damage = true; + Manager.GetGame().DamagePvP = true; Bukkit.getPluginManager().callEvent(event); - Manager.GetGame().DamagePvP.setOption(false); - Manager.GetGame().Damage.setOption(false); + Manager.GetGame().DamagePvP = false; + Manager.GetGame().Damage = false; } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index aed7c6020..379833f82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -306,28 +306,28 @@ public class EventModule extends MiniPlugin //XXX Settings else if (event.getMessage().toLowerCase().equals("/e damage all")) { - Manager.GetGame().Damage.setOption(!Manager.GetGame().Damage.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage All", F.tf(Manager.GetGame().Damage.getOption())))); + Manager.GetGame().Damage = !Manager.GetGame().Damage; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage All", F.tf(Manager.GetGame().Damage)))); } else if (event.getMessage().toLowerCase().equals("/e damage pvp")) { - Manager.GetGame().DamagePvP.setOption(!Manager.GetGame().DamagePvP.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP.getOption())))); + Manager.GetGame().DamagePvP = !Manager.GetGame().DamagePvP; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP)))); } else if (event.getMessage().toLowerCase().equals("/e damage pve")) { - Manager.GetGame().DamagePvE.setOption(!Manager.GetGame().DamagePvE.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE.getOption())))); + Manager.GetGame().DamagePvE = !Manager.GetGame().DamagePvE; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE)))); } else if (event.getMessage().toLowerCase().equals("/e damage evp")) { - Manager.GetGame().DamageEvP.setOption(!Manager.GetGame().DamageEvP.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP.getOption())))); + Manager.GetGame().DamageEvP = !Manager.GetGame().DamageEvP; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP)))); } else if (event.getMessage().toLowerCase().equals("/e damage fall")) { - Manager.GetGame().DamageFall.setOption(!Manager.GetGame().DamageFall.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.getOption())))); + Manager.GetGame().DamageFall = !Manager.GetGame().DamageFall; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall)))); } else if (args[0].equalsIgnoreCase("health")) { @@ -339,18 +339,18 @@ public class EventModule extends MiniPlugin } else if (event.getMessage().toLowerCase().equals("/e item drop")) { - Manager.GetGame().ItemDrop.setOption(!Manager.GetGame().ItemDrop.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop.getOption())))); + Manager.GetGame().ItemDrop = !Manager.GetGame().ItemDrop; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop)))); } else if (event.getMessage().toLowerCase().equals("/e item pickup")) { - Manager.GetGame().ItemPickup.setOption(!Manager.GetGame().ItemPickup.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup.getOption())))); + Manager.GetGame().ItemPickup = !Manager.GetGame().ItemPickup; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup)))); } else if (event.getMessage().toLowerCase().equals("/e blockplace")) { - Manager.GetGame().BlockPlace.setOption(!Manager.GetGame().BlockPlace.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Place", F.tf(Manager.GetGame().BlockPlace.getOption())))); + Manager.GetGame().BlockPlace = !Manager.GetGame().BlockPlace; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Place", F.tf(Manager.GetGame().BlockPlace)))); } else if (args.length >= 4 && args[0].equalsIgnoreCase("blockplace") && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist"))) @@ -359,8 +359,8 @@ public class EventModule extends MiniPlugin } else if (event.getMessage().toLowerCase().equals("/e blockbreak")) { - Manager.GetGame().BlockBreak.setOption(!Manager.GetGame().BlockBreak.getOption()); - Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Break", F.tf(Manager.GetGame().BlockBreak.getOption())))); + Manager.GetGame().BlockBreak = !Manager.GetGame().BlockBreak; + Manager.GetGame().Announce(F.main("Event Settings", F.value("Block Break", F.tf(Manager.GetGame().BlockBreak)))); } else if (args.length >= 4 && args[0].equalsIgnoreCase("blockbreak") && (args[1].equalsIgnoreCase("whitelist") || args[1].equalsIgnoreCase("blacklist"))) @@ -537,32 +537,32 @@ public class EventModule extends MiniPlugin public void listSettings(Player player) { - UtilPlayer.message(player, F.value("Damage All", F.tf(Manager.GetGame().Damage.getOption()))); - UtilPlayer.message(player, F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP.getOption()))); - UtilPlayer.message(player, F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE.getOption()))); - UtilPlayer.message(player, F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP.getOption()))); - UtilPlayer.message(player, F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall.getOption()))); + UtilPlayer.message(player, F.value("Damage All", F.tf(Manager.GetGame().Damage))); + UtilPlayer.message(player, F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP))); + UtilPlayer.message(player, F.value("Damage PvE", F.tf(Manager.GetGame().DamagePvE))); + UtilPlayer.message(player, F.value("Damage EvP", F.tf(Manager.GetGame().DamageEvP))); + UtilPlayer.message(player, F.value("Damage Fall", F.tf(Manager.GetGame().DamageFall))); UtilPlayer.message(player, F.value("Health Set", Manager.GetGame().HealthSet+"")); UtilPlayer.message(player, F.value("Hunger Set", Manager.GetGame().HungerSet+"")); - UtilPlayer.message(player, F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup.getOption()))); - UtilPlayer.message(player, F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop.getOption()))); - UtilPlayer.message(player, F.value("Block Place Creative", F.tf(Manager.GetGame().BlockPlaceCreative.getOption()))); - UtilPlayer.message(player, F.value("Block Break Creative", F.tf(Manager.GetGame().BlockBreakCreative.getOption()))); - UtilPlayer.message(player, F.value("Block Place", F.tf(Manager.GetGame().BlockPlace.getOption()))); - UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.getOption(), true))); - UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.getOption(), true))); - UtilPlayer.message(player, F.value("Block Break", F.tf(Manager.GetGame().BlockPlace.getOption()))); - UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.getOption(), true))); - UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.getOption(), true))); + UtilPlayer.message(player, F.value("Item Pickup", F.tf(Manager.GetGame().ItemPickup))); + UtilPlayer.message(player, F.value("Item Drop", F.tf(Manager.GetGame().ItemDrop))); + UtilPlayer.message(player, F.value("Block Place Creative", F.tf(Manager.GetGame().BlockPlaceCreative))); + UtilPlayer.message(player, F.value("Block Break Creative", F.tf(Manager.GetGame().BlockBreakCreative))); + UtilPlayer.message(player, F.value("Block Place", F.tf(Manager.GetGame().BlockPlace))); + UtilPlayer.message(player, F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow, true))); + UtilPlayer.message(player, F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny, true))); + UtilPlayer.message(player, F.value("Block Break", F.tf(Manager.GetGame().BlockPlace))); + UtilPlayer.message(player, F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow, true))); + UtilPlayer.message(player, F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny, true))); UtilPlayer.message(player, F.value("Time Set", Manager.GetGame().WorldTimeSet+"")); UtilPlayer.message(player, F.value("Mob griefing", F.tf(_mobGriefing))); } public void commandBlockBreakInCreative(Player player, String[] args) { - Manager.GetGame().BlockBreakCreative.setOption(!Manager.GetGame().BlockBreakCreative.getOption()); + Manager.GetGame().BlockBreakCreative = !Manager.GetGame().BlockBreakCreative; - UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative.getOption()))); + UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative))); } public void commandStacker(Player player, String[] args) @@ -594,9 +594,9 @@ public class EventModule extends MiniPlugin public void commandBlockPlaceInCreative(Player player, String[] args) { - Manager.GetGame().BlockPlaceCreative.setOption(!Manager.GetGame().BlockPlaceCreative.getOption()); + Manager.GetGame().BlockPlaceCreative = !Manager.GetGame().BlockPlaceCreative; - UtilPlayer.message(player, F.main("Settings", "BlockPlaceCreative: " + F.tf(Manager.GetGame().BlockPlaceCreative.getOption()))); + UtilPlayer.message(player, F.main("Settings", "BlockPlaceCreative: " + F.tf(Manager.GetGame().BlockPlaceCreative))); } public void commandMobGriefing(Player player, String[] args) @@ -616,44 +616,44 @@ public class EventModule extends MiniPlugin { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockPlaceAllow.getOption().add(blockId); + Manager.GetGame().BlockPlaceAllow.add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockPlaceAllow.getOption().remove(blockId); + Manager.GetGame().BlockPlaceAllow.remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockPlaceAllow.getOption().clear(); + Manager.GetGame().BlockPlaceAllow.clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow.getOption(), true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Whitelist", UtilText.listToString(Manager.GetGame().BlockPlaceAllow, true)))); } } else { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockPlaceDeny.getOption().add(blockId); + Manager.GetGame().BlockPlaceDeny.add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockPlaceDeny.getOption().remove(blockId); + Manager.GetGame().BlockPlaceDeny.remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockPlaceDeny.getOption().clear(); + Manager.GetGame().BlockPlaceDeny.clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny.getOption(), true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Place Blacklist", UtilText.listToString(Manager.GetGame().BlockPlaceDeny, true)))); } } @@ -677,44 +677,44 @@ public class EventModule extends MiniPlugin { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockBreakAllow.getOption().add(blockId); + Manager.GetGame().BlockBreakAllow.add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockBreakAllow.getOption().remove(blockId); + Manager.GetGame().BlockBreakAllow.remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockBreakAllow.getOption().clear(); + Manager.GetGame().BlockBreakAllow.clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow.getOption(), true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Whitelist", UtilText.listToString(Manager.GetGame().BlockBreakAllow, true)))); } } else { if (command.equalsIgnoreCase("add")) { - Manager.GetGame().BlockBreakDeny.getOption().add(blockId); + Manager.GetGame().BlockBreakDeny.add(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Added " + blockId))); } else if (command.equalsIgnoreCase("remove")) { - Manager.GetGame().BlockBreakDeny.getOption().remove(blockId); + Manager.GetGame().BlockBreakDeny.remove(blockId); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Removed " + blockId))); } else if (command.equalsIgnoreCase("clear")) { - Manager.GetGame().BlockBreakDeny.getOption().clear(); + Manager.GetGame().BlockBreakDeny.clear(); UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", "Cleared"))); } else if (command.equalsIgnoreCase("list")) { - UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny.getOption(), true)))); + UtilPlayer.message(player, F.main("Event Settings", F.value("Block Break Blacklist", UtilText.listToString(Manager.GetGame().BlockBreakDeny, true)))); } } @@ -741,9 +741,9 @@ public class EventModule extends MiniPlugin if (health > 20) health = 20; - Manager.GetGame().HealthSet.setOption(health); + Manager.GetGame().HealthSet = health; - if (Manager.GetGame().HealthSet.getOption() == -1) + if (Manager.GetGame().HealthSet == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Health Set", Manager.GetGame().HealthSet + ""))); @@ -772,9 +772,9 @@ public class EventModule extends MiniPlugin if (hunger > 20) hunger = 20; - Manager.GetGame().HungerSet.setOption(hunger); + Manager.GetGame().HungerSet = hunger; - if (Manager.GetGame().HungerSet.getOption() == -1) + if (Manager.GetGame().HungerSet == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Hunger Set", Manager.GetGame().HungerSet + ""))); @@ -803,9 +803,9 @@ public class EventModule extends MiniPlugin if (time > 24000) time = 24000; - Manager.GetGame().WorldTimeSet.setOption(time); + Manager.GetGame().WorldTimeSet = time; - if (Manager.GetGame().WorldTimeSet.getOption() == -1) + if (Manager.GetGame().WorldTimeSet == -1) Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", "Disabled"))); else Manager.GetGame().Announce(F.main("Event Settings", F.value("Time Set", Manager.GetGame().WorldTimeSet + ""))); @@ -1098,25 +1098,25 @@ public class EventModule extends MiniPlugin //Spec public void commandSpectators(Player player, String[] args) { - Manager.GetGame().JoinInProgress.setOption(!Manager.GetGame().JoinInProgress.getOption()); + Manager.GetGame().JoinInProgress = !Manager.GetGame().JoinInProgress; - UtilPlayer.message(player, F.main("Settings", "Spectator Join: " + F.tf(Manager.GetGame().JoinInProgress.getOption()))); + UtilPlayer.message(player, F.main("Settings", "Spectator Join: " + F.tf(Manager.GetGame().JoinInProgress))); } //Deathout public void commandDeathout(Player player, String[] args) { - Manager.GetGame().DeathOut.setOption(!Manager.GetGame().DeathOut.getOption()); + Manager.GetGame().DeathOut = !Manager.GetGame().DeathOut; - UtilPlayer.message(player, F.main("Settings", "Deathout: " + F.tf(Manager.GetGame().DeathOut.getOption()))); + UtilPlayer.message(player, F.main("Settings", "Deathout: " + F.tf(Manager.GetGame().DeathOut))); } //QuitOut public void commandQuitOut(Player player, String[] args) { - Manager.GetGame().QuitOut.setOption(!Manager.GetGame().QuitOut.getOption()); + Manager.GetGame().QuitOut = !Manager.GetGame().QuitOut; - UtilPlayer.message(player, F.main("Settings", "QuitOut: " + F.tf(Manager.GetGame().QuitOut.getOption()))); + UtilPlayer.message(player, F.main("Settings", "QuitOut: " + F.tf(Manager.GetGame().QuitOut))); } //Double Jump @@ -1327,9 +1327,9 @@ public class EventModule extends MiniPlugin HashSet entSet = new HashSet(); for (int i = 0 ; i < count ; i++) { - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock((HashSet)null, 150).getLocation().add(0.5, 1, 0.5), type)); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; } //Search Vars diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 246aebce5..e8b4ead2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -130,13 +130,13 @@ public class Evolution extends SoloGame "First to get through " + _mobKits.size() + " evolutions wins!" }; - DamageTeamSelf.setOption(true); + DamageTeamSelf = true; - HungerSet.setOption(20); + HungerSet = 20; - DeathOut.setOption(false); + DeathOut = false; - PrepareFreeze.setOption(false); + PrepareFreeze = false; GemKillDeathRespawn = 2; GemAssistDeathRespawn = .5; @@ -144,13 +144,13 @@ public class Evolution extends SoloGame CompassEnabled = true; CompassGiveItem = false; - AutomaticRespawn.setOption(false); - DeathSpectateSecs.setOption(4.0); + AutomaticRespawn = false; + DeathSpectateSecs = 4.0; - CreatureAllow.setOption(false); - InventoryClick.setOption(false); + CreatureAllow = false; + InventoryClick = false; - InventoryOpenBlock.setOption(false); + InventoryOpenBlock = false; Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.Attack); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index c0c20bf6d..fbf5edc54 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -103,18 +103,18 @@ public class Gladiators extends SoloGame "There is only one victor!" }); - Damage.setOption(true); - DamageFall.setOption(false); - DamagePvP.setOption(true); - DamageSelf.setOption(true); - DamageTeamSelf.setOption(true); - HungerSet.setOption(20); - DontAllowOverfill.setOption(true); + Damage = true; + DamageFall = false; + DamagePvP = true; + DamageSelf = true; + DamageTeamSelf = true; + HungerSet = 20; + DontAllowOverfill = true; EnableTutorials = false; - BlockBreakAllow.getOption().add(Material.SUGAR_CANE_BLOCK.getId()); - BlockBreakAllow.getOption().add(Material.DEAD_BUSH.getId()); - BlockBreakAllow.getOption().add(Material.LONG_GRASS.getId()); + BlockBreakAllow.add(Material.SUGAR_CANE_BLOCK.getId()); + BlockBreakAllow.add(Material.DEAD_BUSH.getId()); + BlockBreakAllow.add(Material.LONG_GRASS.getId()); registerStatTrackers( new BrawlerTracker(this), @@ -156,10 +156,10 @@ public class Gladiators extends SoloGame e.getTutorial().getPhase(1).setLocation(white); e.getTutorial().getPhase(1).setTarget(orange); - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; Zombie zombie1 = (Zombie) WorldData.World.spawnEntity(spawn1, EntityType.ZOMBIE); Zombie zombie2 = (Zombie) WorldData.World.spawnEntity(spawn2, EntityType.ZOMBIE); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; for (Zombie zombie : Arrays.asList(zombie1, zombie2)) { GameProfile tiger = new ProfileLoader(UUIDFetcher.getUUIDOf("WilliamTiger").toString(), "WilliamTiger").loadProfile(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index 799594a15..6178db711 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -107,14 +107,14 @@ public class Gravity extends SoloGame "Restore Oxygen at the Emerald Blocks", }; - this.DamagePvP.setOption(false); - this.HungerSet.setOption(10); + this.DamagePvP = false; + this.HungerSet = 10; - this.WorldTimeSet.setOption(18000); + this.WorldTimeSet = 18000; this.CompassEnabled = true; - this.WorldBoundaryKill.setOption(false); + this.WorldBoundaryKill = false; registerChatStats( Kills, @@ -327,9 +327,9 @@ public class Gravity extends SoloGame //Projectile Vector velocity = player.getLocation().getDirection().multiply(0.4); - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Slime slime = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection().multiply(2)), Slime.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; slime.setSize(1); UtilEnt.Vegetate(slime, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java index 35c057b57..34c83e330 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/GravityObject.java @@ -47,9 +47,9 @@ public abstract class GravityObject else Vel = new Vector(0,0,0); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Base = ent.getWorld().spawn(ent.getLocation().subtract(0, 0, 0), Zombie.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; Base.setMaxHealth(60); Base.setHealth(60); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index e2f439b02..4ccc70136 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -123,20 +123,20 @@ public class Halloween extends SoloGame "Kill the Pumpkin King" }); - this.DamagePvP.setOption(false); + this.DamagePvP = false; - this.WorldTimeSet.setOption(16000); + this.WorldTimeSet = 16000; - this.ItemDrop.setOption(false); - this.ItemPickup.setOption(false); + this.ItemDrop = false; + this.ItemPickup = false; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; //this.HungerSet = 20; - this.WorldBoundaryKill.setOption(false); + this.WorldBoundaryKill = false; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; registerChatStats( DamageDealt, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java index 406168c3c..fb4b3232c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java @@ -28,7 +28,7 @@ public abstract class CreatureBase Host = game; _name = name; - game.CreatureAllowOverride.setOption(true); + game.CreatureAllowOverride = true; _ent = loc.getWorld().spawn(loc, mobClass); @@ -40,7 +40,7 @@ public abstract class CreatureBase SpawnCustom(_ent); - game.CreatureAllowOverride.setOption(false); + game.CreatureAllowOverride = false; } public abstract void SpawnCustom(T ent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java index 7786fa3de..cff83a8df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java @@ -377,9 +377,9 @@ public class PumpkinKing extends CreatureBase for (int i=0 ; i<_minionsMax ; i++) { - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Skeleton skel = GetEntity().getWorld().spawn(GetEntity().getLocation(), Skeleton.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; Host.Manager.GetCondition().Factory().Invisible("Cloak", skel, skel, 999999, 0, false, false, false); @@ -642,13 +642,13 @@ public class PumpkinKing extends CreatureBase for (int i=0 ; i(); _allowedBlocks.add(Material.TNT); @@ -447,9 +447,9 @@ public class HideSeek extends TeamGame if (GetKits().length <= 5 + i) continue; - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Entity ent = GetKits()[5 + i].SpawnEntity(WorldData.GetDataLocs("RED").get(i)); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; Manager.GetLobby().AddKitLocation(ent, GetKits()[5 + i], WorldData.GetDataLocs("RED").get(i)); } @@ -752,7 +752,7 @@ public class HideSeek extends TeamGame if (event.GetState() != GameState.Prepare) return; - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; for (Location loc : WorldData.GetDataLocs("WHITE")) _mobs.put(loc.getWorld().spawn(loc, Sheep.class), loc); @@ -766,7 +766,7 @@ public class HideSeek extends TeamGame for (Location loc : WorldData.GetDataLocs("BROWN")) _mobs.put(loc.getWorld().spawn(loc, Cow.class), loc); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } @EventHandler(priority = EventPriority.LOW) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java index dc360286d..29abe0ef7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/holeinwall/HoleInTheWall.java @@ -50,13 +50,13 @@ public class HoleInTheWall extends SoloGame "Hole in wall" }); - DamagePvP.setOption(false); - DamagePvE.setOption(false); - DamageEvP.setOption(false); - DamageSelf.setOption(false); - DamageFall.setOption(false); - HungerSet.setOption(20); - WorldTimeSet.setOption(8000); + DamagePvP = false; + DamagePvE = false; + DamageEvP = false; + DamageSelf = false; + DamageFall = false; + HungerSet = 20; + WorldTimeSet = 8000; registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 4ddc7d6fa..93d9bb2bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -92,28 +92,28 @@ public class BombLobbers extends TeamGame implements IThrown "Last team alive wins!" }); - DamageFall.setOption(true); - DamageEvP.setOption(true); + DamageFall = true; + DamageEvP = true; - WorldWaterDamage.setOption(5); + WorldWaterDamage = 5; - PrepareFreeze.setOption(false); + PrepareFreeze = false; TeamArmor = true; TeamArmorHotbar = true; - InventoryOpenChest.setOption(false); - InventoryOpenBlock.setOption(false); + InventoryOpenChest = false; + InventoryOpenBlock = false; - ItemDrop.setOption(false); + ItemDrop = false; - BlockPlace.setOption(false); + BlockPlace = false; Manager.GetExplosion().SetLiquidDamage(false); - HungerSet.setOption(20); + HungerSet = 20; - WorldTimeSet.setOption(6000); + WorldTimeSet = 6000; registerStatTrackers( new Tracker6Kill(this), @@ -140,7 +140,7 @@ public class BombLobbers extends TeamGame implements IThrown if (WorldData.MapName.equalsIgnoreCase("Intergalactic")) { - WorldTimeSet.setOption(18000); + WorldTimeSet = 18000; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java index 1a8e8b523..3fea362b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -46,18 +46,18 @@ public class Micro extends TeamGame "Small game, big strategy!", }); - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; this.TeamArmor = true; this.TeamArmorHotbar = true; - this.InventoryClick.setOption(true); + this.InventoryClick = true; - this.ItemDrop.setOption(true); - this.ItemPickup.setOption(true); + this.ItemDrop = true; + this.ItemPickup = true; - this.BlockBreak.setOption(true); - this.BlockPlace.setOption(true); + this.BlockBreak = true; + this.BlockPlace = true; registerStatTrackers( new KillsWithinGameStatTracker(this, 8, "Annihilation") diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index 11be9b061..d4c95961f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -93,7 +93,7 @@ public class MilkCow extends SoloGame }); this.CompassEnabled = true; - this.DeathOut.setOption(false); + this.DeathOut = false; _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Milk", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); @@ -163,7 +163,7 @@ public class MilkCow extends SoloGame for (Location loc : _chickens) { - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Chicken ent = loc.getWorld().spawn(loc, Chicken.class); if (Math.random() > 0.75) { @@ -171,12 +171,12 @@ public class MilkCow extends SoloGame ent.setAgeLock(true); } - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } for (Location loc : _pigs) { - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Pig ent = loc.getWorld().spawn(loc, Pig.class); if (Math.random() > 0.75) { @@ -184,12 +184,12 @@ public class MilkCow extends SoloGame ent.setAgeLock(true); } - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } for (Location loc : _villager) { - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Villager ent = loc.getWorld().spawn(loc, Villager.class); if (Math.random() > 0.75) { @@ -197,7 +197,7 @@ public class MilkCow extends SoloGame ent.setCustomNameVisible(true); } - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } } @@ -249,7 +249,7 @@ public class MilkCow extends SoloGame while (_herd.size() < 5) { - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Cow cow = host.getWorld().spawn(host.getLocation(), Cow.class); if (Math.random() > 0.5) { @@ -258,7 +258,7 @@ public class MilkCow extends SoloGame } _herd.add(cow); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index fdb3d0f5b..3931b7f3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -260,21 +260,21 @@ public class MineStrike extends TeamGame _shopManager = new ShopManager(this); - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - AnnounceStay.setOption(false); + AnnounceStay = false; - this.HungerSet.setOption(20); + this.HungerSet = 20; - this.ItemDrop.setOption(true); + this.ItemDrop = true; - this.DeathTeleport.setOption(false); + this.DeathTeleport = false; - this.InventoryClick.setOption(true); + this.InventoryClick = true; - this.JoinInProgress.setOption(true); + this.JoinInProgress = true; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); @@ -2923,12 +2923,12 @@ public class MineStrike extends TeamGame if (event.getMessage().contains("god")) { - if (HealthSet.getOption() == 20) - HealthSet.setOption(-1); + if (HealthSet == 20) + HealthSet = -1; else - HealthSet.setOption(20); + HealthSet = 20; - Announce(C.cPurple + C.Bold + "God Mode: " + ChatColor.RESET + (HealthSet.getOption() == 20)); + Announce(C.cPurple + C.Bold + "God Mode: " + ChatColor.RESET + (HealthSet == 20)); event.setCancelled(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java index cd68be98a..ca74c8d3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java @@ -70,16 +70,16 @@ public class MineWare extends SoloGame "Other players lose one life.", "Last player with lives wins!" }); - DamageTeamSelf.setOption(true); - DamagePvP.setOption(false); - DamagePvE.setOption(false); - DamageEvP.setOption(false); - DamageFall.setOption(false); - InventoryClick.setOption(true); - DamageSelf.setOption(false); - DeathOut.setOption(false); - AutomaticRespawn.setOption(false); - DeathMessages.setOption(false); + DamageTeamSelf = true; + DamagePvP = false; + DamagePvE = false; + DamageEvP = false; + DamageFall = false; + InventoryClick = true; + DamageSelf = false; + DeathOut = false; + AutomaticRespawn = false; + DeathMessages = false; Manager.GetCreature().SetDisableCustomDrops(true); @@ -298,7 +298,7 @@ public class MineWare extends SoloGame @EventHandler public void PlayerMoveCancel(PlayerMoveEvent event) { - if (!PrepareFreeze.getOption()) + if (!PrepareFreeze) return; if (!_orderWaiting) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java index 7bb69b813..c472b72f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java @@ -81,7 +81,7 @@ public class ChallengeDragonEgg extends Challenge block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0, 11, ViewDist.MAX, UtilServer.getPlayers()); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; for (int i = 0; i < 10; i++) { @@ -106,7 +106,7 @@ public class ChallengeDragonEgg extends Challenge } } - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java index cb064206f..fbb0f7dd4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeHitTargets.java @@ -100,13 +100,13 @@ public class ChallengeHitTargets extends Challenge @Override public void cleanupRoom() { - Host.DamagePvP.setOption(false); + Host.DamagePvP = false; } @Override public void setupPlayers() { - Host.DamagePvP.setOption(true); + Host.DamagePvP = true; ArrayList players = getChallengers(); for (Player player : players) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java index b245d85b2..2ce37789a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java @@ -126,7 +126,7 @@ public class ChallengeMilkACow extends Challenge } } - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; _villager = (Villager) getCenter().getWorld().spawnEntity(getCenter().clone().add(0, 1, 0), EntityType.VILLAGER); _villager.setProfession(Profession.FARMER); _villager.setCustomName(C.Bold + "Farmer Joe"); @@ -156,7 +156,7 @@ public class ChallengeMilkACow extends Challenge _milked.put(cow, new ArrayList()); } - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java index 5ddb01042..1b84f183d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNameThatSound.java @@ -184,7 +184,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms Collections.shuffle(entityType); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; int i = 0; @@ -205,7 +205,7 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms } } - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java index e96e53320..5bf0b4bab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java @@ -52,7 +52,7 @@ public class ChallengeShootChickens extends Challenge arrow.remove(); } - Host.DamagePvE.setOption(false); + Host.DamagePvE = false; } @EventHandler @@ -140,9 +140,9 @@ public class ChallengeShootChickens extends Challenge { Location loc = getCenter().clone().add(UtilMath.r(20) - 10, 15, UtilMath.r(20) - 10); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; Chicken chicken = (Chicken) loc.getWorld().spawnEntity(loc, EntityType.CHICKEN); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; chicken.setMaxHealth(0.1); chicken.setHealth(0.1); @@ -164,7 +164,7 @@ public class ChallengeShootChickens extends Challenge _killedChickens.put(player.getName(), 0); } - Host.DamagePvE.setOption(true); + Host.DamagePvE = true; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java index e531e11bb..1408f1d2d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSkyFall.java @@ -42,7 +42,7 @@ public class ChallengeSkyFall extends Challenge @Override public void cleanupRoom() { - Host.DamageEvP.setOption(false); + Host.DamageEvP = false; } @EventHandler @@ -66,7 +66,7 @@ public class ChallengeSkyFall extends Challenge { setBorder(-50, 50, 0, 254, -50, 50); - Host.DamageEvP.setOption(true); + Host.DamageEvP = true; for (Player player : getChallengers()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java index ecc477c66..7527e633b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java @@ -29,7 +29,7 @@ public class ChallengeSmashOff extends Challenge @Override public void cleanupRoom() { - Host.DamagePvP.setOption(false); + Host.DamagePvP = false; for (Player player : getChallengers()) { @@ -40,7 +40,7 @@ public class ChallengeSmashOff extends Challenge @Override public void setupPlayers() { - Host.DamagePvP.setOption(true); + Host.DamagePvP = true; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java index ed1281fb8..d7879a713 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java @@ -46,7 +46,7 @@ public class ChallengeTntLauncher extends Challenge @Override public void cleanupRoom() { - Host.Damage.setOption(true); + Host.Damage = true; for (Entity tnt : _tnt) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java index 469e107c1..ce69eba1f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java @@ -62,7 +62,7 @@ public class ChallengeVolleyPig extends Challenge public void cleanupRoom() { _pig.remove(); - Host.DamagePvE.setOption(false); + Host.DamagePvE = false; } @Override @@ -73,7 +73,7 @@ public class ChallengeVolleyPig extends Challenge player.getInventory().setItem(0, new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 1).build()); } - Host.DamagePvE.setOption(true); + Host.DamagePvE = true; } @EventHandler(priority = EventPriority.LOW) @@ -203,12 +203,12 @@ public class ChallengeVolleyPig extends Challenge @Override public void generateRoom() { - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; _pig = getCenter().getWorld().spawnEntity(getCenter().add(0, 1, 0), EntityType.PIG); UtilEnt.Vegetate(_pig); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; for (int x = -6; x <= 6; x++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java index 5d22a199a..3879c4b3b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/moba/Moba.java @@ -27,10 +27,10 @@ public class Moba extends TeamGame "..." }); - this.DeathOut.setOption(false); - this.DeathSpectateSecs.setOption(8.0); + this.DeathOut = false; + this.DeathSpectateSecs = 8; - this.HungerSet.setOption(20); + this.HungerSet = 20; registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java index d9f29d257..65af10219 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/Ball.java @@ -155,13 +155,13 @@ public class Ball if (_ballDeadTime > 0 && (_firstSpawn || UtilTime.elapsed(_ballDeadTime, 6000))) { //Spawn - _host.CreatureAllowOverride.setOption(true); + _host.CreatureAllowOverride = true; _ball = _ballSpawn.getWorld().spawn(_ballSpawn, Slime.class); _ball.setSize(2); UtilEnt.Vegetate(_ball); UtilEnt.ghost(_ball, false, false); - _host.CreatureAllowOverride.setOption(false); + _host.CreatureAllowOverride = false; _lastParticle = _ball.getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java index 0f90122e4..bc413c4da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/MonsterLeague.java @@ -54,12 +54,12 @@ public class MonsterLeague extends TeamGame "CHEESE IZ DELISH" }); - this.PrepareFreeze.setOption(false); - this.DamagePvP.setOption(false); - this.HungerSet.setOption(20); - this.HealthSet.setOption(20); + this.PrepareFreeze = false; + this.DamagePvP = false; + this.HungerSet = 20; + this.HealthSet = 20; - this.DeathOut.setOption(false); + this.DeathOut = false; this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java index 385e643c8..3d1d29c40 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java @@ -513,7 +513,7 @@ public class Maze implements Listener } Location loc = UtilAlg.Random(validSpawns); - _host.CreatureAllowOverride.setOption(true); + _host.CreatureAllowOverride = true; Snowman ent = loc.getWorld().spawn(loc, Snowman.class); DisguiseBase disguise = DisguiseFactory.createDisguise(ent, _host.getMonsterType()); @@ -528,7 +528,7 @@ public class Maze implements Listener ((DisguiseMagmaCube) disguise).SetSize(3); } - _host.CreatureAllowOverride.setOption(false); + _host.CreatureAllowOverride = false; UtilEnt.Vegetate(ent, true); UtilEnt.ghost(ent, true, false); @@ -551,7 +551,7 @@ public class Maze implements Listener while (spawned <= numToSpawn) { - _host.CreatureAllowOverride.setOption(true); + _host.CreatureAllowOverride = true; Snowman ent = loc.getWorld().spawn(loc, Snowman.class); DisguiseBase disguise = DisguiseFactory.createDisguise(ent, _host.getMonsterType()); @@ -566,7 +566,7 @@ public class Maze implements Listener ((DisguiseMagmaCube) disguise).SetSize(3); } - _host.CreatureAllowOverride.setOption(false); + _host.CreatureAllowOverride = false; UtilEnt.Vegetate(ent, true); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index ab5fb7a14..d52c5039b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -81,16 +81,16 @@ public class MonsterMaze extends SoloGame "Make it to a Safe Pad or be killed!" }); - DamagePvP.setOption(false); - DamagePvE.setOption(false); + DamagePvP = false; + DamagePvE = false; - DamageFall.setOption(false); + DamageFall = false; - HungerSet.setOption(20); + HungerSet = 20; - PrepareFreeze.setOption(false); + PrepareFreeze = false; - HungerSet.setOption(20); + HungerSet = 20; CompassEnabled = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java index 772d2769a..e127ed2aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/OldMineWare.java @@ -73,19 +73,19 @@ public class OldMineWare extends SoloGame "Last player with lives wins!" }); - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; - this.DamagePvP.setOption(false); + this.DamagePvP = false; - this.BlockPlace.setOption(true); - this.BlockBreak.setOption(true); + this.BlockPlace = true; + this.BlockBreak = true; - this.ItemDrop.setOption(true); - this.ItemPickup.setOption(true); + this.ItemDrop = true; + this.ItemPickup = true; - InventoryOpenBlock.setOption(true); - InventoryOpenChest.setOption(true); - InventoryClick.setOption(true); + InventoryOpenBlock = true; + InventoryOpenChest = true; + InventoryClick = true; PopulateOrders(); @@ -299,14 +299,14 @@ public class OldMineWare extends SoloGame Location loc = _mobLocs.get(UtilMath.r(_mobLocs.size())).clone().add(new Vector(0.5,1,0.5)); double r = Math.random(); - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Pig.class)); else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Cow.class)); else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Chicken.class)); else _mobs.add(loc.getWorld().spawn(loc, Sheep.class)); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } if (_ghast == null || !_ghast.isValid()) @@ -314,9 +314,9 @@ public class OldMineWare extends SoloGame if (_ghast != null) _ghast.remove(); - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; _ghast = _ghastLoc.getWorld().spawn(_ghastLoc, Ghast.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; _ghast.setMaxHealth(10000); _ghast.setHealth(_ghast.getMaxHealth()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java index 3dd7f69f9..a3bc65606 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/Order.java @@ -48,10 +48,10 @@ public abstract class Order implements Listener public void EndOrder() { - Host.BlockBreakAllow.getOption().clear(); - Host.BlockPlaceAllow.getOption().clear(); - Host.ItemDropAllow.getOption().clear(); - Host.ItemPickupAllow.getOption().clear(); + Host.BlockBreakAllow.clear(); + Host.BlockPlaceAllow.clear(); + Host.ItemDropAllow.clear(); + Host.ItemPickupAllow.clear(); Uninitialize(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java index acdece832..1ed1a32fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderGather.java @@ -32,8 +32,8 @@ public abstract class OrderGather extends Order public void SubInitialize() { _counter.clear(); - Host.BlockBreakAllow.getOption().add(_id); - Host.ItemPickupAllow.getOption().add(_id); + Host.BlockBreakAllow.add(_id); + Host.ItemPickupAllow.add(_id); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java index 5b82fdb9d..89e24c25f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/oldmineware/order/OrderPlace.java @@ -30,7 +30,7 @@ public abstract class OrderPlace extends Order public void SubInitialize() { _counter.clear(); - Host.BlockPlaceAllow.getOption().add(_id); + Host.BlockPlaceAllow.add(_id); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 887444531..0d51c64a0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -100,11 +100,11 @@ public class Paintball extends TeamGame "Last team alive wins!" }); - StrictAntiHack.setOption(true); + StrictAntiHack = true; - HungerSet.setOption(20); + HungerSet = 20; - InventoryClick.setOption(false); + InventoryClick = false; TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java index 107cbae90..a42d2592b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java @@ -39,9 +39,9 @@ public class PlayerCopyPaintball Location entLoc = owner.getLocation(); entLoc.setPitch(0F); - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; _ent = owner.getWorld().spawn(owner.getLocation(), ArmorStand.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java index 388c48650..e3a2bf311 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java @@ -72,17 +72,17 @@ public class Quiver extends SoloGame "First player to 20 kills wins." }); - this.HungerSet.setOption(20); - this.DeathOut.setOption(false); - this.DamageSelf.setOption(false); - this.DamageTeamSelf.setOption(true); - this.PrepareFreeze.setOption(false); - this.BlockBreakAllow.getOption().add(102); - this.BlockBreakAllow.getOption().add(20); - this.BlockBreakAllow.getOption().add(Material.STAINED_GLASS_PANE.getId()); - this.BlockBreakAllow.getOption().add(Material.STAINED_GLASS.getId()); + this.HungerSet = 20; + this.DeathOut = false; + this.DamageSelf = false; + this.DamageTeamSelf = true; + this.PrepareFreeze = false; + this.BlockBreakAllow.add(102); + this.BlockBreakAllow.add(20); + this.BlockBreakAllow.add(Material.STAINED_GLASS_PANE.getId()); + this.BlockBreakAllow.add(Material.STAINED_GLASS.getId()); - this.DeathSpectateSecs.setOption(1.0); + this.DeathSpectateSecs = 1; _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java index dd8ebcc07..4626d4f24 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java @@ -54,14 +54,14 @@ public class QuiverTeams extends TeamGame "First team to 60 kills wins." }); - this.HungerSet.setOption(20); - this.DeathOut.setOption(false); - this.DamageSelf.setOption(false); - this.DamageTeamSelf.setOption(false); - this.PrepareFreeze.setOption(false); - this.BlockBreakAllow.getOption().add(102); - this.BlockBreakAllow.getOption().add(20); - this.BlockBreakAllow.getOption().add(18); + this.HungerSet = 20; + this.DeathOut = false; + this.DamageSelf = false; + this.DamageTeamSelf = false; + this.PrepareFreeze = false; + this.BlockBreakAllow.add(102); + this.BlockBreakAllow.add(20); + this.BlockBreakAllow.add(18); this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 1fe284e99..10f901cd1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -60,11 +60,11 @@ public class Runner extends SoloGame implements IThrown "Last player alive wins!" }); - this.DamagePvP.setOption(false); - this.HungerSet.setOption(20); - this.WorldWaterDamage.setOption(4); + this.DamagePvP = false; + this.HungerSet = 20; + this.WorldWaterDamage = 4; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; registerStatTrackers(new DistanceTraveledStatTracker(this, "MarathonRunner")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java index 301fb8ee1..ebb419815 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java @@ -62,14 +62,14 @@ public class SearchAndDestroy extends TeamGame setKits(_kitManager.get_kits()); _evolve = new KitEvolve(manager.getPlugin(), this, _kitManager.getUpgradeKits()); - InventoryClick.setOption(true); - WorldTimeSet.setOption(-1); - WorldBoundaryKill.setOption(false); - HungerSet.setOption(20); - AnnounceJoinQuit.setOption(false); - DisableKillCommand.setOption(false); + InventoryClick = true; + WorldTimeSet = -1; + WorldBoundaryKill = false; + HungerSet = 20; + AnnounceJoinQuit = false; + DisableKillCommand = false; AllowParticles = false; - DamageSelf.setOption(false); + DamageSelf = false; Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName); @@ -194,7 +194,7 @@ public class SearchAndDestroy extends TeamGame bomb.getBlockLocation().getWorld().playSound(bomb.getBlockLocation(), Sound.EXPLODE, 1000, 0); bomb.getBlockLocation().getWorld().playEffect(bomb.getBomb().getLocation(), Effect.EXPLOSION_HUGE, 0); bomb.removeBomb(); - DeathMessages.setOption(false); + DeathMessages = false; for (Player player : this.GetPlayers(true)) { GameTeam pTeam = GetTeam(player); @@ -208,7 +208,7 @@ public class SearchAndDestroy extends TeamGame } } } - DeathMessages.setOption(true); + DeathMessages = true; // TODO The code below could be used when a team is defeated. /* if (getBombs().size() == 1) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java index 1cd8a00b7..3c22b71c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/TeamBomb.java @@ -107,9 +107,9 @@ class TeamBomb implements Comparable _bombEntity.remove(); loc = _bombEntity.getLocation(); } - _game.CreatureAllowOverride.setOption(true); + _game.CreatureAllowOverride = true; EntityTNTPrimed entity = new EntityTNTPrimed(((CraftWorld) getBlockLocation().getWorld()).getHandle()); - _game.CreatureAllowOverride.setOption(false); + _game.CreatureAllowOverride = false; double x = loc.getX(); double y = loc.getY() + 0.2; double z = loc.getZ(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java index 847de358d..09c03515c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java @@ -141,12 +141,12 @@ public class SheepGame extends TeamGame "Most sheep at 5 minutes wins!" }); - this.DeathOut.setOption(false); - this.DeathSpectateSecs.setOption(6.0); + this.DeathOut = false; + this.DeathSpectateSecs = 6; - this.HungerSet.setOption(20); + this.HungerSet = 20; - this.WorldTimeSet.setOption(2000); + this.WorldTimeSet = 2000; this.TeamArmor = true; this.TeamArmorHotbar = true; @@ -225,12 +225,12 @@ public class SheepGame extends TeamGame public void SheepSpawn() { //Spawn Sheep - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Sheep sheep = _sheepSpawns.get(0).getWorld().spawn(UtilAlg.Random(_sheepSpawns), Sheep.class); sheep.setAdult(); sheep.setMaxHealth(2048); sheep.setHealth(2048); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; _sheep.put(sheep, new SheepData(this, sheep)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 04c7b2a02..70cb11fd8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -145,46 +145,46 @@ public abstract class Skywars extends Game }, description); - PrepareFreeze.setOption(true); + PrepareFreeze = true; - AnnounceStay.setOption(false); + AnnounceStay = false; HideTeamSheep = true; CompassEnabled = true; - StrictAntiHack.setOption(true); + StrictAntiHack = true; - GameTimeout.setOption(1500000L); + GameTimeout = 1500000L; - DeathDropItems.setOption(true); + DeathDropItems = true; - QuitDropItems.setOption(true); + QuitDropItems = true; - WorldTimeSet.setOption(0); - WorldBoundaryKill.setOption(false); + WorldTimeSet = 0; + WorldBoundaryKill = false; - DamageSelf.setOption(true); - DamageTeamSelf.setOption(true); - DamageEvP.setOption(true); - Damage.setOption(true); + DamageSelf = true; + DamageTeamSelf = true; + DamageEvP = true; + Damage = true; - DeathDropItems.setOption(true); + DeathDropItems = true; - ItemDrop.setOption(true); - ItemPickup.setOption(true); + ItemDrop = true; + ItemPickup = true; - BlockBreak.setOption(true); - BlockPlace.setOption(true); + BlockBreak = true; + BlockPlace = true; - InventoryClick.setOption(true); - InventoryOpenBlock.setOption(true); - InventoryOpenChest.setOption(true); + InventoryClick = true; + InventoryOpenBlock = true; + InventoryOpenChest = true; PlaySoundGameStart = true; PrepareTime = 10000L; - DontAllowOverfill.setOption(true); + DontAllowOverfill = true; _oreHider = new OreHider(); @@ -265,14 +265,14 @@ public abstract class Skywars extends Game for (Location loc : WorldData.GetDataLocs("RED")) { //Spawn - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; Zombie zombie = (Zombie) loc.getWorld().spawn(loc, Zombie.class); zombie.setRemoveWhenFarAway(false); zombie.setCustomName(C.cDRed + "Zombie Guardian"); zombie.setCustomNameVisible(true); zombie.setMaxHealth(15); zombie.setHealth(15); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; // Armor - Make sure the player can't get it! zombie.getEquipment().setHelmet( @@ -474,7 +474,7 @@ public abstract class Skywars extends Game if (!UtilTime.elapsed(this.GetStateTime(), 5000)) return; - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; for (Location loc : GetTeamList().get(0).GetSpawns()) { Chicken chicken = loc.getWorld().spawn(loc.clone().add(0, 1, 0), Chicken.class); @@ -485,7 +485,7 @@ public abstract class Skywars extends Game chicken.setMaxHealth(4); chicken.setHealth(4); } - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; _lastChicken = System.currentTimeMillis(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java index 6ae3c2b0f..d5262599d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/SoloSkywars.java @@ -34,7 +34,7 @@ public class SoloSkywars extends Skywars "Last player alive wins!" }); - this.DamageTeamSelf.setOption(true); + this.DamageTeamSelf = true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java index 5ba1b38a4..7eb916b53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java @@ -46,13 +46,13 @@ public class TeamSkywars extends Skywars "Last team alive wins!" }); - this.FillTeamsInOrderToCount.setOption(2); + this.FillTeamsInOrderToCount = 2; - this.SpawnNearAllies.setOption(true); + this.SpawnNearAllies = true; - this.DamageTeamSelf.setOption(false); + this.DamageTeamSelf = false; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java index c29033dff..c8c1a5082 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SoloSuperSmash.java @@ -32,7 +32,7 @@ public class SoloSuperSmash extends SuperSmash "Last player alive wins!" }); - this.DamageTeamSelf.setOption(true); + this.DamageTeamSelf = true; registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 1529c6c67..23c7ff8a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -116,13 +116,13 @@ public abstract class SuperSmash extends Game },description); - this.DeathOut.setOption(false); + this.DeathOut = false; this.CompassEnabled = true; - this.DeathSpectateSecs.setOption(4.0); + this.DeathSpectateSecs = 4; - this.WorldWaterDamage.setOption(1000); + this.WorldWaterDamage = 1000; this.HideTeamSheep = true; @@ -241,9 +241,9 @@ public abstract class SuperSmash extends Game } else { - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; _powerup = _powerupTarget.getWorld().spawn(_powerupTarget, EnderCrystal.class); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; _powerupTarget.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 8bf949f6e..8ae71d3b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -46,14 +46,14 @@ public class TeamSuperSmash extends SuperSmash }); this.PlayersPerTeam = 2; - this.FillTeamsInOrderToCount.setOption(2); + this.FillTeamsInOrderToCount = 2; - this.SpawnNearAllies.setOption(true); - this.DamageTeamSelf.setOption(false); + this.SpawnNearAllies = true; + this.DamageTeamSelf = false; this.TeamArmorHotbar = true; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; registerChatStats( Kills, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java index 440f9aeec..5981b1303 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java @@ -116,9 +116,9 @@ public class KitKnight extends SmashKit Manager.GetDisguise().disguise(disguise); //Horse - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; final Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; //Owner horse.setTamed(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index 41ad6c563..0a403c85e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -132,7 +132,7 @@ public class KitSkySquid extends SmashKit @Override public void activateSuperCustom(Player player) { - Manager.GetGame().WorldWeatherEnabled.setOption(true); + Manager.GetGame().WorldWeatherEnabled = true; Manager.GetGame().WorldData.World.setStorm(true); Manager.GetGame().WorldData.World.setThundering(true); Manager.GetGame().WorldData.World.setThunderDuration(9999); @@ -141,6 +141,6 @@ public class KitSkySquid extends SmashKit @Override public void deactivateSuperCustom(Player player) { - Manager.GetGame().WorldWeatherEnabled.setOption(false); + Manager.GetGame().WorldWeatherEnabled = false; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java index 1cb90b820..d398bba74 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkCowAngryHerd.java @@ -86,10 +86,10 @@ public class PerkCowAngryHerd extends SmashPerk loc.add(dir); loc.add(UtilAlg.getLeft(dir).multiply(i*1.5)); - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Class clazz = isSuperActive(player) ? MushroomCow.class : Cow.class; Cow cow = player.getWorld().spawn(loc, clazz); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; _active.add(new DataCowCharge(player, cow)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java index 2b7791b14..0c4b96110 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java @@ -100,9 +100,9 @@ public class Snake extends SoloGame "Last one alive wins!" }); - this.DamageTeamSelf.setOption(true); + this.DamageTeamSelf = true; - this.HungerSet.setOption(2); + this.HungerSet = 2; this.GemMultiplier = 0.5; @@ -130,9 +130,9 @@ public class Snake extends SoloGame Player player = GetPlayers(true).get(i); _color.put(player, DyeColor.getByDyeData((byte) (i % 16))); - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Sheep sheep = player.getWorld().spawn(player.getLocation(), Sheep.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; sheep.setColor(DyeColor.getByDyeData((byte) (i % 16))); sheep.setPassenger(player); @@ -380,9 +380,9 @@ public class Snake extends SoloGame return; //Spawn - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Slime pig = loc.getWorld().spawn(loc, Slime.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; pig.setSize(2); UtilEnt.Vegetate(pig); @@ -444,9 +444,9 @@ public class Snake extends SoloGame loc.subtract(player.getLocation().getDirection().setY(0)); //Spawn - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Sheep tail = loc.getWorld().spawn(loc, Sheep.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; tail.setRemoveWhenFarAway(false); tail.setColor(_color.get(player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java index 5f9204063..0c19539cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java @@ -72,12 +72,12 @@ public class SneakyAssassins extends SoloGame this._npcManager = new NpcManager(this, UtilMath.random); - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - this.DamageTeamSelf.setOption(true); - this.PrepareFreeze.setOption(false); + this.DamageTeamSelf = true; + this.PrepareFreeze = false; - this.HungerSet.setOption(20); + this.HungerSet = 20; this.CompassEnabled = true; this.CompassGiveItem = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java index 60ab6e669..f491bfa88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java @@ -48,12 +48,12 @@ public class NpcManager implements Listener { Location spawn = getNpcSpawn(); - getGame().CreatureAllowOverride.setOption(true); + getGame().CreatureAllowOverride = true; LivingEntity npc = (LivingEntity) spawn.getWorld().spawn(spawn, getDisguiseType().getEntityClass()); npc.setCanPickupItems(false); npc.setRemoveWhenFarAway(false); UtilEnt.Vegetate(npc); - getGame().CreatureAllowOverride.setOption(false); + getGame().CreatureAllowOverride = false; return npc; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java index e53f49927..70cce7b1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java @@ -103,9 +103,9 @@ public class PowerUpItem UtilFirework.playFirework(itemLocation, effect); - _powerUpManager.getGame().CreatureAllowOverride.setOption(true); + _powerUpManager.getGame().CreatureAllowOverride = true; _npc = itemLocation.getWorld().spawn(itemLocation, Skeleton.class); - _powerUpManager.getGame().CreatureAllowOverride.setOption(false); + _powerUpManager.getGame().CreatureAllowOverride = false; UtilEnt.Vegetate(_npc); UtilEnt.ghost(_npc, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java index f25a2f0c8..9aaf3396d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/SnowFight.java @@ -95,9 +95,9 @@ public class SnowFight extends TeamGame "Last team alive wins!" }); - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; - this.HungerSet.setOption(20); + this.HungerSet = 20; this.CompassEnabled = true; this.CompassGiveItem = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 1088ec236..ea2b2960e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -166,20 +166,20 @@ public class SpeedBuilders extends SoloGame "Last person left wins!" }); - Damage.setOption(false); + Damage = false; - HungerSet.setOption(20); - HealthSet.setOption(20); + HungerSet = 20; + HealthSet = 20; - DontAllowOverfill.setOption(true); + DontAllowOverfill = true; - DeathMessages.setOption(false); + DeathMessages = false; FixSpawnFacing = false; AllowParticles = false; - InventoryClick.setOption(true); + InventoryClick = true; registerStatTrackers( new DependableTracker(this), @@ -323,7 +323,7 @@ public class SpeedBuilders extends SoloGame } } - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; for (MobData mobData : buildData.Mobs) { @@ -337,16 +337,16 @@ public class SpeedBuilders extends SoloGame _middleMobs.add(entity); } - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; } public void spawnJudge() { - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; _judgeEntity = _judgeSpawn.getWorld().spawn(_judgeSpawn, ArmorStand.class); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; _judgeEntity.setVisible(false); _judgeEntity.setGravity(false); @@ -391,11 +391,11 @@ public class SpeedBuilders extends SoloGame if (_judgeLaserTarget != null) judgeTargetLocation(null); - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; _judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; _judgeLaserTarget.setVisible(false); _judgeLaserTarget.setGravity(false); @@ -787,8 +787,8 @@ public class SpeedBuilders extends SoloGame recreation.breakAndDropItems(); } - ItemPickup.setOption(true); - BlockPlace.setOption(true); + ItemPickup = true; + BlockPlace = true; _buildCountStage = 0; @@ -855,8 +855,8 @@ public class SpeedBuilders extends SoloGame _perfectBuild.clear(); - ItemPickup.setOption(false); - BlockPlace.setOption(false); + ItemPickup = false; + BlockPlace = false; RecreationData lowest = null; int lowestScore = -1; @@ -1589,14 +1589,14 @@ public class SpeedBuilders extends SoloGame if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block)) return; - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; Entity entity = block.getWorld().spawnEntity(block.getLocation().add(0.5, 0, 0.5), type); UtilEnt.Vegetate(entity, true); UtilEnt.ghost(entity, true, false); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; _buildRecreations.get(event.getPlayer()).Mobs.add(entity); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index b922a9216..268434338 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -183,7 +183,7 @@ public class RecreationData } } - Game.CreatureAllowOverride.setOption(true); + Game.CreatureAllowOverride = true; for (MobData mobData : buildData.Mobs) { @@ -197,7 +197,7 @@ public class RecreationData Mobs.add(entity); } - Game.CreatureAllowOverride.setOption(false); + Game.CreatureAllowOverride = false; } public void breakAndDropItems() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index 3723f3350..a06235e88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -57,10 +57,10 @@ public class Spleef extends SoloGame "Last player alive wins!" }); - this.DamagePvP.setOption(false); - this.WorldWaterDamage.setOption(4); + this.DamagePvP = false; + this.WorldWaterDamage = 4; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; registerStatTrackers(new SpleefBlockDestroyStatTracker(this)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java index dfe60b4ee..47ea38230 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/SpleefTeams.java @@ -53,10 +53,10 @@ public class SpleefTeams extends TeamGame "Last team alive wins!" }); - this.DamagePvP.setOption(false); - this.WorldWaterDamage.setOption(4); + this.DamagePvP = false; + this.WorldWaterDamage = 4; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; this.TeamArmor = true; this.TeamArmorHotbar = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java index 6618bc8f4..a77b8817b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/SquidShooter.java @@ -44,12 +44,12 @@ public class SquidShooter extends SoloGame "First player to 20 kills wins." }); - this.DeathOut.setOption(false); - this.DamageSelf.setOption(false); - this.DamageTeamSelf.setOption(true); - this.PrepareFreeze.setOption(false); + this.DeathOut = false; + this.DamageSelf = false; + this.DamageTeamSelf = true; + this.PrepareFreeze = false; this.CompassEnabled = true; - this.KitRegisterState.setOption(GameState.Prepare); + this.KitRegisterState = GameState.Prepare; registerChatStats(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java index 8b4b2b5ec..93fd43c1e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java @@ -70,9 +70,9 @@ public class Stacker extends SoloGame implements IThrown Location loc = GetTeamList().get(0).GetSpawns().get(UtilMath.r(GetTeamList().get(0).GetSpawns().size())); //Spawn - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Pig pig = loc.getWorld().spawn(loc, Pig.class); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java index 6c25ba164..2c71759e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SoloSurvivalGames.java @@ -39,7 +39,7 @@ public class SoloSurvivalGames extends SurvivalGames "Last tribute alive wins!" }); - this.DamageTeamSelf.setOption(true); + this.DamageTeamSelf = true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index ea758c1b7..b39c25164 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -184,60 +184,60 @@ public abstract class SurvivalGames extends Game // Manager.GetAntiStack().SetEnabled(false); - StrictAntiHack.setOption(true); + StrictAntiHack = true; - AnnounceStay.setOption(false); + AnnounceStay = false; HideTeamSheep = true; this.ReplaceTeamsWithKits = true; - GameTimeout.setOption((long)1500000); + GameTimeout = 1500000; - QuitDropItems.setOption(true); + QuitDropItems = true; - WorldTimeSet.setOption(0); - WorldBoundaryKill.setOption(false); + WorldTimeSet = 0; + WorldBoundaryKill = false; - DamageSelf.setOption(true); - DamageTeamSelf.setOption(true); + DamageSelf = true; + DamageTeamSelf = true; - DeathDropItems.setOption(true); + DeathDropItems = true; - ItemDrop.setOption(true); - ItemPickup.setOption(true); + ItemDrop = true; + ItemPickup = true; - InventoryClick.setOption(true); - InventoryOpenBlock.setOption(true); - InventoryOpenChest.setOption(true); + InventoryClick = true; + InventoryOpenBlock = true; + InventoryOpenChest = true; PlaySoundGameStart = false; PrepareTime = 15000; DeadBodies = true; - BlockBreakAllow.getOption().add(Material.WEB.getId()); // Web - BlockPlaceAllow.getOption().add(Material.WEB.getId()); + BlockBreakAllow.add(Material.WEB.getId()); // Web + BlockPlaceAllow.add(Material.WEB.getId()); - BlockBreakAllow.getOption().add(Material.LEAVES.getId()); // Leaves - BlockBreakAllow.getOption().add(Material.LEAVES_2.getId()); // Leaves + BlockBreakAllow.add(Material.LEAVES.getId()); // Leaves + BlockBreakAllow.add(Material.LEAVES_2.getId()); // Leaves - BlockPlaceAllow.getOption().add(Material.CAKE_BLOCK.getId()); - BlockBreakAllow.getOption().add(Material.CAKE_BLOCK.getId()); + BlockPlaceAllow.add(Material.CAKE_BLOCK.getId()); + BlockBreakAllow.add(Material.CAKE_BLOCK.getId()); - BlockBreakAllow.getOption().add(Material.LONG_GRASS.getId()); - BlockBreakAllow.getOption().add(Material.RED_ROSE.getId()); - BlockBreakAllow.getOption().add(Material.YELLOW_FLOWER.getId()); - BlockBreakAllow.getOption().add(Material.BROWN_MUSHROOM.getId()); - BlockBreakAllow.getOption().add(Material.RED_MUSHROOM.getId()); - BlockBreakAllow.getOption().add(Material.DEAD_BUSH.getId()); - BlockBreakAllow.getOption().add(Material.CARROT.getId()); - BlockBreakAllow.getOption().add(Material.POTATO.getId()); - BlockBreakAllow.getOption().add(Material.DOUBLE_PLANT.getId()); - BlockBreakAllow.getOption().add(Material.CROPS.getId()); - BlockBreakAllow.getOption().add(Material.SAPLING.getId()); - BlockBreakAllow.getOption().add(Material.VINE.getId()); - BlockBreakAllow.getOption().add(Material.WATER_LILY.getId()); + BlockBreakAllow.add(Material.LONG_GRASS.getId()); + BlockBreakAllow.add(Material.RED_ROSE.getId()); + BlockBreakAllow.add(Material.YELLOW_FLOWER.getId()); + BlockBreakAllow.add(Material.BROWN_MUSHROOM.getId()); + BlockBreakAllow.add(Material.RED_MUSHROOM.getId()); + BlockBreakAllow.add(Material.DEAD_BUSH.getId()); + BlockBreakAllow.add(Material.CARROT.getId()); + BlockBreakAllow.add(Material.POTATO.getId()); + BlockBreakAllow.add(Material.DOUBLE_PLANT.getId()); + BlockBreakAllow.add(Material.CROPS.getId()); + BlockBreakAllow.add(Material.SAPLING.getId()); + BlockBreakAllow.add(Material.VINE.getId()); + BlockBreakAllow.add(Material.WATER_LILY.getId()); // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", // "chestsOpened"); @@ -452,14 +452,14 @@ public abstract class SurvivalGames extends Game if (time > 22000 || time < 14000) { - WorldTimeSet.setOption((WorldTimeSet.getOption() + 4) % 24000); + WorldTimeSet = (WorldTimeSet + 4) % 24000; } else { - WorldTimeSet.setOption((WorldTimeSet.getOption() + 16) % 24000); + WorldTimeSet = (WorldTimeSet + 16) % 24000; } - WorldData.World.setTime(WorldTimeSet.getOption()); + WorldData.World.setTime(WorldTimeSet); } @EventHandler @@ -635,7 +635,7 @@ public abstract class SurvivalGames extends Game { _deathMatchTeleported = true; - WorldTimeSet.setOption(0); + WorldTimeSet = 0; WorldData.World.setTime(15000); for (GameTeam team : GetTeamList()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index e28cba94b..9222cd907 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -172,51 +172,51 @@ public class SurvivalGamesTeams extends TeamGame setItemMerge(true); // Manager.GetAntiStack().SetEnabled(false); - this.GameTimeout.setOption((long)9600000); + this.GameTimeout = 9600000; - this.WorldTimeSet.setOption(0); - this.WorldBoundaryKill.setOption(false); + this.WorldTimeSet = 0; + this.WorldBoundaryKill = false; - SpawnNearAllies.setOption(true); - SpawnNearEnemies.setOption(true); //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split. + SpawnNearAllies = true; + SpawnNearEnemies = true; //This is to ensure theres no 'gaps' of 1 between teams, hence forcing a team to get split. - this.DamageSelf.setOption(true); - this.DamageTeamSelf.setOption(false); + this.DamageSelf = true; + this.DamageTeamSelf = false; - this.DeathDropItems.setOption(true); + this.DeathDropItems = true; - this.ItemDrop.setOption(true); - this.ItemPickup.setOption(true); + this.ItemDrop = true; + this.ItemPickup = true; this.CompassEnabled = false; //XXX - this.InventoryClick.setOption(true); - this.InventoryOpenBlock.setOption(true); - this.InventoryOpenChest.setOption(true); + this.InventoryClick = true; + this.InventoryOpenBlock = true; + this.InventoryOpenChest = true; //Blocks - this.BlockBreakAllow.getOption().add(46); //TNT - this.BlockPlaceAllow.getOption().add(46); + this.BlockBreakAllow.add(46); //TNT + this.BlockPlaceAllow.add(46); - this.BlockBreakAllow.getOption().add(30); //Web - this.BlockPlaceAllow.getOption().add(30); + this.BlockBreakAllow.add(30); //Web + this.BlockPlaceAllow.add(30); - this.BlockBreakAllow.getOption().add(132); //Tripwire - this.BlockPlaceAllow.getOption().add(132); + this.BlockBreakAllow.add(132); //Tripwire + this.BlockPlaceAllow.add(132); - this.BlockBreakAllow.getOption().add(131); //Wire Hook - this.BlockPlaceAllow.getOption().add(131); + this.BlockBreakAllow.add(131); //Wire Hook + this.BlockPlaceAllow.add(131); - this.BlockBreakAllow.getOption().add(55); //Redstone Dust - this.BlockPlaceAllow.getOption().add(55); + this.BlockBreakAllow.add(55); //Redstone Dust + this.BlockPlaceAllow.add(55); - this.BlockBreakAllow.getOption().add(72); //Wood Pressure Plate - this.BlockPlaceAllow.getOption().add(72); + this.BlockBreakAllow.add(72); //Wood Pressure Plate + this.BlockPlaceAllow.add(72); - this.BlockBreakAllow.getOption().add(69); //Lever - this.BlockPlaceAllow.getOption().add(69); + this.BlockBreakAllow.add(69); //Lever + this.BlockPlaceAllow.add(69); - this.BlockBreakAllow.getOption().add(18); //Leaves + this.BlockBreakAllow.add(18); //Leaves //SPREAD _spreadType = 1;//UtilMath.r(3); @@ -255,7 +255,7 @@ public class SurvivalGamesTeams extends TeamGame //Tournament if (Manager.IsTournamentServer()) - QuitOut.setOption(false); + QuitOut = false; } @Override @@ -1093,14 +1093,14 @@ public class SurvivalGamesTeams extends TeamGame if (time > 22000 || time < 14000) { - WorldTimeSet.setOption((WorldTimeSet.getOption() + 4)%24000); + WorldTimeSet = (WorldTimeSet + 4)%24000; } else { - WorldTimeSet.setOption((WorldTimeSet.getOption() + 16)%24000); + WorldTimeSet = (WorldTimeSet + 16)%24000; } - WorldData.World.setTime(WorldTimeSet.getOption()); + WorldData.World.setTime(WorldTimeSet); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java index 468167353..6b3c717da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java @@ -52,14 +52,14 @@ public class TeamSurvivalGames extends SurvivalGames }); this.PlayersPerTeam = 2; - this.FillTeamsInOrderToCount.setOption(2); + this.FillTeamsInOrderToCount = 2; - this.SpawnNearAllies.setOption(true); - this.SpawnNearEnemies.setOption(true); + this.SpawnNearAllies = true; + this.SpawnNearEnemies = true; - this.DamageTeamSelf.setOption(false); + this.DamageTeamSelf = false; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java index 5d4a47253..30a7e7a17 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/Tug.java @@ -71,10 +71,10 @@ public class Tug extends TeamGame }); - this.HungerSet.setOption(20); - this.DeathOut.setOption(false); + this.HungerSet = 20; + this.DeathOut = false; - this.DeathSpectateSecs.setOption(20.0); + this.DeathSpectateSecs = 20; registerChatStats(); } @@ -146,24 +146,24 @@ public class Tug extends TeamGame { if (_redCreatures.size() < 30) { - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Location loc = UtilAlg.Random(_redMobs); Creature ent = loc.getWorld().spawn(loc, Pig.class); ent.setMaxHealth(10); ent.setHealth(10); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; _redCreatures.add(new TugCreature(this, ent, _blueLives)); } if (_blueCreatures.size() < 30) { - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Location loc = UtilAlg.Random(_blueMobs); Creature ent = loc.getWorld().spawn(loc, Sheep.class); ent.setMaxHealth(10); ent.setHealth(10); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; _blueCreatures.add(new TugCreature(this, ent, _redLives)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 944890091..15952925a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -141,15 +141,15 @@ public class TurfForts extends TeamGame "Take over all the turf to win!" }); - this.StrictAntiHack.setOption(true); - this.HungerSet.setOption(20); - this.DeathOut.setOption(false); - this.BlockPlaceAllow.getOption().add(35); - this.BlockBreakAllow.getOption().add(35); - this.ItemDrop.setOption(false); - this.ItemPickup.setOption(false); - this.DamageSelf.setOption(false); - this.DeathSpectateSecs.setOption(4.0); + this.StrictAntiHack = true; + this.HungerSet = 20; + this.DeathOut = false; + this.BlockPlaceAllow.add(35); + this.BlockBreakAllow.add(35); + this.ItemDrop = false; + this.ItemPickup = false; + this.DamageSelf = false; + this.DeathSpectateSecs = 4; _breakStatTracker = new BlockBreakStatTracker(this, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index eb746548a..fd5ad26b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -116,28 +116,28 @@ public class TypeWars extends TeamGame new StaffKillMonitorManager(this); - this.DeathOut.setOption(false); - this.DamageTeamSelf.setOption(false); - this.DamageSelf.setOption(false); - this.DamageTeamOther.setOption(false); - this.DeathSpectateSecs.setOption(0.0); - this.HungerSet.setOption(20); - this.WorldBoundaryKill.setOption(true); + this.DeathOut = false; + this.DamageTeamSelf = false; + this.DamageSelf = false; + this.DamageTeamOther = false; + this.DeathSpectateSecs = 0; + this.HungerSet = 20; + this.WorldBoundaryKill = true; this.CompassEnabled = false; this.TeamArmor = true; this.TeamArmorHotbar = false; - this.WorldTimeSet.setOption(6000); - this.DamageEvP.setOption(false); - this.DamagePvE.setOption(false); - this.DamagePvP.setOption(false); + this.WorldTimeSet = 6000; + this.DamageEvP = false; + this.DamagePvE = false; + this.DamagePvP = false; this.TeamArmorHotbar = true; - this.Damage.setOption(false); - this.CreatureAllow.setOption(false); + this.Damage = false; + this.CreatureAllow = false; this.PrepareTime = 50000; - this.PrepareFreeze.setOption(false); + this.PrepareFreeze = false; this.PlaySoundGameStart = false; this.EnableTutorials = true; - this.PrepareFreeze.setOption(true); + this.PrepareFreeze = true; this.AllowParticles = false; _activeMinions = new ArrayList<>(); @@ -231,10 +231,10 @@ public class TypeWars extends TeamGame if(i == 1) loc = blue; - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Giant giant = loc.getWorld().spawn(loc, Giant.class); _giantLocs.put(giant, loc.clone()); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; giant.setRemoveWhenFarAway(false); UtilEnt.Vegetate(giant, true); UtilEnt.ghost(giant, true, false); @@ -492,10 +492,10 @@ public class TypeWars extends TeamGame continue; int rdm = UtilMath.r(_minionSpawns.get(teams).size()); - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, MinionSize.BOSS.getRandomType(), rdm); _activeMinions.add(minion); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; UtilPlayer.message(event.getPlayer(), F.main("Boss", "You have spawned a Boss")); } } @@ -531,14 +531,14 @@ public class TypeWars extends TeamGame return; } - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) - type.getCost()); UtilTextMiddle.display("", ChatColor.GRAY + "You bought a Minion.", event.getPlayer()); int rdm = UtilMath.r(_minionSpawns.get(teams).size()); Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type.getRandomType(), rdm); Bukkit.getPluginManager().callEvent(new SummonMinionEvent(event.getPlayer(), minion)); _activeMinions.add(minion); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } } return; @@ -576,7 +576,7 @@ public class TypeWars extends TeamGame { _lastSpawnedRed = System.currentTimeMillis(); - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(0)).size()); Minion minion = null; @@ -592,7 +592,7 @@ public class TypeWars extends TeamGame } _activeMinions.add(minion); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; if(_timeToSpawnRed > 5000 / (GetTeamList().get(1).GetPlayers(true).size() > 0 ? GetTeamList().get(1).GetPlayers(true).size() : 1)) _timeToSpawnRed = _timeToSpawnRed - 75; @@ -605,7 +605,7 @@ public class TypeWars extends TeamGame { _lastSpawnedBlue = System.currentTimeMillis(); - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(1)).size()); Minion minion = null; if(_minionsSpawned.get(GetTeamList().get(1)) >= 100) @@ -619,7 +619,7 @@ public class TypeWars extends TeamGame minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1), rdm); } _activeMinions.add(minion); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; if(_timeToSpawnBlue > 5000 / (GetTeamList().get(0).GetPlayers(true).size() > 0 ? GetTeamList().get(0).GetPlayers(true).size() : 1)) _timeToSpawnBlue = _timeToSpawnRed - 75; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index 7d1df558e..6c4cd2600 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -36,11 +36,11 @@ public class TutorialTypeWars extends GameTutorial { ArrayList locations = UtilShapes.getLinesDistancedPoints(_typeWars.getMinionSpawns().get(getTeam()).get(4), _typeWars.getMinionSpawns().get(team).get(4), 1); _manager.GetCreature().SetForce(true); - _manager.GetGame().CreatureAllowOverride.setOption(true); + _manager.GetGame().CreatureAllowOverride = true; Minion minion = new Minion(_manager, locations.get(locations.size() - 35), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); minion.changeName("Fishing"); ((TypeWars) _manager.GetGame()).getActiveMinions().add(minion); - _manager.GetGame().CreatureAllowOverride.setOption(false); + _manager.GetGame().CreatureAllowOverride = false; _manager.GetCreature().SetForce(false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 787e5d9d3..d543c505a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -139,57 +139,57 @@ public class UHC extends TeamGame this.HideTeamSheep = true; - this.StrictAntiHack.setOption(true); + this.StrictAntiHack = true; - AnnounceStay.setOption(false); + AnnounceStay = false; - this.GameTimeout.setOption((long)10800000); + this.GameTimeout = 10800000; - this.DamagePvP.setOption(false); + this.DamagePvP = false; - this.DeathDropItems.setOption(true); + this.DeathDropItems = true; - this.ItemDrop.setOption(true); - this.ItemPickup.setOption(true); + this.ItemDrop = true; + this.ItemPickup = true; - this.BlockBreak.setOption(true); - this.BlockPlace.setOption(true); + this.BlockBreak = true; + this.BlockPlace = true; - this.InventoryOpenBlock.setOption(true); - this.InventoryOpenChest.setOption(true); - this.InventoryClick.setOption(true); + this.InventoryOpenBlock = true; + this.InventoryOpenChest = true; + this.InventoryClick = true; - this.DeathOut.setOption(true); - this.QuitOut.setOption(false); + this.DeathOut = true; + this.QuitOut = false; - this.CreatureAllow.setOption(true); + this.CreatureAllow = true; - this.AnnounceStay.setOption(false); + this.AnnounceStay = false; - this.DisplayLobbySide.setOption(true); + this.DisplayLobbySide = true; - this.DeathMessages.setOption(false); + this.DeathMessages = false; this.SoupEnabled = false; this.CompassEnabled = true; this.CompassGiveItem = false; - this.WorldBoundaryKill.setOption(false); + this.WorldBoundaryKill = false; - this.TickPerTeleport.setOption(3); + this.TickPerTeleport = 3; this.GemBoosterEnabled = false; this.GemDoubleEnabled = false; this.GemHunterEnabled = false; - this.WorldBoneMeal.setOption(true); + this.WorldBoneMeal = true; - this.DontAllowOverfill.setOption(true); + this.DontAllowOverfill = true; - this.GadgetsDisabled.setOption(true); + this.GadgetsDisabled = true; - WorldTimeSet.setOption(-1); + WorldTimeSet = -1; CraftRecipes(); @@ -564,9 +564,9 @@ public class UHC extends TeamGame for (Player player : UtilServer.getPlayers()) player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); - this.DamagePvP.setOption(true); + this.DamagePvP = true; this.CompassGiveItem = true; - this.QuitOut.setOption(true); + this.QuitOut = true; } } @@ -579,7 +579,7 @@ public class UHC extends TeamGame if (event.getType() != UpdateType.FAST) return; - if (DamagePvP.getOption()) + if (DamagePvP) return; WorldData.World.setTime(2000); @@ -748,7 +748,7 @@ public class UHC extends TeamGame if (!IsAlive(player)) return; - if (!QuitOut.getOption()) + if (!QuitOut) return; // Drop Items @@ -1216,7 +1216,7 @@ public class UHC extends TeamGame teamsAlive.add(team); // Offline Player Team - if (!QuitOut.getOption()) + if (!QuitOut) for (GameTeam team : RejoinTeam.values()) teamsAlive.add(team); @@ -1411,7 +1411,7 @@ public class UHC extends TeamGame if (damagerEnt instanceof Player) { // PvP - if (!DamagePvP.getOption() && damagee != null) + if (!DamagePvP && damagee != null) event.setCancelled(true); Player damager = (Player) damagerEnt; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java index 8107bf6fa..e902d5f44 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java @@ -122,9 +122,9 @@ public class Valentines extends SoloGame "Slowest players are eliminated!" }); - this.DamageTeamSelf.setOption(true); - this.HungerSet.setOption(20); - this.HealthSet.setOption(20); + this.DamageTeamSelf = true; + this.HungerSet = 20; + this.HealthSet = 20; EnableTutorials = true; @@ -170,14 +170,14 @@ public class Valentines extends SoloGame { _playersOutPerRound = Math.max(1, (int)(GetPlayers(true).size()/8d)); - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; _cow = GetSpectatorLocation().getWorld().spawn(GetSpectatorLocation(), Cow.class); _cow.setCustomName(C.cGreen + C.Bold + _cowName); _cow.setCustomNameVisible(true); UtilEnt.Vegetate(_cow); UtilEnt.ghost(_cow, true, false); - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; } if (event.GetState() == GameState.End || event.GetState() == GameState.Dead) _music.cancel(); @@ -404,7 +404,7 @@ public class Valentines extends SoloGame public void pigSpawn() { - CreatureAllowOverride.setOption(true); + CreatureAllowOverride = true; int toSpawn = Math.max(1, GetPlayers(true).size()-_playersOutPerRound); @@ -432,7 +432,7 @@ public class Valentines extends SoloGame } } - CreatureAllowOverride.setOption(false); + CreatureAllowOverride = false; } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java index 752d7c668..386bc5fe1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/tutorial/TutorialValentines.java @@ -106,7 +106,7 @@ public class TutorialValentines extends GameTutorial //Spawn if (_pigs.size() < 5 && tick % 15 == 0) { - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; //Spawn Pig pig = _pigSpawn.getWorld().spawn(_pigSpawn, Pig.class); @@ -119,7 +119,7 @@ public class TutorialValentines extends GameTutorial _pigs.put(pig, 0);; - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; } //Move @@ -178,7 +178,7 @@ public class TutorialValentines extends GameTutorial } //Spawn Cows - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; _cowBoy = _pigSpawn.getWorld().spawn(Host.WorldData.GetDataLocs("BROWN").get(0), Cow.class); _cowBoy.setCustomName(C.cGreenB + "Calvin"); @@ -190,7 +190,7 @@ public class TutorialValentines extends GameTutorial _cowGirl.setCustomNameVisible(true); UtilEnt.Vegetate(_cowGirl); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; //Player Data diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java index f5cd3166d..d1348569e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopyWither.java @@ -22,9 +22,9 @@ public class PlayerCopyWither _owner = owner; - Host.CreatureAllowOverride.setOption(true); + Host.CreatureAllowOverride = true; _ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class); - Host.CreatureAllowOverride.setOption(false); + Host.CreatureAllowOverride = false; UtilEnt.ghost(_ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index 27465af58..6a6749d96 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -116,26 +116,26 @@ public class WitherGame extends TeamGame implements IBlockRestorer C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes", }); - this.DeathOut.setOption(true); - this.DamageTeamSelf.setOption(false); - this.DamageSelf.setOption(false); - this.DeathSpectateSecs.setOption(4.0); - this.HungerSet.setOption(20); - this.WorldBoundaryKill.setOption(false); + this.DeathOut = true; + this.DamageTeamSelf = false; + this.DamageSelf = false; + this.DeathSpectateSecs = 4; + this.HungerSet = 20; + this.WorldBoundaryKill = false; this.CompassEnabled = false; //Customizing for the Editor kit - this.BlockBreak.setOption(true); - this.BlockPlace.setOption(true); - this.ItemPickup.setOption(true); + this.BlockBreak = true; + this.BlockPlace = true; + this.ItemPickup = true; - this.KitRegisterState.setOption(GameState.Prepare); + this.KitRegisterState = GameState.Prepare; this.TeamArmor = true; this.TeamArmorHotbar = false; - this.InventoryClick.setOption(false); - this.InventoryOpenBlock.setOption(false); + this.InventoryClick = false; + this.InventoryOpenBlock = false; _help = new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index c125e7a37..9ab574b9b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -155,17 +155,17 @@ public class Wizards extends SoloGame _wizard = new WizardSpellMenu("Wizard Spell Menu", getArcadeManager().getPlugin(), this); - AnnounceStay.setOption(false); - BlockBreak.setOption(true); - BlockPlace.setOption(true); - ItemPickup.setOption(true); - ItemDrop.setOption(true); - InventoryOpenBlock.setOption(true); - InventoryOpenChest.setOption(true); - InventoryClick.setOption(true); - DisableKillCommand.setOption(false); + AnnounceStay = false; + BlockBreak = true; + BlockPlace = true; + ItemPickup = true; + ItemDrop = true; + InventoryOpenBlock = true; + InventoryOpenChest = true; + InventoryClick = true; + DisableKillCommand = false; SoupEnabled = false; - DamageTeamSelf.setOption(true); + DamageTeamSelf = true; registerChatStats( Kills, @@ -1716,7 +1716,7 @@ public class Wizards extends SoloGame if (_endgameMessageCounter == 6) { - WorldTimeSet.setOption(0); + WorldTimeSet = 0; WorldData.World.setTime(15000); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java index 3ebcfa50c..cdfbe7b97 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellSummonWolves.java @@ -48,12 +48,12 @@ public class SpellSummonWolves extends Spell implements SpellClick, SpellClickBl for (int i = 0; i < getSpellLevel(player); i++) { - Wizards.CreatureAllowOverride.setOption(true); + Wizards.CreatureAllowOverride = true; Wolf wolf = (Wolf) player.getWorld().spawnEntity( loc.clone().add(new Random().nextFloat() - 0.5F, 0, new Random().nextFloat() - 0.5F), EntityType.WOLF); - Wizards.CreatureAllowOverride.setOption(false); + Wizards.CreatureAllowOverride = false; wolf.setCollarColor(DyeColor.YELLOW); wolf.setTamed(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java index f944598a7..3f118fbb9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java @@ -67,8 +67,8 @@ public class ZombieSurvival extends SoloGame "The last Survivor alive wins!" }); - this.DeathOut.setOption(false); - this.HungerSet.setOption(20); + this.DeathOut = false; + this.HungerSet = 20; this.CompassEnabled = true; @@ -230,10 +230,10 @@ public class ZombieSurvival extends SoloGame if (_mobs.size() < 50) { - this.CreatureAllowOverride.setOption(true); + this.CreatureAllowOverride = true; Zombie zombie = _undead.GetSpawn().getWorld().spawn(_undead.GetSpawn(), Zombie.class); _mobs.put(zombie, new ZombieData(GetTargetLocation())); - this.CreatureAllowOverride.setOption(false); + this.CreatureAllowOverride = false; } mobIterator = _mobs.keySet().iterator(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java index e3f5c7397..b0366e539 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBatWave.java @@ -127,10 +127,10 @@ public class PerkBatWave extends SmashPerk for (int i=0 ; i<32 ; i++) { - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class); _bats.get(player).add(bat); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; } //Inform diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java index 34c3873b1..eb840ba27 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChicken.java @@ -52,7 +52,7 @@ public class PerkChicken extends Perk return; } - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Location loc = player.getLocation(); Chicken c = loc.getWorld().spawn(loc.add(0, 1, 0), Chicken.class); @@ -67,7 +67,7 @@ public class PerkChicken extends Perk _activeKitHolders.put(player.getName(), c); _failedAttempts.put(player.getName(), 0); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java index 2397deb70..5b34be0b8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkChickenRocket.java @@ -80,14 +80,14 @@ public class PerkChickenRocket extends SmashPerk if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) return; - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Chicken ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Chicken.class); ent.getLocation().setPitch(0); ent.getLocation().setYaw(player.getLocation().getYaw()); ent.setBaby(); ent.setAgeLock(true); UtilEnt.Vegetate(ent); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; _data.add(new ChickenMissileData(player, ent)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java index feede4574..e3461cd2f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java @@ -65,9 +65,9 @@ public class PerkCowBomb extends Perk implements IThrown UtilInv.Update(player); - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Cow ent = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Cow.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; ent.setBaby(); ent.setAgeLock(true); ent.setMaxHealth(100); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java index 4bc883afd..4d430ad0b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkEndermanDragon.java @@ -41,10 +41,10 @@ public class PerkEndermanDragon extends SmashPerk @Override public void addSuperCustom(Player player) { - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; EnderDragon dragon = player.getWorld().spawn(player.getLocation().add(0, 5, 0), EnderDragon.class); UtilEnt.Vegetate(dragon); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; dragon.setCustomName(C.cYellow + player.getName() + "'s Dragon"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java index 3ea238e92..19133d9b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java @@ -55,9 +55,9 @@ public class PerkHorsePet extends Perk if (!Manager.GetGame().IsAlive(player)) return; - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; horse.setAdult(); horse.setAgeLock(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java index 66639a23a..2edeb706a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkMadScientist.java @@ -221,7 +221,7 @@ public class PerkMadScientist extends Perk implements IThrown data.GetThrown().remove(); - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Zombie zombie = (Zombie) data.GetThrown().getWorld() .spawn(data.GetThrown().getLocation(), Zombie.class); @@ -275,7 +275,7 @@ public class PerkMadScientist extends Perk implements IThrown // // Manager.GetDisguise().disguise(disguise); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java index 9322ad543..64dcdc9b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java @@ -50,13 +50,13 @@ public class PerkNightLivingDead extends SmashPerk if (event.getType() != UpdateType.TICK) return; - if (_night.isEmpty() && Manager.GetGame().WorldTimeSet.getOption() != 12000) + if (_night.isEmpty() && Manager.GetGame().WorldTimeSet != 12000) { - Manager.GetGame().WorldTimeSet.setOption((Manager.GetGame().WorldTimeSet.getOption() + 50)%24000); + Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; } - else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet.getOption() != 18000) + else if (!_night.isEmpty() && Manager.GetGame().WorldTimeSet != 18000) { - Manager.GetGame().WorldTimeSet.setOption((Manager.GetGame().WorldTimeSet.getOption() + 50)%24000); + Manager.GetGame().WorldTimeSet = (Manager.GetGame().WorldTimeSet + 50)%24000; } } @@ -101,9 +101,9 @@ public class PerkNightLivingDead extends SmashPerk loc.subtract(0, 1, 0); //Spawn - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Zombie zombie = loc.getWorld().spawn(loc, Zombie.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; data.Zombies.add(zombie); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java index dd63b07a6..ba3a225c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBomb.java @@ -96,11 +96,11 @@ public class PerkPigBaconBomb extends SmashPerk player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 2f, 0.75f); //Pig - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Pig pig = player.getWorld().spawn(player.getLocation(), Pig.class); pig.setHealth(5); pig.setVelocity(new Vector(0, -0.4, 0)); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; pig.setBaby(); UtilEnt.Vegetate(pig); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java index 83630a670..eea416543 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java @@ -42,9 +42,9 @@ public class PerkSheepHoming extends SmashPerk if (target.equals(player)) continue; - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Sheep sheep = player.getWorld().spawn(player.getEyeLocation(), Sheep.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; sheep.setBaby(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index 02fb08c7f..3533cc8be 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -85,9 +85,9 @@ public class PerkSkeletons extends Perk Player killed = (Player) event.GetEvent().getEntity(); - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Skeleton skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; UtilEnt.removeGoalSelectors(skel); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index b0bc11219..1b16508b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -174,10 +174,10 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown double charge = Math.min(3, (double)(System.currentTimeMillis() - _charge.get(player))/1000d); //Spawn Slime - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class); slime.setSize(1); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; //Size slime.setSize(Math.max(1, (int)charge)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java index 84713ec24..710589904 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSnowTurret.java @@ -50,9 +50,9 @@ public class PerkSnowTurret extends SmashPerk @Override public void addSuperCustom(Player player) { - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Snowman ent = player.getWorld().spawn(player.getEyeLocation(), Snowman.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; UtilEnt.Vegetate(ent); UtilEnt.ghost(ent, true, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index 2d1465136..5a7fccc01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -73,9 +73,9 @@ public class PerkWitherImage extends SmashPerk return; //Spawn - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Skeleton skel = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Skeleton.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; skel.setSkeletonType(SkeletonType.WITHER); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java index 52b715b79..c0131bc41 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherMinion.java @@ -74,7 +74,7 @@ public class PerkWitherMinion extends Perk event.setCancelled(true); - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; for (int i=0 ; i<2 ; i++) { @@ -99,7 +99,7 @@ public class PerkWitherMinion extends Perk UtilAction.velocity(skel, player.getLocation().getDirection().add(random), 1 + Math.random() * 0.4, false, 0, 0.2, 10, false); } - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java index 52f6c15a3..febca2e0a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java @@ -87,9 +87,9 @@ public class PerkWolf extends SmashPerk return; //Get Nearest Wolf - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Wolf wolf = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Wolf.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; wolf.setBaby(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java index b34fe6f33..ccebfc71c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java @@ -197,9 +197,9 @@ public class PerkWolfPack extends Perk public void MinionSpawn(Player cur) { - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; //wolf.setOwner(cur); //wolf.setCollarColor(DyeColor.GREEN); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index 0b0258f98..027066090 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -95,9 +95,9 @@ public class PerkWolfPet extends Perk if (_wolfMap.get(cur).size() >= _max) continue; - Manager.GetGame().CreatureAllowOverride.setOption(true); + Manager.GetGame().CreatureAllowOverride = true; Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); - Manager.GetGame().CreatureAllowOverride.setOption(false); + Manager.GetGame().CreatureAllowOverride = false; wolf.setOwner(cur); wolf.setCollarColor(DyeColor.GREEN); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 963c4b6f3..9ddacd156 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -124,7 +124,7 @@ public class GameFlagManager implements Listener return; } - if (!game.Damage.getOption()) + if (!game.Damage) { event.SetCancelled("Damage Disabled"); return; @@ -148,7 +148,7 @@ public class GameFlagManager implements Listener return; } - if (event.GetCause() == DamageCause.FALL && !game.DamageFall.getOption()) + if (event.GetCause() == DamageCause.FALL && !game.DamageFall) { event.SetCancelled("Fall Damage Disabled"); return; @@ -169,7 +169,7 @@ public class GameFlagManager implements Listener //PvE else if (damager instanceof Player) { - if (!game.DamagePvE.getOption()) + if (!game.DamagePvE) { event.SetCancelled("PvE Disabled"); return; @@ -178,7 +178,7 @@ public class GameFlagManager implements Listener //EvP else if (damagee instanceof Player) { - if (!game.DamageEvP.getOption()) + if (!game.DamageEvP) { event.SetCancelled("EvP Disabled"); return; @@ -224,16 +224,16 @@ public class GameFlagManager implements Listener } - if (game.ItemPickup.getOption()) + if (game.ItemPickup) { - if (game.ItemPickupDeny.getOption().contains(event.getItem().getItemStack().getTypeId())) + if (game.ItemPickupDeny.contains(event.getItem().getItemStack().getTypeId())) { event.setCancelled(true); } } else { - if (!game.ItemPickupAllow.getOption().contains(event.getItem().getItemStack().getTypeId())) + if (!game.ItemPickupAllow.contains(event.getItem().getItemStack().getTypeId())) { event.setCancelled(true); } @@ -258,16 +258,16 @@ public class GameFlagManager implements Listener return; } - if (game.ItemDrop.getOption()) + if (game.ItemDrop) { - if (game.ItemDropDeny.getOption().contains(event.getItemDrop().getItemStack().getTypeId())) + if (game.ItemDropDeny.contains(event.getItemDrop().getItemStack().getTypeId())) { event.setCancelled(true); } } else { - if (!game.ItemDropAllow.getOption().contains(event.getItemDrop().getItemStack().getTypeId())) + if (!game.ItemDropAllow.contains(event.getItemDrop().getItemStack().getTypeId())) { event.setCancelled(true); } @@ -285,7 +285,7 @@ public class GameFlagManager implements Listener return; //normal inventories - if (!game.InventoryOpenBlock.getOption()) + if (!game.InventoryOpenBlock) { if (event.getInventory().getType() == InventoryType.ANVIL || event.getInventory().getType() == InventoryType.BEACON || @@ -317,7 +317,7 @@ public class GameFlagManager implements Listener } //deal with chests - if (!game.InventoryOpenChest.getOption()) + if (!game.InventoryOpenChest) { if (event.getInventory().getType() == InventoryType.CHEST) { @@ -340,7 +340,7 @@ public class GameFlagManager implements Listener if (!game.InProgress()) return; - if (game.InventoryClick.getOption()) + if (game.InventoryClick) return; Player player = UtilPlayer.searchExact(event.getWhoClicked().getName()); @@ -378,22 +378,22 @@ public class GameFlagManager implements Listener event.setCancelled(true); } // Event Server Allowance - else if (game.BlockPlaceCreative.getOption() && player.getGameMode() == GameMode.CREATIVE) + else if (game.BlockPlaceCreative && player.getGameMode() == GameMode.CREATIVE) { return; } else { - if (game.BlockPlace.getOption()) + if (game.BlockPlace) { - if (game.BlockPlaceDeny.getOption().contains(event.getBlock().getTypeId())) + if (game.BlockPlaceDeny.contains(event.getBlock().getTypeId())) { event.setCancelled(true); } } else { - if (!game.BlockPlaceAllow.getOption().contains(event.getBlock().getTypeId())) + if (!game.BlockPlaceAllow.contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -421,15 +421,15 @@ public class GameFlagManager implements Listener event.setCancelled(true); } // Event Server Allowance - else if (game.BlockBreakCreative.getOption() && player.getGameMode() == GameMode.CREATIVE) + else if (game.BlockBreakCreative && player.getGameMode() == GameMode.CREATIVE) { return; } else { - if (game.BlockBreak.getOption()) + if (game.BlockBreak) { - if (game.BlockBreakDeny.getOption().contains(event.getBlock().getTypeId())) + if (game.BlockBreakDeny.contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -437,7 +437,7 @@ public class GameFlagManager implements Listener } else { - if (!game.BlockBreakAllow.getOption().contains(event.getBlock().getTypeId())) + if (!game.BlockBreakAllow.contains(event.getBlock().getTypeId())) { event.setCancelled(true); } @@ -454,7 +454,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.getOption()) + if (!game.PrivateBlocks) return; if (event.isCancelled()) @@ -493,7 +493,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.getOption()) + if (!game.PrivateBlocks) return; if (event.isCancelled()) @@ -547,7 +547,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.getOption()) + if (!game.PrivateBlocks) return; if (event.isCancelled()) @@ -588,7 +588,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.getOption()) + if (!game.PrivateBlocks) return; if (event.getAction() != Action.RIGHT_CLICK_BLOCK) @@ -640,7 +640,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.PrivateBlocks.getOption()) + if (!game.PrivateBlocks) return; if (event.isCancelled()) @@ -690,13 +690,13 @@ public class GameFlagManager implements Listener player.setFallDistance(0); //Drop Items - if (game.DeathDropItems.getOption()) + if (game.DeathDropItems) for (ItemStack stack : event.getDrops()) player.getWorld().dropItem(player.getLocation(), stack); event.getDrops().clear(); //DEATH OUT - if (game.GetState() == GameState.Live && game.DeathOut.getOption()) + if (game.GetState() == GameState.Live && game.DeathOut) { //Event PlayerDeathOutEvent outEvent = new PlayerDeathOutEvent(game, player); @@ -709,16 +709,16 @@ public class GameFlagManager implements Listener } //RESPAWN - if (game.DeathSpectateSecs.getOption() <= 0 && (game.GetTeam(player) == null || game.GetTeam(player).GetRespawnTime() <= 0)) + if (game.DeathSpectateSecs <= 0 && (game.GetTeam(player) == null || game.GetTeam(player).GetRespawnTime() <= 0)) { //Teleport - if (game.AutomaticRespawn.getOption() && game.IsAlive(player)) + if (game.AutomaticRespawn && game.IsAlive(player)) { game.RespawnPlayer(player); } else { - Manager.addSpectator(player, game.DeathTeleport.getOption()); + Manager.addSpectator(player, game.DeathTeleport); } Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() @@ -733,7 +733,7 @@ public class GameFlagManager implements Listener //TIMER else { - double time = game.DeathSpectateSecs.getOption(); + double time = game.DeathSpectateSecs; if (game.GetTeam(player) != null) if (game.GetTeam(player).GetRespawnTime() > time) time = game.GetTeam(player).GetRespawnTime(); @@ -753,7 +753,7 @@ public class GameFlagManager implements Listener if (!game.IsAlive(player)) { - Manager.addSpectator(player, game.DeathTeleport.getOption()); + Manager.addSpectator(player, game.DeathTeleport); return; } @@ -774,7 +774,7 @@ public class GameFlagManager implements Listener } else { - Manager.addSpectator(player, game.DeathTeleport.getOption()); + Manager.addSpectator(player, game.DeathTeleport); } player.setFireTicks(0); @@ -791,7 +791,7 @@ public class GameFlagManager implements Listener if (game == null) return; //Drop Items - if (game.QuitDropItems.getOption()) + if (game.QuitDropItems) if (game.IsLive()) if (game.IsAlive(event.getPlayer())) UtilInv.drop(event.getPlayer(), true); @@ -801,7 +801,7 @@ public class GameFlagManager implements Listener game.GetPlayerKits().remove(event.getPlayer()); game.GetPlayerGems().remove(event.getPlayer()); - if (!game.QuitOut.getOption()) + if (!game.QuitOut) return; GameTeam team = game.GetTeam(event.getPlayer()); @@ -822,7 +822,7 @@ public class GameFlagManager implements Listener if (game == null || game.GetState() != GameState.Prepare) return; - if (!game.PrepareFreeze.getOption()) + if (!game.PrepareFreeze) return; if (!game.IsAlive(event.getPlayer())) @@ -859,20 +859,20 @@ public class GameFlagManager implements Listener if (game == null || !game.IsLive()) return; - if (game.HungerSet.getOption() != -1) + if (game.HungerSet != -1) for (Player player : game.GetPlayers(true)) { if (Manager.GetCondition().HasCondition(player, ConditionType.ARCADE_HUNGER_DISABLE, null)) continue; - player.setFoodLevel(game.HungerSet.getOption()); + player.setFoodLevel(game.HungerSet); player.setSaturation(1F); } - if (game.HealthSet.getOption() != -1) + if (game.HealthSet != -1) for (Player player : game.GetPlayers(true)) { - player.setHealth(game.HealthSet.getOption()); + player.setHealth(game.HealthSet); } } @@ -898,7 +898,7 @@ public class GameFlagManager implements Listener ((CraftPlayer)player).getHandle().spectating = false; } - if (!game.WorldBoundaryKill.getOption()) + if (!game.WorldBoundaryKill) { UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!"); @@ -938,7 +938,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.CreatureAllow.getOption() && !game.CreatureAllowOverride.getOption()) + if (!game.CreatureAllow && !game.CreatureAllowOverride) { if (game.WorldData != null) { @@ -968,7 +968,7 @@ public class GameFlagManager implements Listener if (!(game.IsLive() || game.GetState() == GameState.Prepare)) return; - if (!game.TeleportsDisqualify.getOption()) + if (!game.TeleportsDisqualify) return; if (!game.IsAlive(event.getPlayer())) @@ -1001,13 +1001,13 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldTimeSet.getOption() != -1) + if (game.WorldTimeSet != -1) { if (game.WorldData != null) { if (game.WorldData.World != null) { - game.WorldData.World.setTime(game.WorldTimeSet.getOption()); + game.WorldData.World.setTime(game.WorldTimeSet); } } } @@ -1022,7 +1022,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.WorldWeatherEnabled.getOption()) + if (!game.WorldWeatherEnabled) { if (game.WorldData != null) { @@ -1047,11 +1047,11 @@ public class GameFlagManager implements Listener if (!game.IsLive()) return; - if (game.WorldWaterDamage.getOption() <= 0) + if (game.WorldWaterDamage <= 0) { if (!game.WorldData.GetCustomLocs("WATER_DAMAGE").isEmpty()) { - game.WorldWaterDamage.setOption(4); + game.WorldWaterDamage = 4; } else { @@ -1066,7 +1066,7 @@ public class GameFlagManager implements Listener { //Damage Event Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.DROWNING, game.WorldWaterDamage.getOption(), true, false, false, + DamageCause.DROWNING, game.WorldWaterDamage, true, false, false, "Water", "Water Damage"); player.getWorld().playSound(player.getLocation(), @@ -1084,7 +1084,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldSoilTrample.getOption()) + if (game.WorldSoilTrample) return; if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL) @@ -1099,7 +1099,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldBlockBurn.getOption()) + if (game.WorldBlockBurn) return; event.setCancelled(true); @@ -1111,7 +1111,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldBlockGrow.getOption()) + if (game.WorldBlockGrow) return; event.setCancelled(true); @@ -1123,7 +1123,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldFireSpread.getOption()) + if (game.WorldFireSpread) return; event.setCancelled(true); @@ -1135,7 +1135,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (game.WorldLeavesDecay.getOption()) + if (game.WorldLeavesDecay) return; event.setCancelled(true); @@ -1150,7 +1150,7 @@ public class GameFlagManager implements Listener if (Manager.GetGame() == null) return; - if (!Manager.GetGame().AnnounceStay.getOption()) + if (!Manager.GetGame().AnnounceStay) return; if (!Manager.GetGame().IsLive()) @@ -1177,7 +1177,7 @@ public class GameFlagManager implements Listener public void AntiHackStrict(GameStateChangeEvent event) { if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Live) - AntiHack.Instance.setStrict(event.GetGame().StrictAntiHack.getOption()); + AntiHack.Instance.setStrict(event.GetGame().StrictAntiHack); else AntiHack.Instance.setStrict(true); @@ -1189,7 +1189,7 @@ public class GameFlagManager implements Listener if (Manager.GetGame() == null) return; - if (!Manager.GetGame().DisableKillCommand.getOption()) + if (!Manager.GetGame().DisableKillCommand) return; if (event.getMessage().toLowerCase().startsWith("/kill")) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index 04d273467..a77e3f72b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -1045,7 +1045,7 @@ public class GameLobbyManager implements Listener if (event.getType() != UpdateType.FAST) return; - if (Manager.GetGame() != null && !Manager.GetGame().DisplayLobbySide.getOption()) + if (Manager.GetGame() != null && !Manager.GetGame().DisplayLobbySide) { return; } @@ -1318,7 +1318,7 @@ public class GameLobbyManager implements Listener if (Manager.GetGame() == null) return; - if (Manager.GetGame().GetState() != GameState.Recruit && Manager.GetGame().GadgetsDisabled.getOption()) + if (Manager.GetGame().GetState() != GameState.Recruit && Manager.GetGame().GadgetsDisabled) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 32c4c88c8..be185ed2b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -388,7 +388,7 @@ public class GameManager implements Listener } else if (game.GetState() == GameState.Live) { - if (game.GameTimeout.getOption() != -1 && UtilTime.elapsed(game.GetStateTime(), game.GameTimeout.getOption()) && Manager.IsGameTimeout()) + if (game.GameTimeout != -1 && UtilTime.elapsed(game.GetStateTime(), game.GameTimeout) && Manager.IsGameTimeout()) { game.HandleTimeout(); } @@ -411,7 +411,7 @@ public class GameManager implements Listener return; //Disabling Cosmetics - if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled.getOption()) + if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled) { if (Manager.getCosmeticManager().isShowingInterface()) { @@ -484,7 +484,7 @@ public class GameManager implements Listener @EventHandler public void KitRegister(GameStateChangeEvent event) { - if (event.GetState() != event.GetGame().KitRegisterState.getOption()) + if (event.GetState() != event.GetGame().KitRegisterState) return; event.GetGame().RegisterKits(); @@ -761,7 +761,7 @@ public class GameManager implements Listener PlayerPrepareTeleportEvent playerStateEvent = new PlayerPrepareTeleportEvent(game, player); UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); } - }, i * game.TickPerTeleport.getOption()); + }, i * game.TickPerTeleport); } //Announce Game after every player is TP'd in @@ -776,7 +776,7 @@ public class GameManager implements Listener GamePrepareCountdownCommence event = new GamePrepareCountdownCommence(game); UtilServer.getServer().getPluginManager().callEvent(event); } - }, players.size() * game.TickPerTeleport.getOption()); + }, players.size() * game.TickPerTeleport); //Spectators Move for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java index b926d5f47..1923c030f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -50,7 +50,7 @@ public class MiscManager implements Listener Player player = event.getPlayer(); //BoneMeal - if (!Manager.GetGame().WorldBoneMeal.getOption() && + if (!Manager.GetGame().WorldBoneMeal && event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) From 9e8a7b582b8dbb57e16f8229d066119a21b11d28 Mon Sep 17 00:00:00 2001 From: "Joseph Prezioso Jr." Date: Wed, 13 Apr 2016 18:35:56 -0400 Subject: [PATCH 30/34] Elo updates EloRanking turned on for Domination, Team Deathmatch, Turf Wars, CTF Database QoL changes made to EloManager and EloRepository --Unfortunately, Database still seems to not be updating properly --Something on my end, or something to do with the queries? Unsure. --- .../src/mineplex/core/elo/EloDivision.java | 37 +++- .../src/mineplex/core/elo/EloManager.java | 96 +++++++++- .../src/mineplex/core/elo/EloRepository.java | 37 +++- .../src/nautilus/game/arcade/game/Game.java | 172 +++++++++++++++++- .../arcade/game/games/common/Domination.java | 11 ++ .../game/games/common/TeamDeathmatch.java | 33 +++- .../game/games/turfforts/TurfForts.java | 51 ++++++ 7 files changed, 415 insertions(+), 22 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloDivision.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloDivision.java index e1b3be8b8..f60ae1d1f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloDivision.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloDivision.java @@ -1,11 +1,15 @@ package mineplex.core.elo; +import java.util.UUID; + import org.bukkit.Material; import org.bukkit.material.MaterialData; public class EloDivision { private byte _divisionPercentile; + private int _playerElo; + private UUID _uuid; private String _divisionName; //If I understand MaterialData objects correctly, @@ -13,24 +17,37 @@ public class EloDivision private byte _divisionMaterialValue; private MaterialData _divisionMaterialData; - public EloDivision(byte divPercent) + public EloDivision(UUID userID, byte divPercent, int pElo) { - // TODO Auto-generated constructor stub + _uuid = userID; _divisionPercentile = divPercent; - _divisionName = CalculateDivision(divPercent); + _playerElo = pElo; + _divisionName = calculateDivision(divPercent, _playerElo); } - public String CalculateDivision(double divPercent) + public String calculateDivision(double divPercent, int _playerElo) { - if (divPercent == 100) return "Diamond"; - if (divPercent <= 99 && divPercent >= 81) return "Emerald"; - if (divPercent <= 80 && divPercent >= 61) return "Lapis"; - if (divPercent <= 60 && divPercent >= 41) return "Gold"; - if (divPercent <= 40 && divPercent >= 21) return "Iron"; + + if (divPercent > 99 && _playerElo > 3500) { return "Diamond"; } + if (_playerElo >= 3500) { return "Emerald 3"; } + if (_playerElo < 3500 && _playerElo >= 3300) { return "Emerald 2"; } + if (_playerElo < 3300 && _playerElo >= 3100) { return "Emerald 1"; } + if (_playerElo < 3100 && _playerElo >= 2900) { return "Lapis 3"; } + if (_playerElo < 2900 && _playerElo >= 2700) { return "Lapis 2"; } + if (_playerElo < 2700 && _playerElo >= 2500) { return "Lapis 1"; } + if (_playerElo < 2500 && _playerElo >= 2300) { return "Gold 3"; } + if (_playerElo < 2300 && _playerElo >= 2100) { return "Gold 2"; } + if (_playerElo < 2100 && _playerElo >= 1900) { return "Gold 1"; } + if (_playerElo < 1900 && _playerElo >= 1700) { return "Iron 3"; } + if (_playerElo < 1700 && _playerElo >= 1500) { return "Iron 2"; } + if (_playerElo < 1500 && _playerElo >= 1300) { return "Iron 1"; } + if (_playerElo < 1300 && _playerElo >= 800) { return "Coal 3"; } + if (_playerElo < 800 && _playerElo >= 600) { return "Coal 2"; } + if (_playerElo < 600) { return "Coal 1"; } //if none of the above are true, a player is in the bottom 20% - return "Coal"; + return "Coal 1"; } @SuppressWarnings("deprecation") diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index d1c44b6d6..83a4dc7b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -2,11 +2,15 @@ package mineplex.core.elo; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; import java.util.UUID; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.NautHashMap; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnVarChar; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -18,6 +22,9 @@ public class EloManager extends MiniDbClientPlugin private EloRepository _repository; private EloRatingSystem _ratingSystem; private NautHashMap> _playerElos; + private NautHashMap> _playerDivisions; + + private EloDivision _division; public EloManager(JavaPlugin plugin, CoreClientManager clientManager) { @@ -26,8 +33,9 @@ public class EloManager extends MiniDbClientPlugin _repository = new EloRepository(plugin); _ratingSystem = new EloRatingSystem(new KFactor(0, 1200, 25), new KFactor(1201, 1600, 20), new KFactor(1601, 2000, 15), new KFactor(2001, 2500, 10)); _playerElos = new NautHashMap>(); + } - + public int getElo(UUID uuid, String gameType) { int elo = 1000; @@ -76,7 +84,9 @@ public class EloManager extends MiniDbClientPlugin public void saveElo(UUID uuid, String gameType, int elo) { + String playerDiv = getPlayerDivision(uuid, gameType); saveElo(uuid.toString(), gameType, elo); + saveDivision(uuid.toString(), gameType, playerDiv); } public void saveElo(final String uuid, final String gameType, final int elo) @@ -85,7 +95,12 @@ public class EloManager extends MiniDbClientPlugin { public void run() { - _repository.saveElo(uuid, gameType, elo); + try { + _repository.saveElo(uuid, gameType, elo); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } synchronized (_playerEloLock) { @@ -100,7 +115,84 @@ public class EloManager extends MiniDbClientPlugin } }); } + + //save divisons the same way that we're saving Elos + public void saveDivision(final String uuid, final String gameType, final String division) + { + Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() + { + public void run() + { + _repository.saveDivision(uuid, gameType, division); + + synchronized (_playerEloLock) + { + if (_playerDivisions.containsKey(uuid)) + { + if (_playerDivisions.get(uuid).containsKey(gameType)) + { + _playerDivisions.get(uuid).put(gameType, division); + } + } + } + } + }); + } + //get a player's Division + public String getPlayerDivision(UUID uuid, String gameType) + { + //get playerElo for gameType (need to store this to check it against other Elo's) + int playerElo = getElo(uuid, gameType); + //this list will be filled with ELO's from other players (but only for the same game type + ArrayList allElos = new ArrayList(); + + for(int i = 0; i < _playerElos.size(); i++) + { + //we're only concerned with this Game Type + if(_playerElos.containsKey(gameType)) + { + //add elo's to the list + allElos.add(_playerElos.get(uuid.toString()).get(gameType)); + } + } + //sort list of Elos (needed for percentile calculations) + Collections.sort(allElos); + + //Calculate how much going up one spot is worth + double individualValue = (100/allElos.size()); + + /* lastIndexOf gets the last instance of player's Elo + * Consequently, it should be easier for rank to go up than down + * and everyone at the same Elo should be in the same division + */ + double percentile = allElos.lastIndexOf(playerElo) * individualValue; + + return CalculateDivision(playerElo, percentile); + } + + public String CalculateDivision(int playerElo, double divPercent) + { + if (playerElo >= 3500 && divPercent > 99) return "Diamond"; + if (playerElo >= 3500) return "Emerald 3"; + if (playerElo < 3500 && playerElo >= 3300) return "Emerald 2"; + if (playerElo < 3300 && playerElo >= 3100) return "Emerald 1"; + if (playerElo < 3100 && playerElo >= 2900) return "Lapis 3"; + if (playerElo < 2900 && playerElo >= 2700) return "Lapis 2"; + if (playerElo < 2700 && playerElo >= 2500) return "Lapis 1"; + if (playerElo < 2500 && playerElo >= 2300) return "Gold 3"; + if (playerElo < 2300 && playerElo >= 2100) return "Gold 2"; + if (playerElo < 2100 && playerElo >= 1900) return "Gold 1"; + if (playerElo < 1900 && playerElo >= 1700) return "Iron 3"; + if (playerElo < 1700 && playerElo >= 1500) return "Iron 2"; + if (playerElo < 1500 && playerElo >= 1300) return "Iron 1"; + if (playerElo < 1300 && playerElo >= 800) return "Coal 3"; + if (playerElo < 800 && playerElo >= 600) return "Coal 2"; + if (playerElo < 600 && playerElo >= 400) return "Coal 1"; + + return "Result not found"; + } + @Override protected EloClientData AddPlayer(String player) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java index 8c0874208..82dcd49b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java @@ -1,11 +1,14 @@ package mineplex.core.elo; +import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import mineplex.core.database.MinecraftRepository; import org.bukkit.plugin.java.JavaPlugin; +import com.mysql.jdbc.Statement; + import mineplex.serverdata.database.DBPool; import mineplex.serverdata.database.RepositoryBase; import mineplex.serverdata.database.column.ColumnInt; @@ -13,9 +16,10 @@ import mineplex.serverdata.database.column.ColumnVarChar; public class EloRepository extends MinecraftRepository { - private static String CREATE_ELO_TABLE = "CREATE TABLE IF NOT EXISTS eloRating (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), gameType VARCHAR(256), elo INT, PRIMARY KEY (id), UNIQUE INDEX uuid_gameType_index (uuid, gameType));"; + private static String CREATE_ELO_TABLE = "CREATE TABLE IF NOT EXISTS eloRating (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), gameType VARCHAR(256), elo INT, division VARCHAR(256), PRIMARY KEY (id), UNIQUE INDEX uuid_gameType_index (uuid, gameType));"; private static String INSERT_ELO = "INSERT INTO eloRating (uuid, gameType, elo) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE elo=VALUES(elo);"; - + private static String INSERT_DIVISION = "INSERT INTO eloRating (uuid, gameType, division) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE division=VALUES(division);"; + public EloRepository(JavaPlugin plugin) { super(plugin, DBPool.getAccount()); @@ -28,9 +32,34 @@ public class EloRepository extends MinecraftRepository //executeUpdate(CREATE_ELO_TABLE); } - public void saveElo(String uuid, String gameType, int elo) + public void saveElo(String uuid, String gameType, int elo) throws SQLException + { + Connection con = getConnection(); + java.sql.Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE); + String selectQuery = "SELECT gameType, elo FROM eloRating WHERE uuid = '" + uuid + "';"; + ResultSet rs = stmt.executeQuery(selectQuery); + + boolean contains = false; + + while (rs.next()) + { + contains = true; + //update elo + String updateQuery = "UPDATE eloRating SET elo='" + elo + "';"; + executeQuery(updateQuery, null, new ColumnVarChar("elo", 100, uuid)); + } + if(!contains) + { + //insert elo + executeUpdate(INSERT_ELO, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnInt("elo", elo)); + } + + + } + + public void saveDivision(String uuid, String gameType, String division) { - executeUpdate(INSERT_ELO, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnInt("elo", elo)); + executeUpdate(INSERT_ELO, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnVarChar("division", 100, division)); } public EloClientData loadClientInformation(ResultSet resultSet) throws SQLException diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index f65ac2c78..ea70aeaca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -55,6 +55,7 @@ import mineplex.core.common.util.UtilTabTitle; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.elo.EloSettings; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; @@ -310,9 +311,12 @@ public abstract class Game implements Listener public String Winner = "Nobody"; public GameTeam WinnerTeam = null; + //EloSetting - (0 = disabled, 1 = background, 2 = full) + public EloSettings EloSetting = new EloSettings(0); + public boolean EloRanking = false; public int EloStart = 1000; - + public boolean CanAddStats = true; public boolean CanGiveLoot = true; @@ -1263,6 +1267,9 @@ public abstract class Game implements Listener } UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); + + //call adjustPlayerElo + adjustPlayerElo(places); if (AnnounceSilence) Manager.GetChat().Silence(5000, false); @@ -1289,6 +1296,169 @@ public abstract class Game implements Listener System.out.println("[Announcement] " + message); } + //calculate the elo multiplier for a player based on the average elo of all players + public int calculateEloMultiplier(int currentElo, int averageElo) + { + + int eloDifference = averageElo - currentElo; + + if (Math.abs(eloDifference) <= 50) + { + return 0; + } + if (eloDifference >= 200) + { + return 3; + } + if (eloDifference >= 100) + { + return 2; + } + if (eloDifference > 50) + { + return 1; + } + if (eloDifference <= -200) + { + return -3; + } + if (eloDifference <= -100) + { + return -2; + } + if (eloDifference < -50) + { + return -1; + } + + return 0; + } + + //adjust the elo's of every player, depending on their ranking in the game mode + public void adjustPlayerElo(List places) + { + int averageElo = 0; + for (Player player : UtilServer.getPlayers()) + { + averageElo += Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + } + //average Elo of all players + averageElo = averageElo/places.size(); + + //update Elos of all players + assignEloPoints(places, averageElo); + + } + + //method to loop through every player and assign their new Elo + public void assignEloPoints(List places, int averageElo) + { + for (Player player : UtilServer.getPlayers()) + { + int currentElo = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + int lossMultiplier = 1; + int sizeModifier = 3; + int eloMultiplier = calculateEloMultiplier(currentElo, averageElo); + + //nobody won, add 10 points to all players + //Profitable enough see the match through to the end, but not enough for a stale-mate to be a more desirable outcome than 3rd place + if (places == null || places.isEmpty()) + { + int newElo = currentElo + 10; + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + //Top 3 players get 25, 20, and 15 points, respectively + else + { + if (places.size() >= 1) + { + if (player.getUniqueId() == places.get(0).getUniqueId()) + { + int newElo = currentElo + 25 + (5 * eloMultiplier); + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + } + if (places.size() >= 5) + { + if (player.getUniqueId() == places.get(1).getUniqueId()) + { + int newElo = currentElo + 20 + (5 * eloMultiplier); + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + } + if (places.size() >= 6) + { + if (player.getUniqueId() == places.get(2).getUniqueId()) + { + if (eloMultiplier < -2) + { + eloMultiplier = -2; + } + + int newElo = currentElo + 15 + (5 * eloMultiplier); + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + + } + if (places.size() > 6 && places.size() <= 7) + { + if (player.getUniqueId() == places.get(5).getUniqueId()) + { + if(eloMultiplier > 1) + { + eloMultiplier = 0; + } + + int newElo = currentElo - 5 + (5 * eloMultiplier); + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + } + if (places.size() == 7) + { + if (player.getUniqueId() == places.get(6).getUniqueId()) + { + if(eloMultiplier > 2) + { + eloMultiplier = 2; + } + + int newElo = currentElo - 10 + (5 * eloMultiplier); + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + } + } + if (places.size() >= 8) + { + //for games with 8+ players, this if statement is just going to run 3 times to check 3 different places + while(lossMultiplier != 0) + { + if (player.getUniqueId() == places.get(places.size() - sizeModifier).getUniqueId()) + { + if(eloMultiplier > lossMultiplier) + { + eloMultiplier = lossMultiplier; + } + + int newElo = currentElo - (5 * lossMultiplier) + (5 * eloMultiplier); + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), newElo); + + if(sizeModifier >= 1) + { + lossMultiplier++; + sizeModifier--; + } + else + { + lossMultiplier = 0; + } + } + } + } + + } + + } + } + public boolean AdvertiseText(GameLobbyManager gameLobbyManager, int _advertiseStage) { return false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index c92af3e1f..3550e866b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -86,6 +86,8 @@ public class Domination extends TeamGame this.WorldTimeSet = 2000; this.DeathSpectateSecs = 10; + this.EloRanking = true; + this.EloSetting.setEloSetting(2); //this.QuitOut = false; } @@ -330,6 +332,9 @@ public class Domination extends TeamGame eloPlayer.UniqueId = player.getUniqueId().toString(); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + //Increment Elo (in case it isn't being incremented already) + eloPlayer.Rating += 20; + teamWinner.addPlayer(eloPlayer); } } @@ -341,6 +346,9 @@ public class Domination extends TeamGame eloPlayer.UniqueId = player.getUniqueId().toString(); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + //Decrement Elo (in case it isn't being decremented already) + eloPlayer.Rating -= 10; + teamLoser.addPlayer(eloPlayer); } } @@ -348,11 +356,14 @@ public class Domination extends TeamGame for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) { + eloPlayer.Rating += 20; Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + } for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) { + eloPlayer.Rating -= 10; Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java index 1e26628f7..02794e31b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.common; import java.util.ArrayList; import java.util.HashMap; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -78,7 +79,9 @@ public class TeamDeathmatch extends TeamGame this.HungerSet = 20; this.WorldTimeSet = 2000; this.CompassEnabled = true; - + this.EloRanking = true; + this.EloSetting.setEloSetting(2); + this.Manager.GetDamage().UseSimpleWeaponDamage = false; //_healthObj = GetScoreboard().registerNewObjective("HP", "dummy"); @@ -364,8 +367,16 @@ public class TeamDeathmatch extends TeamGame EloPlayer eloPlayer = new EloPlayer(); eloPlayer.UniqueId = player.getUniqueId().toString(); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); - + teamWinner.addPlayer(eloPlayer); + + eloPlayer.Rating += 25; + + Bukkit.broadcastMessage(player.getName() + " GetTeamList Elo: " + eloPlayer.Rating); + + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(player.getName() + " Post-Save Elo: " + eloPlayer.Rating); + } } else @@ -373,23 +384,35 @@ public class TeamDeathmatch extends TeamGame for (Player player : team.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.UniqueId = player.getUniqueId().toString();; eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); - teamLoser.addPlayer(eloPlayer); + + eloPlayer.Rating -= 15; + + Bukkit.broadcastMessage(player.getName() + " GetTeamList Elo: " + eloPlayer.Rating); + + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(player.getName() + " Post-Save Elo: " + eloPlayer.Rating); + } } } - + /* for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) { + eloPlayer.Rating += 20; Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(eloPlayer.UniqueId + "Post-Save Elo: " + eloPlayer.Rating); } for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) { + eloPlayer.Rating -= 10; Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(eloPlayer.UniqueId + "Post-Save Elo: " + eloPlayer.Rating); } + */ } //End diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 15952925a..995629274 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -44,6 +44,9 @@ import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; +import mineplex.core.elo.EloPlayer; +import mineplex.core.elo.EloTeam; +import mineplex.core.elo.GameResult; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -150,6 +153,8 @@ public class TurfForts extends TeamGame this.ItemPickup = false; this.DamageSelf = false; this.DeathSpectateSecs = 4; + this.EloRanking = true; + this.EloSetting.setEloSetting(2); _breakStatTracker = new BlockBreakStatTracker(this, false); @@ -851,9 +856,55 @@ public class TurfForts extends TeamGame AddGems(player, 10, "Participation", false, false); } + if (EloRanking) + { + EloTeam teamWinner = new EloTeam(); + EloTeam teamLoser = new EloTeam(); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : WinnerTeam.GetPlayers(false)) + { + EloPlayer eloPlayer = new EloPlayer(); + eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + + teamWinner.addPlayer(eloPlayer); + Bukkit.broadcastMessage(player.getName() + "'s old Elo: " + eloPlayer.Rating); + } + } + else + { + for (Player player : team.GetPlayers(false)) + { + EloPlayer eloPlayer = new EloPlayer(); + eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + + teamLoser.addPlayer(eloPlayer); + Bukkit.broadcastMessage(player.getName() + "'s old Elo: " + eloPlayer.Rating); + } + } + } + + for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) + { + Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(eloPlayer.UniqueId + "'s new Elo: " + eloPlayer.Rating); + } + + for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) + { + Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + } + } + //End SetState(GameState.End); } + public Long getEnemyTurfEntranceTime(Player player) { From eb67c12108ea879c409f514986ded4adbb0a6c2d Mon Sep 17 00:00:00 2001 From: "Joseph Prezioso Jr." Date: Thu, 14 Apr 2016 15:21:28 -0400 Subject: [PATCH 31/34] Added getRepoElo to EloRepository Added Bukkit.broadcastMessage() calls to test code Methods that needed to throw SQLExceptions now throw SQLExceptions --- .../core/account/CoreClientManager.java | 8 +++- .../account/repository/AccountRepository.java | 7 +-- .../src/mineplex/core/elo/EloManager.java | 23 ++++++++- .../src/mineplex/core/elo/EloPlayer.java | 3 ++ .../src/mineplex/core/elo/EloRepository.java | 35 +++++++++++++- .../events/IncognitoHidePlayerEvent.java | 47 +++++++++++++++++++ 6 files changed, 113 insertions(+), 10 deletions(-) create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/core/incognito/events/IncognitoHidePlayerEvent.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 6b6e119ca..69a745818 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -1,5 +1,6 @@ package mineplex.core.account; +import java.sql.SQLException; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -378,7 +379,12 @@ public class CoreClientManager extends MiniPlugin @Override public void run() { - client.setAccountId(_repository.login(_loginProcessors, uuid, client.GetPlayerName())); + try { + client.setAccountId(_repository.login(_loginProcessors, uuid, client.GetPlayerName())); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } _clientLoginLock.remove(client.GetPlayerName()); } }); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java index 856c5e8a0..e00cd1b21 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -57,7 +57,7 @@ public class AccountRepository extends MinecraftRepository //executeUpdate(CREATE_ACCOUNT_TABLE); } - public int login(final List loginProcessors, final UUID uuid, final String name) + public int login(final List loginProcessors, final UUID uuid, final String name) throws SQLException { // First we try to grab the account id from cache - this saves an extra trip to database int accountId = PlayerCache.getInstance().getAccountId(uuid); @@ -117,10 +117,7 @@ public class AccountRepository extends MinecraftRepository statement.getMoreResults(); } } - catch (Exception exception) - { - exception.printStackTrace(); - } + return accountId; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 83a4dc7b2..0f9194ded 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -46,7 +46,17 @@ public class EloManager extends MiniDbClientPlugin { if (_playerElos.get(uuid.toString()).containsKey(gameType)) { - elo = _playerElos.get(uuid.toString()).get(gameType); + //let's try getting Elo directly from the repository + try + { + elo = _repository.getRepoElo(uuid.toString(), gameType); + Bukkit.broadcastMessage("Fetching Elo..."); + } + catch (SQLException e) + { + e.printStackTrace(); + } + //elo = _playerElos.get(uuid.toString()).get(gameType); } } } @@ -97,6 +107,7 @@ public class EloManager extends MiniDbClientPlugin { try { _repository.saveElo(uuid, gameType, elo); + Bukkit.broadcastMessage("Attempting to saveElo..."); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -143,7 +154,14 @@ public class EloManager extends MiniDbClientPlugin public String getPlayerDivision(UUID uuid, String gameType) { //get playerElo for gameType (need to store this to check it against other Elo's) - int playerElo = getElo(uuid, gameType); + int playerElo = 1000; + + try { + playerElo = _repository.getRepoElo(uuid.toString(), gameType); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } //this list will be filled with ELO's from other players (but only for the same game type ArrayList allElos = new ArrayList(); @@ -153,6 +171,7 @@ public class EloManager extends MiniDbClientPlugin if(_playerElos.containsKey(gameType)) { //add elo's to the list + allElos.add(_playerElos.get(uuid.toString()).get(gameType)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index a2661fee3..fac0369d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -9,4 +9,7 @@ public class EloPlayer { System.out.println(UniqueId + "'s elo is " + Rating); } + + + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java index 82dcd49b6..b357811bd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java @@ -5,6 +5,8 @@ import java.sql.ResultSet; import java.sql.SQLException; import mineplex.core.database.MinecraftRepository; + +import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; import com.mysql.jdbc.Statement; @@ -31,7 +33,34 @@ public class EloRepository extends MinecraftRepository { //executeUpdate(CREATE_ELO_TABLE); } - + + //A few get methods to make grabbing info from the database easier + + //get an elo from the database + public int getRepoElo(String uuid, String gameType) throws SQLException + { + Connection con = getConnection(); + java.sql.Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); + String selectQuery = "SELECT elo FROM eloRating WHERE uuid = '" + uuid + "' AND gameType = '" + gameType + "';"; + ResultSet rs = stmt.executeQuery(selectQuery); + + //elo set to 1000 by default + int elo = 1000; + + //if something was found, return the elo + if(rs.next()) + { + elo = rs.getInt(1); + Bukkit.broadcastMessage("getRepoElo pulled " + elo + "from database for " + uuid); + return elo; + } + + //make a new entry into eloRatings, if there is no elo for the player for this gameType + saveElo(uuid, gameType, elo); + //then return the elo (should be 1000) + return elo; + } + public void saveElo(String uuid, String gameType, int elo) throws SQLException { Connection con = getConnection(); @@ -45,13 +74,15 @@ public class EloRepository extends MinecraftRepository { contains = true; //update elo - String updateQuery = "UPDATE eloRating SET elo='" + elo + "';"; + String updateQuery = "UPDATE eloRating SET elo='" + elo + "' WHERE uuid = '" + uuid + "' AND gametype = '" + gameType + "';"; executeQuery(updateQuery, null, new ColumnVarChar("elo", 100, uuid)); + Bukkit.broadcastMessage("Updating existing elo"); } if(!contains) { //insert elo executeUpdate(INSERT_ELO, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnInt("elo", elo)); + Bukkit.broadcastMessage("Adding new player elo to " + gameType +" elo database..."); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/core/incognito/events/IncognitoHidePlayerEvent.java b/Plugins/Mineplex.Game.Clans/src/mineplex/core/incognito/events/IncognitoHidePlayerEvent.java new file mode 100644 index 000000000..54dabeebc --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/core/incognito/events/IncognitoHidePlayerEvent.java @@ -0,0 +1,47 @@ +package mineplex.core.incognito.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * Called when an Incognito player is getting hidden from all other players. + */ +public class IncognitoHidePlayerEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private boolean _cancelled; + + public IncognitoHidePlayerEvent(Player player) + { + _player = player; + } + + public Player getPlayer() + { + return _player; + } + + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public boolean isCancelled() + { + return _cancelled; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} \ No newline at end of file From 742807d80ec0d64f636939ff5c26118b8fb0e98c Mon Sep 17 00:00:00 2001 From: "Joseph Prezioso Jr." Date: Thu, 14 Apr 2016 17:17:26 -0400 Subject: [PATCH 32/34] Added generatePlayerElos and updated saveDivision Added method to fill EloManager's playerElos hashmap with values --This may not work as intended --Currently only implemented in Team Death Match --- .../src/mineplex/core/elo/EloManager.java | 48 ++++++++++++++----- .../src/mineplex/core/elo/EloPlayer.java | 12 ++++- .../src/mineplex/core/elo/EloRepository.java | 19 +++++++- .../game/games/common/CaptureTheFlag.java | 8 ++-- .../arcade/game/games/common/Domination.java | 8 ++-- .../game/games/common/TeamDeathmatch.java | 6 ++- .../game/games/turfforts/TurfForts.java | 10 ++-- 7 files changed, 79 insertions(+), 32 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 0f9194ded..c92ca5c54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -13,6 +13,7 @@ import mineplex.serverdata.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnVarChar; import org.bukkit.Bukkit; +import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; public class EloManager extends MiniDbClientPlugin @@ -36,27 +37,43 @@ public class EloManager extends MiniDbClientPlugin } + /* + * fill _playerElos with information from database + * If no entry exists, create one + */ + public void generatePlayerElos(ArrayList players, String gameType) + { + for (Player player : players) + { + int elo = getElo(player.getUniqueId(), gameType); + _playerElos.get(player.getUniqueId().toString()).put(gameType, elo); + } + } + public int getElo(UUID uuid, String gameType) { int elo = 1000; + //let's try getting Elo directly from the repository + //If this works, we will never hit the return at the bottom + try + { + elo = _repository.getRepoElo(uuid.toString(), gameType); + Bukkit.broadcastMessage("Fetching Elo..."); + return elo; + } + catch (SQLException e) + { + e.printStackTrace(); + } + synchronized (_playerEloLock) { if (_playerElos.containsKey(uuid.toString())) { if (_playerElos.get(uuid.toString()).containsKey(gameType)) { - //let's try getting Elo directly from the repository - try - { - elo = _repository.getRepoElo(uuid.toString(), gameType); - Bukkit.broadcastMessage("Fetching Elo..."); - } - catch (SQLException e) - { - e.printStackTrace(); - } - //elo = _playerElos.get(uuid.toString()).get(gameType); + elo = _playerElos.get(uuid.toString()).get(gameType); } } } @@ -77,7 +94,7 @@ public class EloManager extends MiniDbClientPlugin for (EloPlayer player : teamA.getPlayers()) { EloPlayer newPlayer = new EloPlayer(); - newPlayer.UniqueId = player.UniqueId; + newPlayer.setUniqueId(player.getUniqueId()); newPlayer.Rating = (int)(player.Rating + ((double)player.Rating / (double)teamA.TotalElo) * (newTotal - teamA.TotalElo)); System.out.println("Old:"); @@ -134,7 +151,12 @@ public class EloManager extends MiniDbClientPlugin { public void run() { - _repository.saveDivision(uuid, gameType, division); + try { + _repository.saveDivision(uuid, gameType, division); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } synchronized (_playerEloLock) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java index fac0369d9..066ea4ec6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloPlayer.java @@ -2,14 +2,22 @@ package mineplex.core.elo; public class EloPlayer { - public String UniqueId; + private String _uniqueId; public int Rating; public void printInfo() { - System.out.println(UniqueId + "'s elo is " + Rating); + System.out.println(_uniqueId + "'s elo is " + Rating); } + public String getUniqueId() + { + return _uniqueId; + } + public void setUniqueId(String uuid) + { + _uniqueId = uuid; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java index b357811bd..61159d1f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java @@ -88,9 +88,24 @@ public class EloRepository extends MinecraftRepository } - public void saveDivision(String uuid, String gameType, String division) + public void saveDivision(String uuid, String gameType, String division) throws SQLException { - executeUpdate(INSERT_ELO, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnVarChar("division", 100, division)); + Connection con = getConnection(); + java.sql.Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE); + String selectQuery = "SELECT gameType, division FROM eloRating WHERE uuid = '" + uuid + "';"; + ResultSet rs = stmt.executeQuery(selectQuery); + + boolean contains = false; + + while(rs.next()) + { + String updateQuery = "UPDATE eloRating SET division='" + division + "' WHERE uuid = '" + uuid + "' AND gametype = '" + gameType + "';"; + executeQuery(updateQuery, null, new ColumnVarChar("elo", 100, uuid)); + } + if(!contains) + { + executeUpdate(INSERT_DIVISION, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnVarChar("division", 100, division)); + } } public EloClientData loadClientInformation(ResultSet resultSet) throws SQLException diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java index d2d8dd2e8..613df95e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/CaptureTheFlag.java @@ -564,7 +564,7 @@ public class CaptureTheFlag extends TeamGame for (Player player : WinnerTeam.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); teamWinner.addPlayer(eloPlayer); @@ -575,7 +575,7 @@ public class CaptureTheFlag extends TeamGame for (Player player : team.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); teamLoser.addPlayer(eloPlayer); @@ -585,12 +585,12 @@ public class CaptureTheFlag extends TeamGame for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) { - Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + Manager.getEloManager().saveElo(eloPlayer.getUniqueId(), GetName(), eloPlayer.Rating); } for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) { - Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + Manager.getEloManager().saveElo(eloPlayer.getUniqueId(), GetName(), eloPlayer.Rating); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index 3550e866b..29aad952f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -329,7 +329,7 @@ public class Domination extends TeamGame for (Player player : WinnerTeam.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); //Increment Elo (in case it isn't being incremented already) @@ -343,7 +343,7 @@ public class Domination extends TeamGame for (Player player : team.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); //Decrement Elo (in case it isn't being decremented already) @@ -357,14 +357,14 @@ public class Domination extends TeamGame for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) { eloPlayer.Rating += 20; - Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + Manager.getEloManager().saveElo(eloPlayer.getUniqueId(), GetName(), eloPlayer.Rating); } for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) { eloPlayer.Rating -= 10; - Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + Manager.getEloManager().saveElo(eloPlayer.getUniqueId(), GetName(), eloPlayer.Rating); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java index 02794e31b..fb265835f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java @@ -79,8 +79,10 @@ public class TeamDeathmatch extends TeamGame this.HungerSet = 20; this.WorldTimeSet = 2000; this.CompassEnabled = true; + this.EloRanking = true; this.EloSetting.setEloSetting(2); + this.Manager.getEloManager().generatePlayerElos(this.GetPlayers(false), this.GetName()); this.Manager.GetDamage().UseSimpleWeaponDamage = false; @@ -365,7 +367,7 @@ public class TeamDeathmatch extends TeamGame for (Player player : WinnerTeam.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); teamWinner.addPlayer(eloPlayer); @@ -384,7 +386,7 @@ public class TeamDeathmatch extends TeamGame for (Player player : team.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString();; + eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); teamLoser.addPlayer(eloPlayer); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 995629274..550482f26 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -868,7 +868,7 @@ public class TurfForts extends TeamGame for (Player player : WinnerTeam.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); teamWinner.addPlayer(eloPlayer); @@ -880,7 +880,7 @@ public class TurfForts extends TeamGame for (Player player : team.GetPlayers(false)) { EloPlayer eloPlayer = new EloPlayer(); - eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); teamLoser.addPlayer(eloPlayer); @@ -891,13 +891,13 @@ public class TurfForts extends TeamGame for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) { - Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); - Bukkit.broadcastMessage(eloPlayer.UniqueId + "'s new Elo: " + eloPlayer.Rating); + Manager.getEloManager().saveElo(eloPlayer.getUniqueId(), GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(eloPlayer.getUniqueId() + "'s new Elo: " + eloPlayer.Rating); } for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) { - Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + Manager.getEloManager().saveElo(eloPlayer.getUniqueId(), GetName(), eloPlayer.Rating); } } From 4a4e64a3ff40141f666282f32d85055fcd29a5e1 Mon Sep 17 00:00:00 2001 From: "Joseph Prezioso Jr." Date: Thu, 14 Apr 2016 20:09:09 -0400 Subject: [PATCH 33/34] EloRepository overhaul started Tinkering with EloRepository, using AccountRepository as a base --- .../src/mineplex/core/elo/EloRepository.java | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java index 61159d1f4..abef99c08 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java @@ -3,6 +3,8 @@ package mineplex.core.elo; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; import mineplex.core.database.MinecraftRepository; @@ -21,6 +23,9 @@ public class EloRepository extends MinecraftRepository private static String CREATE_ELO_TABLE = "CREATE TABLE IF NOT EXISTS eloRating (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), gameType VARCHAR(256), elo INT, division VARCHAR(256), PRIMARY KEY (id), UNIQUE INDEX uuid_gameType_index (uuid, gameType));"; private static String INSERT_ELO = "INSERT INTO eloRating (uuid, gameType, elo) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE elo=VALUES(elo);"; private static String INSERT_DIVISION = "INSERT INTO eloRating (uuid, gameType, division) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE division=VALUES(division);"; + private static String UPDATE_ELO = "UPDATE eloRating SET elo=? WHERE uuid=?;"; + private static String SELECT_ELO_BY_UUID = "SELECT elo FROM eloRating WHERE uuid = ? LIMIT 1"; + private static String ELO_NEW = "INSERT INTO eloRating (uuid, gameType, elo), values(?, ?, ?);"; public EloRepository(JavaPlugin plugin) { @@ -39,25 +44,23 @@ public class EloRepository extends MinecraftRepository //get an elo from the database public int getRepoElo(String uuid, String gameType) throws SQLException { - Connection con = getConnection(); - java.sql.Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); - String selectQuery = "SELECT elo FROM eloRating WHERE uuid = '" + uuid + "' AND gameType = '" + gameType + "';"; - ResultSet rs = stmt.executeQuery(selectQuery); - //elo set to 1000 by default int elo = 1000; - //if something was found, return the elo - if(rs.next()) - { - elo = rs.getInt(1); - Bukkit.broadcastMessage("getRepoElo pulled " + elo + "from database for " + uuid); - return elo; + try (Connection con = getConnection(); java.sql.Statement satement = con.createStatement()) + { + satement.execute(SELECT_ELO_BY_UUID); + ResultSet resultSet = satement.getResultSet(); + + //if something was found, return the elo + if(resultSet.next()) + { + elo = resultSet.getInt(1); + Bukkit.broadcastMessage("getRepoElo pulled " + elo + "from database for " + uuid); + return elo; + } } - //make a new entry into eloRatings, if there is no elo for the player for this gameType - saveElo(uuid, gameType, elo); - //then return the elo (should be 1000) return elo; } @@ -65,7 +68,7 @@ public class EloRepository extends MinecraftRepository { Connection con = getConnection(); java.sql.Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE); - String selectQuery = "SELECT gameType, elo FROM eloRating WHERE uuid = '" + uuid + "';"; + String selectQuery = SELECT_ELO_BY_UUID; ResultSet rs = stmt.executeQuery(selectQuery); boolean contains = false; @@ -74,8 +77,7 @@ public class EloRepository extends MinecraftRepository { contains = true; //update elo - String updateQuery = "UPDATE eloRating SET elo='" + elo + "' WHERE uuid = '" + uuid + "' AND gametype = '" + gameType + "';"; - executeQuery(updateQuery, null, new ColumnVarChar("elo", 100, uuid)); + executeUpdate(UPDATE_ELO, new ColumnVarChar("elo", 100, uuid)); Bukkit.broadcastMessage("Updating existing elo"); } if(!contains) @@ -100,7 +102,7 @@ public class EloRepository extends MinecraftRepository while(rs.next()) { String updateQuery = "UPDATE eloRating SET division='" + division + "' WHERE uuid = '" + uuid + "' AND gametype = '" + gameType + "';"; - executeQuery(updateQuery, null, new ColumnVarChar("elo", 100, uuid)); + executeUpdate(updateQuery, new ColumnVarChar("elo", 100, uuid)); } if(!contains) { From bbb81dd6630a0a711c07d784418cfd2dfb7fdd61 Mon Sep 17 00:00:00 2001 From: "Joseph Prezioso Jr." Date: Fri, 15 Apr 2016 20:48:56 -0400 Subject: [PATCH 34/34] Elo calls migrated to Game.java Consequently, elo code is actually being called now Bukkit.broadcastMessage calls have shown where things are breaking handleElo() added to EloManager to facilitate movement of team elo code preparing to use EloManager's getNewRatings() method to calculate team elos --- .../src/mineplex/core/elo/EloManager.java | 25 ++++++- .../src/mineplex/core/elo/EloRepository.java | 48 +++++++++---- .../src/nautilus/game/arcade/game/Game.java | 71 +++++++++++++++++++ .../game/games/common/TeamDeathmatch.java | 24 ++++--- 4 files changed, 143 insertions(+), 25 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index c92ca5c54..1d472c9ed 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -37,6 +37,14 @@ public class EloManager extends MiniDbClientPlugin } + //add an EloPlayer's info to _playerElos + public void addToPlayerElos(EloPlayer player, String gameType) + { + NautHashMap playerInfo = new NautHashMap(); + playerInfo.put(player.getUniqueId(), player.Rating); + _playerElos.put(gameType, playerInfo); + } + /* * fill _playerElos with information from database * If no entry exists, create one @@ -111,32 +119,43 @@ public class EloManager extends MiniDbClientPlugin public void saveElo(UUID uuid, String gameType, int elo) { - String playerDiv = getPlayerDivision(uuid, gameType); + //Bukkit.broadcastMessage("SAVE_ELO - EloManager (uuid type) called"); + //String playerDiv = getPlayerDivision(uuid, gameType); saveElo(uuid.toString(), gameType, elo); - saveDivision(uuid.toString(), gameType, playerDiv); + //saveDivision(uuid.toString(), gameType, playerDiv); } public void saveElo(final String uuid, final String gameType, final int elo) { + //Bukkit.broadcastMessage("SAVE_ELO - EloManager (String type) called"); + Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { public void run() { + try { + //it hits this, but doesn't hit the message below. _repository.saveElo(uuid, gameType, elo); - Bukkit.broadcastMessage("Attempting to saveElo..."); + Bukkit.broadcastMessage("Attempting to save " + elo + " as Elo from repository..."); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); + Bukkit.broadcastMessage("EloManager SaveElo (string) - CATCH hit"); } + //Doesn't hit any of this, to my knowledge - JP synchronized (_playerEloLock) { + //Bukkit.broadcastMessage("EloManager SaveElo (string) - _playerEloLock synchronized..."); if (_playerElos.containsKey(uuid)) { + //Bukkit.broadcastMessage("EloManager SaveElo (string) - uuid found in _playerElos"); if (_playerElos.get(uuid).containsKey(gameType)) { + //Bukkit.broadcastMessage("EloManager SaveElo (string) - gameType found in _playerElos"); _playerElos.get(uuid).put(gameType, elo); + //Bukkit.broadcastMessage("Attempting to save " + elo + " as Elo from hash map..."); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java index abef99c08..ea46403ca 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java @@ -11,6 +11,7 @@ import mineplex.core.database.MinecraftRepository; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; +import com.mysql.jdbc.PreparedStatement; import com.mysql.jdbc.Statement; import mineplex.serverdata.database.DBPool; @@ -25,6 +26,8 @@ public class EloRepository extends MinecraftRepository private static String INSERT_DIVISION = "INSERT INTO eloRating (uuid, gameType, division) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE division=VALUES(division);"; private static String UPDATE_ELO = "UPDATE eloRating SET elo=? WHERE uuid=?;"; private static String SELECT_ELO_BY_UUID = "SELECT elo FROM eloRating WHERE uuid = ? LIMIT 1"; + private static String SELECT_DIVISION_BY_UUID = "SELECT division FROM eloRating WHERE uuid = ? LIMIT 1"; + private static String UPDATE_DIVISION = "UPDATE eloRating SET division=? WHERE uuid=?;"; private static String ELO_NEW = "INSERT INTO eloRating (uuid, gameType, elo), values(?, ?, ?);"; public EloRepository(JavaPlugin plugin) @@ -39,26 +42,30 @@ public class EloRepository extends MinecraftRepository //executeUpdate(CREATE_ELO_TABLE); } - //A few get methods to make grabbing info from the database easier - //get an elo from the database public int getRepoElo(String uuid, String gameType) throws SQLException { //elo set to 1000 by default int elo = 1000; - try (Connection con = getConnection(); java.sql.Statement satement = con.createStatement()) + try (Connection con = getConnection(); java.sql.PreparedStatement pStatement = con.prepareStatement(SELECT_ELO_BY_UUID);) { - satement.execute(SELECT_ELO_BY_UUID); - ResultSet resultSet = satement.getResultSet(); + pStatement.execute(SELECT_ELO_BY_UUID); + pStatement.setString(1, uuid.toString()); + ResultSet resultSet = pStatement.executeQuery(); //if something was found, return the elo if(resultSet.next()) { - elo = resultSet.getInt(1); + elo = resultSet.getInt("elo"); Bukkit.broadcastMessage("getRepoElo pulled " + elo + "from database for " + uuid); return elo; } + else + { + saveElo(uuid, gameType, elo); + } + } return elo; @@ -67,27 +74,40 @@ public class EloRepository extends MinecraftRepository public void saveElo(String uuid, String gameType, int elo) throws SQLException { Connection con = getConnection(); - java.sql.Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE); - String selectQuery = SELECT_ELO_BY_UUID; - ResultSet rs = stmt.executeQuery(selectQuery); + java.sql.PreparedStatement stmt = con.prepareStatement(SELECT_ELO_BY_UUID); + stmt.setString(1, uuid.toString()); + ResultSet rs = stmt.executeQuery(); boolean contains = false; + Bukkit.broadcastMessage("SAVE_ELO - EloRepository called"); + + Bukkit.broadcastMessage("Pre-loop - Result Set Boolean:" + rs.toString()); + while (rs.next()) { + Bukkit.broadcastMessage("Result Set Boolean:" + rs.toString()); contains = true; //update elo - executeUpdate(UPDATE_ELO, new ColumnVarChar("elo", 100, uuid)); - Bukkit.broadcastMessage("Updating existing elo"); + java.sql.PreparedStatement updateStatement = con.prepareStatement(UPDATE_ELO); + updateStatement.setInt(1, elo); + updateStatement.setString(2, uuid.toString()); + updateStatement.executeUpdate(); + //executeUpdate(UPDATE_ELO, new ColumnInt("elo", elo)); + Bukkit.broadcastMessage("SAVE_ELO - EloRepository: Updating existing elo to " + elo); } if(!contains) { //insert elo - executeUpdate(INSERT_ELO, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnInt("elo", elo)); - Bukkit.broadcastMessage("Adding new player elo to " + gameType +" elo database..."); + java.sql.PreparedStatement updateStatement = con.prepareStatement(INSERT_ELO); + updateStatement.setInt(1, elo); + updateStatement.setString(2, uuid.toString()); + updateStatement.executeUpdate(); + //executeUpdate(INSERT_ELO, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnInt("elo", elo)); + Bukkit.broadcastMessage("SAVE_ELO - EloRepository: Adding " + elo + " to " + gameType +" elo database..."); } - + Bukkit.broadcastMessage("SAVE_ELO - EloRepository: Adding " + elo + " to " + gameType +" elo database..."); } public void saveDivision(String uuid, String gameType, String division) throws SQLException diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index ea70aeaca..977d21357 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -55,7 +55,9 @@ import mineplex.core.common.util.UtilTabTitle; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.elo.EloPlayer; import mineplex.core.elo.EloSettings; +import mineplex.core.elo.EloTeam; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; @@ -1039,6 +1041,7 @@ public abstract class Game implements Listener @EventHandler public void eloStart(PlayerLoginEvent event) { + Bukkit.broadcastMessage("eloStart called in Game. Player's Elo should be saved."); if (EloRanking) { if (Manager.getEloManager().getElo(event.getPlayer().getUniqueId(), GetName()) == -1) @@ -1210,6 +1213,9 @@ public abstract class Game implements Listener } UtilTextMiddle.display(winnerText, subColor + "won the game", 20, 120, 20); + + //try to do Elo stuff + handleElo(); if (AnnounceSilence) Manager.GetChat().Silence(5000, false); @@ -1734,10 +1740,75 @@ public abstract class Game implements Listener if (player.isOnline()) AddGems(player, 10, "Participation", false, false); } + + handleElo(); // End SetState(GameState.End); } + + public void handleElo() + { + UtilTextMiddle.display("HandleElo Called", "at Game AnnounceEnd (team)"); + //Bukkit.broadcastMessage("handleElo called"); + if (EloRanking) + { + Bukkit.broadcastMessage("Game Class EloRanking = True"); + + EloTeam teamWinner = new EloTeam(); + EloTeam teamLoser = new EloTeam(); + + //EloManager may make most of the code below redundant. leaving inactive, pending testing + //Manager.getEloManager().getNewRatings(teamA, teamB, result) + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : WinnerTeam.GetPlayers(false)) + { + Bukkit.broadcastMessage("Game Class WinnerTeam For Loop Reached"); + + EloPlayer eloPlayer = new EloPlayer(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); + eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + + teamWinner.addPlayer(eloPlayer); + + eloPlayer.Rating += 25; + + Manager.getEloManager().addToPlayerElos(eloPlayer, this.GetName()); + + Bukkit.broadcastMessage(player.getName() + " GetTeamList Elo: " + eloPlayer.Rating); + + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(player.getName() + " Post-Save Elo: " + eloPlayer.Rating); + + } + } + else + { + for (Player player : team.GetPlayers(false)) + { + Bukkit.broadcastMessage("Game Class LosingTeam For Loop Reached"); + + EloPlayer eloPlayer = new EloPlayer(); + eloPlayer.setUniqueId(player.getUniqueId().toString()); + eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + teamLoser.addPlayer(eloPlayer); + + eloPlayer.Rating -= 15; + + Bukkit.broadcastMessage(player.getName() + " GetTeamList Elo: " + eloPlayer.Rating); + + Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(player.getName() + " Post-Save Elo: " + eloPlayer.Rating); + + } + } + } + } + } @EventHandler public void handleInteractEntityPacket(GameStateChangeEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java index fb265835f..d024cbe2d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java @@ -354,9 +354,13 @@ public class TeamDeathmatch extends TeamGame if (player.isOnline()) AddGems(player, 10, "Participation", false, false); } + + Bukkit.broadcastMessage("TDM AnnounceEnd Called"); if (EloRanking) { + Bukkit.broadcastMessage("TDM EloRanking = True"); + EloTeam teamWinner = new EloTeam(); EloTeam teamLoser = new EloTeam(); @@ -366,6 +370,8 @@ public class TeamDeathmatch extends TeamGame { for (Player player : WinnerTeam.GetPlayers(false)) { + Bukkit.broadcastMessage("TDM WinnerTeam For Loop Reached"); + EloPlayer eloPlayer = new EloPlayer(); eloPlayer.setUniqueId(player.getUniqueId().toString()); eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); @@ -374,6 +380,8 @@ public class TeamDeathmatch extends TeamGame eloPlayer.Rating += 25; + Manager.getEloManager().addToPlayerElos(eloPlayer, this.GetName()); + Bukkit.broadcastMessage(player.getName() + " GetTeamList Elo: " + eloPlayer.Rating); Manager.getEloManager().saveElo(player.getUniqueId(), GetName(), eloPlayer.Rating); @@ -400,21 +408,21 @@ public class TeamDeathmatch extends TeamGame } } } - /* + for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) { - eloPlayer.Rating += 20; - Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); - Bukkit.broadcastMessage(eloPlayer.UniqueId + "Post-Save Elo: " + eloPlayer.Rating); + eloPlayer.Rating += 25; + Manager.getEloManager().saveElo(eloPlayer.getUniqueId(), GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(eloPlayer.getUniqueId() + "Post-Save Elo: " + eloPlayer.Rating); } for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) { - eloPlayer.Rating -= 10; - Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); - Bukkit.broadcastMessage(eloPlayer.UniqueId + "Post-Save Elo: " + eloPlayer.Rating); + eloPlayer.Rating -= 15; + Manager.getEloManager().saveElo(eloPlayer.getUniqueId(), GetName(), eloPlayer.Rating); + Bukkit.broadcastMessage(eloPlayer.getUniqueId() + "Post-Save Elo: " + eloPlayer.Rating); } - */ + } //End