From 71f8640189275b18baa41f1353b3acf2b0a22380 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Mon, 2 May 2016 01:06:00 +0200 Subject: [PATCH] implement Dukes of decoration, OP Gladiators, Countdown, Heroes of the ewe, OP Skywars, Ultra spleef, Assassins and Blood diamonds --- .../nautilus/game/arcade/ArcadeManager.java | 23 +- .../src/nautilus/game/arcade/GameType.java | 23 +- .../games/build/modes/DukesOfDecoration.java | 101 +++++++++ .../game/games/gladiators/ArenaType.java | 1 - .../game/games/gladiators/Gladiators.java | 15 +- .../modes/OverpoweredGladiators.java | 92 ++++++++ .../arcade/game/games/hideseek/HideSeek.java | 5 + .../game/games/hideseek/forms/BlockForm.java | 2 +- .../game/games/hideseek/modes/Countdown.java | 103 +++++++++ .../arcade/game/games/sheep/SheepGame.java | 30 ++- .../game/games/sheep/modes/EweHeroes.java | 82 +++++++ .../arcade/game/games/skywars/Skywars.java | 21 +- .../skywars/modes/OverpoweredSkywars.java | 214 ++++++++++++++++++ .../game/games/spleef/modes/UltraSpleef.java | 122 ++++++++++ .../game/games/uhc/modes/Assassins.java | 118 ++++++++++ .../game/games/uhc/modes/BloodDiamonds.java | 48 ++++ .../game/games/uhc/modes/GodBattles.java | 2 +- .../arcade/managers/GameCreationManager.java | 11 +- 18 files changed, 972 insertions(+), 41 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/DukesOfDecoration.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/OverpoweredGladiators.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/modes/Countdown.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/OverpoweredSkywars.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/modes/UltraSpleef.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/Assassins.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/BloodDiamonds.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 6dd245b99..c60046b45 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1388,6 +1388,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation }); } + public void enableChampionsModules() + { + _classManager.setEnabled(true); + _classShopManager.registerSelf(); + _skillFactory.registerSelf(); + _itemFactory.registerSelf(); + _energy.registerSelf(); + _eloManager.registerSelf(); + + //Class Shop + _plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin); + } + public void toggleChampionsModules(GameType gameType) { boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF || gameType == GameType.BossBattles; @@ -1403,15 +1416,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (_enabled) { - _classManager.setEnabled(true); - _classShopManager.registerSelf(); - _skillFactory.registerSelf(); - _itemFactory.registerSelf(); - _energy.registerSelf(); - _eloManager.registerSelf(); - - //Class Shop - _plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin); + enableChampionsModules(); } else { 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 225837812..703e1e187 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -15,6 +15,7 @@ import nautilus.game.arcade.game.games.bridge.Bridge; import nautilus.game.arcade.game.games.bridge.modes.OverpoweredBridge; import nautilus.game.arcade.game.games.bridge.modes.SpeedBridges ; import nautilus.game.arcade.game.games.build.Build; +import nautilus.game.arcade.game.games.build.modes.DukesOfDecoration; import nautilus.game.arcade.game.games.build.modes.TeamBuild; import nautilus.game.arcade.game.games.cards.Cards; import nautilus.game.arcade.game.games.castlesiege.CastleSiege; @@ -32,9 +33,11 @@ import nautilus.game.arcade.game.games.draw.Draw; import nautilus.game.arcade.game.games.event.EventGame; import nautilus.game.arcade.game.games.evolution.Evolution; import nautilus.game.arcade.game.games.gladiators.Gladiators; +import nautilus.game.arcade.game.games.gladiators.modes.OverpoweredGladiators; import nautilus.game.arcade.game.games.gravity.Gravity; import nautilus.game.arcade.game.games.halloween.Halloween; import nautilus.game.arcade.game.games.hideseek.HideSeek; +import nautilus.game.arcade.game.games.hideseek.modes.Countdown; import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall; import nautilus.game.arcade.game.games.horsecharge.Horse; import nautilus.game.arcade.game.games.lobbers.BombLobbers; @@ -55,8 +58,10 @@ import nautilus.game.arcade.game.games.runner.Runner; import nautilus.game.arcade.game.games.runner.modes.FasterThanLight; import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy; import nautilus.game.arcade.game.games.sheep.SheepGame; +import nautilus.game.arcade.game.games.sheep.modes.EweHeroes; import nautilus.game.arcade.game.games.skywars.SoloSkywars; import nautilus.game.arcade.game.games.skywars.TeamSkywars; +import nautilus.game.arcade.game.games.skywars.modes.OverpoweredSkywars; import nautilus.game.arcade.game.games.smash.SoloSuperSmash; import nautilus.game.arcade.game.games.smash.SuperSmashDominate; import nautilus.game.arcade.game.games.smash.TeamSuperSmash; @@ -66,6 +71,7 @@ import nautilus.game.arcade.game.games.snowfight.SnowFight; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.games.spleef.Spleef; import nautilus.game.arcade.game.games.spleef.SpleefTeams; +import nautilus.game.arcade.game.games.spleef.modes.UltraSpleef; import nautilus.game.arcade.game.games.squidshooter.SquidShooter; import nautilus.game.arcade.game.games.stacker.Stacker; import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames; @@ -75,7 +81,10 @@ import nautilus.game.arcade.game.games.tug.Tug; import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.typewars.TypeWars; import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.game.games.uhc.modes.Assassins; +import nautilus.game.arcade.game.games.uhc.modes.BloodDiamonds; import nautilus.game.arcade.game.games.uhc.modes.CutClean ; +import nautilus.game.arcade.game.games.uhc.modes.GodBattles; import nautilus.game.arcade.game.games.valentines.Valentines; import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wizards.Wizards; @@ -113,7 +122,7 @@ public enum GameType { Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResHalloween.zip") }, true), - HideSeek(HideSeek.class, GameDisplay.HideSeek), + HideSeek(HideSeek.class, new GameMode[]{new GameMode(Countdown.class, "Countdown")}, GameDisplay.HideSeek), HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall), Horse(Horse.class, GameDisplay.Horse), Lobbers(BombLobbers.class, GameDisplay.Lobbers), @@ -131,7 +140,7 @@ public enum GameType QuiverTeams(QuiverTeams.class, GameDisplay.QuiverTeams), Runner(Runner.class, new GameMode[]{new GameMode(FasterThanLight.class, "Gotta Go Fast")}, GameDisplay.Runner), SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy), - Sheep(SheepGame.class, GameDisplay.Sheep), + Sheep(SheepGame.class, new GameMode[]{new GameMode(EweHeroes.class, "Heroes Of The Ewe")}, GameDisplay.Sheep), TypeWars(TypeWars.class, GameDisplay.TypeWars), Smash(SoloSuperSmash.class, GameDisplay.Smash), @@ -141,7 +150,7 @@ public enum GameType SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins), SnowFight(SnowFight.class, GameDisplay.SnowFight), SpeedBuilders(SpeedBuilders.class, GameDisplay.SpeedBuilders), - Spleef(Spleef.class, GameDisplay.Spleef), + Spleef(Spleef.class, new GameMode[]{new GameMode(UltraSpleef.class, "Ultra Spleef")}, GameDisplay.Spleef), SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams), SquidShooter(SquidShooter.class, GameDisplay.SquidShooter), Stacker(Stacker.class, GameDisplay.Stacker), @@ -149,20 +158,20 @@ public enum GameType SurvivalGamesTeams(TeamSurvivalGames.class, GameDisplay.SurvivalGamesTeams, new GameType[]{GameType.SurvivalGames}, false), Tug(Tug.class, GameDisplay.Tug), TurfWars(TurfForts.class, GameDisplay.TurfWars), - UHC(UHC.class, new GameMode[]{new GameMode(CutClean.class, "Cut Clean")}, GameDisplay.UHC), + UHC(UHC.class, new GameMode[]{new GameMode(CutClean.class, "Cut Clean"), new GameMode(GodBattles.class, "God Battles"), new GameMode(BloodDiamonds.class, "Blood Diamonds"), new GameMode(Assassins.class, "Assassins")}, GameDisplay.UHC), WitherAssault(WitherGame.class, GameDisplay.WitherAssault), Wizards(Wizards.class, GameDisplay.Wizards, new Pair[] { Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResWizards.zip") }, true), ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival), - Build(Build.class, new GameMode[]{new GameMode(TeamBuild.class, "Team Master Builders")}, GameDisplay.Build), + Build(Build.class, new GameMode[]{new GameMode(TeamBuild.class, "Team Master Builders"), new GameMode(DukesOfDecoration.class, "Dukes Of Decoration")}, GameDisplay.Build), Cards(Cards.class, GameDisplay.Cards), Skywars(SoloSkywars.class, GameDisplay.Skywars), - SkywarsTeams(TeamSkywars.class, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false), + SkywarsTeams(TeamSkywars.class, new GameMode[]{new GameMode(OverpoweredSkywars.class, "OP Skywars")}, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false), MonsterMaze(MonsterMaze.class, GameDisplay.MonsterMaze), MonsterLeague(MonsterLeague.class, GameDisplay.MonsterLeague), - Gladiators(Gladiators.class, GameDisplay.Gladiators), + Gladiators(Gladiators.class, new GameMode[]{new GameMode(OverpoweredGladiators.class, "OP Gladiators")}, GameDisplay.Gladiators), BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/DukesOfDecoration.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/DukesOfDecoration.java new file mode 100644 index 000000000..4948e41fa --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/DukesOfDecoration.java @@ -0,0 +1,101 @@ +package nautilus.game.arcade.game.games.build.modes; + +import java.util.ArrayList; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.games.build.Build; + +/** + * DukesOfDecoration + * + * @author xXVevzZXx + */ +public class DukesOfDecoration extends Build +{ + + private ArrayList _blocks; + + public DukesOfDecoration(ArcadeManager manager) + { + super(manager); + + _blocks = new ArrayList<>(); + + for (int i = 0; i < 22; i++) + { + Material mat = Material.values()[1 + UtilMath.r(174)]; + while (_blocks.contains(mat) || mat == Material.COMMAND || mat == Material.COMMAND_MINECART) + { + mat = Material.values()[1 + UtilMath.r(174)]; + } + _blocks.add(mat); + } + } + + @EventHandler + public void giveBlocks(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + for (Player player : GetPlayers(true)) + { + giveBlocks(player); + } + } + + @EventHandler + public void giveBlockCommand(PlayerCommandPreprocessEvent event) + { + if (!IsPlaying(event.getPlayer())) + return; + + if (!event.getMessage().equalsIgnoreCase("/giveblocks")) + return; + + event.setCancelled(true); + + UtilInv.Clear(event.getPlayer()); + giveBlocks(event.getPlayer()); + } + + public void giveBlocks(Player player) + { + for (Material mat : _blocks) + { + UtilInv.insert(player, new ItemStack(mat)); + } + + UtilPlayer.message(player, F.main("Game", "You have been given your building blocks. If you want to get them once again type " + F.game("/giveblocks"))); + } + + @EventHandler + public void placeBlock(BlockPlaceEvent event) + { + if (!_blocks.contains(event.getBlockPlaced().getType())) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You can not place this Block")); + } + } + + @Override + public String GetMode() + { + return "Dukes Of Decoration"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/ArenaType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/ArenaType.java index 73506445e..b0d146283 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/ArenaType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/ArenaType.java @@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack; */ public enum ArenaType { - RED(1, new Loadout() { @Override 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..6fe490ce6 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 @@ -357,7 +357,7 @@ public class Gladiators extends SoloGame } } - private void findGameArenaSet() + protected void findGameArenaSet() { _gameArenaSet = new ArrayList<>(); @@ -753,7 +753,7 @@ public class Gladiators extends SoloGame p.setHealth(p.getMaxHealth()); //Heal } - private void giveLoadout(Player p, ArenaType type) + protected void giveLoadout(Player p, ArenaType type) { if (!GetPlayers(true).contains(p)) return; @@ -1113,4 +1113,15 @@ public class Gladiators extends SoloGame _hotbarEditor.deregisterSelf(); // De-register as listener _hotbarEditor.onDisable(); // Fully disable } + + public HashMap getArenas() + { + return _playerArenas; + } + + public HotbarEditor getHotbarEditor() + { + return _hotbarEditor; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/OverpoweredGladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/OverpoweredGladiators.java new file mode 100644 index 000000000..e2853ecb5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/OverpoweredGladiators.java @@ -0,0 +1,92 @@ +package nautilus.game.arcade.game.games.gladiators.modes; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.gladiators.Arena; +import nautilus.game.arcade.game.games.gladiators.ArenaType; +import nautilus.game.arcade.game.games.gladiators.Gladiators; +import nautilus.game.arcade.game.games.gladiators.hotbar.HotbarLayout; + +/** + * OverpoweredGladiators + * + * @author xXVevzZXx + */ +public class OverpoweredGladiators extends Gladiators +{ + + public OverpoweredGladiators(ArcadeManager manager) + { + super(manager); + } + + @Override + protected void giveLoadout(Player p, ArenaType type) + { + if (!GetPlayers(true).contains(p)) + return; + + HotbarLayout layout = getHotbarEditor().getLayout(p); + + int enchantMentLevel = 0; + switch(type) + { + case RED: enchantMentLevel = 4; + case ORANGE: enchantMentLevel = 3; + case YELLOW: enchantMentLevel = 2; + case GREEN: enchantMentLevel = 1; + } + + p.getInventory().clear(); + p.getInventory().setArmorContents(null); + + p.getInventory().setItem(layout.getRod(), UtilItem.makeUnbreakable(type.getLoadout().getRod())); + p.getInventory().setItem(layout.getBow(), type.getLoadout().getBow()); + p.getInventory().setItem(layout.getArrows(), type.getLoadout().getArrows()); + + ItemStack sword = new ItemStack(Material.DIAMOND_SWORD); + + ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET); + ItemStack chest = new ItemStack(Material.DIAMOND_CHESTPLATE); + ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS); + ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS); + + + if(enchantMentLevel != 0) + { + sword.addEnchantment(Enchantment.DAMAGE_ALL, enchantMentLevel); + helmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, enchantMentLevel); + chest.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, enchantMentLevel); + leggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, enchantMentLevel); + boots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, enchantMentLevel); + + if(enchantMentLevel >= 4) + { + UtilInv.insert(p, new ItemStack(Material.GOLDEN_APPLE,1 , (short) 1)); + } + } + + p.getInventory().setItem(layout.getSword(), UtilItem.makeUnbreakable(sword)); + + p.getInventory().setHelmet(helmet); + p.getInventory().setChestplate(chest); + p.getInventory().setLeggings(leggings); + p.getInventory().setBoots(boots); + + p.playSound(p.getLocation(), Sound.LEVEL_UP, 1f, 1f); + } + + @Override + public String GetMode() + { + return "OP Gladiators"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 5488f3d77..2ef678d00 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -1653,4 +1653,9 @@ public class HideSeek extends TeamGame return ent.getVehicle() != null; } + + public HashMap getForms() + { + return _forms; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java index f0a2973f4..a3c515081 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java @@ -70,7 +70,7 @@ public class BlockForm extends Form _fakeBlockId = UtilEnt.getNewEntityId(); System.out.println("Block Form: " + _mat + " " + _mat.getId()); } - + @Override public void Apply() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/modes/Countdown.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/modes/Countdown.java new file mode 100644 index 000000000..04afbc989 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/modes/Countdown.java @@ -0,0 +1,103 @@ +package nautilus.game.arcade.game.games.hideseek.modes; + +import java.util.ArrayList; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.games.hideseek.HideSeek; +import nautilus.game.arcade.game.games.hideseek.forms.BlockForm; +import nautilus.game.arcade.game.games.hideseek.forms.Form; + +/** + * Countdown + * + * @author xXVevzZXx + */ +public class Countdown extends HideSeek +{ + + private int _changeInterval; + + private long _lastChanged = 0; + + private ArrayList _blocks; + + public Countdown(ArcadeManager manager) + { + super(manager); + + _changeInterval = 30; + _blocks = new ArrayList<>(); + for (Material mat : Material.values()) + { + _blocks.add(mat); + } + } + + @EventHandler + public void gameState(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + _lastChanged = System.currentTimeMillis(); + } + + @EventHandler + public void changeForms(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if(UtilTime.elapsed(_lastChanged, _changeInterval*1000)) + { + _lastChanged = System.currentTimeMillis(); + + Material mat = _blocks.get(UtilMath.r(_blocks.size())); + int i = 0; + while (i < 20 && UtilBlock.isBlock(new ItemStack(mat))) + { + mat = _blocks.get(UtilMath.r(_blocks.size())); + i++; + } + if (i >= 20) + { + mat = Material.JUKEBOX; + } + for (Player player : GetPlayers(true)) + { + getForms().get(player).Remove(); + + Form form = new BlockForm(this, player, mat); + + getForms().put(player, form); + + form.Apply(); + + Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form)); + } + + } + } + + @Override + public String GetMode() + { + return "Countdown"; + } + +} 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..f48b69d27 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 @@ -125,14 +125,17 @@ public class SheepGame extends TeamGame public SheepGame(ArcadeManager manager) { - super(manager, GameType.Sheep, - - new Kit[] - { - new KitBeserker(manager), - new KitArcher(manager), - new KitBrute(manager) - }, + this(manager, new Kit[] + { + new KitBeserker(manager), + new KitArcher(manager), + new KitBrute(manager) + }); + } + + public SheepGame(ArcadeManager manager, Kit[] kits) + { + super(manager, GameType.Sheep, kits, new String[] { @@ -333,9 +336,8 @@ public class SheepGame extends TeamGame } //Put Wool in Inventory - player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)sheep).getColor().getWoolData())); - UtilInv.Update(player); - + inventoryWool(player, count, sheep); + //Effect sheep.getWorld().playEffect(sheep.getLocation(), Effect.STEP_SOUND, 35); @@ -350,6 +352,12 @@ public class SheepGame extends TeamGame return true; } + + public void inventoryWool(Player player, int count, Entity sheep) + { + player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)sheep).getColor().getWoolData())); + UtilInv.Update(player); + } @EventHandler public void StackPlayer(PlayerInteractEntityEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java new file mode 100644 index 000000000..e32cb60ab --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java @@ -0,0 +1,82 @@ +package nautilus.game.arcade.game.games.sheep.modes; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.champions.ChampionsFixes; +import nautilus.game.arcade.game.games.champions.kits.KitAssassin; +import nautilus.game.arcade.game.games.champions.kits.KitBrute; +import nautilus.game.arcade.game.games.champions.kits.KitKnight; +import nautilus.game.arcade.game.games.champions.kits.KitMage; +import nautilus.game.arcade.game.games.champions.kits.KitRanger; +import nautilus.game.arcade.game.games.sheep.SheepGame; +import nautilus.game.arcade.kit.Kit; + +/** + * EweHeroes + * + * @author xXVevzZXx + */ +public class EweHeroes extends SheepGame +{ + + public EweHeroes(ArcadeManager manager) + { + super(manager, + + new Kit[] + { + new KitBrute(manager), + new KitRanger(manager), + new KitKnight(manager), + new KitMage(manager), + new KitAssassin(manager), + }); + + Manager.GetDamage().UseSimpleWeaponDamage = false; + Manager.getCosmeticManager().setHideParticles(true); + + Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6); + + StrictAntiHack = true; + TeamArmor = false; + + new ChampionsFixes(this); + + manager.enableChampionsModules(); + } + + @EventHandler + public void saddle(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (Player player : GetPlayers(true)) + { + player.getInventory().setItem(7, new ItemStack(Material.SADDLE)); + } + } + + @Override + public void inventoryWool(Player player, int count, Entity sheep) + { + + } + + @Override + public String GetMode() + { + return "Heroes Of The Ewe"; + } + +} 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..9e58995ca 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 @@ -1027,7 +1027,7 @@ public abstract class Skywars extends Game } } - private void fillChest(Player looter, Block block) + public void fillChest(Player looter, Block block) { _lootedBlocks.add(block.getLocation()); Chest chest = (Chest) block.getState(); @@ -1122,7 +1122,7 @@ public abstract class Skywars extends Game } - private void setupPlayerLoot() + public void setupPlayerLoot() { //Armor _playerArmor.addLoot(new RandomItem(Material.LEATHER_HELMET, 20)); @@ -1168,7 +1168,7 @@ public abstract class Skywars extends Game _playerBlock.addLoot(new RandomItem(Material.WOOD, 30, 8, 16)); } - private void setupMiddleLoot() + public void setupMiddleLoot() { //Armor _middleArmor.addLoot(new RandomItem(Material.GOLD_HELMET, 20)); @@ -1365,4 +1365,19 @@ public abstract class Skywars extends Game return this._crumbleTime; } + public ArrayList getSpawnChests() + { + return _spawnChests; + } + + public ArrayList getMiddleChests() + { + return _middleChests; + } + + public HashSet getLooted() + { + return _lootedBlocks; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/OverpoweredSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/OverpoweredSkywars.java new file mode 100644 index 000000000..489fab11c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/modes/OverpoweredSkywars.java @@ -0,0 +1,214 @@ +package nautilus.game.arcade.game.games.skywars.modes; + +import java.util.HashSet; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.loot.ChestLoot; +import mineplex.core.loot.RandomItem; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.skywars.TeamSkywars; + +/** + * OverpoweredSkywars + * + * @author xXVevzZXx + */ +public class OverpoweredSkywars extends TeamSkywars +{ + + private ChestLoot _playerArmor = new ChestLoot(); + private ChestLoot _playerFood = new ChestLoot(); + private ChestLoot _playerTool = new ChestLoot(); + private ChestLoot _playerProjectile = new ChestLoot(); + private ChestLoot _playerBlock = new ChestLoot(); + + private ChestLoot _middleArmor = new ChestLoot(); + private ChestLoot _middleFood = new ChestLoot(); + private ChestLoot _middleTool = new ChestLoot(); + private ChestLoot _middleProjectile = new ChestLoot(); + private ChestLoot _middleBlock = new ChestLoot(); + + public OverpoweredSkywars(ArcadeManager manager) + { + super(manager); + } + + @Override + public void fillChest(Player looter, Block block) + { + getLooted().add(block.getLocation()); + Chest chest = (Chest) block.getState(); + + chest.getBlockInventory().clear(); + + //Prevents same inventory spot being used twice + HashSet used = new HashSet(); + + //Player Island + if (getSpawnChests().contains(block)) + { + //Armor + for (int i=0 ; i<1 + UtilMath.r(2) ; i++) + { + ItemStack item = _playerArmor.getLoot(); + item.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1 + UtilMath.r(3)); + chest.getBlockInventory().setItem(getIndex(used), item); + } + //Food + for (int i=0 ; i<1 + UtilMath.r(3) ; i++) + chest.getBlockInventory().setItem(getIndex(used), _playerFood.getLoot()); + + //Tool + for (int i=0 ; i<1 + UtilMath.r(2) ; i++) + chest.getBlockInventory().setItem(getIndex(used), _playerTool.getLoot()); + + //Projectile + for (int i=0 ; i<1 + UtilMath.r(2) ; i++) + chest.getBlockInventory().setItem(getIndex(used), _playerProjectile.getLoot()); + + //Block + for (int i=0 ; i<1 + UtilMath.r(2) ; i++) + chest.getBlockInventory().setItem(getIndex(used), _playerBlock.getLoot()); + } + //Other + else if (getMiddleChests().contains(block)) + { + //Armor + for (int i=0 ; i<1 + UtilMath.r(2) ; i++) + { + ItemStack item = _middleArmor.getLoot(); + item.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1 + UtilMath.r(3)); + chest.getBlockInventory().setItem(getIndex(used), item); + } + + //Food + for (int i=0 ; i<1 + UtilMath.r(3) ; i++) + chest.getBlockInventory().setItem(getIndex(used), _middleFood.getLoot()); + + //Tool + for (int i=0 ; i<1 + UtilMath.r(2) ; i++) + chest.getBlockInventory().setItem(getIndex(used), _middleTool.getLoot()); + + //Projectile + for (int i=0 ; i<1 + UtilMath.r(2) ; i++) + chest.getBlockInventory().setItem(getIndex(used), _middleProjectile.getLoot()); + + //Block + for (int i=0 ; i<1 + UtilMath.r(2) ; i++) + chest.getBlockInventory().setItem(getIndex(used), _middleBlock.getLoot()); + } + else + { + //Armor + for (int i=0 ; i used) + { + int i = UtilMath.r(27); + + while (used.contains(i)) + { + i = UtilMath.r(27); + } + + used.add(i); + + return i; + } + + @Override + public String GetMode() + { + return "OP Skywars"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/modes/UltraSpleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/modes/UltraSpleef.java new file mode 100644 index 000000000..ffdfb1586 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/modes/UltraSpleef.java @@ -0,0 +1,122 @@ +package nautilus.game.arcade.game.games.spleef.modes; + +import org.bukkit.Material; +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.BlockDamageEvent; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.spleef.Spleef; +import nautilus.game.arcade.game.games.spleef.kits.KitSnowballer; + +/** + * UltraSpleef + * + * @author xXVevzZXx + */ +public class UltraSpleef extends Spleef +{ + + public UltraSpleef(ArcadeManager manager) + { + super(manager); + } + + @Override + @EventHandler(priority = EventPriority.LOW) + public void BlockDamage(BlockDamageEvent event) + { + if (!this.IsLive()) + return; + + if (!this.IsAlive(event.getPlayer())) + return; + + event.setCancelled(true); + + if (event.getBlock().getType() == Material.BEDROCK) + return; + + BlockFade(event.getBlock(), event.getPlayer(), false); + + for (Block block : UtilBlock.getSurrounding(event.getBlock(), false)) + { + BlockFade(block, event.getPlayer(), false); + } + + //Snowball + if (GetKit(event.getPlayer()) instanceof KitSnowballer && event.getBlock().getType() != Material.BEDROCK) + if (!UtilInv.contains(event.getPlayer(), Material.SNOW_BALL, (byte)0, 16)) + event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL)); + } + + @Override + public void BlockFade(Block block, Player player, boolean slowDamage) + { + if (block.getType() == Material.BEDROCK || block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA) + return; + + //Prevent Super Hunger from Bow + if (Recharge.Instance.use(player, GetName() + " Hunger", 50, false, false)) + UtilPlayer.hunger(player, 1); + + if (!slowDamage) + { + Break(block, player); + return; + } + + //Wool and Stained Clay + if (block.getTypeId() == 35 || block.getTypeId() == 159) + { + //Greens + if (block.getData() == 5 || block.getData() == 13) + block.setData((byte)14); + + else + Break(block, player); + } + + //Stone Brick + else if (block.getTypeId() == 98) + { + Break(block, player); + } + + //Grass + else if (block.getTypeId() == 2) + { + Break(block, player); + } + + //Wood Planks + else if (block.getTypeId() == 5) + { + if (block.getData() == 1) + block.setData((byte)0); + + else + Break(block, player); + } + + //Other + else if (block.getTypeId() != 7) + { + Break(block, player); + } + } + + @Override + public String GetMode() + { + return "Ultra Spleef"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/Assassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/Assassins.java new file mode 100644 index 000000000..eb658e819 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/Assassins.java @@ -0,0 +1,118 @@ +package nautilus.game.arcade.game.games.uhc.modes; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; + +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.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.games.uhc.UHC; + +/** + * Assassins + * + * @author xXVevzZXx + */ +public class Assassins extends UHC +{ + + private HashMap _assassins; + + public Assassins(ArcadeManager manager) + { + super(manager); + } + + @EventHandler + public void setTargets(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + for (Player player : GetPlayers(true)) + { + for (Player other : GetPlayers(true)) + { + if (GetTeam(player) == GetTeam(other)) + continue; + + if (_assassins.containsValue(other)) + continue; + + _assassins.put(player, other); + UtilPlayer.message(player, F.main("Game", "Your target is " + F.game(other.getName()) + ". If you kill another Player no loot will drop.")); + } + } + for (Player player : GetPlayers(true)) + { + if (!_assassins.containsKey(player)) + { + getNewTarget(player); + } + } + } + + @EventHandler + public void killPlayer(PlayerDeathEvent event) + { + Player player = event.getEntity(); + + for (Player other : _assassins.keySet()) + { + if (_assassins.get(other) == player) + { + UtilPlayer.message(other, F.main("Game", "Your target has died.")); + + Player newTarget = _assassins.get(player); + if (GetTeam(newTarget) != GetTeam(other)) + { + _assassins.put(other, newTarget); + } + else + { + getNewTarget(other); + } + } + } + + if (event.getEntity().getKiller() instanceof Player) + { + Player killer = event.getEntity().getKiller(); + if (_assassins.get(killer) != event.getEntity()) + { + event.getDrops().clear(); + event.setDroppedExp(0); + } + } + } + + public void getNewTarget(Player player) + { + Player other = GetPlayers(true).get(UtilMath.r(GetPlayers(true).size())); + + while (other == player || GetTeam(player) == GetTeam(other)) + { + other = GetPlayers(true).get(UtilMath.r(GetPlayers(true).size())); + } + + _assassins.put(player, other); + UtilPlayer.message(player, F.main("Game", "Your target is " + F.game(other.getName()) + ". If you kill another Player no loot will drop.")); + + UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, "Your target is: " + F.game(other.getName()))); + } + + @Override + public String GetMode() + { + return "Assassins"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/BloodDiamonds.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/BloodDiamonds.java new file mode 100644 index 000000000..77d9775c2 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/BloodDiamonds.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.games.uhc.modes; + +import java.util.HashMap; + +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockBreakEvent; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.uhc.UHC; + +/** + * BloodDiamonds + * + * @author xXVevzZXx + */ +public class BloodDiamonds extends UHC +{ + + private HashMap _oreDamage; + + public BloodDiamonds(ArcadeManager manager) + { + super(manager); + + _oreDamage = new HashMap<>(); + _oreDamage.put(Material.DIAMOND_ORE, 1D); + } + + @EventHandler + public void damageOres(BlockBreakEvent event) + { + for (Material mat : _oreDamage.keySet()) + { + if (event.getBlock().getType() == mat) + { + event.getPlayer().damage(_oreDamage.get(mat)); + } + } + } + + @Override + public String GetMode() + { + return "Blood Diamonds"; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java index fade27ff6..102df5fac 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java @@ -39,7 +39,7 @@ public class GodBattles extends UHC } @EventHandler - public void smeltOres(BlockBreakEvent event) + public void blockOres(BlockBreakEvent event) { for (Material mat : _oreDrops.keySet()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index bd512cf60..9143fc96e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -313,13 +313,12 @@ public class GameCreationManager implements Listener private void modifyGameConfiguration(Class gameClass, GameMode mode, Game game) { ArrayList> classes = new ArrayList<>(); - classes.add(gameClass); - classes.add((Class) gameClass.getSuperclass()); - - if (gameClass.getSuperclass() != Game.class) + + Class superClass = gameClass; + while(superClass != Game.class) { - Class gameType = (Class) gameClass.getSuperclass(); - classes.add((Class) gameType.getSuperclass()); + classes.add(superClass); + superClass = (Class) superClass.getSuperclass(); } HashMap varSet = Manager.GetServerConfig().GameModeMods.get(mode.getName());