From 27afd3d96c0da949c308195ef57a5ea31d6cfc4c Mon Sep 17 00:00:00 2001 From: TadahTech Date: Wed, 15 Jun 2016 06:22:04 -0500 Subject: [PATCH 01/34] Kit progression update --- .../progression/KitProgressionManager.java | 50 +++ .../progression/KitProgressionRepository.java | 220 +++++++++++ .../core/progression/ProgressiveKit.java | 278 ++++++++++++++ .../progression/data/KitAbilityDetail.java | 38 ++ .../core/progression/data/PlayerKit.java | 103 +++++ .../data/PlayerKitDataManager.java | 40 ++ .../mineplex/core/progression/gui/Button.java | 36 ++ .../mineplex/core/progression/gui/Menu.java | 191 ++++++++++ .../core/progression/gui/MenuListener.java | 45 +++ .../gui/buttons/KitAbilityButton.java | 50 +++ .../progression/gui/buttons/KitButton.java | 27 ++ .../gui/buttons/KitIconButton.java | 78 ++++ .../buttons/KitPermanentDefaultButton.java | 49 +++ .../gui/buttons/KitSelectButton.java | 43 +++ .../gui/buttons/KitUpgradeButton.java | 50 +++ .../gui/buttons/KitUpgradeMenuButton.java | 134 +++++++ .../progression/gui/buttons/KitXPButton.java | 95 +++++ .../gui/buttons/misc/BackButton.java | 40 ++ .../gui/buttons/misc/IconButton.java | 23 ++ .../progression/gui/guis/KitDisplayMenu.java | 109 ++++++ .../gui/guis/KitInformationTrackerMenu.java | 298 +++++++++++++++ .../core/progression/gui/guis/KitMenu.java | 101 +++++ .../core/progression/math/Calculations.java | 208 ++++++++++ .../core/progression/util/SQLStatement.java | 75 ++++ .../nautilus/game/arcade/ArcadeManager.java | 64 ++-- .../src/nautilus/game/arcade/game/Game.java | 153 ++++---- .../games/baconbrawl/kits/KitMamaPig.java | 93 +++-- .../game/games/baconbrawl/kits/KitPig.java | 41 +- .../games/baconbrawl/kits/KitSheepPig.java | 59 ++- .../game/games/barbarians/kits/KitArcher.java | 68 ++-- .../game/games/barbarians/kits/KitBomber.java | 75 ++-- .../game/games/barbarians/kits/KitBrute.java | 66 ++-- .../game/games/bridge/kits/KitApple.java | 46 +-- .../game/games/bridge/kits/KitArcher.java | 44 ++- .../game/games/bridge/kits/KitBerserker.java | 49 +++ .../game/games/bridge/kits/KitBomber.java | 47 +-- .../game/games/bridge/kits/KitBrawler.java | 50 +++ .../game/games/bridge/kits/KitDestructor.java | 66 ++-- .../game/games/bridge/kits/KitMiner.java | 53 +-- .../game/games/build/kits/KitBuilder.java | 33 +- .../game/games/castlesiege/kits/KitHuman.java | 18 +- .../castlesiege/kits/KitHumanAssassin.java | 81 ---- .../castlesiege/kits/KitHumanBrawler.java | 82 ---- .../castlesiege/kits/KitHumanKnight.java | 89 +++-- .../castlesiege/kits/KitHumanMarksman.java | 97 +++-- .../castlesiege/kits/KitHumanPeasant.java | 78 ++-- .../games/castlesiege/kits/KitUndead.java | 15 +- .../castlesiege/kits/KitUndeadArcher.java | 68 ++-- .../castlesiege/kits/KitUndeadGhoul.java | 63 +-- .../castlesiege/kits/KitUndeadZombie.java | 50 +-- .../games/champions/kits/KitAssassin.java | 73 ++-- .../game/games/champions/kits/KitBrute.java | 48 ++- .../game/games/champions/kits/KitKnight.java | 69 ++-- .../game/games/champions/kits/KitMage.java | 42 +- .../game/games/champions/kits/KitRanger.java | 64 ++-- .../deathtag/kits/AbstractKitChaser.java | 17 +- .../deathtag/kits/AbstractKitRunner.java | 15 +- .../games/deathtag/kits/KitAlphaChaser.java | 54 +-- .../game/games/deathtag/kits/KitChaser.java | 44 ++- .../games/deathtag/kits/KitRunnerArcher.java | 51 +-- .../games/deathtag/kits/KitRunnerBasher.java | 44 ++- .../games/deathtag/kits/KitRunnerTraitor.java | 44 ++- .../games/dragonescape/kits/KitDigger.java | 72 ++-- .../games/dragonescape/kits/KitDisruptor.java | 59 +-- .../games/dragonescape/kits/KitLeaper.java | 49 +-- .../games/dragonescape/kits/KitWarper.java | 53 +-- .../games/dragonriders/kits/KitRider.java | 62 +-- .../game/games/dragons/kits/KitCoward.java | 66 ++-- .../game/games/dragons/kits/KitMarksman.java | 70 ++-- .../games/dragons/kits/KitPyrotechnic.java | 60 +-- .../game/games/draw/kits/KitArtist.java | 35 +- .../game/games/draw/kits/KitSelector.java | 36 +- .../games/draw/kits/KitSlowAndSteady.java | 36 +- .../game/games/evolution/kits/KitAbility.java | 34 +- .../games/evolution/kits/KitEvolveSpeed.java | 32 +- .../game/games/evolution/kits/KitHealth.java | 81 ++-- .../games/gladiators/kits/KitGladiator.java | 41 +- .../game/games/gravity/kits/KitJetpack.java | 65 ++-- .../game/games/halloween/kits/KitFinn.java | 75 ++-- .../games/halloween/kits/KitRobinHood.java | 72 ++-- .../game/games/halloween/kits/KitThor.java | 74 ++-- .../arcade/game/games/hideseek/HideSeek.java | 4 +- .../game/games/hideseek/kits/KitHider.java | 28 +- .../games/hideseek/kits/KitHiderInfestor.java | 67 ++++ .../games/hideseek/kits/KitHiderQuick.java | 50 +-- .../games/hideseek/kits/KitHiderShocker.java | 51 +-- .../games/hideseek/kits/KitHiderSwapper.java | 48 +-- .../game/games/hideseek/kits/KitSeeker.java | 15 +- .../games/hideseek/kits/KitSeekerLeaper.java | 74 ++-- .../games/hideseek/kits/KitSeekerRadar.java | 83 ++-- .../games/hideseek/kits/KitSeekerTNT.java | 80 ++-- .../game/games/hideseek/modes/Countdown.java | 11 +- .../horsecharge/kits/KitDefenceArcher.java | 60 +-- .../horsecharge/kits/KitHorseKnight.java | 62 +-- .../game/games/lobbers/kits/KitArmorer.java | 67 ++-- .../game/games/lobbers/kits/KitJumper.java | 47 ++- .../game/games/lobbers/kits/KitPitcher.java | 86 +++-- .../game/games/lobbers/kits/KitWaller.java | 64 ++-- .../game/games/micro/kits/KitArcher.java | 64 ++-- .../game/games/micro/kits/KitFighter.java | 60 +-- .../game/games/micro/kits/KitWorker.java | 64 ++-- .../game/games/milkcow/kits/KitCow.java | 101 +++-- .../games/milkcow/kits/KitFarmerJump.java | 57 ++- .../games/milkcow/kits/KitSturdyFarmhand.java | 49 +-- .../games/monsterleague/kits/KitEnderman.java | 46 +-- .../games/monsterleague/kits/KitGolem.java | 49 ++- .../games/monsterleague/kits/KitSkeleton.java | 47 ++- .../games/monsterleague/kits/LeagueKit.java | 23 +- .../monstermaze/kits/KitBodyBuilder.java | 41 +- .../games/monstermaze/kits/KitJumper.java | 52 ++- .../games/monstermaze/kits/KitRepulsor.java | 61 +-- .../games/monstermaze/kits/KitSlowball.java | 51 +-- .../games/paintball/kits/KitMachineGun.java | 58 +-- .../game/games/paintball/kits/KitRifle.java | 63 +-- .../game/games/paintball/kits/KitShotgun.java | 62 +-- .../game/games/paintball/kits/KitSniper.java | 93 ++--- .../game/games/quiver/kits/KitBrawler.java | 62 +-- .../game/games/quiver/kits/KitEnchanter.java | 61 +-- .../game/games/quiver/kits/KitLeaper.java | 68 ++-- .../game/games/quiver/kits/KitNinja.java | 64 ++-- .../game/games/quiver/kits/KitSlamShot.java | 60 +-- .../game/games/runner/kits/KitArcher.java | 51 +-- .../game/games/runner/kits/KitFrosty.java | 56 +-- .../game/games/runner/kits/KitLeaper.java | 50 +-- .../searchanddestroy/kits/bow/KitBow.java | 72 ++-- .../searchanddestroy/kits/bow/KitPinner.java | 78 ++-- .../searchanddestroy/kits/bow/KitPunch.java | 82 ++-- .../kits/bow/KitQuickshooter.java | 80 ++-- .../kits/bow/KitSearchAndDestroyBow.java | 21 + .../kits/bow/KitSharpshooter.java | 78 ++-- .../searchanddestroy/kits/bow/KitSniper.java | 86 +++-- .../kits/bow/KitThunderstorm.java | 84 ++-- .../searchanddestroy/kits/rogue/KitEvade.java | 80 ++-- .../searchanddestroy/kits/rogue/KitFlash.java | 81 ++-- .../kits/rogue/KitMultiFlash.java | 82 ++-- .../kits/rogue/KitPhaseBlast.java | 81 ++-- .../kits/rogue/KitRewind.java | 88 +++-- .../searchanddestroy/kits/rogue/KitRogue.java | 77 ++-- .../kits/rogue/KitSearchAndDestroyRogue.java | 20 + .../kits/rogue/KitWraith.java | 77 ++-- .../kits/trooper/KitAssault.java | 76 ++-- .../kits/trooper/KitBeserker.java | 78 ++-- .../kits/trooper/KitBreaker.java | 78 ++-- .../kits/trooper/KitChampion.java | 78 ++-- .../kits/trooper/KitJuggernaut.java | 80 ++-- .../trooper/KitSearchAndDestroyTrooper.java | 24 ++ .../kits/trooper/KitTank.java | 75 ++-- .../kits/trooper/KitTitan.java | 86 ++--- .../kits/trooper/KitTrooper.java | 74 ++-- .../game/games/sheep/kits/KitArcher.java | 64 ++-- .../game/games/sheep/kits/KitBeserker.java | 59 +-- .../game/games/sheep/kits/KitBrute.java | 61 +-- .../game/games/skywars/kits/KitChicken.java | 55 +-- .../games/skywars/kits/KitDestructor.java | 75 ++-- .../games/skywars/kits/KitMadScientist.java | 44 ++- .../game/games/skywars/kits/KitMiner.java | 53 +-- .../game/games/smash/kits/KitBlaze.java | 142 ++++--- .../game/games/smash/kits/KitChicken.java | 143 +++---- .../arcade/game/games/smash/kits/KitCow.java | 170 ++++----- .../game/games/smash/kits/KitCreeper.java | 163 ++++---- .../game/games/smash/kits/KitEnderman.java | 168 ++++---- .../game/games/smash/kits/KitGolem.java | 151 ++++---- .../game/games/smash/kits/KitMagmaCube.java | 135 +++---- .../arcade/game/games/smash/kits/KitPig.java | 166 ++++---- .../game/games/smash/kits/KitSheep.java | 179 ++++----- .../games/smash/kits/KitSkeletalHorse.java | 170 ++++----- .../game/games/smash/kits/KitSkeleton.java | 163 ++++---- .../game/games/smash/kits/KitSkySquid.java | 175 +++++---- .../game/games/smash/kits/KitSlime.java | 191 +++++----- .../game/games/smash/kits/KitSnowman.java | 160 ++++---- .../game/games/smash/kits/KitSpider.java | 177 ++++----- .../game/games/smash/kits/KitWitch.java | 172 ++++----- .../games/smash/kits/KitWitherSkeleton.java | 153 ++++---- .../arcade/game/games/smash/kits/KitWolf.java | 157 ++++---- .../game/games/smash/kits/KitZombie.java | 166 ++++---- .../games/snake/kits/KitInvulnerable.java | 58 ++- .../game/games/snake/kits/KitReverser.java | 76 ++-- .../game/games/snake/kits/KitSpeed.java | 59 ++- .../sneakyassassins/kits/KitAssassin.java | 51 ++- .../games/sneakyassassins/kits/KitBriber.java | 84 ++-- .../sneakyassassins/kits/KitEscapeArtist.java | 40 +- .../sneakyassassins/kits/KitRevealer.java | 71 ++-- .../kits/SneakyAssassinKit.java | 63 +-- .../game/games/snowfight/kits/KitMedic.java | 87 +++-- .../games/snowfight/kits/KitSportsman.java | 71 ++-- .../games/snowfight/kits/KitTactician.java | 55 +-- .../games/speedbuilders/kits/DefaultKit.java | 27 +- .../game/games/spleef/kits/KitArcher.java | 55 +-- .../game/games/spleef/kits/KitBrawler.java | 58 +-- .../game/games/spleef/kits/KitSnowballer.java | 56 +-- .../games/squidshooter/kits/KitRifle.java | 52 +-- .../games/squidshooter/kits/KitShotgun.java | 52 +-- .../games/squidshooter/kits/KitSniper.java | 53 +-- .../squidshooter/kits/SquidShooterKit.java | 54 +++ .../game/games/stacker/kits/KitDefault.java | 38 +- .../games/survivalgames/kit/KitArcher.java | 50 ++- .../games/survivalgames/kit/KitAssassin.java | 49 +-- .../games/survivalgames/kit/KitAxeman.java | 51 ++- .../games/survivalgames/kit/KitBarbarian.java | 51 +-- .../survivalgames/kit/KitBeastmaster.java | 47 +-- .../games/survivalgames/kit/KitBomber.java | 51 ++- .../games/survivalgames/kit/KitBrawler.java | 54 ++- .../games/survivalgames/kit/KitHorseman.java | 63 ++- .../games/survivalgames/kit/KitKnight.java | 50 ++- .../games/survivalgames/kit/KitLooter.java | 46 +-- .../survivalgames/kit/KitNecromancer.java | 45 +-- .../survivalgames/kit/SurvivalGamesKit.java | 42 ++ .../arcade/game/games/tug/kits/KitArcher.java | 65 ++-- .../game/games/tug/kits/KitSmasher.java | 63 +-- .../games/turfforts/kits/KitInfiltrator.java | 81 ++-- .../games/turfforts/kits/KitMarksman.java | 72 ++-- .../games/turfforts/kits/KitShredder.java | 78 ++-- .../games/typewars/kits/KitTactician.java | 38 +- .../games/typewars/kits/KitTypeWarsBase.java | 12 +- .../game/games/typewars/kits/KitTyper.java | 40 +- .../game/games/typewars/kits/KitWarrior.java | 38 +- .../game/arcade/game/games/uhc/KitUHC.java | 40 +- .../games/valentines/kit/KitMasterOfLove.java | 44 ++- .../game/games/wither/kit/KitHumanArcher.java | 78 ++-- .../game/games/wither/kit/KitHumanEditor.java | 55 +-- .../game/games/wither/kit/KitHumanMedic.java | 82 ++-- .../games/wither/kit/KitWitherMinion.java | 106 +++--- .../game/games/wizards/kit/KitMage.java | 20 +- .../game/games/wizards/kit/KitMystic.java | 20 +- .../game/games/wizards/kit/KitSorcerer.java | 20 +- .../games/wizards/kit/KitWitchDoctor.java | 29 +- .../kits/KitSurvivorArcher.java | 64 ++-- .../kits/KitSurvivorKnight.java | 66 ++-- .../zombiesurvival/kits/KitSurvivorRogue.java | 66 ++-- .../zombiesurvival/kits/KitUndeadAlpha.java | 62 +-- .../zombiesurvival/kits/KitUndeadZombie.java | 62 +-- .../game/arcade/kit/ChampionsKit.java | 21 + .../src/nautilus/game/arcade/kit/Kit.java | 31 +- .../game/arcade/kit/KitProgressionData.java | 36 ++ .../src/nautilus/game/arcade/kit/Perk.java | 7 +- .../game/arcade/kit/ProgressingKit.java | 360 ++++++++++++++++++ .../nautilus/game/arcade/kit/SmashKit.java | 26 +- .../game/arcade/kit/perks/PerkApple.java | 26 +- .../game/arcade/kit/perks/PerkAxeThrower.java | 2 +- .../game/arcade/kit/perks/PerkChicken.java | 2 +- .../arcade/kit/perks/PerkMadScientist.java | 29 +- .../arcade/kit/perks/PerkNoSpillMilk.java | 2 +- .../game/arcade/kit/perks/PerkThrower.java | 2 +- .../arcade/managers/GamePlayerManager.java | 143 +++---- .../managers/ProgressingKitManager.java | 306 +++++++++++++++ .../arcade/stats/ExperienceStatTracker.java | 25 +- 246 files changed, 10525 insertions(+), 6957 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionRepository.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/ProgressiveKit.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/data/KitAbilityDetail.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/data/PlayerKit.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/data/PlayerKitDataManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/Button.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/Menu.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/MenuListener.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitAbilityButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitIconButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitPermanentDefaultButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitSelectButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitXPButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/misc/BackButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/misc/IconButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitDisplayMenu.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitInformationTrackerMenu.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitMenu.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/math/Calculations.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/progression/util/SQLStatement.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBerserker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBrawler.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanBrawler.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderInfestor.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSearchAndDestroyBow.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitSearchAndDestroyRogue.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitSearchAndDestroyTrooper.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/SquidShooterKit.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/SurvivalGamesKit.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ChampionsKit.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitProgressionData.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java new file mode 100644 index 000000000..35511ac6a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java @@ -0,0 +1,50 @@ +package mineplex.core.progression; + +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.progression.data.PlayerKit; +import mineplex.core.progression.data.PlayerKitDataManager; +import mineplex.core.progression.gui.MenuListener; +import org.bukkit.plugin.java.JavaPlugin; + +/** + * The main class, process logins and loads data. + */ +public class KitProgressionManager extends MiniClientPlugin +{ + + private PlayerKitDataManager _dataManager; + private KitProgressionRepository _kitProgressionRepository; + private CoreClientManager _coreClientManager; + + public KitProgressionManager(JavaPlugin plugin, CoreClientManager clientManager) + { + super("Kit Progression", plugin); + _dataManager = new PlayerKitDataManager(); + _kitProgressionRepository = new KitProgressionRepository(this); + _coreClientManager = clientManager; + getPlugin().getServer().getPluginManager().registerEvents(new MenuListener(), getPlugin()); + } + + public CoreClientManager getClientManager() + { + return _coreClientManager; + } + + + @Override + protected PlayerKit AddPlayer(String player) + { + return null; + } + + public PlayerKitDataManager getDataManager() + { + return _dataManager; + } + + public KitProgressionRepository getRepository() + { + return _kitProgressionRepository; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionRepository.java new file mode 100644 index 000000000..7978eaa0d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionRepository.java @@ -0,0 +1,220 @@ +package mineplex.core.progression; + +import mineplex.core.database.MinecraftRepository; +import mineplex.core.progression.data.PlayerKit; +import mineplex.core.progression.util.SQLStatement; +import mineplex.serverdata.database.DBPool; +import org.bukkit.Bukkit; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.UUID; + +/** + * Handles all things database related. + */ +public class KitProgressionRepository extends MinecraftRepository +{ + + private final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS `kitProgression` (" + + "`uuid` VARCHAR(36), " + + "`kitId` VARCHAR(64), " + + "`level` INT, " + + "`xp` INT, " + + "`upgrade_level` INT, " + + "`default` TINYINT, PRIMARY KEY(uuid, kitId))"; + private final String INSERT_OR_UPDATE = "INSERT INTO `kitProgression` VALUES(?,?,?,?,?,?) ON DUPLICATE KEY UPDATE " + + "`level` = ?, `xp` = ?, `upgrade_level` = ?, `default` = ?"; + private final String QUERY_KITS = "SELECT * FROM `kitProgression` WHERE `uuid` = ?;"; + + private KitProgressionManager _kitProgressionManager; + + public KitProgressionRepository(KitProgressionManager plugin) + { + super(plugin.getPlugin(), DBPool.getAccount()); + _kitProgressionManager = plugin; + } + + @Override + protected void initialize() + { + } + + @Override + protected void update() + { + } + + /** + * Inserts data for a kit into the database + * This will update the info if the kit is already in there + * + * @param playerKit The reference to the Player Kit + * @param kit The kit's INTERNAL name + */ + public void insertOrUpdate(PlayerKit playerKit, String kit) + { + async(() -> { + int level = playerKit.getLevel(kit); + int upgradeLevel = playerKit.getUpgradeLevel(kit); + int xp = playerKit.getXp(kit); + int defaultType = playerKit.isDefault(kit) ? 1 : 0; + Connection connection = getConnection(); + try + { + PreparedStatement statement = new SQLStatement(INSERT_OR_UPDATE) + .set(1, playerKit.getUuid()) + .set(2, kit) + .set(3, level) + .set(4, xp) + .set(5, upgradeLevel) + .set(6, defaultType) + .set(7, level) + .set(8, xp) + .set(9, upgradeLevel) + .set(10, defaultType) + .prepare(connection); + + int effect = executeUpdate(statement); + + if (effect == -1) + { + //Something went wrong uh oh + this.getPlugin().getLogger().severe("Inserting new Kit Data for " + playerKit.getUuid() + " failed!"); + } + } catch (SQLException e) + { + e.printStackTrace(); + } finally + { + if (connection != null) + { + try + { + connection.close(); + } catch (SQLException e) + { + e.printStackTrace(); + } + } + } + }); + + } + + /** + * Update whether or not the specified kit is a default kit + * + * @param playerKit The player's kit data object + * @param kit The INTERNAL name of the kit + * @param def The integer representing the boolean value (1 for true 0 for false) + */ + public void updateDefault(PlayerKit playerKit, String kit, int def) + { + async(() -> { + Connection connection = getConnection(); + String update = "UPDATE `kitProgression` SET `default` = ? " + "WHERE `uuid` = ? AND`kitId` = ?"; + + try + { + PreparedStatement statement = new SQLStatement(update) + .set(1, def) + .set(2, playerKit.getUuid()) + .set(3, kit) + .prepare(connection); + int effect = executeUpdate(statement); + if (effect == -1) + { + this.getPlugin().getLogger().severe("Updating default value for" + playerKit.getUuid().toString() + "'s kit failed!"); + } + } catch (SQLException e) + { + e.printStackTrace(); + } finally + { + if (connection != null) + { + try + { + connection.close(); + } catch (SQLException e) + { + e.printStackTrace(); + } + } + } + }); + } + + + @SuppressWarnings("Duplicates") + public void getInfo(UUID uuid) + { + async(() -> { + PlayerKit playerKit = new PlayerKit(uuid); + try (Connection connection = getConnection()) + { + PreparedStatement preparedStatement = new SQLStatement(QUERY_KITS).set(1, uuid).prepare(connection); + ResultSet resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) + { + String kitId = resultSet.getString("kitId"); + + int level = resultSet.getInt("level"); + int xp = resultSet.getInt("xp"); + int upgradeLevel = resultSet.getInt("upgrade_level"); + boolean def = resultSet.getInt("default") == 1; + + playerKit.setLevel(level, kitId); + playerKit.setXp(xp, kitId); + playerKit.setUpgradeLevel(upgradeLevel, kitId); + playerKit.setDefault(def, kitId); + } + } catch (SQLException e) + { + e.printStackTrace(); + } + + _kitProgressionManager.getDataManager().add(playerKit); + }); + } + + + /** + * Internal method for updating the table + * + * @param preparedStatement The statement to execute + * @return The amount of rows effected + */ + private int executeUpdate(PreparedStatement preparedStatement) + { + try + { + return preparedStatement.executeUpdate(); + } catch (SQLException e) + { + e.printStackTrace(); + return -1; + } finally + { + try + { + if (preparedStatement != null) + { + preparedStatement.close(); + } + } catch (SQLException e) + { + e.printStackTrace(); + } + } + } + + private void async(Runnable runnable) + { + Bukkit.getScheduler().runTaskAsynchronously(_plugin, runnable); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/ProgressiveKit.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/ProgressiveKit.java new file mode 100644 index 000000000..7ea77ef52 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/ProgressiveKit.java @@ -0,0 +1,278 @@ +package mineplex.core.progression; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.progression.data.KitAbilityDetail; +import mineplex.core.progression.math.Calculations; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.UUID; + +/** + * The API class all kits with the new system must use + */ +public interface ProgressiveKit +{ + + /** + * The name of the kit for displaying + * + * @return The kit's display name + */ + String getDisplayName(); + + /** + * This is the name stored in the database and checked against + * + * @return The internal name of this kit + */ + String getInternalName(); + + /** + * Get the Icon to display in the GUI + * + * @return This kit's icon + */ + Material getIcon(); + + /** + * Get the description for this kit + * + * @return This kit's description + */ + String[] getDescription(); + + /** + * This method gives the GUI information to display about the kit's upgrades and what they do + * This information is being directly displayed in a GUI, so make sure it looks good + * For more information, see the {@link KitAbilityDetail} class + * + * @return The map of upgrades and their details + */ + List getAbilityDetails(); + + /** + * Retrieve the current level of this kit + * + * @param player The UUID of the player whose level you wish to check + * @return The kit's current level + */ + int getLevel(UUID player); + + //Should this be a double? I don't think so... + + /** + * Get the current amount of XP for this kit + * NOTE: XP Resets after each level up + * + * @param player The UUID of the player whose XP you wish to check + * @return The kit's current XP + */ + int getXp(UUID player); + + /** + * Get the current state of upgrades for this kit + * X/5 with 5 being the highest. + * Linearly activated upon meeting certain criteria + * + * @param player The UUID of the player whose upgrade level you wish to check + * @return The kit's current upgrade level out of 5 + */ + int getUpgradeLevel(UUID player); + + /** + * Is this kit set as a default kit for this player? + * + * @param player The UUID of the player whose default type for this kit you wish to check + * @return Whether or not this kit is a default + */ + boolean isDefault(UUID player); + + /** + * Gets whether or not this kit has been selected by the player + * + * @param player The UUID of the player + * @return Whether or not this kit has been selected by the player + */ + boolean isSelected(UUID player); + + /** + * Upgrade the player's kit to the current level + * + * @param upgradeLevel The level to upgrade too + * @param player The player who we want to upgrade for. + */ + void upgrade(int upgradeLevel, UUID player); + + /** + * Toggle whether or not this kit is default for the specified player + * + * @param defaultValue Whether or not this kit should be default + * @param player The specific player for whom this kit's default staturs will be toggled + */ + void setDefault(boolean defaultValue, UUID player); + + /** + * Set the player's overall level for this kit + * + * @param level The level to which you wish to set the player's kit + * @param player The UUID of the player + */ + void setLevel(int level, UUID player); + + /** + * Set the player's overall xp for this kit (relative to his current level, this is not TOTAL xp) + * + * @param xp The xp to which you wish to set the player's kit + * @param player The UUID of the player + */ + void setXp(int xp, UUID player); + + /** + * Set the player's overall upgradeLevel for this kit + * + * @param upgradeLevel The upgradeLevel to which you wish to set the player's kit + * @param player The UUID of the player + */ + void setUpgradeLevel(int upgradeLevel, UUID player); + + /** + * This is called when a player selects a kit in the GUI + * This is where you do your logic for storing player kits in relation to the game + * + * @param player The player who selects this kit. + */ + void onSelected(UUID player); + + /** + * This is called when a player clicks the default button in the gui + * It will change the state of default + * + * @param player The player who toggles this kit's default setting. + */ + void onSetDefault(UUID player); + + /** + * This method is called when a player level ups + * If you have special effects or messages, here is the place to do it + * + * @param player The player who leveled up + */ + void onLevelUp(UUID player); + + /** + * Gets whether or not the player can purchase the upgrade level + * + * @param upgradeLevel The level of the upgrade you wish to check. + * @param player The UUID of the player + * @return If the player can purchase the upgrade + */ + boolean canPurchaseUpgrade(UUID player, int upgradeLevel); + + /* ====================================================================================================== + * + * + * Below here are utility methods that I believe people will be using frequently. + * If you need to override them, feel free to do so. + * + * + * ====================================================================================================== */ + + /** + * Gets if a player has already leveled up + * Players are only allowed 1 level up per game. + * + * @param player The player's UUID we want to check against + * @return Whether or not the player has already leveled up in this game + */ + boolean alreadyLeveledUp(UUID player); + + /** + * Increment the players current level for this kit, and reset his XP + * + * @param player The player whose level we want to increase + */ + default void levelUp(UUID player) + { + setXp(1, player); + + setLevel(getLevel(player) + 1, player); + + onLevelUp(player); + } + + /** + * Check to see if this player is eligible for level up + * + * @param player The player who we want to check + * @return True if he is able to level up, or false if he's not + */ + default boolean isLevelUpReady(UUID player) + { + int currentLevel = getLevel(player); + + int xp = getXp(player); + int nextXP = Calculations.getXpForNextLevel(currentLevel); + + if (nextXP < xp) + { + //We don't want people to continue earning XP after the level up, so cancel this. + //Makes sure that they only get the exact amount required. + setXp(nextXP, player); + return true; + } + + return xp >= nextXP; + } + + /** + * Get the difference (the amount needed) between the players current XP and his next levels XP + * + * @param player The player who we want to check against + * @return The integer difference between his current XP and his next level's required XP + */ + default int getXpDifference(UUID player) + { + int currentLevel = getLevel(player); + + int xp = getXp(player); + int nextXP = Calculations.getXpForNextLevel(currentLevel); + + return nextXP - xp; + } + + /** + * Retrieves whether or not the player currently owns this upgrade. + * This is the upgrade level, not the player level which the player must be to upgrade + * So it should be between 1 and 5 + * + * @param player The UUID of the player you wish to check + * @param upgradeLevel The level to check and see if the player owns + * @return If the player has the current upgrade + */ + default boolean ownsUpgrade(UUID player, int upgradeLevel) + { + return getUpgradeLevel(player) >= upgradeLevel; + } + + default void displaySelectedEffect(Entity kitHost, Player... displayTo) + { + for (int i = 0; i < 1; i++) + { + double lead = i * ((2d * Math.PI) / 2); + float x = (float) (Math.cos(kitHost.getTicksLived() / 5d + lead) * 1f); + float z1 = (float) (Math.sin(kitHost.getTicksLived() / 5d + lead) * 1f); + float z2 = (float) -(Math.sin(kitHost.getTicksLived() / 5d + lead) * 1f); + float y = (float) (Math.sin(kitHost.getTicksLived() / 5d + lead) + 1f); + + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, kitHost.getLocation().add(x, y, z1), 0f, 0f, 0f, 0, 1, + ViewDist.NORMAL, displayTo); + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, kitHost.getLocation().add(x, y, z2), 0f, 0f, 0f, 0, 1, + ViewDist.NORMAL, displayTo); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/data/KitAbilityDetail.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/data/KitAbilityDetail.java new file mode 100644 index 000000000..b88519c41 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/data/KitAbilityDetail.java @@ -0,0 +1,38 @@ +package mineplex.core.progression.data; + +import org.bukkit.Material; + +/** + * General wrapper for Ability Details (The display properties of this kits Abilities) for a GUI + * The purpose is to limit the amount of hard coded data Kit's do and make it as flexible as possible. + */ +public class KitAbilityDetail +{ + + private Material _icon; + private String _displayName; + private String[] _description; + + public KitAbilityDetail(Material icon, String displayName, String[] description) + { + _icon = icon; + _displayName = displayName; + _description = description; + } + + public String getDisplayName() + { + return _displayName; + } + + public Material getIcon() + { + return _icon; + } + + public String[] getDescription() + { + return _description; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/data/PlayerKit.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/data/PlayerKit.java new file mode 100644 index 000000000..7a947b198 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/data/PlayerKit.java @@ -0,0 +1,103 @@ +package mineplex.core.progression.data; + +import com.google.common.collect.Maps; + +import java.util.Map; +import java.util.UUID; + +/** + * Player Wrapper for the Progressive kit system + */ +public class PlayerKit +{ + + private UUID _player; + private String _currentKit; + private Map _kitLevels; + private Map _kitXPs; + private Map _kitUpgradeLevels; + private Map _kitDefaultTypes; + + //We only want players to level up kits once per game + private boolean _hasLeveledUp; + + public PlayerKit(UUID player) + { + _player = player; + _kitLevels = Maps.newHashMap(); + _kitXPs = Maps.newHashMap(); + _kitUpgradeLevels = Maps.newHashMap(); + _kitDefaultTypes = Maps.newHashMap(); + } + + public String getCurrentKit() + { + return _currentKit; + } + + public void setCurrentKit(String currentKit) + { + _currentKit = currentKit; + } + + public int getLevel(String kit) + { + return _kitLevels.getOrDefault(kit, 1); + } + + public int getXp(String kit) + { + return _kitXPs.getOrDefault(kit, 1); + } + + public int getUpgradeLevel(String kit) + { + return _kitUpgradeLevels.getOrDefault(kit, 0); + } + + public void setLevel(int level, String kit) + { + _kitLevels.put(kit, level); + } + + public void setXp(int xp, String kit) + { + _kitXPs.put(kit, xp); + } + + public void setUpgradeLevel(int upgradeLevel, String kit) + { + _kitUpgradeLevels.put(kit, upgradeLevel); + } + + public boolean isDefault(String kit) + { + return _kitDefaultTypes.getOrDefault(kit, true); + } + + public void setDefault(boolean value, String kit) + { + _kitDefaultTypes.put(kit, value); + } + + public boolean hasLeveledUp() + { + return _hasLeveledUp; + } + + public void levelUp() + { + this._hasLeveledUp = true; + } + + public UUID getPlayer() + { + return _player; + } + + public UUID getUuid() + { + return _player; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/data/PlayerKitDataManager.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/data/PlayerKitDataManager.java new file mode 100644 index 000000000..faa5641f0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/data/PlayerKitDataManager.java @@ -0,0 +1,40 @@ +package mineplex.core.progression.data; + +import com.google.common.collect.Maps; + +import java.util.Map; +import java.util.UUID; + +/** + * Manages all PlayerKit data in memory + */ +public class PlayerKitDataManager +{ + + private Map _dataMapAccountUUID; + + public PlayerKitDataManager() + { + _dataMapAccountUUID = Maps.newConcurrentMap(); + } + + public PlayerKit get(UUID uuid) + { + return _dataMapAccountUUID.get(uuid); + } + + public void add(PlayerKit playerKit) + { + _dataMapAccountUUID.put(playerKit.getUuid(), playerKit); + } + + public void remove(PlayerKit kit) + { + _dataMapAccountUUID.remove(kit.getUuid()); + } + + public Map getAll() + { + return _dataMapAccountUUID; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/Button.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/Button.java new file mode 100644 index 000000000..5e172ce91 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/Button.java @@ -0,0 +1,36 @@ +package mineplex.core.progression.gui; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +/** + * An abstract class for managing buttons inside of menus + */ +public abstract class Button +{ + + private ItemStack _item; + + public Button(ItemStack item) + { + this._item = item; + } + + /** + * The method called when a players clicks the slot + * + * @param player The player who clicked + */ + public abstract void onClick(Player player); + + public ItemStack getItemStack() + { + return _item; + } + + public void setItemStack(ItemStack item) + { + this._item = item; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/Menu.java new file mode 100644 index 000000000..e2089e9ff --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/Menu.java @@ -0,0 +1,191 @@ +package mineplex.core.progression.gui; + +import mineplex.core.progression.gui.buttons.misc.IconButton; +import net.md_5.bungee.api.ChatColor; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * A class to manage dynamic creation of GUI's + */ +public abstract class Menu +{ + + protected static final Button[] EMPTY = new Button[45]; + protected static Map MENUS = new HashMap<>(); + private String _name; + protected Button[] _buttons; + + public Menu(String name) + { + _name = name; + _buttons = EMPTY; + } + + public static Menu get(UUID name) + { + return MENUS.get(name); + } + + + /** + * Create an icon (no click action) + * + * @param item The itemstack ti display + * @return The created button + */ + protected Button create(ItemStack item) + { + return new IconButton(item); + } + + public String getName() + { + return ChatColor.translateAlternateColorCodes('&', _name); + } + + /** + * Open and setup the inventory for the player to view + * Store a reference to it inside a map for retrieving later + * + * @param player The player who we wish to show the GUI to + */ + public void open(Player player) + { + setButtons(setUp()); + + if (MENUS.get(player.getUniqueId()) != null) + { + MENUS.remove(player.getUniqueId()); + } + + MENUS.put(player.getUniqueId(), this); + + int size = (_buttons.length + 8) / 9 * 9; + Inventory inventory = Bukkit.createInventory(player, size, getName()); + + for (int i = 0; i < _buttons.length; i++) + { + if (_buttons[i] == null) + { + continue; + } + + ItemStack item = _buttons[i].getItemStack(); + + inventory.setItem(i, item); + } + player.openInventory(inventory); + } + + /** + * Set up the GUI with buttons + * + * @return The setup button array + */ + protected abstract Button[] setUp(); + + public Button[] getButtons() + { + return _buttons; + } + + public void setButtons(Button[] buttons) + { + _buttons = buttons; + } + + /** + * Retrieve the button based off the slot + * + * @param slot The slot in the inventory + * @return The button corresponding to that slot + */ + public Button getButton(int slot) + { + try + { + return _buttons[slot]; + } catch (ArrayIndexOutOfBoundsException e) + { + //There isn't a button there, so no need to throw an error + //e.printStackTrace(); + return null; + } + } + + /** + * Replace a button, or create a new button dynamically + * Update the players GUI + * + * @param slot The slot to set the new button + * @param button The reference to the button + * @param player The player whose GUI we'll be updating + */ + public void setButton(int slot, Button button, Player player) + { + try + { + _buttons[slot] = button; + } catch (ArrayIndexOutOfBoundsException ignored) + { + ignored.printStackTrace(); + } + update(player); + } + + /** + * Refresh the players view, allows to change what the player sees, without opening and closing the GUI + * + * @param player The player whose view you wish to update + */ + public void update(Player player) + { + InventoryView view = player.getOpenInventory(); + + if (view == null) + { + return; + } + + if (!view.getTitle().equalsIgnoreCase(getName())) + { + return; + } + + Inventory inventory = view.getTopInventory(); + for (int i = 0; i < _buttons.length; i++) + { + if (_buttons[i] == null) + { + continue; + } + + ItemStack item = _buttons[i].getItemStack(); + + inventory.setItem(i, item); + } + } + + public void setTitle(String title) + { + _name = title; + } + + public void onClose(Player player) + { + MENUS.remove(player.getUniqueId()); + } + + public static Menu remove(UUID uniqueId) + { + return MENUS.remove(uniqueId); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/MenuListener.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/MenuListener.java new file mode 100644 index 000000000..3fc59c542 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/MenuListener.java @@ -0,0 +1,45 @@ +package mineplex.core.progression.gui; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; + +/** + * Listener for the Menu system + */ +public class MenuListener implements Listener +{ + + @EventHandler + public void onClick(InventoryClickEvent event) + { + String name = event.getInventory().getName(); + Player player = (Player) event.getWhoClicked(); + Menu gui = Menu.get(player.getUniqueId()); + + if (gui == null) + { + return; + } + + if (!gui.getName().equalsIgnoreCase(name)) + { + return; + } + + Button button = gui.getButton(event.getRawSlot()); + + event.setCancelled(true); + event.setResult(Event.Result.DENY); + + if (button == null) + { + return; + } + + button.onClick(player); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitAbilityButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitAbilityButton.java new file mode 100644 index 000000000..817d1a8bf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitAbilityButton.java @@ -0,0 +1,50 @@ +package mineplex.core.progression.gui.buttons; + +import com.google.common.collect.Lists; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.data.KitAbilityDetail; +import mineplex.core.progression.gui.buttons.misc.IconButton; +import org.bukkit.inventory.ItemStack; + +import java.util.Arrays; +import java.util.List; + +/** + * Representing this kits Abilities in a GUI + */ +public class KitAbilityButton extends IconButton +{ + + private ItemStack _item; + + public KitAbilityButton(KitAbilityDetail detail) + { + super(null); + + ItemBuilder builder = new ItemBuilder(detail.getIcon()); + + builder.setTitle(detail.getDisplayName()); + + List lore = Lists.newArrayList(" "); + + lore.addAll(Arrays.asList(detail.getDescription())); + lore.add(" "); + + builder.setLore(lore.toArray(new String[lore.size()])); + + _item = builder.build(); + } + + @Override + public ItemStack getItemStack() + { + return _item; + } + + @Override + public void setItemStack(ItemStack item) + { + _item = item; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitButton.java new file mode 100644 index 000000000..6614e2528 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitButton.java @@ -0,0 +1,27 @@ +package mineplex.core.progression.gui.buttons; + +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.Button; +import org.bukkit.inventory.ItemStack; + +/** + * Similar to KitMenu, this helps with organizing buttons related to kits + * Since they all share common features. + */ +public abstract class KitButton extends Button +{ + + private ProgressiveKit _kit; + + public KitButton(ProgressiveKit kit, ItemStack itemStack) + { + super(itemStack); + _kit = kit; + } + + protected ProgressiveKit getKit() + { + return _kit; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitIconButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitIconButton.java new file mode 100644 index 000000000..f0e7576ca --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitIconButton.java @@ -0,0 +1,78 @@ +package mineplex.core.progression.gui.buttons; + +import com.google.common.collect.Lists; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.Menu; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.List; + +/** + * This is the display icon for the Kit inside of the main GUI + */ +public class KitIconButton extends KitButton +{ + + private ItemStack _itemStack; + + public KitIconButton(ProgressiveKit kit, Player player) + { + super(kit, null); + + ItemBuilder builder = new ItemBuilder(kit.getIcon()); + + builder.setTitle(C.cYellow + kit.getDisplayName()); + + List lore = Lists.newArrayList(" "); + + boolean foundPerkStart = false; + for (String s : kit.getDescription()) + { + if (!foundPerkStart) + { + lore.add(ChatColor.GRAY + s); + if (s.equalsIgnoreCase(" ") || s.isEmpty() || s.equalsIgnoreCase("")) + { + foundPerkStart = true; + } + } else + { + lore.add(ChatColor.WHITE + s); + } + } + + builder.setLore(lore.toArray(new String[lore.size()])); + + if (kit.isSelected(player.getUniqueId())) + { + builder.addEnchantment(UtilInv.getDullEnchantment(), 1); + } + + _itemStack = builder.build(); + } + + @Override + public ItemStack getItemStack() + { + return _itemStack; + } + + @Override + public void setItemStack(ItemStack itemStack) + { + _itemStack = itemStack; + } + + @Override + public void onClick(Player player) + { + getKit().onSelected(player.getUniqueId()); + Menu.remove(player.getUniqueId()); + player.closeInventory(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitPermanentDefaultButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitPermanentDefaultButton.java new file mode 100644 index 000000000..48c8db40d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitPermanentDefaultButton.java @@ -0,0 +1,49 @@ +package mineplex.core.progression.gui.buttons; + +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.ProgressiveKit; +import net.md_5.bungee.api.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +/** + * This manages toggling default selection of a kit + * I.E. Whether or not this kit will be always enabled without the user doing anything + */ +public class KitPermanentDefaultButton extends KitButton +{ + + private static final String[] DESCRIPTION = { + " ", + ChatColor.WHITE + "Selects this kit as your default kit", + ChatColor.WHITE + "until you decide to change it.", + " ", + ChatColor.WHITE + "Default kits will be auto-selected", + ChatColor.WHITE + "when you join a lobby.", + " " + }; + + private static final ItemStack ITEM = new ItemBuilder(Material.STAINED_GLASS_PANE) + .setData(DyeColor.LIGHT_BLUE.getWoolData()) + .setTitle(ChatColor.YELLOW + "Default Kit") + .setLore(DESCRIPTION) + .build(); + + public KitPermanentDefaultButton(ProgressiveKit kit) + { + super(kit, ITEM); + } + + @Override + public void onClick(Player player) + { + getKit().onSelected(player.getUniqueId()); + + getKit().setDefault(!getKit().isDefault(player.getUniqueId()), player.getUniqueId()); + + getKit().onSetDefault(player.getUniqueId()); + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitSelectButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitSelectButton.java new file mode 100644 index 000000000..1817eb337 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitSelectButton.java @@ -0,0 +1,43 @@ +package mineplex.core.progression.gui.buttons; + +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.Menu; +import net.md_5.bungee.api.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +/** + * This manages selecting of the kit for the current game. + */ +public class KitSelectButton extends KitButton +{ + + private static final String[] LORE = { + " ", + ChatColor.WHITE + "Click to select this kit", + " " + }; + + public KitSelectButton(ProgressiveKit kit) + { + super(kit, new ItemBuilder(Material.STAINED_GLASS_PANE) + .setData(DyeColor.LIME.getWoolData()) + .setTitle(ChatColor.YELLOW + kit.getDisplayName()) + .setLore(UtilText.splitLinesToArray(LORE, LineFormat.LORE)) + .build()); + } + + @Override + public void onClick(Player player) + { + getKit().onSelected(player.getUniqueId()); + + Menu.remove(player.getUniqueId()); + + player.closeInventory(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeButton.java new file mode 100644 index 000000000..cc73ff690 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeButton.java @@ -0,0 +1,50 @@ +package mineplex.core.progression.gui.buttons; + +import mineplex.core.common.util.F; +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.Menu; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.UUID; + +/** + * @author Timothy Andis (TadahTech) on 4/7/2016. + */ +public class KitUpgradeButton extends KitButton +{ + + private int _upgradeLevel; + private String _upggradeName; + + public KitUpgradeButton(ProgressiveKit kit, ItemStack itemStack, int upgradeLevel, String upggradeName) + { + super(kit, itemStack); + _upgradeLevel = upgradeLevel; + _upggradeName = upggradeName; + } + + @Override + public void onClick(Player player) + { + UUID uuid = player.getUniqueId(); + + if (!getKit().canPurchaseUpgrade(uuid, _upgradeLevel)) + { + player.playSound(player.getLocation(), Sound.ITEM_BREAK, 10.0F, 1.0F); + player.sendMessage(F.main("Kit Progression", "You cannot purchase this upgrade!")); + return; + } + + getKit().upgrade(_upgradeLevel, uuid); + + player.playSound(player.getLocation(), Sound.CAT_MEOW, 5.0f, 1.0f); + + player.sendMessage(F.main("Kit Progression", "Purchased " + _upggradeName)); + + Menu.remove(uuid); + + player.closeInventory(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java new file mode 100644 index 000000000..7195032c8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java @@ -0,0 +1,134 @@ +package mineplex.core.progression.gui.buttons; + +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.guis.KitInformationTrackerMenu; +import mineplex.core.progression.gui.guis.KitMenu; +import mineplex.core.progression.math.Calculations; +import net.md_5.bungee.api.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import static mineplex.core.common.util.UtilServer.getPlugin; + +/** + * This is the button for upgrades. It'll flash when one is available + * Displays information regarding upgrades on hover + */ +public class KitUpgradeMenuButton extends KitButton +{ + + private ItemStack _item; + private boolean _flash; + private BukkitTask _task; + + public KitUpgradeMenuButton(ProgressiveKit kit, Player player) + { + super(kit, null); + + //The current upgrade level out of 5 for this kit + int upgradeLevel = kit.getUpgradeLevel(player.getUniqueId()); + //The players level + int level = kit.getLevel(player.getUniqueId()); + //What's the next UPGRADE LEVEL (1-5) + int nextUpgradeLevel = Calculations.getNextUpgradeLevel(level); + //The 1-100 Level + int nextUpgradeLevelPlayer = Calculations.getNextUpgradeLevelPlayer(level); + //The difference between the players current level, and the next upgrade level + int diff = nextUpgradeLevelPlayer - level; + + //This ONLY flashes if their next upgrade level isn't their same one. + _flash = Calculations.isUpgradeLevelEligible(level) && (nextUpgradeLevel > upgradeLevel); + + if (_flash) + { + flash(); + } + + ChatColor color = Calculations.getColor(level, nextUpgradeLevelPlayer); + + ItemBuilder builder = new ItemBuilder(Material.ENCHANTMENT_TABLE); + + builder.setTitle(ChatColor.YELLOW + "Upgrade Level"); + builder.setLore(" ", ChatColor.RED + "Upgrades Coming Soon!"); + + _item = builder.build(); + } + + @Override + public ItemStack getItemStack() + { + return _item; + } + + @Override + public void setItemStack(ItemStack item) + { + _item = item; + } + + private void flash() + { + this._task = new BukkitRunnable() + { + + private ItemStack itemClone = getItemStack().clone(); + + private ItemStack AIR = new ItemStack(Material.AIR); + + private boolean resetItem = false; + + @Override + public void run() + { + if (!_flash) + { + cancel(); + return; + } + + if (resetItem) + { + setItemStack(itemClone); + + resetItem = false; + return; + } + + setItemStack(AIR); + + resetItem = true; + } + }.runTaskTimer(getPlugin(), 0L, 10L); + } + + @Override + public void onClick(Player player) + { + this._flash = false; + + if (_task != null) + { + this._task.cancel(); + } + + KitMenu menu = new KitInformationTrackerMenu(getKit()); + menu.open(player); + } + + /** + * Will be used later + */ + private ItemBuilder lore(ItemBuilder builder, int upgradeLevel, ChatColor color, int diff) + { + builder.setLore(" ", + ChatColor.WHITE + "Upgrade Level: " + ChatColor.GREEN + upgradeLevel + " out of 5", + ChatColor.WHITE + "Next Upgrade Unlocked in: " + color + diff + " level" + (diff == 1 ? "" : "s"), + "", + ChatColor.WHITE + "Click to view Upgrade and XP tracking"); + return builder; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitXPButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitXPButton.java new file mode 100644 index 000000000..c96cc3a08 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitXPButton.java @@ -0,0 +1,95 @@ +package mineplex.core.progression.gui.buttons; + +import com.google.common.collect.Lists; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.guis.KitInformationTrackerMenu; +import mineplex.core.progression.gui.guis.KitMenu; +import mineplex.core.progression.math.Calculations; +import net.md_5.bungee.api.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.List; + +/** + * This the button which takes the player to {@link KitInformationTrackerMenu} + * Display's information regarding this kits level and experience + */ +public class KitXPButton extends KitButton +{ + + private ItemStack _item; + + public KitXPButton(ProgressiveKit kit, Player player) + { + super(kit, null); + + ItemBuilder builder = new ItemBuilder(Material.EXP_BOTTLE); + builder.setTitle(ChatColor.YELLOW + "XP and Level"); + + List lore = Lists.newArrayList(" "); + + StringBuilder levelStringBuilder = new StringBuilder(); + StringBuilder xpStringBuilder = new StringBuilder(); + + int level = kit.getLevel(player.getUniqueId()); + + levelStringBuilder.append(level).append(" out of 100 ") + .append(ChatColor.GRAY).append("(") + .append(getColor(level, 100)).append(100 - level) + .append(ChatColor.GRAY).append(")"); + + int xp = kit.getXp(player.getUniqueId()); + int nextXp = Calculations.getXpForNextLevel(kit.getLevel(player.getUniqueId())); + int diff = kit.getXpDifference(player.getUniqueId()); + + xpStringBuilder.append(xp).append(" out of ").append(nextXp) + .append(ChatColor.GRAY).append(" (") + .append(getColor(xp, nextXp)).append(diff) + .append(ChatColor.GRAY).append(")"); + + lore.add(addLoreLine("Level", levelStringBuilder.toString())); + + lore.add(addLoreLine("XP", xpStringBuilder.toString())); + + lore.add(" "); + + lore.add(ChatColor.WHITE + "Click to view Upgrade and XP tracking"); + + builder.setLore(lore.toArray(new String[lore.size()])); + + _item = builder.build(); + } + + private ChatColor getColor(int i, int n) + { + return Calculations.getColor(i, n); + } + + private String addLoreLine(String key, Object value) + { + return ChatColor.WHITE + key + ": " + ChatColor.GREEN + value; + } + + @Override + public ItemStack getItemStack() + { + return _item; + } + + @Override + public void setItemStack(ItemStack item) + { + this._item = item; + } + + + @Override + public void onClick(Player player) + { + KitMenu menu = new KitInformationTrackerMenu(getKit()); + menu.open(player); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/misc/BackButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/misc/BackButton.java new file mode 100644 index 000000000..11dd54c5a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/misc/BackButton.java @@ -0,0 +1,40 @@ +package mineplex.core.progression.gui.buttons.misc; + +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.gui.Button; +import mineplex.core.progression.gui.guis.KitMenu; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +/** + * This button take you back to the specified menu + */ +public class BackButton extends Button +{ + + private static ItemStack ITEM = new ItemBuilder(Material.BED) + .setTitle(ChatColor.GRAY + "\u21FD Go Back") + .build(); + + private KitMenu _toMenu; + + public BackButton(KitMenu toMenu) + { + super(ITEM); + _toMenu = toMenu; + } + + @Override + public void setItemStack(ItemStack itemStack) + { + //You can't remove this item + } + + @Override + public void onClick(Player player) + { + _toMenu.open(player); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/misc/IconButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/misc/IconButton.java new file mode 100644 index 000000000..36de05e7c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/misc/IconButton.java @@ -0,0 +1,23 @@ +package mineplex.core.progression.gui.buttons.misc; + +import mineplex.core.progression.gui.Button; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +/** + * A button designed for purely cosmetic reasons, but has no impact when clicked. + */ +public class IconButton extends Button +{ + + public IconButton(ItemStack item) + { + super(item); + } + + @Override + public void onClick(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitDisplayMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitDisplayMenu.java new file mode 100644 index 000000000..f46165e34 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitDisplayMenu.java @@ -0,0 +1,109 @@ +package mineplex.core.progression.gui.guis; + +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.Button; +import mineplex.core.progression.gui.buttons.*; +import mineplex.core.progression.gui.buttons.misc.IconButton; +import org.bukkit.entity.Player; + +/** + * This is the main menu a player sees when we selects an NPC Kit + * Displays the most important information about this kit + */ +public class KitDisplayMenu extends KitMenu +{ + + private static final int[] UPGRADE_SLOTS = { + 27, 29, 31, 33, 35 + }; + + private static final int[] PERM_SLOTS = { + 0, 1, 9, 10 + }; + + private static final int[] SELECT_SLOTS = { + 7, 8, 16, 17 + }; + + public KitDisplayMenu(ProgressiveKit kit) + { + super(kit); + } + + @Override + public Button[] setup(Player player) + { + Button[] buttons = new Button[51]; + + setUpSelecting(buttons); + + setUpIcon(buttons, player); + + setUpDetails(buttons); + + setUpNextMenuButtons(buttons, player); + + return buttons; + } + + /** + * Set up the buttons corresponding to opening {@link KitInformationTrackerMenu} + * + * @param buttons The array of buttons we're modifying + * @param player The player whose data we'll be using + */ + private void setUpNextMenuButtons(Button[] buttons, Player player) + { + buttons[48] = new KitXPButton(getKit(), player); + buttons[50] = new KitUpgradeMenuButton(getKit(), player); + } + + /** + * Set up the Kit display's icon + * + * @param buttons The array of buttons we're modifying + */ + private void setUpIcon(Button[] buttons, Player player) + { + buttons[13] = new KitIconButton(getKit(), player); + } + + /** + * Set up the details (info) regarding the upgrades to this kit + * Lines commented out due to waiting to release upgrades + * + * @param buttons The array of buttons we're modifying + */ + private void setUpDetails(Button[] buttons) + { + for (int i : UPGRADE_SLOTS) + { + buttons[i] = new IconButton(COMING_SOON); + } + } + + /** + * Set up the options for selecting this kit + * Either permanent or just for this game + * + * @param buttons The array of buttons we're modifying + */ + private void setUpSelecting(Button[] buttons) + { + for (int permSlot : PERM_SLOTS) + { + buttons[permSlot] = new KitPermanentDefaultButton(getKit()); + } + + for (int tempSlot : SELECT_SLOTS) + { + buttons[tempSlot] = new KitSelectButton(getKit()); + } + } + + @Override + public void onClose(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitInformationTrackerMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitInformationTrackerMenu.java new file mode 100644 index 000000000..89b0708cf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitInformationTrackerMenu.java @@ -0,0 +1,298 @@ +package mineplex.core.progression.gui.guis; + +import com.google.common.collect.Lists; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.Button; +import mineplex.core.progression.gui.buttons.misc.BackButton; +import mineplex.core.progression.gui.buttons.misc.IconButton; +import mineplex.core.progression.math.Calculations; +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.List; +import java.util.UUID; + +/** + * This is the secondary menu access by either the Enchantment table or XP Bottle + * Displays the more technical data of a kit for the player + */ +public class KitInformationTrackerMenu extends KitMenu +{ + + private final DyeColor[] COLORS = { + DyeColor.GRAY, + DyeColor.YELLOW, + DyeColor.ORANGE, + DyeColor.LIME, + DyeColor.BLACK + }; + + private final int[] XP_SLOTS = { + 11, 12, 13, 14, 15 + }; + private final int[] LEVEL_SLOTS = { + 29, 30, 31, 32, 33 + }; + private final int[] UPGRADE_SLOTS = { + 47, 48, 49, 50, 51 + }; + + public KitInformationTrackerMenu(ProgressiveKit kit) + { + super(kit); + } + + @Override + public Button[] setup(Player player) + { + Button[] buttons = new Button[52]; + + buttons[0] = new BackButton(new KitDisplayMenu(getKit())); + + setUpXP(buttons, player); + + setUpLevel(buttons, player); + + setUpUpgrade(buttons, player); + + return buttons; + } + + /** + * Set up the row of glass panes symbolizing the players XP advancement + * + * @param buttons The array of buttons we're modifying + * @param player The player whose data we'll be using + */ + private void setUpXP(Button[] buttons, Player player) + { + ProgressiveKit kit = getKit(); + + UUID uuid = player.getUniqueId(); + + int level = kit.getLevel(uuid); + int xp = kit.getXp(uuid); + int nextXp = Calculations.getXpForNextLevel(level); + + float perc = (xp * 100.0f) / nextXp; + + String[] lore = { + " ", + ChatColor.WHITE + "Current XP: " + Calculations.getColor(xp, nextXp) + xp + + ChatColor.GRAY + " (" + Calculations.getColor(xp, nextXp) + (int) perc + "%" + ChatColor.GRAY + ")", + xpLore(getKit(), player) + }; + + for (int i : XP_SLOTS) + { + buttons[i] = new IconButton(new ItemBuilder(Material.STAINED_GLASS_PANE) + .setData(DyeColor.BLACK.getWoolData()) + .setAmount(1) + .setTitle(ChatColor.YELLOW + "Experience Progression") + .setLore(lore) + .build()); + } + + percentButtons(true, perc, XP_SLOTS, buttons, xp, nextXp, player); + } + + /** + * Set up the row of glass panes symbolizing the players level advancement + * + * @param buttons The array of buttons we're modifying + * @param player The player whose data we'll be using + */ + private void setUpLevel(Button[] buttons, Player player) + { + ProgressiveKit kit = getKit(); + + UUID uuid = player.getUniqueId(); + int level = kit.getLevel(uuid); + + float perc = (level * 100.0f) / 100; + + String[] lore = { + " ", + ChatColor.WHITE + "Current Level: " + Calculations.getColor(level, 100) + level + + ChatColor.GRAY + " (" + Calculations.getColor(level, 100) + level + + "/" + ChatColor.GREEN + 100 + ChatColor.GRAY + ")" + }; + + for (int i : LEVEL_SLOTS) + { + buttons[i] = new IconButton(new ItemBuilder(Material.STAINED_GLASS_PANE) + .setData(DyeColor.BLACK.getWoolData()) + .setAmount(1) + .setTitle(ChatColor.YELLOW + "Level Progression") + .setLore(lore) + .build()); + } + + percentButtons(false, perc, LEVEL_SLOTS, buttons, level, 100, player); + } + + /** + * Set up the row of Dyes / Music discs symbolizing the players upgrade advancement + * + * @param buttons The array of buttons we're modifying + * @param player The player whose data we'll be using + */ + private void setUpUpgrade(Button[] buttons, Player player) + { + for (int i : UPGRADE_SLOTS) + { + buttons[i] = new IconButton(COMING_SOON); + } + } + + /* ====================================================================================================== + * + * + * Below here are utility methods that speed up the process for me, and makes the code neater and easier + * to read. + * + * ====================================================================================================== */ + + @SuppressWarnings("Duplicates") + private int getLocked(int level) + { + switch (level) + { + case 1: + return 5; + case 2: + return 10; + case 3: + return 30; + case 4: + return 75; + case 5: + return 100; + } + if (level >= 5) + { + return 100; + } + return -1; + } + + private void percentButtons(boolean xp, float perc, int[] array, Button[] buttons, int number, int total, Player player) + { + float checkAgainst = perc; + + if (perc <= 20) + { + //One button + buttons[array[0]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + return; + } + + if (perc <= 40) + { + buttons[array[0]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + checkAgainst -= 20; + buttons[array[1]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + return; + } + + if (perc <= 60) + { + buttons[array[0]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + buttons[array[1]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + checkAgainst -= 40; + buttons[array[2]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + return; + } + if (perc <= 80) + { + buttons[array[0]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + buttons[array[1]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + buttons[array[2]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + checkAgainst -= 60; + buttons[array[3]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + return; + } + buttons[array[0]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + buttons[array[1]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + buttons[array[2]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + buttons[array[3]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + checkAgainst -= 80; + buttons[array[4]] = new IconButton(paneIcon(xp, number, total, perc, checkAgainst, player)); + } + + private ItemStack paneIcon(boolean xp, int number, int total, float perc, float checkAgainst, Player player) + { + String title = ChatColor.YELLOW + (xp ? "Experience Progression" : "Level Progression"); + String current = ChatColor.WHITE + "Current " + (xp ? "XP" : "Level") + ": " + Calculations.getColor(number, total) + number; + String calculatedPerc = ChatColor.GRAY + " (" + Calculations.getColor(number, total) + (int) perc + "%" + ChatColor.GRAY + ")"; + + List loreList = Lists.newArrayList(" "); + if (xp) + { + loreList.add(current + calculatedPerc); + loreList.add(xpLore(getKit(), player)); + } else + { + loreList.add(current + ChatColor.GRAY + " (" + Calculations.getColor(number, total) + number + + "/" + ChatColor.GREEN + total + ChatColor.GRAY + ")"); + } + + return new ItemBuilder(Material.STAINED_GLASS_PANE) + .setData(perc >= 20 ? DyeColor.LIME.getWoolData() : getColor(checkAgainst)) + .setTitle(title) + .setLore(loreList.toArray(new String[loreList.size()])) + .build(); + } + + + private byte getColor(float perc) + { + if (perc <= 5) + { + return COLORS[0].getWoolData(); + } + + if (perc <= 10) + { + return COLORS[1].getWoolData(); + } + + if (perc <= 15) + { + return COLORS[2].getWoolData(); + } + + if (perc <= 20) + { + return COLORS[3].getWoolData(); + } + + return COLORS[4].getWoolData(); + } + + private String xpLore(ProgressiveKit kit, Player player) + { + StringBuilder xp = new StringBuilder(C.cWhite + "Progress: "); + + int xpInt = kit.getXp(player.getUniqueId()); + int xpNext = Calculations.getXpForNextLevel(kit.getLevel(player.getUniqueId())); + int diff = kit.getXpDifference(player.getUniqueId()); + + xp.append(Calculations.getColor(xpInt, xpNext)).append(xpInt) + .append(ChatColor.GRAY).append("/") + .append(ChatColor.GREEN).append(xpNext) + .append(ChatColor.GRAY).append(" (") + .append(Calculations.getColor(xpInt, xpNext)).append(diff) + .append(" needed") + .append(ChatColor.GRAY).append(")"); + return xp.toString(); + } + + + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitMenu.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitMenu.java new file mode 100644 index 000000000..4c546aa7b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/guis/KitMenu.java @@ -0,0 +1,101 @@ +package mineplex.core.progression.gui.guis; + +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.gui.Button; +import mineplex.core.progression.gui.Menu; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +/** + * An implementation of {@link Menu} corresponding to kits + */ +public abstract class KitMenu extends Menu +{ + + /** + * Coming soon icon for upgrades + */ + protected static final ItemStack COMING_SOON = new ItemBuilder(Material.INK_SACK) + .setAmount(1) + .setData(DyeColor.GRAY.getDyeData()) + .setTitle(ChatColor.RED + "Coming Soon") + .setLore(" ", ChatColor.GRAY + "Upgrades coming soon!") + .build(); + + private ProgressiveKit _kit; + + public KitMenu(ProgressiveKit kit) + { + super(kit.getDisplayName()); + _kit = kit; + } + + /** + * Set up a menu based on the specific player + * + * @param player The player who we want to tailor the GUI to + * @return The setup arrangement of buttons + */ + public abstract Button[] setup(Player player); + + /** + * Open a GUI tailored to the player + * + * @param player The player who we wish to show the GUI to + */ + @Override + public void open(Player player) + { + this.setButtons(setup(player)); + + if (MENUS.get(player.getUniqueId()) != null) + { + MENUS.remove(player.getUniqueId()); + } + + MENUS.put(player.getUniqueId(), this); + + int size = (this._buttons.length + 8) / 9 * 9; + Inventory inventory = Bukkit.createInventory(player, size, getName()); + + for (int i = 0; i < _buttons.length; i++) + { + if (_buttons[i] == null) + { + continue; + } + + ItemStack item = _buttons[i].getItemStack(); + + inventory.setItem(i, item); + } + player.openInventory(inventory); + } + + /** + * Get the kit specific to this GUI + * + * @return This GUI's kit + */ + public ProgressiveKit getKit() + { + return _kit; + } + + /** + * We don't want to use this, as we may require per player GUI's + * @return The arrangement of buttons + */ + @Override + public Button[] setUp() + { + return new Button[45]; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/math/Calculations.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/math/Calculations.java new file mode 100644 index 000000000..be4c2f959 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/math/Calculations.java @@ -0,0 +1,208 @@ +package mineplex.core.progression.math; + +import com.google.common.collect.Maps; +import net.md_5.bungee.api.ChatColor; + +import java.util.Map; + +/** + * This class handles all the math and static fields needed for Kit Progressions + * You can find some util methods in here as well that relate to numbers + */ +public class Calculations +{ + + private static final int[] LEVELS = new int[100]; + private static final int[] UPGRADE_LEVELS = {5, 10, 30, 75, 100}; + private static final Map GEMS_FOR_UPGRADE = Maps.newHashMap(); + + static + { + generateDefaultExperienceLevels(); + for (int level : UPGRADE_LEVELS) + { + GEMS_FOR_UPGRADE.put(level, level * 1000); + } + } + + /** + * Generate the default XP values for leveling up. + */ + private static void generateDefaultExperienceLevels() + { + int expReq = 0; + + for (int i = 0; i < 10; i++) + { + expReq += 50; + LEVELS[i] = expReq; + } + + for (int i = 10; i < 20; i++) + { + expReq += 100; + LEVELS[i] = expReq; + } + + for (int i = 20; i < 40; i++) + { + expReq += 200; + LEVELS[i] = expReq; + } + + for (int i = 40; i < 60; i++) + { + expReq += 300; + LEVELS[i] = expReq; + } + + for (int i = 60; i < 80; i++) + { + expReq += 400; + LEVELS[i] = expReq; + } + + for (int i = 80; i < LEVELS.length; i++) + { + expReq += 500; + LEVELS[i] = expReq; + } + } + + /** + * Determines if the players current level is a level at which an upgrade is unlocked + * + * @param currentLevel The players level + * @return Whether or not the players level is within the {@code GEMS_FOR_UPGRADE} map + */ + public static boolean isUpgradeLevelEligible(int currentLevel) + { + return GEMS_FOR_UPGRADE.containsKey(currentLevel); + } + + /** + * Determines if the players current level, and his gems, are what he needs to level up this upgrade + * + * @param currentLevel The players level + * @param gems The players current gems + * @return Whether or not the player can upgrade + */ + public static boolean canUpgrade(int currentLevel, int gems) + { + return GEMS_FOR_UPGRADE.containsKey(currentLevel) && GEMS_FOR_UPGRADE.get(currentLevel) <= gems; + } + + /** + * Get the XP required for the next level + * + * @param currLevel The players current level + * @return The XP for the next level + */ + public static int getXpForNextLevel(int currLevel) + { + if (currLevel >= 100) + { + return LEVELS[LEVELS.length - 1]; + } + + //lets get this calculation right.... + return LEVELS[currLevel - 1]; + } + + /** + * Get the difference between the players current level, and the next level he needs for upgrades + * + * @param currentLevel The players level + * @return The integer difference + */ + public static int getUpgradeLevelDifference(int currentLevel) + { + for (int i = 0; i < UPGRADE_LEVELS.length; i++) { + if (UPGRADE_LEVELS[i] > currentLevel) { + return UPGRADE_LEVELS[i] - currentLevel; + } + } + return 0; + } + + /** + * Utility method for percentage based chat colors + * + * @param i The initial number + * @param n The total number + * @return The chat color corresponding to the percentage + */ + public static ChatColor getColor(int i, int n) + { + ChatColor color = ChatColor.GREEN; + + float perc = (i * 100.0f) / n; + + if (perc <= 25) + { + return ChatColor.GRAY; + } + if (perc <= 50) + { + return ChatColor.YELLOW; + } + if (perc <= 75) + { + return ChatColor.GOLD; + } + + return color; + } + + /** + * Get the next integer upgrade level based of the players current leve; + * + * @param currentLevel The players current level + * @return The next upgrade level + */ + public static int getNextUpgradeLevel(int currentLevel) + { + for (int i = 0; i < UPGRADE_LEVELS.length; i++) { + if (UPGRADE_LEVELS[i] <= currentLevel) { + return UPGRADE_LEVELS[i]; + } + } + return 5; + } + + /** + * Get the next level the player needs to reach to unlock an upgrade + * + * @param currentLevel The players current level + * @return The next level the player needs to reach to unlock an upgrade + */ + public static int getNextUpgradeLevelPlayer(int currentLevel) + { + for (int i = 0; i < UPGRADE_LEVELS.length; i++) { + if (UPGRADE_LEVELS[i] >= currentLevel) { + return UPGRADE_LEVELS[i]; + } + } + return 100; + } + + @SuppressWarnings("Duplicates") + public static int getLevelRequiredFor(int upgradeLevel) + { + switch (upgradeLevel) + { + case 1: + return 5; + case 2: + return 10; + case 3: + return 30; + case 4: + return 75; + case 5: + return 100; + } + + return -1; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/util/SQLStatement.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/util/SQLStatement.java new file mode 100644 index 000000000..be2bc52dc --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/util/SQLStatement.java @@ -0,0 +1,75 @@ +package mineplex.core.progression.util; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * Create and manager a prepared statement for inserting into SQL + */ +public class SQLStatement +{ + /** + * The initial string literal statement + */ + private String _base; + /** + * The _map for inserting objects into a prepared statement + */ + private Map _map; + + /** + * Create a new instance of an SQLStatement + * + * @param base The literal string MySQL query ('?' are allowed) + */ + public SQLStatement(String base) + { + this._base = base; + this._map = new HashMap<>(); + } + + /** + * Set an object to a value for inserting upon completion + * + * @param i The position of the object + * @param object The object to insert into the statement for the given position + * @return The local instance with an updated map + */ + public SQLStatement set(int i, Object object) + { + this._map.put(i, object); + return this; + } + + /** + * Prepare a fully built statement for running + * + * @param connection The connection used to establish the statement + * @return The fully built PreparedStatement + * @throws SQLException + */ + public PreparedStatement prepare(Connection connection) throws SQLException + { + PreparedStatement statement = connection.prepareStatement(_base); + + for (Map.Entry entry : _map.entrySet()) + { + int slot = entry.getKey(); + Object object = entry.getValue(); + + if (object instanceof UUID) + { + statement.setObject(slot, object.toString()); + continue; + } + + statement.setObject(slot, object); + } + return statement; + } + +} 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 2ecca2baf..f2de6934c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1,9 +1,5 @@ package nautilus.game.arcade; -import java.io.File; -import java.util.ArrayList; -import java.util.HashSet; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; @@ -12,13 +8,7 @@ import mineplex.core.blood.Blood; import mineplex.core.bonuses.BonusManager; import mineplex.core.chat.Chat; import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.*; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.creature.Creature; import mineplex.core.customdata.CustomDataManager; @@ -45,6 +35,7 @@ import mineplex.core.pet.PetManager; import mineplex.core.poll.PollManager; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; +import mineplex.core.progression.KitProgressionManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; import mineplex.core.resourcepack.ResourcePackManager; @@ -73,46 +64,22 @@ import mineplex.minecraft.game.core.fire.Fire; import nautilus.game.arcade.addons.SoupAddon; import nautilus.game.arcade.addons.TeamArmorAddon; import nautilus.game.arcade.addons.compass.CompassAddon; -import nautilus.game.arcade.command.DisguiseCommand; -import nautilus.game.arcade.command.GameCmdModeCommand; -import nautilus.game.arcade.command.GameCommand; -import nautilus.game.arcade.command.KitUnlockCommand; -import nautilus.game.arcade.command.RequiredRankCommand; -import nautilus.game.arcade.command.WriteCommand; +import nautilus.game.arcade.command.*; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.GameServerConfig; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.GameTeam.PlayerState; 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.GameCreationManager; -import nautilus.game.arcade.managers.GameFlagManager; -import nautilus.game.arcade.managers.GameGemManager; -import nautilus.game.arcade.managers.GameHostManager; -import nautilus.game.arcade.managers.GameLobbyManager; -import nautilus.game.arcade.managers.GameLootManager; -import nautilus.game.arcade.managers.GameManager; -import nautilus.game.arcade.managers.GamePlayerManager; -import nautilus.game.arcade.managers.GameSpectatorManager; -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.IdleManager; -import nautilus.game.arcade.managers.MiscManager; +import nautilus.game.arcade.managers.*; 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; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; +import org.bukkit.*; import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; @@ -136,6 +103,10 @@ import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; + public class ArcadeManager extends MiniPlugin implements IRelation { // Modules @@ -192,6 +163,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation private Punish _punishmentManager; private BrandingManager _brandingManager; private BonusManager _bonusManager; + private KitProgressionManager _kitProgressionManager; + private ProgressingKitManager _progressionKitManager; private IncognitoManager _incognitoManager; @@ -344,6 +317,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation _punishmentManager = punish; + _kitProgressionManager = new KitProgressionManager(getPlugin(), clientManager); + _progressionKitManager = new ProgressingKitManager(this); + if (GetHost() != null && !GetHost().isEmpty()) { Bukkit.getScheduler().runTaskLater(plugin, () -> Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName()), 80L); @@ -1703,4 +1679,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation return true; } + + public ProgressingKitManager getProgressionKitManager() + { + return _progressionKitManager; + } + + public KitProgressionManager getKitProgressionManager() + { + return _kitProgressionManager; + } } 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 59a9d1590..f6bc99724 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 @@ -1,20 +1,41 @@ package nautilus.game.arcade.game; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; +import mineplex.core.common.util.*; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.elo.EloPlayer; +import mineplex.core.elo.EloTeam; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; +import mineplex.minecraft.game.core.combat.DeathMessageType; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerGameRespawnEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.managers.GameLobbyManager; +import nautilus.game.arcade.managers.chat.ChatStatData; +import nautilus.game.arcade.scoreboard.GameScoreboard; +import nautilus.game.arcade.stats.*; +import nautilus.game.arcade.wineffect.WinEffectManager; +import nautilus.game.arcade.world.WorldData; +import net.minecraft.server.v1_8_R3.EntityItem; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; +import net.minecraft.server.v1_8_R3.WorldServer; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; @@ -45,57 +66,8 @@ import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; -import com.mojang.authlib.GameProfile; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -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.EloTeam; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.packethandler.IPacketHandler; -import mineplex.core.packethandler.PacketInfo; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; -import mineplex.minecraft.game.core.combat.DeathMessageType; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import nautilus.game.arcade.ArcadeFormat; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.events.PlayerGameRespawnEvent; -import nautilus.game.arcade.events.PlayerStateChangeEvent; -import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.managers.GameLobbyManager; -import nautilus.game.arcade.managers.chat.ChatStatData; -import nautilus.game.arcade.scoreboard.GameScoreboard; -import nautilus.game.arcade.stats.AssistsStatTracker; -import nautilus.game.arcade.stats.DamageDealtStatTracker; -import nautilus.game.arcade.stats.DamageTakenStatTracker; -import nautilus.game.arcade.stats.DeathsStatTracker; -import nautilus.game.arcade.stats.ExperienceStatTracker; -import nautilus.game.arcade.stats.GamesPlayedStatTracker; -import nautilus.game.arcade.stats.KillsStatTracker; -import nautilus.game.arcade.stats.LoseStatTracker; -import nautilus.game.arcade.stats.StatTracker; -import nautilus.game.arcade.stats.WinStatTracker; -import nautilus.game.arcade.wineffect.WinEffectManager; -import nautilus.game.arcade.world.WorldData; -import net.minecraft.server.v1_8_R3.EntityItem; -import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; -import net.minecraft.server.v1_8_R3.WorldServer; +import java.util.*; +import java.util.Map.Entry; public abstract class Game implements Listener { @@ -819,13 +791,48 @@ public abstract class Game implements Listener public void ValidateKit(Player player, GameTeam team) { - // Kit + if (GetKit(player) != null) + { + //Make sure their current kit can be used, if not, tell them. + Kit kit = GetKit(player); + if (team.KitAllowed(kit)) + { + return; + } + player.sendMessage(F.main("Kit", "Your current kit is not applicable with your team. Please select a different kit")); + Optional newKit = Lists.newArrayList(GetKits()) + .stream().filter(team::KitAllowed).findFirst(); + if (newKit.isPresent()) + { + SetKit(player, newKit.get(), true); + return; + } + return; + } + + //This IN THEORY shouldn't ever be used, but oh well. if (GetKit(player) == null || !team.KitAllowed(GetKit(player))) { for (Kit kit : _kits) { if (kit.GetAvailability() == KitAvailability.Hide || kit.GetAvailability() == KitAvailability.Null) + { continue; + } + + //Set the default kit (if they have one selected) + if (kit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) kit; + if (team.KitAllowed(progressingKit)) + { + if (progressingKit.isDefault(player.getUniqueId())) + { + SetKit(player, progressingKit, true); + break; + } + } + } if (team.KitAllowed(kit)) { @@ -845,9 +852,9 @@ public abstract class Game implements Listener { player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); UtilPlayer.message( - player, - F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") - + ".")); + player, + F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + + ".")); return; } } @@ -864,11 +871,17 @@ public abstract class Game implements Listener if (announce) { player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); + if (kit instanceof ProgressingKit && ((ProgressingKit) kit).isDefault(player.getUniqueId())) + { + player.sendMessage(F.main("Kit", "Loaded default kit " + F.elem(kit.GetFormattedName()))); + } UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); } if (InProgress()) + { kit.ApplyKit(player); + } } public Kit GetKit(Player player) 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..e08594b7e 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 @@ -1,5 +1,17 @@ package nautilus.game.arcade.game.games.baconbrawl.kits; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguisePig; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBaconBlast; +import nautilus.game.arcade.kit.perks.PerkSpeed; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -10,50 +22,38 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguisePig; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBaconBlast; -import nautilus.game.arcade.kit.perks.PerkSpeed; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; - -public class KitMamaPig extends Kit +public class KitMamaPig extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Mama & Baby Piggles fight together", + "", + click(false, C.cWhite + "Axe to use " + C.cGreen + "Bacon Blast"), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.PORK); + + private static final Perk[] PERKS = { + new PerkBaconBlast(), + new PerkSpeed(1) + }; + public KitMamaPig(ArcadeManager manager) { - super(manager, "Mama Piggles", KitAvailability.Gem, - - new String[] - { - "Mama & Baby Piggles fight together!" - }, - - new Perk[] - { - new PerkBaconBlast(), - new PerkSpeed(1), - }, - EntityType.PIG, - new ItemStack(Material.PORK)); + super(manager, "Mama Piggles", "mamapiggles", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.PIG, IN_HAND); } @Override - public void GiveItems(final Player player) + public void GiveItems(final Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - + //Disguise DisguisePig disguise = new DisguisePig(player); disguise.setName(C.cYellow + player.getName()); disguise.setCustomNameVisible(false); Manager.GetDisguise().disguise(disguise); - + Manager.GetGame().CreatureAllowOverride = true; final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); pig.setBaby(); @@ -61,33 +61,32 @@ public class KitMamaPig extends Kit pig.setCustomName(C.cYellow + player.getName()); pig.setCustomNameVisible(false); Manager.GetGame().CreatureAllowOverride = false; - + player.setPassenger(pig); - Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[] { pig.getEntityId() })); - } - }, 2); + Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), () -> UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[]{pig.getEntityId()})), 2); } - - @EventHandler(priority=EventPriority.LOWEST) + + @EventHandler(priority = EventPriority.LOWEST) public void damageTransfer(CustomDamageEvent event) { if (event.IsCancelled()) + { return; + } if (!(event.GetDamageeEntity() instanceof Pig)) + { return; - - Pig pig = (Pig)event.GetDamageeEntity(); - + } + + Pig pig = (Pig) event.GetDamageeEntity(); + if (pig.getVehicle() == null || !(pig.getVehicle() instanceof LivingEntity)) + { return; - - event.setDamagee((LivingEntity)pig.getVehicle()); + } + + event.setDamagee((LivingEntity) pig.getVehicle()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java index 1f54d2eec..bd9eeacae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java @@ -1,37 +1,36 @@ package nautilus.game.arcade.game.games.baconbrawl.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkBodySlam; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitPig extends Kit +public class KitPig extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Such a fat pig. Oink", + "", + click(false, "Axe to " + C.cGreen + "Body Slam"), + }; + + private static final Perk[] PERKS = { + new PerkBodySlam(6, 2), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.PORK); + public KitPig(ArcadeManager manager) { - super(manager, "El Muchacho Pigo", KitAvailability.Free, - - new String[] - { - "Such a fat pig. Oink." - }, - - new Perk[] - { - new PerkBodySlam(6, 2), - //new PerkJump(1), MAC - }, - EntityType.PIG, - new ItemStack(Material.PORK)); + super(manager, "El Muchacho Pigo", "elmuchachopigo", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.PIG, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java index 5607d41ba..725f5b910 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java @@ -1,48 +1,45 @@ package nautilus.game.arcade.game.games.baconbrawl.kits; -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.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Sheep; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilEnt; import mineplex.core.disguise.disguises.DisguiseSheep; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkBackstabKnockback; import nautilus.game.arcade.kit.perks.PerkPigCloak; +import org.bukkit.DyeColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.*; +import org.bukkit.inventory.ItemStack; -public class KitSheepPig extends Kit +public class KitSheepPig extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "\"...Oink?\"", + "", + click(false, "Axe to " + C.cGreen + "Cloak"), + "Deal " + C.cGreen + "+250%" + C.cWhite + " Knockback from behind opponents." + }; + + private static final Perk[] PERKS = { + new PerkPigCloak(), + new PerkBackstabKnockback() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.WOOL, 1, DyeColor.PINK.getWoolData()); + public KitSheepPig(ArcadeManager manager) { - super(manager, "Pig", KitAvailability.Gem, 5000, - - new String[] - { - "\"...Oink?\"" - }, - - new Perk[] - { - new PerkPigCloak(), - new PerkBackstabKnockback() - }, - EntityType.SHEEP, - new ItemStack(Material.WOOL)); + super(manager, "Pig", "wolfpig", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SHEEP, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); @@ -53,13 +50,15 @@ public class KitSheepPig extends Kit disguise.setColor(DyeColor.PINK); Manager.GetDisguise().disguise(disguise); } - + @Override public Entity SpawnEntity(Location loc) { EntityType type = _entityType; if (type == EntityType.PLAYER) + { type = EntityType.ZOMBIE; + } LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); @@ -70,13 +69,13 @@ public class KitSheepPig extends Kit if (type == EntityType.SHEEP) { - Sheep sheep = (Sheep)entity; + Sheep sheep = (Sheep) entity; sheep.setColor(DyeColor.PINK); } UtilEnt.Vegetate(entity); - SpawnCustom(entity); + SpawnCustom(entity); return entity; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java index 34e007585..7bfea9ddf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitArcher.java @@ -1,50 +1,56 @@ package nautilus.game.arcade.game.games.barbarians.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkRopedArrow; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkRopedArrow; - -public class KitArcher extends Kit +public class KitArcher extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Uses some kind of less barbaric ranged weapon" + }; + + private static final Perk[] PERKS = { + new PerkRopedArrow("Roped Arrow", 1, 6000), + new PerkFletcher(2, 2, true) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.BOW), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP) + }; + + private static final ItemStack[] ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + public KitArcher(ArcadeManager manager) { - super(manager, "Barbarian Archer", KitAvailability.Gem, - new String[] - { - "Uses some kind of less barbaric ranged weapon..." - }, - new Perk[] - { - new PerkRopedArrow("Roped Arrow", 1, 6000), - new PerkFletcher(2, 2, true), - }, - EntityType.PLAYER, - new ItemStack(Material.BOW)); - + super(manager, "Barbarian Archer", "barbarianarcher", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.PLAYER, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java index 39ea9d950..bbb59fa86 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java @@ -1,56 +1,61 @@ package nautilus.game.arcade.game.games.barbarians.kits; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBomber; +import nautilus.game.arcade.kit.perks.PerkLeap; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.F; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitBomber extends Kit +public class KitBomber extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Crazy bomb throwing barbarian. BOOM!" + }; + + private static final Perk[] PERKS = { + new PerkBomber(8, 2, -1), + new PerkLeap("Leap", 1, 1, 8000) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP) + }; + + private static final ItemStack[] ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.TNT); + public KitBomber(ArcadeManager manager) { - super(manager, "Bomber", KitAvailability.Gem, 5000, - - new String[] - { - "Crazy bomb throwing barbarian. BOOM!" - }, - - new Perk[] - { - new PerkBomber(8, 2, -1), - new PerkLeap("Leap", 1, 1, 8000) - }, - EntityType.ZOMBIE, - new ItemStack(Material.TNT)); - + super(manager, "Bomber", "barbarianbomber", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT"))); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(ARMOR); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBrute.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBrute.java index 9b2960660..10cdea1ac 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBrute.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBrute.java @@ -1,50 +1,56 @@ package nautilus.game.arcade.game.games.barbarians.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBodySlam; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBodySlam; - -public class KitBrute extends Kit +public class KitBrute extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "A true barbarian, loves to kill people!" + }; + + private static final Perk[] PERKS = { + new PerkBodySlam(8, 2) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP) + }; + + private static final ItemStack[] ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + public KitBrute(ArcadeManager manager) { - super(manager, "Barbarian Brute", KitAvailability.Free, - new String[] - { - "A true barbarian, loves to kill people!" - }, - new Perk[] - { - new PerkBodySlam(8, 2) - }, - EntityType.PLAYER, - new ItemStack(Material.IRON_AXE)); - + super(manager, "Barbarian Brute", "barbarianbrute", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.PLAYER, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitApple.java index a8270754a..ac42a517e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitApple.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitApple.java @@ -1,39 +1,39 @@ package nautilus.game.arcade.game.games.bridge.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkApple; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitApple extends Kit +public class KitApple extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Possess the rare skill of finding apples frequently!", + "", + receiveItem("apple", 1, 10, 0), + click(true, "the apple to throw it") + }; + + private static final Perk[] PERKS = { + new PerkApple() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.APPLE); + public KitApple(ArcadeManager manager) { - super(manager, "Apple", KitAvailability.Free, - - new String[] - { - "Possess the rare skill of finding apples frequently!" - }, - - new Perk[] - { - new PerkApple(manager) - }, - EntityType.ZOMBIE, - new ItemStack(Material.APPLE)); - + super(manager, "Apple", "bridgeapple", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitArcher.java index 56b582a28..661415b70 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitArcher.java @@ -1,37 +1,45 @@ package nautilus.game.arcade.game.games.bridge.kits; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.bridge.Bridge; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkBarrage; import nautilus.game.arcade.kit.perks.PerkFletcher; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitArcher extends Kit -{ +public class KitArcher extends ProgressingKit +{ + + private static final String[] DESCRIPTION = { + "Highly trained with a bow, probably an elf or something...", + " ", + "Begin the game with a Bow", + receiveArrowString(1, 20, 3), + "Charge Bow to use " + C.cGreen + "Barrage" + }; + + private static final Perk[] PERKS = { + new PerkFletcher(20, 3, true), + new PerkBarrage(5, 250, true, false), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + public KitArcher(ArcadeManager manager) { - super(manager, "Archer", KitAvailability.Gem, - - new String[] - { - "Highly trained with a bow, probably an elf or something..." - }, - - new Perk[] - { - new PerkFletcher(20, 3, true), - new PerkBarrage(5, 250, true, false), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); + super(manager, "Archer", "bridgearcher", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @@ -42,7 +50,7 @@ public class KitArcher extends Kit { return; } - + Bridge bridge = (Bridge) Manager.GetGame(); if(!bridge.hasUsedRevive(player)) player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBerserker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBerserker.java new file mode 100644 index 000000000..497017ee6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBerserker.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.games.bridge.kits; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkAxeman; +import nautilus.game.arcade.kit.perks.PerkLeap; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class KitBerserker extends ProgressingKit +{ + + private static final String[] DESCRIPTION = { + "Agile warrior trained in the ways of axe combat.", + " ", + "Begin with a Stone Axe", + "Deal " + C.cGreen + "+1" + C.cWhite + " damage using axes", + click(false, " with your axe to use " + C.cGreen + "Berserker Leap") + }; + + private static final Perk[] PERKS = { + new PerkLeap("Beserker Leap", 1.2, 1.2, 8000), + new PerkAxeman(), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_AXE); + + public KitBerserker(ArcadeManager manager) + { + super(manager, "Berserker", "bridgeberserker", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(PLAYER_ITEMS); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBomber.java index 123201d80..ab5687571 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBomber.java @@ -1,39 +1,40 @@ package nautilus.game.arcade.game.games.bridge.kits; +import mineplex.core.common.util.C; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBomber; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitBomber extends Kit +public class KitBomber extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Crazy bomb throwing guy.", + " ", + receiveItem("TNT", 1, 30, 2), + C.cYellow + "Click" + C.cWhite + " to throw TNT" + }; + + private static final Perk[] PERKS = { + new PerkBomber(30, 2, -1) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.TNT); + public KitBomber(ArcadeManager manager) { - super(manager, "Bomber", KitAvailability.Gem, 5000, - - new String[] - { - "Crazy bomb throwing guy." - }, - - new Perk[] - { - new PerkBomber(30, 2, -1) - }, - EntityType.ZOMBIE, - new ItemStack(Material.TNT)); - + super(manager, "Bomber", "bridgebomber", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBrawler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBrawler.java new file mode 100644 index 000000000..95ac0ede6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBrawler.java @@ -0,0 +1,50 @@ +package nautilus.game.arcade.game.games.bridge.kits; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkIronSkin; +import nautilus.game.arcade.kit.perks.PerkMammoth; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class KitBrawler extends ProgressingKit +{ + + private static final String[] DESCRIPTION = { + "Giant and muscular, easily smacks others around.", + " ", + "Begin with an Iron Sword", + "Take " + C.cGreen + "75%" + C.cWhite + " knockback", + "Deal " + C.cGreen + "125%" + C.cWhite + " knockback", + "Take " + C.cGreen + "-1" + C.cWhite + " damage from all attacks" + }; + + private static final Perk[] PERKS = { + new PerkMammoth(), + new PerkIronSkin(1) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + public KitBrawler(ArcadeManager manager) + { + super(manager, "Brawler", "bridgebrawler", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(PLAYER_ITEMS); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitDestructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitDestructor.java index d82da7a63..b5710854f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitDestructor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitDestructor.java @@ -1,44 +1,50 @@ package nautilus.game.arcade.game.games.bridge.kits; +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDestructor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.achievement.Achievement; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitDestructor extends Kit +public class KitDestructor extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Has the ability to make the world crumble!", + " ", + receiveItem("Seismic Charge", 1, 40, 2), + C.cYellow + "Right-Click" + C.cWhite + " with Seismic Charge to " + C.cGreen + "Throw Seismic Charge", + + "", + C.cRed + "Seismic Charges begin after bridges drop" + }; + + private static final Perk[] PERKS = { + new PerkDestructor(40, 2, 400, false) + }; + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.BRIDGES_DEATH_BOMBER, + Achievement.BRIDGES_FOOD, + Achievement.BRIDGES_FORTUNE_BOMBER, + Achievement.BRIDGES_RAMPAGE, + Achievement.BRIDGES_SNIPER, + Achievement.BRIDGES_WINS + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.ENDER_PEARL); + public KitDestructor(ArcadeManager manager) { - super(manager, "Destructor", KitAvailability.Achievement, 99999, + super(manager, "Destructor", "bridgedesctructor", KitAvailability.Achievement, 99999, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); - new String[] - { - "Has the ability to make the world crumble!" - }, - - new Perk[] - { - new PerkDestructor(40, 2, 400, false) - }, - EntityType.ZOMBIE, - new ItemStack(Material.ENDER_PEARL)); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.BRIDGES_DEATH_BOMBER, - Achievement.BRIDGES_FOOD, - Achievement.BRIDGES_FORTUNE_BOMBER, - Achievement.BRIDGES_RAMPAGE, - Achievement.BRIDGES_SNIPER, - Achievement.BRIDGES_WINS - }); + this.setAchievementRequirements(ACHIEVEMENTS); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitMiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitMiner.java index 1aa19adab..2d28e1c6f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitMiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitMiner.java @@ -1,36 +1,45 @@ package nautilus.game.arcade.game.games.bridge.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.bridge.Bridge; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDigger; +import nautilus.game.arcade.kit.perks.PerkOreFinder; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitMiner extends Kit +public class KitMiner extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Master of ore prospecting and digging quickly.", + " ", + "Begin with a Stone Pickaxe", + "Receive " + C.cGreen + "Haste 2", + click(false, "your pickaxe to " + C.cGreen + "find ores"), + }; + + private static final Perk[] PERKS = { + new PerkOreFinder(), + new PerkDigger(), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_PICKAXE); + public KitMiner(ArcadeManager manager) { - super(manager, "Miner", KitAvailability.Gem, 5000, - - new String[] - { - "Master of ore prospecting and digging quickly." - }, - - new Perk[] - { - new PerkOreFinder(), - new PerkDigger(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.STONE_PICKAXE)); + super(manager, "Miner", "bridgeminer", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @@ -41,7 +50,7 @@ public class KitMiner extends Kit { return; } - + Bridge bridge = (Bridge) Manager.GetGame(); if(!bridge.hasUsedRevive(player)) player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/kits/KitBuilder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/kits/KitBuilder.java index a00f1e7f8..7343516a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/kits/KitBuilder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/kits/KitBuilder.java @@ -1,31 +1,28 @@ package nautilus.game.arcade.game.games.build.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitBuilder extends Kit +public class KitBuilder extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Can I build it!? Yes I can!" + }; + + private static final Perk[] PERKS = {}; + + private static final ItemStack IN_HAND = new ItemStack(Material.WOOD); + public KitBuilder(ArcadeManager manager) { - super(manager, "Builder", KitAvailability.Free, - - new String[] - { - "Can I build it!? Yes I can!" - }, - - new Perk[] - { - }, - EntityType.SKELETON, - new ItemStack(Material.WOOD)); + super(manager, "Builder", "buildbuilder", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHuman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHuman.java index 40382362b..6c4da8994 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHuman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHuman.java @@ -1,22 +1,18 @@ package nautilus.game.arcade.game.games.castlesiege.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public abstract class KitHuman extends Kit +public abstract class KitHuman extends ProgressingKit { public KitHuman(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, entityType, itemInHand); } - public KitHuman(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) - { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); - } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java deleted file mode 100644 index ae5158a29..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java +++ /dev/null @@ -1,81 +0,0 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; - -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.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkLeap; -import nautilus.game.arcade.kit.perks.PerkPowershot; -import nautilus.game.arcade.kit.perks.PerkRegeneration; - -public class KitHumanAssassin extends KitHuman -{ - public KitHumanAssassin(ArcadeManager manager) - { - super(manager, "Castle Assassin", KitAvailability.Gem, 5000, - new String[] - { - "Able to kill with a single shot!" - }, - new Perk[] - { - new PerkFletcher(2, 4, false), - new PerkLeap("Leap", 1.2, 1, 8000), - new PerkPowershot(5, 400), - new PerkRegeneration(0), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - - } - - @EventHandler - public void FireItemResist(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - if (Manager.GetGame() == null) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!HasKit(player)) - continue; - - Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); - } - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); - } - - @Override - public void SpawnCustom(LivingEntity ent) - { - ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); - ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); - ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); - ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanBrawler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanBrawler.java deleted file mode 100644 index 2ebc6c976..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanBrawler.java +++ /dev/null @@ -1,82 +0,0 @@ -package nautilus.game.arcade.game.games.castlesiege.kits; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; - -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.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkCleave; -import nautilus.game.arcade.kit.perks.PerkKnockbackGive; -import nautilus.game.arcade.kit.perks.PerkSeismicSlamCS; - -public class KitHumanBrawler extends KitHuman -{ - public KitHumanBrawler(ArcadeManager manager) - { - super(manager, "Castle Brawler", KitAvailability.Gem, 5000, - - new String[] - { - "Extremely tanky, can smash the undead around." - }, - - new Perk[] - { - new PerkSeismicSlamCS(), - new PerkCleave(0.75, true), - }, - - EntityType.ZOMBIE, new ItemStack(Material.IRON_AXE)); - } - - @EventHandler - public void FireItemResist(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - if (Manager.GetGame() == null) - return; - - for (Player player : Manager.GetGame().GetPlayers(true)) - { - if (!HasKit(player)) - continue; - - Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); - } - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 16)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS)); - } - - @Override - public void SpawnCustom(LivingEntity ent) - { - ent.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); - ent.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); - ent.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); - ent.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java index b46cae60f..d918b34eb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanKnight.java @@ -1,5 +1,15 @@ package nautilus.game.arcade.game.games.castlesiege.kits; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +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.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkMammoth; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -7,35 +17,45 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.F; -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.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - public class KitHumanKnight extends KitHuman { + + private static final String[] DESCRIPTION = { + "Robust knight, also able to construct defenses.", + " ", + receiveItem("oak fence", 1, 40, 2), + "Take " + C.cGreen + "75%" + C.cWhite + " knockback", + "Deal " + C.cGreen + "125%" + C.cWhite + " knockback", + }; + + private static final Perk[] PERKS = { + new PerkMammoth(), + new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW), + ItemStackFactory.Instance.CreateStack(Material.ARROW, 64), + ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte) 0, 2, F.item("Castle Barricade")), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP) + }; + + private static final ItemStack[] ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS) + }; + + public static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitHumanKnight(ArcadeManager manager) { - super(manager, "Castle Knight", KitAvailability.Gem, - - new String[] - { - "Robust knight, also able to construct defenses." - }, - - new Perk[] - { - new PerkMammoth(), - new PerkConstructor("Constructor", 40, 2, Material.FENCE, "Castle Barricade", true) - }, - - EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - + super(manager, "Castle Knight", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @EventHandler @@ -59,23 +79,10 @@ public class KitHumanKnight extends KitHuman @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 64)); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FENCE, (byte)0, 2, F.item("Castle Barricade"))); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java index 26693b29c..66e032aea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java @@ -1,5 +1,14 @@ package nautilus.game.arcade.game.games.castlesiege.kits; +import mineplex.core.common.util.C; +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.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -7,70 +16,76 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -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.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkFletcher; - public class KitHumanMarksman extends KitHuman { + + private static final String[] DESCRIPTION = { + "Skilled human marksman, can fletch arrows.", + " ", + receiveArrowString(1, 2, 4), + "Charge your Bow to use " + C.cGreen + "Barrage" + }; + + private static final Perk[] PERKS = { + new PerkBarrage(5, 250, true, false), + new PerkFletcher(2, 4, false), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW), + ItemStackFactory.Instance.CreateStack(Material.ARROW, 32), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP) + }; + + private static final ItemStack[] ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS) + }; + + public static final ItemStack IN_HAND = new ItemStack(Material.BOW); + public KitHumanMarksman(ArcadeManager manager) { - super(manager, "Castle Marksman", KitAvailability.Free, - new String[] - { - "Skilled human marksman, can fletch arrows." - }, - new Perk[] - { - new PerkBarrage(5, 250, true, false), - new PerkFletcher(2, 4, false), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - + super(manager, "Castle Marksman", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @EventHandler public void FireItemResist(UpdateEvent event) { if (event.getType() != UpdateType.FAST) + { return; - + } + if (Manager.GetGame() == null) + { return; - + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!HasKit(player)) + { continue; - + } + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); - } + } } - + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 32)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(ARMOR); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java index eb95626ad..c1ec3e24f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanPeasant.java @@ -1,70 +1,74 @@ package nautilus.game.arcade.game.games.castlesiege.kits; +import mineplex.core.disguise.disguises.DisguiseWolf; +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.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkKnockbackGive; +import nautilus.game.arcade.kit.perks.PerkStrength; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import mineplex.core.disguise.disguises.DisguisePig; -import mineplex.core.disguise.disguises.DisguisePigZombie; -import mineplex.core.disguise.disguises.DisguiseWolf; -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.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkKnockbackGive; -import nautilus.game.arcade.kit.perks.PerkStrength; - public class KitHumanPeasant extends KitHuman { + + private static final String[] DESCRIPTION = { + "OINK! OINK!" + }; + + private static final Perk[] PERKS = { + new PerkStrength(1), + new PerkKnockbackGive(2) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 0, "Wolf Bite") + }; + + public static final ItemStack IN_HAND = new ItemStack(Material.IRON_HOE); + public KitHumanPeasant(ArcadeManager manager) { - super(manager, "Castle Wolf", KitAvailability.Hide, - - new String[] - { - "OINK! OINK!" - }, - - new Perk[] - { - new PerkStrength(1), - new PerkKnockbackGive(2) - }, - - EntityType.ZOMBIE, new ItemStack(Material.IRON_HOE)); - + super(manager, "Castle Wolf", KitAvailability.Hide, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @EventHandler public void FireItemResist(UpdateEvent event) { if (event.getType() != UpdateType.FAST) + { return; - + } + if (Manager.GetGame() == null) + { return; - + } + for (Player player : Manager.GetGame().GetPlayers(true)) { if (!HasKit(player)) + { continue; - + } + Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); } } - - @Override + + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 0, "Wolf Bite")); - + player.getInventory().addItem(PLAYER_ITEMS); + player.setHealth(4); - + DisguiseWolf disguise = new DisguiseWolf(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndead.java index 33ab997dc..31db5ed38 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndead.java @@ -1,22 +1,21 @@ package nautilus.game.arcade.game.games.castlesiege.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public abstract class KitUndead extends Kit +public abstract class KitUndead extends ProgressingKit { public KitUndead(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, entityType, itemInHand); } public KitUndead(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadArcher.java index a31bbade3..ebdefc25a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadArcher.java @@ -1,5 +1,13 @@ package nautilus.game.arcade.game.games.castlesiege.kits; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkIronSkin; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; @@ -8,63 +16,59 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkIronSkin; - public class KitUndeadArcher extends KitUndead { + + private static final String[] DESCRIPTION = { + "Makes use of arrows scavenged from human archers.", + " ", + "Take " + C.cGreen + "-1" + C.cWhite + " damage from attacks" + }; + + private static final Perk[] PERKS = { + new PerkIronSkin(1) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE), + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + + public static final ItemStack IN_HAND = new ItemStack(Material.BOW); + public KitUndeadArcher(ArcadeManager manager) { - super(manager, "Undead Archer", KitAvailability.Gem, - - new String[] - { - "Makes use of arrows scavenged from human archers." - }, - - new Perk[] - { - new PerkIronSkin(1) - }, - EntityType.SKELETON, - new ItemStack(Material.BOW)); + super(manager, "Undead Archer", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } - + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - + player.getInventory().addItem(PLAYER_ITEMS); + DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - + @EventHandler public void ArrowPickup(PlayerPickupItemEvent event) { if (event.getItem().getItemStack().getType() != Material.ARROW) return; - + if (!HasKit(event.getPlayer())) return; - + if (UtilInv.contains(event.getPlayer(), Material.ARROW, (byte)0, 4)) return; - + event.getItem().remove(); - + event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW)); - + event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ITEM_PICKUP, 1f, 1f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java index 3a922401e..1c893a7a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadGhoul.java @@ -1,5 +1,13 @@ package nautilus.game.arcade.game.games.castlesiege.kits; +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguisePigZombie; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkLeap; +import nautilus.game.arcade.kit.perks.PerkSpeed; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -7,39 +15,36 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; -import mineplex.core.disguise.disguises.DisguisePigZombie; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - public class KitUndeadGhoul extends KitUndead { + + private static final String[] DESCRIPTION = { + "Weak, but able to jump around with ease.", + " ", + click(false, "your axe to use " + C.cGreen + "Ghoul Leap"), + }; + + private static final Perk[] PERKS = { + new PerkLeap("Ghoul Leap", 1.2, 0.8, 8000), + new PerkSpeed(0) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE), + }; + + public static final ItemStack IN_HAND = new ItemStack(Material.STONE_AXE); + public KitUndeadGhoul(ArcadeManager manager) { - super(manager, "Undead Ghoul", KitAvailability.Free, - - new String[] - { - "Weak, but able to jump around with ease." - }, - - new Perk[] - { - new PerkLeap("Ghoul Leap", 1.2, 0.8, 8000), - new PerkSpeed(0) - }, - EntityType.PIG_ZOMBIE, - new ItemStack(Material.STONE_AXE)); + super(manager, "Undead Ghoul", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.PIG_ZOMBIE, IN_HAND); } - - @Override + + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); - + player.getInventory().addItem(PLAYER_ITEMS); + DisguisePigZombie disguise = new DisguisePigZombie(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); @@ -50,9 +55,13 @@ public class KitUndeadGhoul extends KitUndead public void PickupArrow(PlayerPickupItemEvent event) { if (!HasKit(event.getPlayer())) + { return; - + } + if (event.getItem().getItemStack().getType() == Material.ARROW) + { event.setCancelled(true); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java index 842da57bf..9d9eb4b75 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java @@ -1,5 +1,12 @@ package nautilus.game.arcade.game.games.castlesiege.kits; +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguiseZombie; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkRegeneration; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -7,39 +14,36 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; -import mineplex.core.disguise.disguises.DisguiseZombie; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - public class KitUndeadZombie extends KitUndead { + + private static final String[] DESCRIPTION = { + "Regenerates rapidly", + " ", + "Receive " + C.cGreen + "Regeneration III" + }; + + private static final Perk[] PERKS = { + new PerkRegeneration(2) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE), + }; + + public static final ItemStack IN_HAND = new ItemStack(Material.STONE_AXE); + public KitUndeadZombie(ArcadeManager manager) { - super(manager, "Undead Zombie", KitAvailability.Gem, 5000, - - new String[] - { - "Regenerates rapidly" - }, - - new Perk[] - { - new PerkRegeneration(2) - }, - EntityType.ZOMBIE, - new ItemStack(Material.STONE_AXE)); + super(manager, "Undead Zombie", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); - + player.getInventory().addItem(PLAYER_ITEMS); + DisguiseZombie disguise = new DisguiseZombie(player); if (Manager.GetGame().GetTeam(player) != null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitAssassin.java index cb1765619..3ae2efd42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitAssassin.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitAssassin.java @@ -1,88 +1,87 @@ package nautilus.game.arcade.game.games.champions.kits; -import java.util.HashMap; - +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.ChampionsKit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.minecraft.game.classcombat.Class.ClientClass; -import mineplex.minecraft.game.classcombat.Class.IPvpClass; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; +import java.util.HashMap; -public class KitAssassin extends Kit +public class KitAssassin extends ChampionsKit { private HashMap _class = new HashMap(); - + + private static final String[] DESCRIPTION = { + "Extremely agile warrior, trained in", + "the mystic arts of assassination.", + "", + "Attack Damage increased by 1", + "Fall Damage reduced by 1", + "Permanent Speed 2", + }; + + private static final Perk[] PERKS = {}; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitAssassin(ArcadeManager manager) { - super(manager, "Assassin", KitAvailability.Free, - new String[] - { - "Extremely agile warrior, trained in", - "the mystic arts of assassination.", - "", - "Attack Damage increased by 1", - "Fall Damage reduced by 1", - "Permanent Speed 2", - }, - new Perk[] - { - - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); + super(manager, "Assassin", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void Deselected(Player player) { _class.remove(player); } - + @Override public void Selected(Player player) { Manager.Clear(player); - + _class.put(player, Manager.getClassManager().Get(player)); ClientClass clientClass = _class.get(player); IPvpClass pvpClass = Manager.getClassManager().GetClass("Assassin"); - + clientClass.SetGameClass(pvpClass); pvpClass.ApplyArmor(player); clientClass.ClearDefaults(); clientClass.EquipCustomBuild(clientClass.GetCustomBuilds(pvpClass).get(0)); - + if (!Manager.GetGame().InProgress()) + { clientClass.SetActiveCustomBuild(pvpClass, pvpClass.getDefaultBuild()); - + } + Manager.openClassShop(player); } - + @Override public void GiveItems(Player player) { _class.get(player).ResetToDefaults(true, true); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); } - + @Override - public void DisplayDesc(Player player) + public void DisplayDesc(Player player) { } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitBrute.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitBrute.java index 4462eb7a0..c9a3aeb3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitBrute.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitBrute.java @@ -1,42 +1,38 @@ package nautilus.game.arcade.game.games.champions.kits; -import java.util.HashMap; - +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.ChampionsKit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.minecraft.game.classcombat.Class.ClientClass; -import mineplex.minecraft.game.classcombat.Class.IPvpClass; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; +import java.util.HashMap; -public class KitBrute extends Kit +public class KitBrute extends ChampionsKit { private HashMap _class = new HashMap(); - + + private static final String[] DESCRIPTION = { + "A giant of a man, able to smash and", + "destroy anything in his path.", + "", + "Takes additional damage to counter", + "the strength of Diamond Armor." + }; + + private static final Perk[] PERKS = {}; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitBrute(ArcadeManager manager) { - super(manager, "Brute", KitAvailability.Free, - new String[] - { - "A giant of a man, able to smash and", - "destroy anything in his path.", - "", - "Takes additional damage to counter", - "the strength of Diamond Armor." - }, - new Perk[] - { - - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - + super(manager, "Brute", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitKnight.java index 97bf4610d..9c288a074 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitKnight.java @@ -1,89 +1,88 @@ package nautilus.game.arcade.game.games.champions.kits; -import java.util.HashMap; - +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.ChampionsKit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.minecraft.game.classcombat.Class.ClientClass; -import mineplex.minecraft.game.classcombat.Class.IPvpClass; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; +import java.util.HashMap; -public class KitKnight extends Kit +public class KitKnight extends ChampionsKit { private HashMap _class = new HashMap(); - + + private static final String[] DESCRIPTION = { + "Knight of the realm, extremely good at", + "defending and surviving.", + }; + + private static final Perk[] PERKS = {}; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitKnight(ArcadeManager manager) { - super(manager, "Knight", KitAvailability.Free, - new String[] - { - "Knight of the realm, extremely good at", - "defending and surviving.", - }, - new Perk[] - { - - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); + super(manager, "Knight", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void Deselected(Player player) { _class.remove(player); } - + @Override public void Selected(Player player) { Manager.Clear(player); - + AddPlayer(player); - + Manager.openClassShop(player); } - + public void AddPlayer(Player player) { _class.put(player, Manager.getClassManager().Get(player)); ClientClass clientClass = _class.get(player); IPvpClass pvpClass = Manager.getClassManager().GetClass("Knight"); - + clientClass.SetGameClass(pvpClass); - pvpClass.ApplyArmor(player); + pvpClass.ApplyArmor(player); clientClass.ClearDefaults(); clientClass.EquipCustomBuild(clientClass.GetCustomBuilds(pvpClass).get(0)); - + if (!Manager.GetGame().InProgress()) + { clientClass.SetActiveCustomBuild(pvpClass, pvpClass.getDefaultBuild()); + } } - + @Override public void GiveItems(Player player) { _class.get(player).ResetToDefaults(true, true); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { ent.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET)); ent.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); ent.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); ent.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS)); } - + @Override - public void DisplayDesc(Player player) + public void DisplayDesc(Player player) { } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitMage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitMage.java index 48e5b1296..192fbab1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitMage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitMage.java @@ -1,39 +1,35 @@ package nautilus.game.arcade.game.games.champions.kits; -import java.util.HashMap; - +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.ChampionsKit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.minecraft.game.classcombat.Class.ClientClass; -import mineplex.minecraft.game.classcombat.Class.IPvpClass; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; +import java.util.HashMap; -public class KitMage extends Kit +public class KitMage extends ChampionsKit { private HashMap _class = new HashMap(); - + + private static final String[] DESCRIPTION = { + "Trained in the ways of magic, the mage", + "can unleash hell upon his opponents.", + }; + + private static final Perk[] PERKS = {}; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitMage(ArcadeManager manager) { - super(manager, "Mage", KitAvailability.Free, - new String[] - { - "Trained in the ways of magic, the mage", - "can unleash hell upon his opponents.", - }, - new Perk[] - { - - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - + super(manager, "Mage", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitRanger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitRanger.java index fd3789a38..9aad799af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitRanger.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitRanger.java @@ -1,52 +1,48 @@ package nautilus.game.arcade.game.games.champions.kits; -import java.util.HashMap; - +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.ChampionsKit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.minecraft.game.classcombat.Class.ClientClass; -import mineplex.minecraft.game.classcombat.Class.IPvpClass; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; +import java.util.HashMap; -public class KitRanger extends Kit +public class KitRanger extends ChampionsKit { private HashMap _class = new HashMap(); - + + private static final String[] DESCRIPTION = { + "Uses mastery of archery and kinship with", + "nature to defeat opponents." + }; + + private static final Perk[] PERKS = {}; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitRanger(ArcadeManager manager) { - super(manager, "Ranger", KitAvailability.Free, - new String[] - { - "Uses mastery of archery and kinship with", - "nature to defeat opponents." - }, - new Perk[] - { - - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - + super(manager, "Ranger", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void Deselected(Player player) { _class.remove(player); } - + @Override public void Selected(Player player) { Manager.Clear(player); - + _class.put(player, Manager.getClassManager().Get(player)); ClientClass clientClass = _class.get(player); IPvpClass pvpClass = Manager.getClassManager().GetClass("Ranger"); @@ -55,30 +51,32 @@ public class KitRanger extends Kit pvpClass.ApplyArmor(player); clientClass.ClearDefaults(); clientClass.EquipCustomBuild(clientClass.GetCustomBuilds(pvpClass).get(0)); - + if (!Manager.GetGame().InProgress()) + { clientClass.SetActiveCustomBuild(pvpClass, pvpClass.getDefaultBuild()); - + } + Manager.openClassShop(player); } - + @Override public void GiveItems(Player player) { _class.get(player).ResetToDefaults(true, true); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); } - + @Override - public void DisplayDesc(Player player) + public void DisplayDesc(Player player) { } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/AbstractKitChaser.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/AbstractKitChaser.java index 5f0374aee..7815e48b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/AbstractKitChaser.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/AbstractKitChaser.java @@ -1,22 +1,17 @@ package nautilus.game.arcade.game.games.deathtag.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public abstract class AbstractKitChaser extends Kit +public abstract class AbstractKitChaser extends ProgressingKit { public AbstractKitChaser(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, entityType, itemInHand); } - public AbstractKitChaser(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) - { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/AbstractKitRunner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/AbstractKitRunner.java index e2664905a..16270db86 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/AbstractKitRunner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/AbstractKitRunner.java @@ -1,22 +1,21 @@ package nautilus.game.arcade.game.games.deathtag.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public abstract class AbstractKitRunner extends Kit +public abstract class AbstractKitRunner extends ProgressingKit { public AbstractKitRunner(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, entityType, itemInHand); } public AbstractKitRunner(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitAlphaChaser.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitAlphaChaser.java index 3a181d75a..876dd30f8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitAlphaChaser.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitAlphaChaser.java @@ -1,47 +1,53 @@ package nautilus.game.arcade.game.games.deathtag.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton.SkeletonType; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkDamageSet; import nautilus.game.arcade.kit.perks.PerkIronSkin; import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.inventory.ItemStack; public class KitAlphaChaser extends AbstractKitChaser { + + private static final String[] DESCRIPTION = { + "Tag! You're it...", + " ", + "Deal " + C.cGreen + 6 + C.cWhite + " damage per attack", + "Take " + C.cGreen + "50%" + C.cWhite + " knockback", + "Take " + C.cGreen + "-4" + C.cWhite + " damage from all attacks" + }; + + private static final Perk[] PERKS = { + new PerkDamageSet(6), + new PerkKnockbackMultiplier(0.5), + new PerkIronSkin(4) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE) + }; + public KitAlphaChaser(ArcadeManager manager) { - super(manager, "Alpha Chaser", KitAvailability.Free, - - new String[] - { - }, - - new Perk[] - { - new PerkDamageSet(6), - new PerkKnockbackMultiplier(0.5), - new PerkIronSkin(4) - }, - EntityType.SKELETON, - new ItemStack(Material.IRON_AXE)); + super(manager, "Alpha Chaser", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - + player.getInventory().addItem(PLAYER_ITEMS); + //Disguise DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.setName(C.cRed + player.getName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitChaser.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitChaser.java index ed0d627ce..192d46d8c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitChaser.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitChaser.java @@ -1,44 +1,46 @@ package nautilus.game.arcade.game.games.deathtag.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkDamageSet; import nautilus.game.arcade.kit.perks.PerkIronSkin; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitChaser extends AbstractKitChaser { + + private static final String[] DESCRIPTION = { + "Tag! You're it..." + }; + + private static final Perk[] PERKS = { + new PerkDamageSet(4), + new PerkIronSkin(2) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE) + }; + public KitChaser(ArcadeManager manager) { - super(manager, "Chaser", KitAvailability.Hide, - - new String[] - { - }, - - new Perk[] - { - new PerkDamageSet(4), - new PerkIronSkin(2) - }, - EntityType.SKELETON, - new ItemStack(Material.IRON_AXE)); + super(manager, "Chaser", KitAvailability.Hide, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - + player.getInventory().addItem(PLAYER_ITEMS); + //Disguise DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.setName(C.cRed + player.getName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerArcher.java index 0d8676bba..eea72cb82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerArcher.java @@ -1,40 +1,47 @@ package nautilus.game.arcade.game.games.deathtag.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; - public class KitRunnerArcher extends AbstractKitRunner { + + private static final String[] DESCRIPTION = { + "Fight off the Chasers with Arrows!", + " ", + receiveArrowString(1, 2, 2), + "Deal " + C.cGreen + "300%" + C.cWhite + " knockback with arrows" + }; + + private static final Perk[] PERKS = { + new PerkKnockbackArrow(3), + new PerkFletcher(2, 2, true), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + public KitRunnerArcher(ArcadeManager manager) { - super(manager, "Runner Archer", KitAvailability.Gem, - new String[] - { - "Fight off the Chasers with Arrows!" - }, - new Perk[] - { - new PerkKnockbackArrow(3), - new PerkFletcher(2, 2, true), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); + super(manager, "Runner Archer", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerBasher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerBasher.java index 66add55bc..f843d1bc7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerBasher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerBasher.java @@ -1,38 +1,44 @@ package nautilus.game.arcade.game.games.deathtag.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkCripple; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkCripple; - public class KitRunnerBasher extends AbstractKitRunner { + + private static final String[] DESCRIPTION = { + "Your attacks cripple Chasers briefly!", + " ", + "Deal " + C.cGreen + "Slowness III" + C.cWhite + " to opponents per attack." + }; + + private static final Perk[] PERKS = { + new PerkCripple(3, 2), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD) + }; + public KitRunnerBasher(ArcadeManager manager) { - super(manager, "Runner Basher", KitAvailability.Free, - new String[] - { - "Your attacks cripple Chasers breifly!" - }, - new Perk[] - { - new PerkCripple(3, 2), - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); + super(manager, "Runner Basher", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerTraitor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerTraitor.java index 5aa51a97e..6ad0b03ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerTraitor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerTraitor.java @@ -1,38 +1,44 @@ package nautilus.game.arcade.game.games.deathtag.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkKnockback; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkKnockback; - public class KitRunnerTraitor extends AbstractKitRunner { + + private static final String[] DESCRIPTION = { + "You can deal knockback to other runners!", + " ", + "Deal " + C.cGreen + "+80%" + C.cWhite + " knockback per hit" + }; + + private static final Perk[] PERKS = { + new PerkKnockback(0.8), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE) + }; + public KitRunnerTraitor(ArcadeManager manager) { - super(manager, "Runner Traitor", KitAvailability.Gem, 5000, - new String[] - { - "You can deal knockback to other runners!" - }, - new Perk[] - { - new PerkKnockback(0.8), - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_AXE)); + super(manager, "Runner Traitor", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDigger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDigger.java index eed4d1731..e591b06b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDigger.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDigger.java @@ -1,52 +1,56 @@ package nautilus.game.arcade.game.games.dragonescape.kits; +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.achievement.Achievement; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitDigger extends Kit +public class KitDigger extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Dig yourself a shortcut, and use the", + "blocks to create another shortcut!", + "", + "Does not have any Leaps.", + "Starts with a " + C.cGreen + "Diamond Pickaxe" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_PICKAXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_PICKAXE, 6) + }; + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.DRAGON_ESCAPE_PARALYMPICS, + Achievement.DRAGON_ESCAPE_PIRATE_BAY, + Achievement.DRAGON_ESCAPE_SKYLANDS, + Achievement.DRAGON_ESCAPE_THROUGH_HELL, + Achievement.DRAGON_ESCAPE_WINS, + }; + public KitDigger(ArcadeManager manager) { - super(manager, "Digger", KitAvailability.Achievement, 5000, + super(manager, "Digger", "dragonescapedigger", KitAvailability.Achievement, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); - new String[] - { - "Dig yourself a shortcut, and use the", - "blocks to create another shortcut!", - "", - "Does not have any Leaps.", - }, - - new Perk[] - { - //new PerkLeap("Leap", 1, 1, 8000, 1) - }, - EntityType.ZOMBIE, - new ItemStack(Material.DIAMOND_PICKAXE)); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.DRAGON_ESCAPE_PARALYMPICS, - Achievement.DRAGON_ESCAPE_PIRATE_BAY, - Achievement.DRAGON_ESCAPE_SKYLANDS, - Achievement.DRAGON_ESCAPE_THROUGH_HELL, - Achievement.DRAGON_ESCAPE_WINS, - }); + this.setAchievementRequirements(ACHIEVEMENTS); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_PICKAXE, 6)); + player.getInventory().addItem(PLAYER_ITEMS); player.setExp(0.99f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDisruptor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDisruptor.java index 2e1ea6fec..0914120da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDisruptor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDisruptor.java @@ -1,44 +1,51 @@ package nautilus.game.arcade.game.games.dragonescape.kits; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDisruptor; +import nautilus.game.arcade.kit.perks.PerkLeap; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.F; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitDisruptor extends Kit +public class KitDisruptor extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Place mini-explosives to stop other players!", + "", + receiveItem("Disruptor", 1, 8, 2), + C.cYellow + "Click" + C.cWhite + " with TNT to " + C.cGreen + "Place Disruptor" + + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1, 1, 8000, 3), + new PerkDisruptor(8, 2) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.TNT); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.TNT, (byte) 0, 1, F.item("Disruptor")) + }; + public KitDisruptor(ArcadeManager manager) { - super(manager, "Disruptor", KitAvailability.Gem, - - new String[] - { - "Place mini-explosives to stop other players!" - }, - - new Perk[] - { - new PerkLeap("Leap", 1, 1, 8000, 3), - new PerkDisruptor(8, 2) - }, - EntityType.ZOMBIE, - new ItemStack(Material.TNT)); - + super(manager, "Disruptor", "dragonescapedisruptor", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Disruptor"))); + player.getInventory().addItem(PLAYER_ITEMS); player.setExp(0.99f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitLeaper.java index 8d0bdc8d5..4690bfe86 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitLeaper.java @@ -1,41 +1,44 @@ package nautilus.game.arcade.game.games.dragonescape.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkLeap; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitLeaper extends Kit +public class KitLeaper extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "You get twice as many leaps!", + "", + leap() + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1, 1, 8000, 4) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + }; + public KitLeaper(ArcadeManager manager) { - super(manager, "Jumper", KitAvailability.Free, - - new String[] - { - "You get twice as many leaps!" - }, - - new Perk[] - { - new PerkLeap("Leap", 1, 1, 8000, 4) - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_AXE)); - + super(manager, "Jumper", "dragonescapejumper", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(PLAYER_ITEMS); player.setExp(0.99f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitWarper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitWarper.java index f3a49065b..14e511a52 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitWarper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitWarper.java @@ -1,43 +1,46 @@ package nautilus.game.arcade.game.games.dragonescape.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkLeap; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitWarper extends Kit +public class KitWarper extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Use your Enderpearl to instantly warp", + "to the player in front of you!", + "", + leap() + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1, 1, 8000, 2) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.ENDER_PEARL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.ENDER_PEARL), + }; + public KitWarper(ArcadeManager manager) { - super(manager, "Warper", KitAvailability.Gem, 5000, - - new String[] - { - "Use your Enderpearl to instantly warp", - "to the player in front of you!" - }, - - new Perk[] - { - new PerkLeap("Leap", 1, 1, 8000, 2) - }, - EntityType.ZOMBIE, - new ItemStack(Material.ENDER_PEARL)); - + super(manager, "Warper", "dragonescapewarper", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ENDER_PEARL)); + player.getInventory().addItem(PLAYER_ITEMS); player.setExp(0.99f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/kits/KitRider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/kits/KitRider.java index 10f07e986..aa9841a3e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/kits/KitRider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/kits/KitRider.java @@ -1,49 +1,53 @@ package nautilus.game.arcade.game.games.dragonriders.kits; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.ExplosionPrimeEvent; -import org.bukkit.inventory.ItemStack; - import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkDragonRider; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitRider extends Kit +public class KitRider extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Whoosh" + }; + + private static final Perk[] PERKS = { + new PerkDragonRider() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW), + ItemStackFactory.Instance.CreateStack(Material.ARROW, 64) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitRider(ArcadeManager manager) { - super(manager, "Dragon Rider", KitAvailability.Free, - new String[] - { - "woosh" - }, - new Perk[] - { - new PerkDragonRider() - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); + super(manager, "Dragon Rider", "dragonridersrider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 64)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitCoward.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitCoward.java index 47d5f64b9..20e123308 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitCoward.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitCoward.java @@ -1,49 +1,55 @@ package nautilus.game.arcade.game.games.dragons.kits; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkLeap; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitCoward extends Kit +public class KitCoward extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "There's no shame in being afraid of dragons...", + "", + leap() + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1.2, 1.0, 8000), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + public KitCoward(ArcadeManager manager) { - super(manager, "Coward", KitAvailability.Free, - - new String[] - { - "There's no shame in being afraid of dragons..." - }, - - new Perk[] - { - new PerkLeap("Leap", 1.2, 1.0, 8000), - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_AXE)); - + super(manager, "Coward", "dragonscoward", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitMarksman.java index f11c90452..6e57a6cdf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitMarksman.java @@ -1,49 +1,59 @@ package nautilus.game.arcade.game.games.dragons.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkFletcher; - -public class KitMarksman extends Kit +public class KitMarksman extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Arrows send dragons running to the sky!", + "", + receiveArrowString(1, 4, 4), + "Charge Bow to use " + C.cGreen + "Barrage" + }; + + private static final Perk[] PERKS = { + new PerkFletcher(4, 4, true), + new PerkBarrage(6, 200, true, false), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW), + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitMarksman(ArcadeManager manager) { - super(manager, "Marksman", KitAvailability.Gem, - new String[] - { - "Arrows send dragons running to the sky!" - }, - new Perk[] - { - new PerkFletcher(4, 4, true), - new PerkBarrage(6, 200, true, false), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - + super(manager, "Marksman", "dragonsmarksman", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitPyrotechnic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitPyrotechnic.java index 4d6e88c6c..8a2eef84c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitPyrotechnic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitPyrotechnic.java @@ -1,45 +1,51 @@ package nautilus.game.arcade.game.games.dragons.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkSparkler; import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitPyrotechnic extends Kit +public class KitPyrotechnic extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Dragons love sparklers!!", + "", + receiveItem("Sparkler", 1, 25, 2), + C.cYellow + "Click" + C.cWhite + " with Sparkler to " + C.cGreen + "Throw Sparkler" + }; + + private static final Perk[] PERKS = { + new PerkSparkler(25, 2), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.EMERALD); + + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET), + }; + public KitPyrotechnic(ArcadeManager manager) { - super(manager, "Pyrotechnic", KitAvailability.Gem, 5000, - - new String[] - { - "Dragons love sparklers!!" - }, - - new Perk[] - { - new PerkSparkler(25, 2), - }, - EntityType.ZOMBIE, - new ItemStack(Material.EMERALD)); - + super(manager, "Pyrotechnic", "dragonspyrotechnic", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS)); + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitArtist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitArtist.java index 8777f16ea..d0106ec8e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitArtist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitArtist.java @@ -1,33 +1,30 @@ package nautilus.game.arcade.game.games.draw.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -/** - * Created by William (WilliamTiger). - * 23/12/15 - */ -public class KitArtist extends Kit +public class KitArtist extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "The world is but a canvas to your imagination." + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitArtist(ArcadeManager manager) { - super(manager, "Artist", KitAvailability.Free, - new String[] - { - "The world is but a canvas to your imagination." - }, - new Perk[] - { - - }, - EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); + super(manager, "Artist", "drawartist", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSelector.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSelector.java index 803108f77..15664c161 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSelector.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSelector.java @@ -1,31 +1,29 @@ package nautilus.game.arcade.game.games.draw.kits; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitSelector extends Kit +public class KitSelector extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Choose from one of three words to draw!" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.EMERALD); + public KitSelector(ArcadeManager manager) { - super(manager, "Selector", KitAvailability.Gem, 4000, - - new String[] - { - "Choose from one of three words to draw!" - }, - - new Perk[] - { - - }, - EntityType.SKELETON, - null); - + super(manager, "Selector", "drawselector", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSlowAndSteady.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSlowAndSteady.java index f60acb333..6677f3805 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSlowAndSteady.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSlowAndSteady.java @@ -1,33 +1,29 @@ package nautilus.game.arcade.game.games.draw.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitSlowAndSteady extends Kit +public class KitSlowAndSteady extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Receive +10 Seconds to draw!" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.WATCH); + public KitSlowAndSteady(ArcadeManager manager) { - super(manager, "Extra Time", KitAvailability.Free, - - new String[] - { - "Receive +10 Seconds to draw!" - }, - - new Perk[] - { - - }, - EntityType.SKELETON, - new ItemStack(Material.WATCH)); - + super(manager, "Extra Time", "drawextratime", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java index 5cff1a8e8..505d073e0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java @@ -1,36 +1,38 @@ package nautilus.game.arcade.game.games.evolution.kits; -import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.kits.perks.PerkCooldownEVO; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitAbility extends Kit +public class KitAbility extends ProgressingKit { - /** - * @author Mysticate - */ - + private static final String[] DESCRIPTION = { + "Your DNA allows you to chop cooldown times!", + "", + "All ability cooldowns are reduced by " + C.cGreen + "33%" + C.cWhite + "." + }; + + private static final Perk[] PERKS = { + new PerkCooldownEVO() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.FEATHER); + public KitAbility(ArcadeManager manager) { - super(manager, "Darwinist", KitAvailability.Free, new String[] - { - "Your DNA allows you to chop cooldown times!" - }, new Perk[] - { - new PerkCooldownEVO() - }, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.FEATHER)); + super(manager, "Darwinist", "evolutiondarwinist", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java index 7eb6d97ba..706a589b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java @@ -1,32 +1,34 @@ package nautilus.game.arcade.game.games.evolution.kits; import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.kits.perks.PerkEvolveSpeedEVO; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitEvolveSpeed extends Kit +public class KitEvolveSpeed extends ProgressingKit { - /** - * @author Mysticate - */ - + + private static final String[] DESCRIPTION = { + "You always had dreams of growing up...", + "", + "You evolve " + C.cGreen + "25%" + C.cWhite + " faster." + }; + + private static final Perk[] PERKS = { + new PerkEvolveSpeedEVO() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.LEATHER_BOOTS); + public KitEvolveSpeed(ArcadeManager manager) { - super(manager, "Quick Evolver", KitAvailability.Gem, 4000, new String[] - { - C.cGray + "You always had dreams of growing up..." - }, new Perk[] - { - new PerkEvolveSpeedEVO() - }, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + super(manager, "Quick Evolver", "evolutionquickevolver", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java index 71ae6fc03..22da45f3d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java @@ -1,79 +1,82 @@ package nautilus.game.arcade.game.games.evolution.kits; import mineplex.core.achievement.Achievement; -import mineplex.core.common.util.F; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.itemstack.ItemStackFactory; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkDummy; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.inventory.ItemStack; -public class KitHealth extends Kit +public class KitHealth extends ProgressingKit { - /** - * @author Mysticate - */ - + + private static final String[] DESCRIPTION = { + "Harvest health every day...", + "", + "Receive " + C.cGreen + "100%" + C.cWhite + " health on kill" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_POWDER); + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.EVOLUTION_EVOLVEKILL, + Achievement.EVOLUTION_MELEE, + Achievement.EVOLUTION_NO_DEATHS, + Achievement.EVOLUTION_RAMPAGE, + Achievement.EVOLUTION_SKILLS, + Achievement.EVOLUTION_STEALTH, + Achievement.EVOLUTION_WINS + }; + public KitHealth(ArcadeManager manager) { - super(manager, "Health Harvester", KitAvailability.Achievement, new String[] - { - "Harvest health every day..." - }, new Perk[] - { - new PerkDummy("Health Haravester", new String[] - { - "Recieve " + F.elem("100%") + " health on kill." - }) - }, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); - - setAchievementRequirements(new Achievement[] - { - Achievement.EVOLUTION_EVOLVEKILL, - Achievement.EVOLUTION_MELEE, - Achievement.EVOLUTION_NO_DEATHS, - Achievement.EVOLUTION_RAMPAGE, - Achievement.EVOLUTION_SKILLS, - Achievement.EVOLUTION_STEALTH, - Achievement.EVOLUTION_WINS - } - ); + super(manager, "Health Harvester", "evolutionhealthharvester", + KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + + setAchievementRequirements(ACHIEVEMENTS); } @Override public void GiveItems(Player player) { - + } - + @EventHandler(priority = EventPriority.HIGH) public void onKill(CombatDeathEvent event) { if (!Manager.GetGame().IsLive()) + { return; - + } Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); if (killer == null || !killer.isOnline()) + { return; - + } if (!Manager.IsAlive(killer)) + { return; - + } if (UtilPlayer.isSpectator(killer)) + { return; - + } if (!HasKit(killer)) + { return; - + } UtilPlayer.health(killer, 9999); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/kits/KitGladiator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/kits/KitGladiator.java index 1a0df8140..2d06066a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/kits/KitGladiator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/kits/KitGladiator.java @@ -1,38 +1,39 @@ package nautilus.game.arcade.game.games.gladiators.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkLeap; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -/** - * Created by William (WilliamTiger). - * 07/12/15 - */ -public class KitGladiator extends Kit +public class KitGladiator extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "At my signal, unleash hell.", + "", + leap() + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1.2, 1.0, 8000), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitGladiator(ArcadeManager manager) { - super(manager, "Gladiator", KitAvailability.Free, - new String[] - { - "At my signal, unleash hell." - }, - new Perk[] - { - - }, - EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); + super(manager, "Gladiator", "gladiatorsgladiator", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - //todo: items based on loadout + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/kits/KitJetpack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/kits/KitJetpack.java index d0c07fbed..f1797298f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/kits/KitJetpack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/kits/KitJetpack.java @@ -1,51 +1,52 @@ package nautilus.game.arcade.game.games.gravity.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitJetpack extends Kit +public class KitJetpack extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "SPAAAAAAAAAAAAAACE" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, "Space Suit") + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.GLASS), + }; + public KitJetpack(ArcadeManager manager) { - super(manager, "Astronaut", KitAvailability.Free, - - new String[] - { - "SPAAAAAAAAAAAAAACE" - }, - - new Perk[] - { - - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_AXE)); - + super(manager, "Astronaut", "gravityastronaut", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SHEARS, (byte)0, 1, "Block Cannon")); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Space Suit")); - - //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Space Shooter")); - //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 64, "Space Arrows")); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.GLASS)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS)); + //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Space Shooter")); + //player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 64, "Space Arrows")); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitFinn.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitFinn.java index ad817be05..1f6b97e8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitFinn.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitFinn.java @@ -7,13 +7,12 @@ 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.kit.AbbreviatedKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkBlizzardFinn; import nautilus.game.arcade.kit.perks.PerkFlameSlam; import nautilus.game.arcade.kit.perks.PerkFletcher; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -21,49 +20,51 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -public class KitFinn extends AbbreviatedKit +public class KitFinn extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Jake is hiding in his pocket.", + "", + "Nearby allies receive " + C.cGreen + "Speed 1" + }; + + private static final Perk[] PERKS = { + new PerkFlameSlam(), + new PerkBlizzardFinn(), + new PerkFletcher(2, 2, true), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.GOLD_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.GOLD_AXE, (byte) 0, 1, F.item("Flaming Axe")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, F.item("Icy Sword")), + ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, F.item("Bow")), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN), + }; + public KitFinn(ArcadeManager manager) { - super(manager, "Finn the Human", KitAvailability.Free, - - new String[] - { - "Jake is hiding in his pocket.", - "", - "Nearby allies receive " + C.cGreen + "Speed 1" - }, - - new Perk[] - { - - new PerkFlameSlam(), - new PerkBlizzardFinn(), - new PerkFletcher(2, 2, true), - }, - - EntityType.ZOMBIE, new ItemStack(Material.GOLD_SWORD)); - + super(manager, "Finn the Human", "halloweenfinn", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_AXE, (byte)0, 1, F.item("Flaming Axe"))); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, F.item("Icy Sword"))); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, F.item("Bow"))); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java index db2a8e825..cd31b70d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitRobinHood.java @@ -8,13 +8,12 @@ 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.kit.AbbreviatedKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkBarrage; import nautilus.game.arcade.kit.perks.PerkFletcher; import nautilus.game.arcade.kit.perks.PerkQuickshotRobinHood; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -22,47 +21,50 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -public class KitRobinHood extends AbbreviatedKit +public class KitRobinHood extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Trick or treating from the rich...", + "", + "Nearby allies receive " + C.cGreen + "Regeneration 1" + }; + + private static final Perk[] PERKS = { + new PerkFletcher(1, 8, true), + new PerkBarrage(8, 125, true, true), + new PerkQuickshotRobinHood() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, F.item("Sword")), + ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, F.item("Bow")), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN), + }; + public KitRobinHood(ArcadeManager manager) { - super(manager, "Robin Hood", KitAvailability.Free, - - new String[] - { - "Trick or treating from the rich...", - "", - "Nearby allies receive " + C.cGreen + "Regeneration 1" - }, - - new Perk[] - { - new PerkFletcher(1, 8, true), - new PerkBarrage(8, 125, true, true), - new PerkQuickshotRobinHood() - }, - - EntityType.ZOMBIE, new ItemStack(Material.BOW)); - + super(manager, "Robin Hood", "halloweenrobinhood", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, F.item("Sword"))); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, F.item("Bow"))); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java index cf589fb4e..58bba7619 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/kits/KitThor.java @@ -7,14 +7,13 @@ 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.kit.AbbreviatedKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkFletcher; import nautilus.game.arcade.kit.perks.PerkHammerThrow; import nautilus.game.arcade.kit.perks.PerkKnockbackAttack; import nautilus.game.arcade.kit.perks.PerkSeismicHammer; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -22,48 +21,53 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -public class KitThor extends AbbreviatedKit +public class KitThor extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Smash and kill with your Thor Hammer!", + "", + "Nearby allies receive " + C.cGreen + "Strength 1" + }; + + private static final Perk[] PERKS = { + new PerkKnockbackAttack(2), + new PerkFletcher(2, 2, true, 9), + new PerkSeismicHammer(), + new PerkHammerThrow(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, F.item("Seismic Hammer")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte) 0, 1, F.item("Thor Hammer")), + ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, F.item("Bow")), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN), + }; + public KitThor(ArcadeManager manager) { - super(manager, "Thor", KitAvailability.Free, - - new String[] - { - "Smash and kill with your Thor Hammer!", - "", - "Nearby allies receive " + C.cGreen + "Strength 1" - }, - - new Perk[] - { - new PerkKnockbackAttack(2), - new PerkFletcher(2, 2, true, 9), - new PerkSeismicHammer(), - new PerkHammerThrow(), - }, - - EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); + super(manager, "Thor", "halloweenthor", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, F.item("Seismic Hammer"))); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, F.item("Thor Hammer"))); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, F.item("Bow"))); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override 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 04778d2fb..e283ad0fa 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 @@ -290,8 +290,8 @@ public class HideSeek extends TeamGame this(manager, new Kit[] { - new KitHiderSwapper(manager), new KitHiderQuick(manager), new KitHiderShocker(manager), - new KitHiderTeleporter(manager), new NullKit(manager), new KitSeekerLeaper(manager), + new KitHiderQuick(manager), new KitHiderSwapper(manager), new KitHiderInfestor(manager), + new KitHiderShocker(manager), new NullKit(manager), new KitSeekerLeaper(manager), new KitSeekerTNT(manager), new KitSeekerRadar(manager), }); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHider.java index 3d4d902de..ba07f5c6c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHider.java @@ -1,22 +1,36 @@ package nautilus.game.arcade.game.games.hideseek.kits; -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public abstract class KitHider extends Kit +public abstract class KitHider extends ProgressingKit { + + protected static final ItemStack PLAYER_ITEM = + ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte) 0, 1, C.cYellow + C.Bold + "Click Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form"); + + public KitHider(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, "hideseek" + name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, entityType, itemInHand); } public KitHider(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, "hideseek" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(3, PLAYER_ITEM); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderInfestor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderInfestor.java new file mode 100644 index 000000000..cbf2633d1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderInfestor.java @@ -0,0 +1,67 @@ +package nautilus.game.arcade.game.games.hideseek.kits; + +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; +import org.bukkit.inventory.ItemStack; + +public class KitHiderInfestor extends KitHider +{ + + private static final String[] DESCRIPTION = { + "Can instantly infest a target block.", + "This is the only way you can hide." + }; + + private static final Perk[] PERKS = { + + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.MONSTER_EGGS, 1, (short) 4); + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.BLOCK_HUNT_BAD_HIDER, + Achievement.BLOCK_HUNT_HUNTER_KILLER, + Achievement.BLOCK_HUNT_HUNTER_OF_THE_YEAR, + Achievement.BLOCK_HUNT_MEOW, + Achievement.BLOCK_HUNT_WINS, + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.MAGMA_CREAM, (byte)0, 1, C.cYellow + C.Bold + "Click Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Infest Block/Animal") + }; + + public KitHiderInfestor(ArcadeManager manager) + { + super(manager, "Infestor Hider", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); + + this.setAchievementRequirements(ACHIEVEMENTS); + } + + @Override + public void GiveItems(Player player) + { + //Swap + player.getInventory().setItem(3, PLAYER_ITEMS[0]); + + DisguiseSlime slime = new DisguiseSlime(player); + slime.SetSize(2); + slime.setName(C.cAqua + player.getName()); + Manager.GetDisguise().disguise(slime); + } + + @Override + public void SpawnCustom(LivingEntity ent) + { + ((Slime)ent).setSize(2); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java index 8ba36c192..6ad3185c5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java @@ -1,50 +1,30 @@ package nautilus.game.arcade.game.games.hideseek.kits; -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.disguises.DisguiseBlock; -import mineplex.core.disguise.disguises.DisguiseSlime; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - public class KitHiderQuick extends KitHider { + + private static final String[] DESCRIPTION = { + "Changes into solid blocks almost instantly!" + }; + + private static final Perk[] PERKS = { + + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.FEATHER); + public KitHiderQuick(ArcadeManager manager) { - super(manager, "Instant Hider", KitAvailability.Gem, - - new String[] - { - "Changes into solid blocks almost instantly!" - }, - - new Perk[] - { - - }, - EntityType.SLIME, - new ItemStack(Material.FEATHER)); - } - - @Override - public void GiveItems(Player player) - { - //Swap - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte)0, 1, C.cYellow + C.Bold + "Click Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form")); + super(manager, "Instant Hider", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java index 2a99fc93d..1d820bc7e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java @@ -1,50 +1,31 @@ package nautilus.game.arcade.game.games.hideseek.kits; -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkShockingStrike; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.disguises.DisguiseBlock; -import mineplex.core.disguise.disguises.DisguiseSlime; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - public class KitHiderShocker extends KitHider { + + private static final String[] DESCRIPTION = { + "Shock and stun seekers!" + }; + + private static final Perk[] PERKS = { + new PerkShockingStrike() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.REDSTONE_LAMP_OFF); + public KitHiderShocker(ArcadeManager manager) { - super(manager, "Shocking Hider", KitAvailability.Gem, 5000, - - new String[] - { - "Shock and stun seekers!" - }, - - new Perk[] - { - new PerkShockingStrike() - }, - EntityType.SLIME, - new ItemStack(Material.REDSTONE_LAMP_OFF)); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte)0, 1, C.cYellow + C.Bold + "Click Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form")); + super(manager, "Shocking Hider", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java index e74217d13..d720ada47 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java @@ -1,49 +1,29 @@ package nautilus.game.arcade.game.games.hideseek.kits; -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.disguises.DisguiseBlock; -import mineplex.core.disguise.disguises.DisguiseSlime; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - public class KitHiderSwapper extends KitHider { + + private static final String[] DESCRIPTION = { + "Can change form unlimited times!" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SLIME_BALL); + public KitHiderSwapper(ArcadeManager manager) { - super(manager, "Swapper Hider", KitAvailability.Free, - - new String[] - { - "Can change form unlimited times!" - }, - - new Perk[] - { - - }, - EntityType.SLIME, - new ItemStack(Material.BEACON)); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte)0, 1, C.cYellow + C.Bold + "Click Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form")); + super(manager, "Swapper Hider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeeker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeeker.java index 6d62e17b3..dbeb5dbbb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeeker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeeker.java @@ -1,22 +1,21 @@ package nautilus.game.arcade.game.games.hideseek.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public abstract class KitSeeker extends Kit +public abstract class KitSeeker extends ProgressingKit { public KitSeeker(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, "hideseek" + name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, entityType, itemInHand); } public KitSeeker(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, "hideseek" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerLeaper.java index 5a2277a5b..3416d6335 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerLeaper.java @@ -1,5 +1,12 @@ package nautilus.game.arcade.game.games.hideseek.kits; - + +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkLeap; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EntityType; @@ -10,48 +17,49 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkLeap; - public class KitSeekerLeaper extends KitSeeker { + + private static final String[] DESCRIPTION = { + "Leap after those pretty blocks!", + "", + leap() + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1.1, 1, 8000), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.COMPASS); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + public KitSeekerLeaper(ArcadeManager manager) { - super(manager, "Leaper Hunter", KitAvailability.Free, - new String[] - { - "Leap after those pretty blocks!", - }, - new Perk[] - { - new PerkLeap("Leap", 1.1, 1, 8000), - }, - EntityType.ZOMBIE, - new ItemStack(Material.COMPASS)); - + super(manager, "Leaper Hunter", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { //Sword - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - - //Bow - ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW); - bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); - player.getInventory().setItem(1, bow); - player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS[0]); + + player.getInventory().setItem(1, PLAYER_ITEMS[1]); + player.getInventory().setItem(28, PLAYER_ITEMS[2]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerRadar.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerRadar.java index 3904a0b5c..f9ae38a32 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerRadar.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerRadar.java @@ -1,5 +1,13 @@ package nautilus.game.arcade.game.games.hideseek.kits; - + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkRadar; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EntityType; @@ -10,53 +18,54 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkRadar; - public class KitSeekerRadar extends KitSeeker { + + private static final String[] DESCRIPTION = { + "tick......tick...tick.tick.", + "", + C.cYellow + "Hold Compass" + C.cWhite + " to use " + C.cGreen + "Radar Scanner", + "Ticks get faster when you are near a Hider!" + }; + + private static final Perk[] PERKS = { + new PerkRadar(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.COMPASS); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD), + new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW), + ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, "Radar Scanner") + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitSeekerRadar(ArcadeManager manager) { - super(manager, "Radar Hunter", KitAvailability.Gem, 5000, - new String[] - { - "tick......tick...tick.tick.", - }, - new Perk[] - { - new PerkRadar(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.COMPASS)); - + super(manager, "Radar Hunter", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { //Sword - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); - - //Bow - ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW); - bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); - player.getInventory().setItem(1, bow); - player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW)); - - //Radar - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte)0, 1, "Radar Scanner")); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS[0]); + + player.getInventory().setItem(1, PLAYER_ITEMS[1]); + player.getInventory().setItem(28, PLAYER_ITEMS[2]); + player.getInventory().addItem(PLAYER_ITEMS[3]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerTNT.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerTNT.java index 17a2bd5d8..21218885f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerTNT.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerTNT.java @@ -1,5 +1,13 @@ package nautilus.game.arcade.game.games.hideseek.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBomber; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EntityType; @@ -10,51 +18,51 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - public class KitSeekerTNT extends KitSeeker { + + private static final String[] DESCRIPTION = { + "Throw TNT to flush out the Hiders!", + "", + receiveItem("TNT", 1, 15, 2), + C.cYellow + "Click" + C.cWhite + " with TNT to " + C.cGreen + "Throw TNT" + }; + + private static final Perk[] PERKS = { + new PerkBomber(15, 2, -1) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.TNT); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW), + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET), + }; + public KitSeekerTNT(ArcadeManager manager) { - super(manager, "TNT Hunter", KitAvailability.Gem, - - new String[] - { - "Throw TNT to flush out the Hiders!" - }, - - new Perk[] - { - new PerkBomber(15, 2, -1) - }, - EntityType.ZOMBIE, - new ItemStack(Material.TNT)); + super(manager, "TNT Hunter", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - //Sword - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - - //Bow - ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW); - bow.addEnchantment(Enchantment.ARROW_INFINITE, 1); - player.getInventory().setItem(1, bow); - player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS[0]); + + player.getInventory().setItem(1, PLAYER_ITEMS[1]); + player.getInventory().setItem(28, PLAYER_ITEMS[2]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { 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 index 7911a1200..29c77670c 100644 --- 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 @@ -19,11 +19,7 @@ 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; -import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick; -import nautilus.game.arcade.game.games.hideseek.kits.KitHiderSwapper; -import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerLeaper; -import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerRadar; -import nautilus.game.arcade.game.games.hideseek.kits.KitSeekerTNT; +import nautilus.game.arcade.game.games.hideseek.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; @@ -44,8 +40,9 @@ public class Countdown extends HideSeek super(manager, new Kit[] { - new KitHiderQuick(manager), new NullKit(manager), new KitSeekerLeaper(manager), - new KitSeekerTNT(manager), new KitSeekerRadar(manager), + new KitHiderQuick(manager), new KitHiderSwapper(manager), new KitHiderInfestor(manager), + new KitHiderShocker(manager), new NullKit(manager), new KitSeekerLeaper(manager), + new KitSeekerTNT(manager), new KitSeekerRadar(manager), }); _changeInterval = 30; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/kits/KitDefenceArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/kits/KitDefenceArcher.java index 5ae80bea9..798ca01c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/kits/KitDefenceArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/kits/KitDefenceArcher.java @@ -1,46 +1,52 @@ package nautilus.game.arcade.game.games.horsecharge.kits; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitDefenceArcher extends Kit +public class KitDefenceArcher extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Able to shoot arrows that can stop horses" + }; + + private static final Perk[] PERKS = { + new PerkFletcher(2, 4, true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + public KitDefenceArcher(ArcadeManager manager) { - super(manager, "Horseback Marksman", KitAvailability.Free, - - new String[] - { - "Able to shoot arrows that can stop horses" - }, - - new Perk[] - { - new PerkFletcher(2, 4, true) - }, - EntityType.SKELETON, - new ItemStack(Material.BOW)); + super(manager, "Horseback Marksman", "horsechargedefensearcher", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/kits/KitHorseKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/kits/KitHorseKnight.java index 3d636bf89..5cea5c70f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/kits/KitHorseKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/horsecharge/kits/KitHorseKnight.java @@ -1,48 +1,54 @@ package nautilus.game.arcade.game.games.horsecharge.kits; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkIronSkin; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitHorseKnight extends Kit +public class KitHorseKnight extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Rides a large warhorse, and can take a beating" + }; + + private static final Perk[] PERKS = { + new PerkIronSkin(1) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + public KitHorseKnight(ArcadeManager manager) { - super(manager, "Horseback Knight", KitAvailability.Free, - - new String[] - { - "Rides a large warhorse, and can take a beating" - }, - - new Perk[] - { - new PerkIronSkin(1) - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); + super(manager, "Horseback Knight", "horsechargehorseknight", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java index f36b6e3aa..21295ec33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java @@ -2,56 +2,65 @@ package nautilus.game.arcade.game.games.lobbers.kits; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; -import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkDummy; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitArmorer extends Kit +import java.util.Collections; + +public class KitArmorer extends ProgressingKit { + private static final String[] DESCRIPTION = { + "He uses his expert armor-making", + "skills to block excess damage!", + "", + "Receive " + C.cGreen + "Full Gold Armor", + "Receive " + C.cGreen + 1 + C.cWhite + " TNT every " + C.cGreen + "4-8" + C.cWhite + " seconds. Max " + C.cGreen + "3." + }; + + private static final Perk[] PERKS = { + new PerkDummy("Armorer", Collections.singletonList(C.cGray + "Receive " + C.cYellow + "Full Gold Armor").toArray(new String[1])), + new PerkCraftman(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.GOLD_HELMET); + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET), + }; + public KitArmorer(ArcadeManager manager) { - super(manager, "Armorer", KitAvailability.Gem, 2000, new String[] - { - C.cGray + "He uses his expert armor-making", - C.cGray + "skills to block excess damage!" - }, new Perk[] - { - new PerkDummy("Armorer", - new String[] - { - C.cGray + "Recieve " + C.cYellow + "Full Gold Armor" - }), - new PerkCraftman() - }, EntityType.ZOMBIE, - new ItemBuilder(Material.GOLD_HELMET).build()); + super(manager, "Armorer", "lobbersarmorer", KitAvailability.Gem, 2000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void ApplyKit(Player player) { UtilInv.Clear(player); - + for (Perk perk : GetPerks()) + { perk.Apply(player); - + } + GiveItemsCall(player); - - player.getInventory().setHelmet(new ItemBuilder(Material.GOLD_HELMET).setUnbreakable(true).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).setUnbreakable(true).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).setUnbreakable(true).build()); - player.getInventory().setBoots(new ItemBuilder(Material.GOLD_BOOTS).setUnbreakable(true).build()); - + + player.getInventory().setArmorContents(PLAYER_ARMOR); + UtilInv.Update(player); } @@ -62,11 +71,11 @@ public class KitArmorer extends Kit entity.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS)); entity.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS)); } - + @Override public void GiveItems(Player player) { - + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java index eec22c8b8..0cf783f9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java @@ -1,40 +1,44 @@ package nautilus.game.arcade.game.games.lobbers.kits; import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemBuilder; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkDummy; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; -public class KitJumper extends Kit +import java.util.Collections; + +public class KitJumper extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Use your jumping abilities to leap away from trouble!", + " ", + "You take no fall damage", + "Receive " + C.cGreen + 1 + C.cWhite + " TNT every " + C.cGreen + "4-8" + C.cWhite + " seconds. Max " + C.cGreen + "3." + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 1.2, 1.2, false, 6000, true), + new PerkDummy("Feathered Boots", Collections.singletonList(C.cGray + "You take no fall damage.").toArray(new String[1])), + new PerkCraftman() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + public KitJumper(ArcadeManager manager) { - super(manager, "Jumper", KitAvailability.Free, 0, new String[] - { - C.cGray + "Use your jumping abilities to leap away from trouble!" - }, new Perk[] - { - new PerkDoubleJump("Double Jump", 1.2, 1.2, false, 6000, true), - new PerkDummy("Feathered Boots", - new String[] - { - C.cGray + "You take no fall damage." - }), - new PerkCraftman() - }, EntityType.ZOMBIE, new ItemBuilder(Material.IRON_AXE).build()); + super(manager, "Jumper", "lobbersjumper", KitAvailability.Free, 0, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override @@ -47,14 +51,17 @@ public class KitJumper extends Kit public void onDamage(CustomDamageEvent event) { if (!Manager.GetGame().IsLive()) + { return; - + } if (!(event.GetDamageeEntity() instanceof Player)) + { return; - + } if (!HasKit(event.GetDamageePlayer())) + { return; - + } if (event.GetCause() == DamageCause.FALL) { event.SetCancelled("Jumper no fall damage"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java index b81bd916d..79186dca6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java @@ -1,20 +1,15 @@ package nautilus.game.arcade.game.games.lobbers.kits; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkDummy; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -22,59 +17,68 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; -public class KitPitcher extends Kit +public class KitPitcher extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "He can easily pitch the perfect", + "shot for any occasion.", + "", + "Receive " + C.cGreen + 1 + C.cWhite + " TNT every " + C.cGreen + "4-8" + C.cWhite + " seconds. Max " + C.cGreen + "3.", + click(true, "lever to " + C.cGreen + "Decrease Velocity. " + C.cGray + "Minimum of" + C.cGreen + " 1."), + click(false, "lever to " + C.cGreen + "Increase Velocity. " + C.cGray + "Maximum of" + C.cGreen + " 3.") + + }; + + private static final Perk[] PERKS = { + + new PerkCraftman() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.LEVER); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.LEVER, (byte) 0, 2, F.item("Velocity Selector")) + }; + public KitPitcher(ArcadeManager manager) { - super(manager, "Pitcher", KitAvailability.Gem, 4000, new String[] - { - C.cGray + "He can easily pitch the perfect", - C.cGray + "shot for any occasion." - }, new Perk[] - { - new PerkDummy("Pitcher", - new String[] - { - C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Velocity. " + C.cGray + "Minimum of 1.", - C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Velocity. " + C.cGray + "Maximum of 3.", - }), - new PerkCraftman() - }, EntityType.ZOMBIE, - new ItemBuilder(Material.LEVER).build()); + super(manager, "Pitcher", "lobberspitcher", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void GiveItems(Player player) { - player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).setAmount(2).build()); + player.getInventory().setItem(1, PLAYER_ITEMS[0]); } @EventHandler public void setFuse(TNTThrowEvent event) { if (!Manager.GetGame().IsLive()) + { return; - + } if (!HasKit(event.getPlayer())) + { return; - + } ItemStack lever = event.getPlayer().getInventory().getItem(1); - + if (lever == null || lever.getType() == Material.AIR) { GiveItems(event.getPlayer()); - } - else + } else { if (lever.getAmount() < 1 || lever.getAmount() > 3) { GiveItems(event.getPlayer()); } - + UtilAction.velocity(event.getTNT(), event.getPlayer().getLocation().getDirection(), getVelocity(lever.getAmount()), false, 0.0D, 0.1D, 10.0D, false); - } + } } - + @EventHandler public void changeFuse(PlayerInteractEvent event) { @@ -86,18 +90,18 @@ public class KitPitcher extends Kit if (!HasKit(event.getPlayer())) return; - + if (!UtilInv.IsItem(event.getItem(), Material.LEVER, (byte) 0)) return; - + int amount = event.getPlayer().getInventory().getItem(1).getAmount(); - + //Right if (UtilEvent.isAction(event, ActionType.R)) { if (amount >= 3) return; - + UtilInv.insert(event.getPlayer(), new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).build()); UtilInv.Update(event.getPlayer()); } @@ -106,7 +110,7 @@ public class KitPitcher extends Kit { if (amount <= 1) return; - + UtilInv.remove(event.getPlayer(), Material.LEVER, (byte) 0, 1); UtilInv.Update(event.getPlayer()); } @@ -116,10 +120,10 @@ public class KitPitcher extends Kit { if (amount == 1) return 1.75; - + if (amount == 3) return 2.25; - + return 2.0; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java index 77dd9a950..953463693 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java @@ -1,49 +1,63 @@ package nautilus.game.arcade.game.games.lobbers.kits; import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkWaller; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitWaller extends Kit +public class KitWaller extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "When the times get tough,", + "build yourself a wall!", + "", + "Receive " + C.cGreen + 1 + C.cWhite + " TNT every " + C.cGreen + "4-8" + C.cWhite + " seconds. Max " + C.cGreen + "3.", + C.cYellow + "Click " + C.cWhite + "a block with shovel to " + C.cGreen + "Place Wall" + + }; + + private static final Perk[] PERKS = { + new PerkWaller(), + new PerkCraftman() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SMOOTH_BRICK); + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.BOMB_LOBBERS_WINS, + Achievement.BOMB_LOBBERS_ULTIMATE_KILLER, + Achievement.BOMB_LOBBERS_SNIPER, + Achievement.BOMB_LOBBERS_PROFESSIONAL_LOBBER, + Achievement.BOMB_LOBBERS_EXPLOSION_PROOF, + Achievement.BOMB_LOBBERS_BLAST_PROOF + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE, (byte) 0, 3, F.item("Wall Builder")) + }; + public KitWaller(ArcadeManager manager) { - super(manager, "Waller", KitAvailability.Achievement, 0, new String[] - { - "When the times get tough,", - "build yourself a wall!" - }, new Perk[] - { - new PerkWaller(), - new PerkCraftman() - }, EntityType.ZOMBIE, - new ItemBuilder(Material.SMOOTH_BRICK).setUnbreakable(true).build()); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.BOMB_LOBBERS_WINS, - Achievement.BOMB_LOBBERS_ULTIMATE_KILLER, - Achievement.BOMB_LOBBERS_SNIPER, - Achievement.BOMB_LOBBERS_PROFESSIONAL_LOBBER, - Achievement.BOMB_LOBBERS_EXPLOSION_PROOF, - Achievement.BOMB_LOBBERS_BLAST_PROOF - }); + super(manager, "Waller", "lobberswalker", KitAvailability.Achievement, 0, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + + this.setAchievementRequirements(ACHIEVEMENTS); } @Override public void GiveItems(Player player) { - player.getInventory().setItem(1, new ItemBuilder(Material.STONE_SPADE).setAmount(3).setTitle(F.item("Wall Builder")).build()); + player.getInventory().setItem(1, PLAYER_ITEMS[0]); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitArcher.java index 42cf7527e..e1a8ea9a0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitArcher.java @@ -1,47 +1,49 @@ package nautilus.game.arcade.game.games.micro.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkFletcher; - -public class KitArcher extends Kit +public class KitArcher extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Shoot shoot!", + " ", + receiveArrowString(1, 20, 3), + "Start the game with: ", + C.cGreen + "▪ Wood Sword", + C.cGreen + "▪ Bow", + C.cGreen + "▪ 3 Apples." + }; + + private static final Perk[] PERKS = { + new PerkFletcher(20, 3, true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW), + ItemStackFactory.Instance.CreateStack(Material.APPLE, 3) + }; + public KitArcher(ArcadeManager manager) { - super(manager, "Archer", KitAvailability.Free, - - new String[] - { - "Shoot shoot!", - " ", - C.cGreen + "Wood Sword", - C.cGreen + "Bow", - C.cGreen + "3 Apples", - }, - - new Perk[] - { - new PerkFletcher(20, 3, true) - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - + super(manager, "Archer", "microarcherer", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.APPLE, 3)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitFighter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitFighter.java index dfc6a1975..b6b761fb1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitFighter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitFighter.java @@ -1,45 +1,47 @@ package nautilus.game.arcade.game.games.micro.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkIronSkin; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitFighter extends Kit +public class KitFighter extends ProgressingKit { + private static final String[] DESCRIPTION = { + "HIT HIT!", + " ", + "Take " + C.cGreen + "0.5" + C.cWhite + " less damage from attacks", + "Start the game with: ", + C.cGreen + "▪ Wood Sword", + C.cGreen + "▪ 5 Apples", + }; + + private static final Perk[] PERKS = { + new PerkIronSkin(0.5) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.WOOD_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD), + ItemStackFactory.Instance.CreateStack(Material.APPLE, 5) + }; + public KitFighter(ArcadeManager manager) { - super(manager, "Fighter", KitAvailability.Free, - - new String[] - { - "HE LIKES TO FIGHT!", - " ", - C.cGreen + "Wood Sword", - C.cGreen + "5 Apples", - }, - - new Perk[] - { - new PerkIronSkin(0.5) - }, - EntityType.ZOMBIE, - new ItemStack(Material.WOOD_SWORD)); - + super(manager, "Fighter", "microfighter", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.APPLE, 5)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitWorker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitWorker.java index 6973fe799..125d648cc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitWorker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitWorker.java @@ -1,48 +1,48 @@ package nautilus.game.arcade.game.games.micro.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitWorker extends Kit +public class KitWorker extends ProgressingKit { + private static final String[] DESCRIPTION = { + "DIG DIG!", + " ", + "Start the game with: ", + C.cGreen + "▪ Wood Sword", + C.cGreen + "▪ Stone Spade", + C.cGreen + "▪ Stone Pickaxe", + C.cGreen + "▪ 4 Apples", + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_PICKAXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD), + ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE), + ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE), + ItemStackFactory.Instance.CreateStack(Material.APPLE, 4) + }; + public KitWorker(ArcadeManager manager) { - super(manager, "Worker", KitAvailability.Free, - - new String[] - { - "DIG DIG!", - " ", - C.cGreen + "Wood Sword", - C.cGreen + "Stone Spade", - C.cGreen + "Stone Pickaxe", - C.cGreen + "4 Apples", - }, - - new Perk[] - { - - }, - EntityType.ZOMBIE, - new ItemStack(Material.STONE_PICKAXE)); - + super(manager, "Worker", "microworker", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.APPLE, 4)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitCow.java index 68be2fd6c..ca49d95ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitCow.java @@ -1,74 +1,71 @@ package nautilus.game.arcade.game.games.milkcow.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - import mineplex.core.common.util.C; import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.itemstack.ItemStackFactory; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.AbbreviatedKit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.SmashKit; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; -public class KitCow extends AbbreviatedKit +public class KitCow extends ProgressingKit { - public KitCow(ArcadeManager manager) - { - super(manager, "The Angry Cow", KitAvailability.Free, + private static final String[] DESCRIPTION = { + }; - new String[] - { - }, + private static final Perk[] PERKS = { + new PerkDamageSet(4), + new PerkKnockbackMultiplier(4), + new PerkCharge(), + new PerkCowBomb(), + new PerkSeismicCow("Body Slam") + }; - new Perk[] - { - new PerkDamageSet(4), - new PerkKnockbackMultiplier(4), - new PerkCharge(), - new PerkCowBomb(), - new PerkSeismicCow("Body Slam"), - }, - EntityType.COW, - null); - - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cow Bomb", - new String[] - { + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cow Bomb", + new String[] + { ChatColor.RESET + "Say goodbye to one of your children", ChatColor.RESET + "and hurl them towards your opponents.", ChatColor.RESET + "Explodes on impact, dealing knockback", - })); - - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Body Slam", - new String[] - { + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Body Slam", + new String[] + { ChatColor.RESET + "Hurl your giant fat cow-body forwards.", ChatColor.RESET + "Deals damage and knockback to anyone it", ChatColor.RESET + "collides with.", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.LEATHER, (byte)0, 1, - C.cYellow + C.Bold + "Sprint" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cow Charge", - new String[] - { + }), + ItemStackFactory.Instance.CreateStack(Material.LEATHER, (byte) 0, 1, + C.cYellow + C.Bold + "Sprint" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cow Charge", + new String[] + { ChatColor.RESET + "Charge with great power, flinging", ChatColor.RESET + "filthy farmers out of your way, making them drop the milk in their buckets!", - })); + }) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.MILK_BUCKET); + + public KitCow(ArcadeManager manager) + { + super(manager, "The Angry Cow", "milkcow", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.COW, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(PLAYER_ITEMS); //Disguise DisguiseCow disguise = new DisguiseCow(player); @@ -76,13 +73,13 @@ public class KitCow extends AbbreviatedKit disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - + @EventHandler public void NoDamage(CustomDamageEvent event) { Player player = event.GetDamageePlayer(); - if (player == null) return; - + if (player == null) return; + if (HasKit(player)) event.SetCancelled("Cow Immunity"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java index f33982c20..f483eb592 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java @@ -1,49 +1,40 @@ package nautilus.game.arcade.game.games.milkcow.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; - -public class KitFarmerJump extends Kit +public class KitFarmerJump extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Learned a thing or two from his rabbits!" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 1, 0.8, false) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BUCKET) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_HOE); + public KitFarmerJump(ArcadeManager manager) { - super(manager, "Rabbit Farmer", KitAvailability.Free, - - new String[] - { - "Learned a thing or two from his rabbits!" - }, - - new Perk[] - { - new PerkDoubleJump("Double Jump", 1, 0.8, false) - }, - - EntityType.ZOMBIE, - new ItemStack(Material.IRON_HOE)); - + super(manager, "Rabbit Farmer", "milkfarmerjump", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - - @EventHandler - public void FireItemResist(UpdateEvent event) - { - } - - @Override + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitSturdyFarmhand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitSturdyFarmhand.java index feeb802d1..b2c259c9e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitSturdyFarmhand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitSturdyFarmhand.java @@ -1,51 +1,42 @@ package nautilus.game.arcade.game.games.milkcow.kits; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkIronSkin; import nautilus.game.arcade.kit.perks.PerkNoSpillMilk; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -public class KitSturdyFarmhand extends Kit +public class KitSturdyFarmhand extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Been working on the ranch so long, even a charging bull can't faze him!" + }; + + private static final Perk[] PERKS = { + new PerkNoSpillMilk(), + new PerkIronSkin(2) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BUCKET) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SPADE); + public KitSturdyFarmhand(ArcadeManager manager) { - super(manager, "Sturdy Farmhand", KitAvailability.Gem, 2000, - - new String[] - { - "Been working on the ranch so long, even a charging bull can't faze him!" - }, - - new Perk[] - { - new PerkNoSpillMilk(manager), - new PerkIronSkin(2), - }, - - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SPADE)); - + super(manager, "Sturdy Farmhand", "milksturdyfarmhand", KitAvailability.Gem, 2000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - - @EventHandler - public void FireItemResist(UpdateEvent event) - { - } - - @Override + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java index 5f1c52111..6948a824c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java @@ -1,10 +1,5 @@ package nautilus.game.arcade.game.games.monsterleague.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; @@ -12,33 +7,38 @@ import nautilus.game.arcade.game.games.monsterleague.perks.PerkBlinkMonsterLeagu import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitEnderman extends LeagueKit { + private static final String[] DESCRIPTION = { + "Kick Power: 1.4" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 1, 1, true), + new PerkBlinkMonsterLeague("Blink", 32, 16000) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.EYE_OF_ENDER, (byte) 0, 1, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blink") + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.EYE_OF_ENDER); + public KitEnderman(ArcadeManager manager) { - super(manager, "Enderman", KitAvailability.Free, 5000, - - new String[] - { - "Kick Power: 1.4", - }, - - new Perk[] - { - new PerkDoubleJump("Double Jump", 1, 1, true), - new PerkBlinkMonsterLeague("Blink", 32, 16000), - }, - EntityType.ENDERMAN, - new ItemStack(Material.AIR), 1.4); - + super(manager, "Enderman", KitAvailability.Free, 5000, DESCRIPTION, PERKS, EntityType.ENDERMAN, IN_HAND, 1.4); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EYE_OF_ENDER, (byte)0, 1, - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blink")); + player.getInventory().addItem(PLAYER_ITEMS); // // //Disguise // DisguiseEnderman disguise = new DisguiseEnderman(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java index 2024c10bd..44c4a39fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitGolem.java @@ -1,12 +1,6 @@ package nautilus.game.arcade.game.games.monsterleague.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseIronGolem; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.monsterleague.perks.PerkStoneWall; @@ -14,34 +8,39 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkSlow; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitGolem extends LeagueKit { + private static final String[] DESCRIPTION = { + "Kick Power: 1.8" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 0.8, 0.8, true), + new PerkStoneWall("Iron Wall", Material.IRON_BLOCK, Material.IRON_INGOT), + new PerkSlow(0) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_INGOT, (byte) 0, 1, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Iron Wall") + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_INGOT); + public KitGolem(ArcadeManager manager) { - super(manager, "Golem", KitAvailability.Free, 5000, - - new String[] - { - "Kick Power: 1.8", - }, - - new Perk[] - { - new PerkDoubleJump("Double Jump", 0.8, 0.8, true), - new PerkStoneWall("Iron Wall", Material.IRON_BLOCK, Material.IRON_INGOT), - new PerkSlow(0) - }, - EntityType.IRON_GOLEM, - new ItemStack(Material.AIR), 1.8); - + super(manager, "Golem", KitAvailability.Free, 5000, DESCRIPTION, PERKS, EntityType.IRON_GOLEM, IN_HAND, 1.8); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_INGOT, (byte)0, 1, - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Iron Wall")); + player.getInventory().addItem(PLAYER_ITEMS); // // //Disguise // DisguiseIronGolem disguise = new DisguiseIronGolem(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitSkeleton.java index 461cc10ad..83bb1a497 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitSkeleton.java @@ -1,45 +1,44 @@ package nautilus.game.arcade.game.games.monsterleague.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkFletcher; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitSkeleton extends LeagueKit { + private static final String[] DESCRIPTION = { + "Kick Power: 1" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 1.1, 1.1, true), + new PerkFletcher(12, 2, true) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, C.cGreen + C.Bold + "Ball Shooter") + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + public KitSkeleton(ArcadeManager manager) { - super(manager, "Skeleton", KitAvailability.Free, 5000, - - new String[] - { - "Kick Power: 1", - }, - - new Perk[] - { - new PerkDoubleJump("Double Jump", 1.1, 1.1, true), - new PerkFletcher(12, 2, true), - }, - EntityType.SKELETON, - new ItemStack(Material.BOW), 1); - + super(manager, "Skeleton", KitAvailability.Free, 5000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, 1); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, C.cGreen + C.Bold + "Ball Shooter")); - + player.getInventory().addItem(PLAYER_ITEMS); + // //Disguise // DisguiseSkeleton disguise = new DisguiseSkeleton(player); // diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/LeagueKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/LeagueKit.java index fdd6030d9..a232d2b2f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/LeagueKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/LeagueKit.java @@ -1,27 +1,26 @@ package nautilus.game.arcade.game.games.monsterleague.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public abstract class LeagueKit extends Kit +public abstract class LeagueKit extends ProgressingKit { private double _kickPower; public LeagueKit(ArcadeManager manager, String name, - KitAvailability kitAvailability, int cost, String[] kitDesc, - Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, - double kickPower) + KitAvailability kitAvailability, int cost, String[] kitDesc, + Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, + double kickPower) { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); - + super(manager, name, "monsterleague" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + _kickPower = kickPower; } - + public double getKickPower() { return _kickPower; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitBodyBuilder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitBodyBuilder.java index d6722bebb..59d3e7c0d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitBodyBuilder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitBodyBuilder.java @@ -3,36 +3,41 @@ package nautilus.game.arcade.game.games.monstermaze.kits; import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitBodyBuilder extends Kit +public class KitBodyBuilder extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Your health just keeps getting better!" + + }; + + private static final Perk[] PERKS = { + new Perk("Body Builder", new String[]{"Your " + F.elem("Max Health") + " increases by " + F.skill("One Heart"), "when you are first to a Safe Pad.", "Maximum of 15 hearts."}) + { + } + }; + + private static final ItemStack IN_HAND = ItemStackFactory.Instance.CreateStack(373, 8229); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator")) + }; + public KitBodyBuilder(ArcadeManager manager) { - super(manager, "Body Builder", KitAvailability.Gem, 2000, - - new String[] - { - "Your health just keeps getting better!" - }, - - new Perk[] - { - new Perk("Body Builder", new String[]{"Your " + F.elem("Max Health") + " increases by " + F.skill("One Heart"), "when you are first to a Safe Pad.", "Maximum of 15 hearts."}){} - }, - EntityType.SKELETON, - ItemStackFactory.Instance.CreateStack(373, 8229)); + super(manager, "Body Builder", "monstermazebodybuilder", KitAvailability.Gem, 2000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator"))); + player.getInventory().setItem(4, PLAYER_ITEMS[0]); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java index 2cc376cfc..22c4d31a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java @@ -5,46 +5,44 @@ import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.monstermaze.kits.perks.PerkJumpsDisplay; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitJumper extends Kit +public class KitJumper extends ProgressingKit { + private static final String[] DESCRIPTION = { + "You have springs attached to your feet!", + "Bouncy... bouncy... bouncy..." + }; + + private static final Perk[] PERKS = { + new Perk("Jumper", new String[]{C.cGray + "You can jump " + C.cYellow + "5 Times" + C.cGray + "."}) + { + }, + new PerkJumpsDisplay() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.FEATHER); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator")), + ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte) 0, 5, C.cYellow + C.Bold + 5 + " Jumps Remaining") + }; + public KitJumper(ArcadeManager manager) { - super(manager, "Jumper", KitAvailability.Free, - - new String[] - { - "You have springs attached to your feet!", - "Bouncy... bouncy... bouncy..." - }, - - new Perk[] - { - new Perk("Jumper", new String[] - { - C.cGray + "You can jump " + C.cYellow + "5 Times" + C.cGray + "." - }) - { - - }, - new PerkJumpsDisplay() - }, - EntityType.SKELETON, - new ItemStack(Material.FEATHER)); + super(manager, "Jumper", "monstermazejumper", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator"))); - player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte)0, 5, C.cYellow + C.Bold + 5 + " Jumps Remaining")); + player.getInventory().setItem(4, PLAYER_ITEMS[4]); + player.getInventory().setItem(8, PLAYER_ITEMS[8]); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitRepulsor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitRepulsor.java index 992dea92d..9304ef792 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitRepulsor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitRepulsor.java @@ -6,49 +6,52 @@ import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.monstermaze.kits.perks.PerkRepulsor; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitRepulsor extends Kit +public class KitRepulsor extends ProgressingKit { + private static final String[] DESCRIPTION = { + "You love to watch monsters", + "fly away... Caw..." + }; + + private static final Perk[] PERKS = { + new PerkRepulsor() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.COAL); + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.MONSTER_MAZE_HARD_MODE, + Achievement.MONSTER_MAZE_NINJA, + Achievement.MONSTER_MAZE_PILOT, + Achievement.MONSTER_MAZE_SPEEDSTER, + Achievement.MONSTER_MAZE_SURVIVAL, + Achievement.MONSTER_MAZE_WINS + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0, 3, C.cYellow + C.Bold + "Right Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Repulse"), + ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator")) + }; + public KitRepulsor(ArcadeManager manager) { - super(manager, "Repulsor", KitAvailability.Achievement, 0, + super(manager, "Repulsor", "monstermazerepulsor", KitAvailability.Achievement, 0, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); - new String[] - { - "You love to watch monsters", - "fly away... Caw..." - }, - - new Perk[] - { - new PerkRepulsor() - }, - EntityType.SKELETON, - new ItemStack(Material.COAL)); - - setAchievementRequirements(new Achievement[] - { - Achievement.MONSTER_MAZE_HARD_MODE, - Achievement.MONSTER_MAZE_NINJA, - Achievement.MONSTER_MAZE_PILOT, - Achievement.MONSTER_MAZE_SPEEDSTER, - Achievement.MONSTER_MAZE_SURVIVAL, - Achievement.MONSTER_MAZE_WINS - }); + setAchievementRequirements(ACHIEVEMENTS); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().setItem(0, ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0, 3, C.cYellow + C.Bold + "Right Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Repulse")); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator"))); + player.getInventory().setItem(0, PLAYER_ITEMS[0]); + player.getInventory().setItem(4, PLAYER_ITEMS[1]); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSlowball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSlowball.java index 914c9d084..c523edbd3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSlowball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSlowball.java @@ -4,11 +4,10 @@ import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemStackFactory; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkConstructor; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -17,45 +16,47 @@ import org.bukkit.entity.Snowball; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -public class KitSlowball extends Kit +public class KitSlowball extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Slow enemies so they can't get to", + "their Safe Pad in time!" + }; + + private static final Perk[] PERKS = { + new PerkConstructor("Slowballer", 2, 16, Material.SNOW_BALL, "Slowball", true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator")) + }; + public KitSlowball(ArcadeManager manager) { - super(manager, "Slowballer", KitAvailability.Gem, 4000, - - new String[] - { - "Slow enemies so they can't get to", - "their Safe Pad in time!" - }, - - new Perk[] - { - new PerkConstructor("Slowballer", 2, 16, Material.SNOW_BALL, "Slowball", true) - }, - EntityType.SKELETON, - new ItemStack(Material.SNOW_BALL)); + super(manager, "Slowballer", "monstermazeslowballer", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, F.item("Safe Pad Locator"))); + player.getInventory().setItem(4, PLAYER_ITEMS[0]); } - + @EventHandler public void SnowballHit(CustomDamageEvent event) { if (event.GetProjectile() == null) return; - + if (!(event.GetProjectile() instanceof Snowball)) return; - + event.GetProjectile().remove(); - + // event.GetDamageeEntity().playEffect(EntityEffect.HURT); - - Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity)event.GetProjectile().getShooter(), 2, 1, false, false, true, false); + + Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity) event.GetProjectile().getShooter(), 2, 1, false, false, true, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java index 591abb677..88f451c4c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java @@ -7,10 +7,9 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballMachineGun; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -18,40 +17,47 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; -public class KitMachineGun extends Kit +public class KitMachineGun extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Full-automatic paintball gun.", + " ", + C.cGreen + "4" + C.cWhite + " Hit Kill" + }; + + private static final Perk[] PERKS = { + new PerkPaintballMachineGun() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_BARDING); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING, (byte) 0, 1, F.item("Paintball Machine Gun")) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build(), + }; + public KitMachineGun(ArcadeManager manager) { - super(manager, "Machine Gun", KitAvailability.Gem, 5000, - - new String[] - { - "Full-automatic paintball gun.", - C.cGold + "4 Hit Kill" - }, - - new Perk[] - { - new PerkPaintballMachineGun() - }, - EntityType.ZOMBIE, - new ItemStack(Material.DIAMOND_BARDING)); + super(manager, "Machine Gun", "paintballmachinegun", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING, (byte)0, 1, F.item("Paintball Machine Gun"))); + UtilInv.insert(player, PLAYER_ITEMS[0]); - ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 - PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); + ItemStack potion = new ItemStack(Material.POTION, 3, (short) 16429); // 16422 + PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); potionMeta.setDisplayName(F.item("Water Bomb")); potion.setItemMeta(potionMeta); UtilInv.insert(player, potion); - - player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java index db88ea43c..7f7c74a45 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java @@ -7,11 +7,10 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballRifle; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkSpeed; - import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -19,41 +18,49 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; -public class KitRifle extends Kit +public class KitRifle extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Semi-automatic paintball rifle.", + " ", + C.cGreen + "2" + C.cWhite + " Hit Kill" + }; + + private static final Perk[] PERKS = { + new PerkPaintballRifle(), + new PerkSpeed(0) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_BARDING); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BARDING, (byte) 0, 1, F.item("Paintball Rifle")) + }; + + + private static final ItemStack[] PLAYER_ARMOR = { + new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build(), + }; + public KitRifle(ArcadeManager manager) { - super(manager, "Rifle", KitAvailability.Free, - - new String[] - { - "Semi-automatic paintball rifle.", - C.cGold + "2 Hit Kill" - }, - - new Perk[] - { - new PerkPaintballRifle(), - new PerkSpeed(0) - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_BARDING)); - } + super(manager, "Rifle", "paintballrifle", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.IRON_BARDING, (byte)0, 1, F.item("Paintball Rifle"))); + UtilInv.insert(player, PLAYER_ITEMS[0]); - ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 - PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); + ItemStack potion = new ItemStack(Material.POTION, 3, (short) 16429); // 16422 + PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); potionMeta.setDisplayName(F.item("Water Bomb")); potion.setItemMeta(potionMeta); UtilInv.insert(player, potion); - - player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java index 65275c0a8..d1f5d3573 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java @@ -7,11 +7,10 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballShotgun; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkSpeed; - import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -19,41 +18,48 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; -public class KitShotgun extends Kit +public class KitShotgun extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Pump action paintball shotgun.", + " ", + C.cGreen + "8" + C.cWhite + " Pellets, " + C.cGreen + " 4" + C.cWhite + " Pellet Hits Kill" + }; + + private static final Perk[] PERKS = { + new PerkPaintballShotgun(), + new PerkSpeed(1) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.GOLD_BARDING); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.GOLD_BARDING, (byte) 0, 1, F.item("Paintball Shotgun")) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build(), + }; + public KitShotgun(ArcadeManager manager) { - super(manager, "Shotgun", KitAvailability.Gem, - - new String[] - { - "Pump action paintball shotgun.", - C.cGold + "8 Pellets, 4 Pellet Hits Kill" - }, - - new Perk[] - { - new PerkPaintballShotgun(), - new PerkSpeed(1) - }, - EntityType.ZOMBIE, - new ItemStack(Material.GOLD_BARDING)); - } + super(manager, "Shotgun", "paintballshotgun", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.GOLD_BARDING, (byte)0, 1, F.item("Paintball Shotgun"))); + UtilInv.insert(player, PLAYER_ITEMS[0]); - ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 - PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); + ItemStack potion = new ItemStack(Material.POTION, 3, (short) 16429); // 16422 + PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); potionMeta.setDisplayName(F.item("Water Bomb")); potion.setItemMeta(potionMeta); UtilInv.insert(player, potion); - - player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java index 3baa4479e..025e33eb8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java @@ -1,13 +1,5 @@ package nautilus.game.arcade.game.games.paintball.kits; -import org.bukkit.Color; -import org.bukkit.Material; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.PotionMeta; - import mineplex.core.achievement.Achievement; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -16,57 +8,72 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballSniper; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; -public class KitSniper extends Kit +public class KitSniper extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Long range sniper rifle", + " ", + C.cWhite + "Higher damage the longer scoped" + }; + + private static final Perk[] PERKS = { + new PerkPaintballSniper() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_HOE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte) 0, 1, F.item("Paintball Sniper Rifle")) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build(), + new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build(), + }; + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.SUPER_PAINTBALL_FLAWLESS_VICTORY, + Achievement.SUPER_PAINTBALL_KILLING_SPREE, + Achievement.SUPER_PAINTBALL_LAST_STAND, + Achievement.SUPER_PAINTBALL_MEDIC, + Achievement.SUPER_PAINTBALL_SPEEDRUNNER, + Achievement.SUPER_PAINTBALL_WINS + }; + public KitSniper(ArcadeManager manager) { - super(manager, "Sniper", KitAvailability.Achievement, + super(manager, "Sniper", "paintballsniper", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); - new String[] - { - "Long range sniper rifle", - C.cGold + "Higher damage the longer scoped" - }, - - new Perk[] - { - new PerkPaintballSniper(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.STONE_HOE)); - - setAchievementRequirements(new Achievement[] - { - Achievement.SUPER_PAINTBALL_FLAWLESS_VICTORY, - Achievement.SUPER_PAINTBALL_KILLING_SPREE, - Achievement.SUPER_PAINTBALL_LAST_STAND, - Achievement.SUPER_PAINTBALL_MEDIC, - Achievement.SUPER_PAINTBALL_SPEEDRUNNER, - Achievement.SUPER_PAINTBALL_WINS - }); - } + setAchievementRequirements(ACHIEVEMENTS); + } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, 1, F.item("Paintball Sniper Rifle"))); + player.getInventory().addItem(PLAYER_ITEMS); - ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422 - PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); + ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422 + PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); potionMeta.setDisplayName(F.item("Water Bomb")); potion.setItemMeta(potionMeta); UtilInv.insert(player, potion); - - player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build()); - player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + public int getPaintDamage(Arrow proj) { for (Perk perk : GetPerks()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitBrawler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitBrawler.java index d04875882..f849de662 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitBrawler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitBrawler.java @@ -1,53 +1,57 @@ package nautilus.game.arcade.game.games.quiver.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkStrength; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitBrawler extends Kit +public class KitBrawler extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Missed your arrow? Not a big deal.", + " ", + "Deal " + C.cGreen + "+1" + C.cWhite + " more damage" + }; + + private static final Perk[] PERKS = { + new PerkStrength(1) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + + public KitBrawler(ArcadeManager manager) { - super(manager, "Brawler", KitAvailability.Gem, - - new String[] - { - "Missed your arrow? Not a big deal." - }, - - new Perk[] - { - new PerkStrength(1) - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - + super(manager, "Brawler", "quiverbrawler", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - + player.getInventory().addItem(PLAYER_ITEMS); + if (Manager.GetGame().GetState() == GameState.Live) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte) 0, 1, F.item("Super Arrow"))); + final Player fPlayer = player; - + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() { public void run() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java index 08a5d7782..fcfce7584 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java @@ -1,53 +1,56 @@ package nautilus.game.arcade.game.games.quiver.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkArrowRebound; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitEnchanter extends Kit +public class KitEnchanter extends ProgressingKit { + private static final String[] DESCRIPTION = { + "3 Kills, 1 Arrow.", + "", + "Arrows bounce " + C.cGreen + "2" + C.cWhite + " times upon hitting your target" + }; + + private static final Perk[] PERKS = { + new PerkArrowRebound(2, 1.2f) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + public KitEnchanter(ArcadeManager manager) { - super(manager, "Enchanter", KitAvailability.Gem, 5000, - - new String[] - { - "3 Kills, 1 Arrow." - }, - - new Perk[] - { - new PerkArrowRebound(2, 1.2f) - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - + super(manager, "Enchanter", "quiverenchanter", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - + player.getInventory().addItem(PLAYER_ITEMS); + if (Manager.GetGame().GetState() == GameState.Live) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte) 0, 1, F.item("Super Arrow"))); + final Player fPlayer = player; - + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() { public void run() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java index c963e3f13..c67f789fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java @@ -1,60 +1,56 @@ package nautilus.game.arcade.game.games.quiver.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitLeaper extends Kit +public class KitLeaper extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Evade and kill using your double jump!", + "", + C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 0.9, 0.9, true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + public KitLeaper(ArcadeManager manager) { - super(manager, "Jumper", KitAvailability.Free, - - new String[] - { - "Evade and kill using your double jump!" - }, - - new Perk[] - { - new PerkDoubleJump("Double Jump", 0.9, 0.9, true) - }, - EntityType.ZOMBIE, - new ItemStack(Material.STONE_SWORD)); + super(manager, "Jumper", "quiverjumper", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - + player.getInventory().addItem(PLAYER_ITEMS); + if (Manager.GetGame().GetState() == GameState.Live) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); - - final Player fPlayer = player; - - UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - public void run() - { - UtilInv.Update(fPlayer); - } - }, 10); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte) 0, 1, F.item("Super Arrow"))); + + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilInv.Update(player), 10); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNinja.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNinja.java index 106360d21..e641fb7c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNinja.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitNinja.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.quiver.kits; import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; @@ -8,47 +9,61 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkVanishing; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitNinja extends Kit +public class KitNinja extends ProgressingKit { + private static final String[] DESCRIPTION = { + "You're a sneaky one, you!", + "", + "Become invisible for " + C.cGreen + "1.2" + C.cWhite + " seconds upon killing", + C.cRed + "Melee attacks remove your invisibility" + }; + + private static final Perk[] PERKS = { + new PerkVanishing() + }; + + private static final ItemStack IN_HAND = new ItemBuilder(Material.GOLD_SWORD).build(); + + private static final ItemStack[] PLAYER_ITEMS = { + new ItemBuilder(Material.GOLD_SWORD).setUnbreakable(true).build(), + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + + private static Achievement[] ACHIEVEMENTS = { + Achievement.OITQ_SHARPSHOOTER, + Achievement.OITQ_WHATS_A_BOW, + Achievement.OITQ_WINS, + }; + + public KitNinja(ArcadeManager manager) { - super(manager, "Ninja", KitAvailability.Achievement, 0, new String[] - { - "You're a sneaky one, you!" - }, new Perk[] - { - new PerkVanishing() - }, EntityType.ZOMBIE, new ItemBuilder(Material.GOLD_SWORD).build()); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.OITQ_SHARPSHOOTER, - Achievement.OITQ_WHATS_A_BOW, - Achievement.OITQ_WINS, - }); + super(manager, "Ninja", "quiverninja", KitAvailability.Achievement, 0, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + + this.setAchievementRequirements(ACHIEVEMENTS); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(new ItemBuilder(Material.GOLD_SWORD).setUnbreakable(true).build()); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - + player.getInventory().addItem(PLAYER_ITEMS); + + if (Manager.GetGame().GetState() == GameState.Live) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte) 0, 1, F.item("Super Arrow"))); + final Player fPlayer = player; - + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() { public void run() @@ -59,6 +74,5 @@ public class KitNinja extends Kit } } - - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java index b248eb2d7..cb74f3079 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java @@ -1,52 +1,56 @@ package nautilus.game.arcade.game.games.quiver.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkSeismicSlamOITQ; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitSlamShot extends Kit +public class KitSlamShot extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Gets 2 arrows for killing slammed players!", + "", + C.cYellow + "Right-Click" + C.cWhite + " with your " + C.cGreen + "Diamond Shovel" + C.cWhite + " to " + C.cGreen + "Ground Pound" + }; + + private static final Perk[] PERKS = { + new PerkSeismicSlamOITQ() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_SPADE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SPADE), + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + public KitSlamShot(ArcadeManager manager) { - super(manager, "Slam Shooter", KitAvailability.Gem, - 5000, new String[] - { - "Gets 2 arrows for killing slammed players!" - }, - - new Perk[] - { - new PerkSeismicSlamOITQ() - }, - EntityType.ZOMBIE, - new ItemStack(Material.DIAMOND_SPADE)); + super(manager, "Slam Shooter", "quiverslamshooter", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } - + @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SPADE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - + player.getInventory().addItem(PLAYER_ITEMS); + if (Manager.GetGame().GetState() == GameState.Live) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte) 0, 1, F.item("Super Arrow"))); + final Player fPlayer = player; - + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() { public void run() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitArcher.java index 32f459137..de41e9b6e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitArcher.java @@ -1,40 +1,43 @@ package nautilus.game.arcade.game.games.runner.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkQuickshot; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitArcher extends Kit +public class KitArcher extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Fire arrows to cause blocks to fall!", + "", + C.cYellow + "Left-Click" + C.cWhite + " with" + C.cGreen + " Bow " + C.cWhite + "to use " + C.cGreen + "Quick Shot" + }; + + private static final Perk[] PERKS = { + new PerkQuickshot("Quickshot", 1.2, 6000) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + public KitArcher(ArcadeManager manager) { - super(manager, "Archer", KitAvailability.Gem, - - new String[] - { - "Fire arrows to cause blocks to fall!" - }, - - new Perk[] - { - new PerkQuickshot("Quickshot", 1.2, 6000) - }, - EntityType.SKELETON, - new ItemStack(Material.BOW)); - + super(manager, "Archer", "runnerarcher", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java index 3ccd29815..c4440fea0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.runner.kits; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkConstructor; import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -9,50 +15,44 @@ import org.bukkit.entity.Snowball; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitFrosty extends Kit +public class KitFrosty extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Slow enemies to send them to their death!", + "", + receiveItem("Snowball", 1, 0.5, 16) + }; + + private static final Perk[] PERKS = { + new PerkConstructor("Frost Balls", 0.5, 16, Material.SNOW_BALL, "Snowball", true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL); + + public KitFrosty(ArcadeManager manager) { - super(manager, "Frosty", KitAvailability.Gem, 5000, - - new String[] - { - "Slow enemies to send them to their death!" - }, - - new Perk[] - { - new PerkConstructor("Frost Balls", 0.5, 16, Material.SNOW_BALL, "Snowball", true) - }, - EntityType.SKELETON, - new ItemStack(Material.SNOW_BALL)); + super(manager, "Frosty", "runnyfrosty", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - + } - + @EventHandler public void SnowballHit(CustomDamageEvent event) { if (event.GetProjectile() == null) return; - + if (!(event.GetProjectile() instanceof Snowball)) return; - + event.GetDamageeEntity().playEffect(EntityEffect.HURT); - - Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity)event.GetProjectile().getShooter(), 2, 1, false, false, true, false); + + Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity) event.GetProjectile().getShooter(), 2, 1, false, false, true, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitLeaper.java index 0f1c18664..6d92289c1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitLeaper.java @@ -1,40 +1,42 @@ package nautilus.game.arcade.game.games.runner.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkLeap; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitLeaper extends Kit +public class KitLeaper extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Leap to avoid falling to your death!", + "", + leap() + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1.2, 1.2, 8000) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE) + }; + public KitLeaper(ArcadeManager manager) { - super(manager, "Jumper", KitAvailability.Free, - - new String[] - { - "Leap to avoid falling to your death!" - }, - - new Perk[] - { - new PerkLeap("Leap", 1.2, 1.2, 8000) - }, - EntityType.SKELETON, - new ItemStack(Material.IRON_AXE)); - + super(manager, "Jumper", "runnerleaper", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitBow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitBow.java index 8f55f7a30..1215fd579 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitBow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitBow.java @@ -1,47 +1,63 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.bow; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -public class KitBow extends KitHuman +public class KitBow extends KitSearchAndDestroyBow { - public KitBow(ArcadeManager manager) - { - super(manager, "Bow", KitAvailability.Free, new String[] - { - "A basic kit with a bow" - }, new Perk[0], EntityType.SKELETON, new ItemStack(Material.BOW)); - } + private static final String[] DESCRIPTION = { + "A basic kit with a bow" + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET) - }); + private static final Perk[] PERKS = { - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.setItem(9, new ItemStack(Material.ARROW, 1)); - } + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitBow(ArcadeManager manager) + { + super(manager, "Bow", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitPinner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitPinner.java index 3dc76f21a..221a328d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitPinner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitPinner.java @@ -1,50 +1,66 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.bow; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkPinned; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -public class KitPinner extends KitHuman +public class KitPinner extends KitSearchAndDestroyBow { - public KitPinner(ArcadeManager manager) - { - super(manager, "Pinner", KitAvailability.Hide, new String[] - { - "Your arrows enchanted with gravity magic.", "Victims find it hard to lift", "Their bodies are sluggish" - }, new Perk[] - { - new PerkPinned() - }, EntityType.SKELETON, new ItemStack(Material.OBSIDIAN)); - } + private static final String[] DESCRIPTION = { + "Your arrows enchanted with gravity magic.", + "Victims find it hard to lift", + "Their bodies are sluggish" + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET) - }); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.setItem(9, new ItemStack(Material.ARROW, 1)); - } + private static final Perk[] PERKS = { + new PerkPinned() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.OBSIDIAN); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitPinner(ArcadeManager manager) + { + super(manager, "Pinner", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitPunch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitPunch.java index 379d3d68a..ec977aae9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitPunch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitPunch.java @@ -1,55 +1,67 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.bow; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -public class KitPunch extends KitHuman +public class KitPunch extends KitSearchAndDestroyBow { - public KitPunch(ArcadeManager manager) - { - super(manager, "Punch", KitAvailability.Hide, new String[] - { - "Your bow is super stretchy", "Your arrows are huge", "What does this mean?", - "Your arrows will knock em flying!" - }, new Perk[] - { - new PerkKnockbackArrow(2.5D) - }, EntityType.SKELETON, new ItemStack(Material.FENCE)); - } + private static final String[] DESCRIPTION = { + "Your bow is super stretchy", + "Your arrows are huge", + "What does this mean?", + "Your arrows will knock em flying!" + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET) - }); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.setItem(9, new ItemStack(Material.ARROW, 1)); - } + private static final Perk[] PERKS = { + new PerkKnockbackArrow(2.5D) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.FENCE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitPunch(ArcadeManager manager) + { + super(manager, "Punch", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitQuickshooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitQuickshooter.java index 7ac860164..5e80dd650 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitQuickshooter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitQuickshooter.java @@ -4,50 +4,66 @@ import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkQuickshot; -import nautilus.game.arcade.kit.perks.PerkRangedBleeding; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -public class KitQuickshooter extends KitHuman +public class KitQuickshooter extends KitSearchAndDestroyBow { - public KitQuickshooter(ArcadeManager manager) - { - super(manager, "Quickshooter", KitAvailability.Hide, new String[] - { - "Able to instantly fire an arrow" - }, new Perk[] - { - new PerkQuickshot("Quickshot", 2, 8000) - }, EntityType.SKELETON, new ItemStack(Material.INK_SACK, 1, (short) 14)); - } - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.BOW).setTitle(C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Quickshot") - .setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); - inv.setItem(9, new ItemStack(Material.ARROW, 1)); + private static final String[] DESCRIPTION = { + "Able to instantly fire an arrow" - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + }; + + private static final Perk[] PERKS = { + new PerkQuickshot("Quickshot", 2, 8000) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.INK_SACK, 1, (short) 14); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + new ItemBuilder(Material.BOW) + .setTitle(C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Quickshot") + .setUnbreakable(true) + .addEnchantment(Enchantment.ARROW_INFINITE, 1) + .build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitQuickshooter(ArcadeManager manager) + { + super(manager, "Quickshooter", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSearchAndDestroyBow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSearchAndDestroyBow.java new file mode 100644 index 000000000..4d741b1b9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSearchAndDestroyBow.java @@ -0,0 +1,21 @@ +package nautilus.game.arcade.game.games.searchanddestroy.kits.bow; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +/** + * Kit wrapper for all Search And Destroy kits which utilize Bows + */ +public abstract class KitSearchAndDestroyBow extends ProgressingKit +{ + + public KitSearchAndDestroyBow(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand) + { + super(manager, name, "sndbow" + name.toLowerCase().replace(" ", " "), kitAvailability, kitDesc, kitPerks, EntityType.SKELETON, itemInHand); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSharpshooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSharpshooter.java index ced452e3c..58361a437 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSharpshooter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSharpshooter.java @@ -1,52 +1,66 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.bow; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; import nautilus.game.arcade.kit.perks.PerkSharpshooter; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -public class KitSharpshooter extends KitHuman +public class KitSharpshooter extends KitSearchAndDestroyBow { - public KitSharpshooter(ArcadeManager manager) - { - super(manager, "Sharpshooter", KitAvailability.Hide, new String[] - { - "Each consecutive arrow hit deals an additional 2 damage.", - "Max of +6. Missing an arrow resets the count to 0." - }, new Perk[] - { - new PerkKnockbackArrow(2.5D), new PerkSharpshooter() - }, EntityType.SKELETON, new ItemStack(Material.FLINT)); - } - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET) - }); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.setItem(9, new ItemStack(Material.ARROW, 1)); + private static final String[] DESCRIPTION = { + "Each consecutive arrow hit deals an additional 2 damage.", + "Max of +6. Missing an arrow resets the count to 0." + }; - } + private static final Perk[] PERKS = { + new PerkKnockbackArrow(2.5D), + new PerkSharpshooter() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.FLINT); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitSharpshooter(ArcadeManager manager) + { + super(manager, "Sharpshooter", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSniper.java index f4eb9425b..4f3eb6718 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitSniper.java @@ -1,62 +1,68 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.bow; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; import nautilus.game.arcade.kit.perks.PerkSniper; - import org.bukkit.ChatColor; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import org.bukkit.metadata.FixedMetadataValue; -public class KitSniper extends KitHuman +public class KitSniper extends KitSearchAndDestroyBow { - public KitSniper(ArcadeManager manager) - { - super(manager, "Sniper", KitAvailability.Hide, new String[] - { - "Arrows do 0.1 damage per block travelled.", "Shoot from afar to score major damage!" - }, new Perk[] - { - new PerkKnockbackArrow(2.5D), new PerkSniper() - }, EntityType.SKELETON, new ItemStack(Material.ARROW)); - } + private static final String[] DESCRIPTION = { + "Arrows do 0.1 damage per block travelled.", + "Shoot from afar to score major damage!" - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET) - }); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.setItem(9, new ItemStack(Material.ARROW, 1)); + }; - } + private static final Perk[] PERKS = { + new PerkKnockbackArrow(2.5D), + new PerkSniper() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.ARROW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitSniper(ArcadeManager manager) + { + super(manager, "Sniper", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitThunderstorm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitThunderstorm.java index 2302aa673..9cf132702 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitThunderstorm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/bow/KitThunderstorm.java @@ -4,52 +4,66 @@ import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBarrage; import nautilus.game.arcade.kit.perks.PerkQuickshot; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -public class KitThunderstorm extends KitHuman +public class KitThunderstorm extends KitSearchAndDestroyBow { - public KitThunderstorm(ArcadeManager manager) - { - super(manager, "Thunderstorm", KitAvailability.Hide, new String[] - { - "Chargeup your bow to release a barrage of arrows." + "The longer you charge your bow" - + "The more arrows are added to the barrage." - }, new Perk[] - { - new PerkQuickshot("Quickshot", 2, 8000), new PerkBarrage(10, 400, false, false, true) - }, EntityType.SKELETON, new ItemStack(Material.ARROW, 16)); - } - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.BOW).setTitle(C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Quickshot") - .setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS), - new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET) - }); - inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.setItem(9, new ItemStack(Material.ARROW, 1)); - } + private static final String[] DESCRIPTION = { + "Chargeup your bow to release a barrage of arrows.", + "The longer you charge your bow", + "The more arrows are added to the barrage." + }; + private static final Perk[] PERKS = { + new PerkQuickshot("Quickshot", 2, 8000) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.ARROW, 16); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + new ItemBuilder(Material.BOW) + .setTitle(C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Quickshot") + .setUnbreakable(true) + .addEnchantment(Enchantment.ARROW_INFINITE, 1) + .build(), + ItemStackFactory.Instance.CreateStack(Material.ARROW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitThunderstorm(ArcadeManager manager) + { + super(manager, "Thunderstorm", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitEvade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitEvade.java index 9ed8e2425..63f9c9a4d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitEvade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitEvade.java @@ -1,52 +1,64 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkEvade; import nautilus.game.arcade.kit.perks.PerkShadowmeld; import nautilus.game.arcade.kit.perks.PerkSpeed; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitEvade extends Kit +public class KitEvade extends KitSearchAndDestroyRogue { - public KitEvade(ArcadeManager manager) - { - super(manager, "Evade", KitAvailability.Hide, new String[] - { - }, new Perk[] - { - new PerkSpeed(1), new PerkShadowmeld(), new PerkEvade() - }, EntityType.ZOMBIE, new ItemStack(Material.DIAMOND_SWORD)); - } + private static final String[] DESCRIPTION = { - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.DIAMOND_SWORD) - .setTitle(C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Evade").setUnbreakable(true).build()); + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.LEATHER_BOOTS), new ItemStack(Material.LEATHER_LEGGINGS), - new ItemStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_HELMET) - }); + private static final Perk[] PERKS = { + new PerkSpeed(1), + new PerkShadowmeld(), + new PerkEvade() + }; - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Evade") + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + + public KitEvade(ArcadeManager manager) + { + super(manager, "Evade", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitFlash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitFlash.java index bc0143f68..becf2c390 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitFlash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitFlash.java @@ -1,51 +1,64 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkFlash; import nautilus.game.arcade.kit.perks.PerkShadowmeld; import nautilus.game.arcade.kit.perks.PerkSpeed; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitFlash extends Kit +public class KitFlash extends KitSearchAndDestroyRogue { - public KitFlash(ArcadeManager manager) - { - super(manager, "Flash", KitAvailability.Hide, new String[] - { - }, new Perk[] - { - new PerkSpeed(1), new PerkShadowmeld(), new PerkFlash(1, false) - }, EntityType.ZOMBIE, new ItemStack(Material.DIAMOND_AXE)); - } + private static final String[] DESCRIPTION = { - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.DIAMOND_AXE) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Flash").setUnbreakable(true).build()); + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.LEATHER_BOOTS), new ItemStack(Material.LEATHER_LEGGINGS), - new ItemStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_HELMET) - }); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final Perk[] PERKS = { + new PerkSpeed(1), + new PerkShadowmeld(), + new PerkFlash(1, false) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Flash") + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + + public KitFlash(ArcadeManager manager) + { + super(manager, "Flash", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitMultiFlash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitMultiFlash.java index 891b0736f..fe6ed302b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitMultiFlash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitMultiFlash.java @@ -1,51 +1,65 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkFlash; import nautilus.game.arcade.kit.perks.PerkShadowmeld; import nautilus.game.arcade.kit.perks.PerkSpeed; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitMultiFlash extends Kit +public class KitMultiFlash extends KitSearchAndDestroyRogue { - public KitMultiFlash(ArcadeManager manager) - { - super(manager, "Multi-Flash", KitAvailability.Hide, new String[] - { - }, new Perk[] - { - new PerkSpeed(1), new PerkShadowmeld(), new PerkFlash(4, false) - }, EntityType.ZOMBIE, new ItemStack(Material.DIAMOND_AXE)); - } + private static final String[] DESCRIPTION = { - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.DIAMOND_AXE) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Flash").setUnbreakable(true).build()); + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.LEATHER_BOOTS), new ItemStack(Material.LEATHER_LEGGINGS), - new ItemStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_HELMET) - }); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final Perk[] PERKS = { + new PerkSpeed(1), + new PerkShadowmeld(), + new PerkFlash(4, false) + + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Evade") + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + + public KitMultiFlash(ArcadeManager manager) + { + super(manager, "Multi-Flash", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitPhaseBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitPhaseBlast.java index 73c7ea3d7..323dcf9ea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitPhaseBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitPhaseBlast.java @@ -1,52 +1,65 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkFlash; import nautilus.game.arcade.kit.perks.PerkShadowmeld; import nautilus.game.arcade.kit.perks.PerkSpeed; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitPhaseBlast extends Kit +public class KitPhaseBlast extends KitSearchAndDestroyRogue { - public KitPhaseBlast(ArcadeManager manager) - { - super(manager, "Phase Blast", KitAvailability.Hide, new String[] - { - }, new Perk[] - { - new PerkSpeed(1), new PerkShadowmeld(), new PerkFlash(1, true) - }, EntityType.ZOMBIE, new ItemStack(Material.DIAMOND_AXE)); - } + private static final String[] DESCRIPTION = { - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.DIAMOND_AXE) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Flash").setUnbreakable(true).build()); + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.LEATHER_BOOTS), new ItemStack(Material.LEATHER_LEGGINGS), - new ItemStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_HELMET) - }); + private static final Perk[] PERKS = { + new PerkSpeed(1), + new PerkShadowmeld(), + new PerkFlash(4, false) - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Evade") + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + + public KitPhaseBlast(ArcadeManager manager) + { + super(manager, "Phase Blast", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitRewind.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitRewind.java index c07fe9193..918fc1fc9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitRewind.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitRewind.java @@ -1,55 +1,71 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkEvade; import nautilus.game.arcade.kit.perks.PerkRewind; import nautilus.game.arcade.kit.perks.PerkShadowmeld; import nautilus.game.arcade.kit.perks.PerkSpeed; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitRewind extends Kit +public class KitRewind extends KitSearchAndDestroyRogue { - public KitRewind(ArcadeManager manager) - { - super(manager, "Rewind", KitAvailability.Hide, new String[] - { + private static final String[] DESCRIPTION = { - }, new Perk[] - { - new PerkSpeed(1), new PerkShadowmeld(), new PerkEvade(), new PerkRewind() + }; - }, EntityType.ZOMBIE, new ItemStack(Material.DIAMOND_SWORD)); - } + private static final Perk[] PERKS = { + new PerkSpeed(1), + new PerkShadowmeld(), + new PerkEvade(), + new PerkRewind() - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.DIAMOND_SWORD) - .setTitle(C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Evade").setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.NETHER_STAR) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Rewind").setUnbreakable(true).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.LEATHER_BOOTS), new ItemStack(Material.LEATHER_LEGGINGS), - new ItemStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_HELMET) - }); - } + + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Evade"), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Rewind"), + + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + + public KitRewind(ArcadeManager manager) + { + super(manager, "Rewind", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitRogue.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitRogue.java index 4fd266413..0b661fd64 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitRogue.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitRogue.java @@ -1,53 +1,62 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkShadowmeld; import nautilus.game.arcade.kit.perks.PerkSpeed; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitRogue extends Kit +public class KitRogue extends KitSearchAndDestroyRogue { - public KitRogue(ArcadeManager manager) - { - super(manager, "Rogue", KitAvailability.Free, new String[] - { + private static final String[] DESCRIPTION = { - }, new Perk[] - { - new PerkSpeed(1), new PerkShadowmeld(), + }; - }, EntityType.ZOMBIE, new ItemStack(Material.DIAMOND_AXE)); - } + private static final Perk[] PERKS = { + new PerkSpeed(1), + new PerkShadowmeld(), - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.DIAMOND_AXE).setTitle(C.cGray + "No Ability").setUnbreakable(true).build()); - inv.setItem(9, new ItemStack(Material.ARROW, 1)); + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.LEATHER_BOOTS), new ItemStack(Material.LEATHER_LEGGINGS), - new ItemStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_HELMET) - }); + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_AXE); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte) 0, 1, C.cGray + "No Ability") + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + + public KitRogue(ArcadeManager manager) + { + super(manager, "Rogue", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setItem(2, PLAYER_ITEMS[0]); + inv.addItem(PLAYER_ITEMS[1]); + inv.setItem(9, new ItemStack(Material.ARROW, 1)); + + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitSearchAndDestroyRogue.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitSearchAndDestroyRogue.java new file mode 100644 index 000000000..2d9af935c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitSearchAndDestroyRogue.java @@ -0,0 +1,20 @@ +package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +/** + * Kit wrapper for all Search And Destroy kits which utilize Rogues + */ +public abstract class KitSearchAndDestroyRogue extends ProgressingKit +{ + public KitSearchAndDestroyRogue(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand) + { + super(manager, name, "sndrogue" + name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, EntityType.ZOMBIE, itemInHand); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitWraith.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitWraith.java index d2e6f4d7f..ede82a358 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitWraith.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/rogue/KitWraith.java @@ -1,45 +1,64 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkEvade; import nautilus.game.arcade.kit.perks.PerkSpeed; import nautilus.game.arcade.kit.perks.PerkWraith; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitWraith extends Kit +public class KitWraith extends KitSearchAndDestroyRogue { - public KitWraith(ArcadeManager manager) - { - super(manager, "Rewind", KitAvailability.Hide, new String[] - { - }, new Perk[] - { - new PerkSpeed(1), new PerkWraith(), new PerkEvade() + private static final String[] DESCRIPTION = { - }, EntityType.ZOMBIE, new ItemStack(Material.DIAMOND_SWORD)); - } + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.DIAMOND_SWORD) - .setTitle(C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Evade").setUnbreakable(true).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final Perk[] PERKS = { + new PerkSpeed(1), + new PerkWraith(), + new PerkEvade() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Evade") + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + + public KitWraith(ArcadeManager manager) + { + super(manager, "Rewind", KitAvailability.Hide, DESCRIPTION, PERKS, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.setItem(2, PLAYER_ITEMS[0]); + for (int i = 1; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().addItem(PLAYER_ITEMS[i]); + } + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitAssault.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitAssault.java index 0b13ed9dc..259ab80b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitAssault.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitAssault.java @@ -1,48 +1,56 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBullsCharge; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import mineplex.core.itemstack.ItemBuilder; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBullsCharge; - -public class KitAssault extends Kit +public class KitAssault extends KitSearchAndDestroyTrooper { - public KitAssault(ArcadeManager manager) - { - super(manager, "Assault", KitAvailability.Hide, new String[] - { - "Bulls Charge ability.", "Temperary speed boost when activated.", "When attacking with the boost on", - "The victim is stunned and slows down" - }, new Perk[] - { - new PerkBullsCharge() - }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - } + private static final String[] DESCRIPTION = { + "Bulls Charge ability.", + "Temporary speed boost when activated.", + "When attacking with the boost on", + "The victim is stunned and slows down" + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET) - }); + private static final Perk[] PERKS = { + new PerkBullsCharge() + }; - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD) + }; + + public KitAssault(ArcadeManager manager) + { + super(manager, "Assault", KitAvailability.Hide, DESCRIPTION, PERKS); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.addItem(PLAYER_ITEMS); + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitBeserker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitBeserker.java index 103f74a73..c80f51d61 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitBeserker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitBeserker.java @@ -1,56 +1,58 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkBullsCharge; import nautilus.game.arcade.kit.perks.PerkTakedown; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitBeserker extends Kit +public class KitBeserker extends KitSearchAndDestroyTrooper { - public KitBeserker(ArcadeManager manager) - { - super(manager, "Beserker", KitAvailability.Hide, new String[] - { - "Leap and bullcharge your foes!" - }, new Perk[] - { - new PerkBullsCharge(), new PerkTakedown() - }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - } + private static final String[] DESCRIPTION = { + "Leap and bullcharge your foes!" + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Takedown").setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.IRON_AXE) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Bulls Charge").setUnbreakable(true).build()); - inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 2)); + private static final Perk[] PERKS = { + new PerkBullsCharge(), + new PerkTakedown() + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET) - }); + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Takedown"), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Bulls Charge"), + ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 2) + }; + public KitBeserker(ArcadeManager manager) + { + super(manager, "Beserker", KitAvailability.Hide, DESCRIPTION, PERKS); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.addItem(PLAYER_ITEMS); + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitBreaker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitBreaker.java index 6fbd3b36f..0b6ee123e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitBreaker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitBreaker.java @@ -1,52 +1,56 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkTakedown; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemBuilder; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkTakedown; - -public class KitBreaker extends Kit +public class KitBreaker extends KitSearchAndDestroyTrooper { - public KitBreaker(ArcadeManager manager) - { - super(manager, "Breaker", KitAvailability.Hide, new String[] - { - "Takedown - You leap forwards.", - "If you collide with anyone midair, they take damage and knockback." - }, new Perk[] - { - new PerkTakedown() - }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - } + private static final String[] DESCRIPTION = { + "Takedown - You leap forwards.", + "If you collide with anyone midair, they take damage and knockback." + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Takedown").setUnbreakable(true).build()); + private static final Perk[] PERKS = { + new PerkTakedown() + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET) - }); + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Takedown"), + }; + + public KitBreaker(ArcadeManager manager) + { + super(manager, "Breaker", KitAvailability.Hide, DESCRIPTION, PERKS); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.addItem(PLAYER_ITEMS); + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitChampion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitChampion.java index d13bc5567..6ab1c5e9e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitChampion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitChampion.java @@ -1,53 +1,59 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkBullsCharge; import nautilus.game.arcade.kit.perks.PerkChampion; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitChampion extends Kit +public class KitChampion extends KitSearchAndDestroyTrooper { - public KitChampion(ArcadeManager manager) - { - super(manager, "Champion", KitAvailability.Hide, new String[] - { - "Grow stronger with every kill" - }, new Perk[] - { - new PerkBullsCharge(), new PerkChampion() - }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - } - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_AXE) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Bulls Charge").setUnbreakable(true).build()); - inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 2)); + private static final String[] DESCRIPTION = { + "Grow stronger with every kill" + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET) - }); + private static final Perk[] PERKS = { + new PerkBullsCharge(), + new PerkChampion() - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Bulls Charge"), + ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 2) + }; + + public KitChampion(ArcadeManager manager) + { + super(manager, "Champion", KitAvailability.Hide, DESCRIPTION, PERKS); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.addItem(PLAYER_ITEMS); + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitJuggernaut.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitJuggernaut.java index e6e8b5bef..40ee2a059 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitJuggernaut.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitJuggernaut.java @@ -1,56 +1,60 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkHarden; import nautilus.game.arcade.kit.perks.PerkSeismicSlamSND; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitJuggernaut extends Kit +public class KitJuggernaut extends KitSearchAndDestroyTrooper { - public KitJuggernaut(ArcadeManager manager) - { - super(manager, "Juggernaut", KitAvailability.Hide, new String[] - { - "Deals damage in a large area" - }, new Perk[] - { - new PerkHarden(false), new PerkSeismicSlamSND() - }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - } + private static final String[] DESCRIPTION = { + "Deals damage in a large area" + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Seismic Slam").setUnbreakable(true).build()); - inv.addItem(new ItemBuilder(Material.IRON_AXE) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Harden").setUnbreakable(true).build()); - inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 2)); + private static final Perk[] PERKS = { + new PerkHarden(false), + new PerkSeismicSlamSND() - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET) - }); + }; - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Takedown"), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Harden"), + ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 2) + }; + + public KitJuggernaut(ArcadeManager manager) + { + super(manager, "Juggernaut", KitAvailability.Hide, DESCRIPTION, PERKS); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.addItem(PLAYER_ITEMS); + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitSearchAndDestroyTrooper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitSearchAndDestroyTrooper.java new file mode 100644 index 000000000..bf7f6ab3c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitSearchAndDestroyTrooper.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +/** + * Kit wrapper for all Search And Destroy kits which utilize Troopers + */ +public abstract class KitSearchAndDestroyTrooper extends ProgressingKit +{ + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + public KitSearchAndDestroyTrooper(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks) + { + super(manager, name, "sndtrooper" + name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, EntityType.ZOMBIE, IN_HAND); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTank.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTank.java index ccc36e48e..f450754f2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTank.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTank.java @@ -1,53 +1,56 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkHarden; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitTank extends Kit +public class KitTank extends KitSearchAndDestroyTrooper { - public KitTank(ArcadeManager manager) - { - super(manager, "Tank", KitAvailability.Hide, new String[] - { - "Able to absorb a lot of damage!" - }, new Perk[] - { - new PerkHarden(true) - }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - } + private static final String[] DESCRIPTION = { + "Able to absorb a lot of damage!" + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Harden").setUnbreakable(true).build()); - inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 2)); + private static final Perk[] PERKS = { + new PerkHarden(true) + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET) - }); + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Harden"), + ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 2) + }; + + public KitTank(ArcadeManager manager) + { + super(manager, "Tank", KitAvailability.Hide, DESCRIPTION, PERKS); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.addItem(PLAYER_ITEMS); + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTitan.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTitan.java index bf0ab361a..2568217b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTitan.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTitan.java @@ -1,60 +1,60 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDefensiveStance; import nautilus.game.arcade.kit.perks.PerkHarden; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; -public class KitTitan extends Kit +public class KitTitan extends KitSearchAndDestroyTrooper { - public KitTitan(ArcadeManager manager) - { - super(manager, "Titan", KitAvailability.Hide, new String[] - { - "Master of survival!" - }, new Perk[] - { - new PerkHarden(false), new PerkDefensiveStance() - }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - } - @Override - public void GiveItems(Player player) - { - - PlayerInventory inv = player.getInventory(); - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD) - .setTitle(C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Defensive Stance").setUnbreakable(true) - .build()); - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.addItem(new ItemBuilder(Material.IRON_AXE) - .setTitle(C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Harden").setUnbreakable(true).build()); - inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 2)); + private static final String[] DESCRIPTION = { + "Master of survival!" + }; - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET) - }); + private static final Perk[] PERKS = { + new PerkHarden(false), + new PerkDefensiveStance() - inv.setItem(8, - new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) - .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, C.cGreen + "Hold Block" + C.cWhite + " - " + C.cYellow + "Defensive Stance"), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Harden"), + ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 2) + }; + + public KitTitan(ArcadeManager manager) + { + super(manager, "Titan", KitAvailability.Hide, DESCRIPTION, PERKS); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.addItem(PLAYER_ITEMS); + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTrooper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTrooper.java index d64947cba..5a59df605 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTrooper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/kits/trooper/KitTrooper.java @@ -1,44 +1,58 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBullsCharge; +import nautilus.game.arcade.kit.perks.PerkTakedown; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import mineplex.core.itemstack.ItemBuilder; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitTrooper extends Kit +public class KitTrooper extends KitSearchAndDestroyTrooper { - public KitTrooper(ArcadeManager manager) - { - super(manager, "Trooper", KitAvailability.Free, new String[] - { - "Full iron armor and 2 golden apples" - }, new Perk[0], EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - } + private static final String[] DESCRIPTION = { + "Full iron armor and 2 golden apples" + }; - @Override - public void GiveItems(Player player) - { - PlayerInventory inv = player.getInventory(); - inv.setArmorContents(new ItemStack[] - { - new ItemStack(Material.IRON_BOOTS), new ItemStack(Material.IRON_LEGGINGS), - new ItemStack(Material.IRON_CHESTPLATE), new ItemStack(Material.IRON_HELMET) - }); + private static final Perk[] PERKS = { + new PerkBullsCharge(), + new PerkTakedown() + }; - inv.setItem(2, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); - inv.addItem(new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build()); - inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 2)); - inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()).setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()).setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); - } + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte) 0, 1, C.cGold + ("Fuse")), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 2) + }; + + public KitTrooper(ArcadeManager manager) + { + super(manager, "Trooper", KitAvailability.Free, DESCRIPTION, PERKS); + } + + @Override + public void GiveItems(Player player) + { + PlayerInventory inv = player.getInventory(); + inv.setArmorContents(PLAYER_ARMOR); + + inv.addItem(PLAYER_ITEMS); + inv.setItem(8, new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(this.Manager.GetGame().GetTeam(player).GetColorBase()) + .setTitle(ChatColor.WHITE + "Evolve Kit Menu").addLore("Right click to use").build()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitArcher.java index 80587c40b..b78c3cf40 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitArcher.java @@ -1,49 +1,55 @@ package nautilus.game.arcade.game.games.sheep.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; -public class KitArcher extends Kit +public class KitArcher extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Highly trained with a bow, probably an elf or something...", + "", + receiveArrowString(1, 2, 5), + "Charge Bow to use " + C.cGreen + "Barrage" + }; + + private static final Perk[] PERKS = { + new PerkFletcher(2, 5, true), + new PerkBarrage(5, 250, true, false) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW), + ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte) 0, 1, + C.cYellow + C.Bold + "Hold This" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Grab/Hold Sheep") + }; + public KitArcher(ArcadeManager manager) { - super(manager, "Archer", KitAvailability.Gem, - - new String[] - { - "Highly trained with a bow, probably an elf or something..." - }, - - new Perk[] - { - new PerkFletcher(2, 5, true), - new PerkBarrage(5, 250, true, false), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); + super(manager, "Archer", "sheeparcher", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte)0, 1, - C.cYellow + C.Bold + "Hold This" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Grab/Hold Sheep")); + player.getInventory().addItem(PLAYER_ITEMS); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java index ad09c56d7..db10ef792 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java @@ -1,48 +1,51 @@ package nautilus.game.arcade.game.games.sheep.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitBeserker extends Kit +public class KitBeserker extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Agile warrior trained in the ways axe combat.", + "", + C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Beserker Jump" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Beserker Jump", 1.2, 1.2, true, 8000, true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte) 0, 1, + C.cYellow + C.Bold + "Hold This" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Grab/Hold Sheep") + }; + public KitBeserker(ArcadeManager manager) { - super(manager, "Beserker", KitAvailability.Free, - - new String[] - { - "Agile warrior trained in the ways axe combat." - }, - - new Perk[] - { - new PerkDoubleJump("Beserker Jump", 1.2, 1.2, true, 8000, true) - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_AXE)); + super(manager, "Berserker", "sheepbeserker", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte)0, 1, - C.cYellow + C.Bold + "Hold This" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Grab/Hold Sheep")); + player.getInventory().addItem(PLAYER_ITEMS); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBrute.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBrute.java index 4dd5cfb77..ba7bd8d44 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBrute.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBrute.java @@ -1,49 +1,52 @@ package nautilus.game.arcade.game.games.sheep.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkThrower; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitBrute extends Kit +public class KitBrute extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Strong enough to throw things around!", + "", + "You can also pick up team mates!", + C.cYellow + "Drop Weapon" + C.cWhite + " to " + C.cGreen + "Throw Sheep / Players", + }; + + private static final Perk[] PERKS = { + new PerkThrower() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte) 0, 1, + C.cYellow + C.Bold + "Hold This" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Grab/Hold Sheep") + }; + public KitBrute(ArcadeManager manager) { - super(manager, "Brute", KitAvailability.Gem, 5000, - - new String[] - { - "Strong enough to throw things around!", - }, - - new Perk[] - { - new PerkThrower(manager) - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); + super(manager, "Brute", "sheepbrute", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte)0, 1, - C.cYellow + C.Bold + "Hold This" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Grab/Hold Sheep")); + player.getInventory().addItem(PLAYER_ITEMS); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitChicken.java index 353ac8f7d..058875fc6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitChicken.java @@ -1,42 +1,47 @@ package nautilus.game.arcade.game.games.skywars.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkChicken; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkChicken; - -public class KitChicken extends Kit +public class KitChicken extends ProgressingKit { + private static final String[] DESCRIPTION = { + "BAWK BAWK. Eggs!", + "", + "Get a chicken that follows you around", + "And lays eggs every " + C.cGreen + 8 + C.cWhite + " seconds!" + }; + + private static final Perk[] PERKS = { + new PerkChicken() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.EGG); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE), + ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE) + }; + - static PerkChicken p; - public KitChicken(ArcadeManager manager) - { - super(manager, - "Chicken Farmer", - KitAvailability.Free, - 0, - new String[] - { - "BAWK BAWK. Eggs!" - }, - new Perk[]{p = new PerkChicken(manager)}, - EntityType.ZOMBIE, - new ItemStack(Material.EGG)); + { + super(manager, "Chicken Farmer", "skywarschickenfarmer", KitAvailability.Free, 0, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - p.spawnChicken(player, player.getLocation()); - - player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); - player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE)); + ((PerkChicken) PERKS[0]).spawnChicken(player, player.getLocation()); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitDestructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitDestructor.java index c8bc39200..a735ffbcd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitDestructor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitDestructor.java @@ -1,51 +1,58 @@ package nautilus.game.arcade.game.games.skywars.kits; +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDestructor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.achievement.Achievement; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitDestructor extends Kit +public class KitDestructor extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Your Ender Pearls make the world crumble!", + "", + receiveItem("Seismic Charge", 1, 40, 2), + C.cYellow + "Right-Click" + C.cWhite + " with Seismic Charge to " + C.cGreen + "Throw Seismic Charge", + }; + + private static final Perk[] PERKS = { + new PerkDestructor(40, 2, 2500, true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.ENDER_PEARL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE), + ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE) + }; + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.SKYWARS_BOMBER, + Achievement.SKYWARS_NOARMOR, + Achievement.SKYWARS_NOCHEST, + Achievement.SKYWARS_PLAYER_KILLS, + Achievement.SKYWARS_TNT, + Achievement.SKYWARS_WINS, + Achievement.SKYWARS_ZOMBIE_KILLS + }; + public KitDestructor(ArcadeManager manager) { - super(manager, "Destructor", KitAvailability.Achievement, + super(manager, "Destructor", "skywarsdestructor", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); - new String[] - { - "Your Ender Pearls make the world crumble!" - }, - - new Perk[] - { - new PerkDestructor(40, 2, 2500, true) - }, - EntityType.ZOMBIE, - new ItemStack(Material.ENDER_PEARL)); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.SKYWARS_BOMBER, - Achievement.SKYWARS_NOARMOR, - Achievement.SKYWARS_NOCHEST, - Achievement.SKYWARS_PLAYER_KILLS, - Achievement.SKYWARS_TNT, - Achievement.SKYWARS_WINS, - Achievement.SKYWARS_ZOMBIE_KILLS - }); + this.setAchievementRequirements(ACHIEVEMENTS); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); - player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMadScientist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMadScientist.java index 0f8e69951..7ebca6b01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMadScientist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMadScientist.java @@ -1,37 +1,45 @@ package nautilus.game.arcade.game.games.skywars.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkMadScientist; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkMadScientist; - -public class KitMadScientist extends Kit +public class KitMadScientist extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Spawn crazy animals to fight for you!", + "", + receiveItem("Egg", 1, 90, 3), + "Eggs spawn a loyal minion to fight for you", + }; + + private static final Perk[] PERKS = { + new PerkMadScientist() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.MONSTER_EGG); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE), + ItemStackFactory.Instance.CreateStack(Material.WOOD_PICKAXE) + }; public KitMadScientist(ArcadeManager manager) { - super(manager, "Mad Scientist", - KitAvailability.Gem, - new String[]{ "Spawn crazy animals to fight for you!" }, - new Perk[] - { - new PerkMadScientist(manager) }, - EntityType.ZOMBIE, new ItemStack( - Material.MONSTER_EGG)); - // TODO Auto-generated constructor stub + super(manager, "Mad Scientist", "skywarsmadscientist", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(new ItemStack(Material.WOOD_AXE)); - player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMiner.java index 8c6351447..8d1e5946f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/kits/KitMiner.java @@ -1,40 +1,45 @@ package nautilus.game.arcade.game.games.skywars.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDigger; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitMiner extends Kit +public class KitMiner extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Start with better tools!", + "", + "Receive " + C.cGreen + "Haste II" + C.cWhite + " the entire game" + }; + + private static final Perk[] PERKS = { + new PerkDigger(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_PICKAXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE), + ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE) + }; + + public KitMiner(ArcadeManager manager) { - super(manager, "Miner", KitAvailability.Gem, 5000, - - new String[] - { - "Start with better tools!" - }, - - new Perk[] - { - new PerkDigger(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_PICKAXE)); - + super(manager, "Miner", "skywarsminer", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(new ItemStack(Material.STONE_AXE)); - player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java index fb3f18e92..2214dfa2a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java @@ -1,13 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseBlaze; @@ -19,103 +11,107 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkFirefly; -import nautilus.game.arcade.kit.perks.PerkInferno; -import nautilus.game.arcade.kit.perks.PerkKnockbackFire; -import nautilus.game.arcade.kit.perks.PerkSmashStats; -import nautilus.game.arcade.kit.perks.PerkSpeed; +import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; public class KitBlaze extends SmashKit { + private static final String[] DESCRIPTION = { + DOUBLE_JUMP, + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.5, 0.15, 5), + new PerkDoubleJump("Double Jump", 1, 1, false), + new PerkKnockbackFire(1.50), + new PerkSpeed(0), + new PerkInferno(), + new PerkFirefly() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_ROD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Inferno", + new String[]{ + ChatColor.RESET + "Releases a deadly torrent of flames,", + ChatColor.RESET + "which ignite and damage opponents.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Firefly", + new String[]{ + ChatColor.RESET + "After a short startup time, you fly", + ChatColor.RESET + "forward with great power, destroying", + ChatColor.RESET + "anyone you touch.", + ChatColor.RESET + "", + ChatColor.RESET + "If you are hit by a projectile during", + ChatColor.RESET + "startup time, the skill is cancelled.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Phoenix", + new String[]{ + ChatColor.RESET + "Unleash all your fiery power and", + ChatColor.RESET + "propel yourself forwards, destroying", + ChatColor.RESET + "everything that comes into your path." + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + }; + + public KitBlaze(ArcadeManager manager) { - super(manager, "Blaze", KitAvailability.Gem, 8000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.5, 0.15, 5), - new PerkDoubleJump("Double Jump", 1, 1, false), - new PerkKnockbackFire(1.50), - new PerkSpeed(0), - new PerkInferno(), - new PerkFirefly() - }, - EntityType.BLAZE, - new ItemStack(Material.BLAZE_ROD), - "Phoenix", 18000, Sound.BLAZE_DEATH); - + super(manager, "Blaze", KitAvailability.Gem, 8000, DESCRIPTION, PERKS, EntityType.BLAZE, IN_HAND, "Phoenix", 18000, Sound.BLAZE_DEATH); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Inferno", - new String[] - { - ChatColor.RESET + "Releases a deadly torrent of flames,", - ChatColor.RESET + "which ignite and damage opponents.", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Firefly", - new String[] - { - ChatColor.RESET + "After a short startup time, you fly", - ChatColor.RESET + "forward with great power, destroying", - ChatColor.RESET + "anyone you touch.", - ChatColor.RESET + "", - ChatColor.RESET + "If you are hit by a projectile during", - ChatColor.RESET + "startup time, the skill is cancelled.", - })); - + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Phoenix", - new String[] - { - ChatColor.RESET + "Unleash all your fiery power and", - ChatColor.RESET + "propel yourself forwards, destroying", - ChatColor.RESET + "everything that comes into your path." - })); + { + player.getInventory().addItem(PLAYER_ITEMS[2]); + } - - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { player.getInventory().remove(Material.IRON_SWORD); player.getInventory().remove(Material.IRON_AXE); - + UtilInv.Update(player); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); //Disguise DisguiseBlaze disguise = new DisguiseBlaze(player); - - if (Manager.GetGame().GetTeam(player) != null) + + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index bb4b110f9..3cf01c3f6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseChicken; @@ -20,98 +13,110 @@ import nautilus.game.arcade.kit.perks.PerkChickenRocket; import nautilus.game.arcade.kit.perks.PerkEggGun; import nautilus.game.arcade.kit.perks.PerkFlap; import nautilus.game.arcade.kit.perks.PerkSmashStats; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitChicken extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(4, 2.0, 0.15, 2), + new PerkFlap(0.8, 0.8, false), + new PerkEggGun(), + new PerkChickenRocket() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.EGG); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Egg Blaster", + new String[]{ + ChatColor.RESET + "Unleash a barrage of your precious eggs.", + ChatColor.RESET + "They won't deal any knockback, but they", + ChatColor.RESET + "can deal some serious damage.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Chicken Missile", + new String[]{ + ChatColor.RESET + "Launch one of your newborn babies.", + ChatColor.RESET + "It will fly forwards and explode if it", + ChatColor.RESET + "collides with anything, giving large", + ChatColor.RESET + "damage and knockback to players.", + }), + ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte) 0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Flap", + new String[]{ + ChatColor.RESET + "You are able to use your double jump", + ChatColor.RESET + "up to 6 times in a row. However, with", + ChatColor.RESET + "each flap, it loses some potency.", + ChatColor.RESET + "", + ChatColor.RESET + C.cAqua + "Flap uses Energy (Experience Bar)", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Airial Gunner", + new String[]{ + ChatColor.RESET + "Unleash an unlimited barrage of eggs", + ChatColor.RESET + "while also gaining permanant flight.", + }) + + }; + + private static final ItemStack[] PLAYER_ARMOR = { + null, + null, + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + null + }; + + public KitChicken(ArcadeManager manager) { - super(manager, "Chicken", KitAvailability.Gem, 8000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(4, 2.0, 0.15, 2), - new PerkFlap(0.8, 0.8, false), - new PerkEggGun(), - new PerkChickenRocket() - }, - EntityType.CHICKEN, - new ItemStack(Material.EGG), - "Aerial Gunner", 20000, Sound.CHICKEN_HURT); - + super(manager, "Chicken", KitAvailability.Gem, 8000, DESCRIPTION, PERKS, EntityType.CHICKEN, IN_HAND, "Aerial Gunner", 20000, Sound.CHICKEN_HURT); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Egg Blaster", - new String[] - { - ChatColor.RESET + "Unleash a barrage of your precious eggs.", - ChatColor.RESET + "They won't deal any knockback, but they", - ChatColor.RESET + "can deal some serious damage.", - })); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Chicken Missile", - new String[] - { - ChatColor.RESET + "Launch one of your newborn babies.", - ChatColor.RESET + "It will fly forwards and explode if it", - ChatColor.RESET + "collides with anything, giving large", - ChatColor.RESET + "damage and knockback to players.", - })); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte)0, 1, - C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Flap", - new String[] - { - ChatColor.RESET + "You are able to use your double jump", - ChatColor.RESET + "up to 6 times in a row. However, with", - ChatColor.RESET + "each flap, it loses some potency.", - ChatColor.RESET + "", - ChatColor.RESET + C.cAqua + "Flap uses Energy (Experience Bar)", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Airial Gunner", - new String[] - { - ChatColor.RESET + "Unleash an unlimited barrage of eggs", - ChatColor.RESET + "while also gaining permanant flight.", - })); + { + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + } - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { player.getInventory().remove(Material.IRON_SWORD); player.getInventory().remove(Material.IRON_AXE); - + UtilInv.Update(player); } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseChicken disguise = new DisguiseChicken(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); disguise.setCustomNameVisible(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index b8bd5b816..532d38060 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -1,18 +1,8 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - 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.disguise.disguises.DisguiseCow; -import mineplex.core.disguise.disguises.DisguiseMooshroom; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; @@ -23,109 +13,113 @@ import nautilus.game.arcade.game.games.smash.perks.PerkCowStampede; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkSmashStats; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitCow extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 0.9, 0.25, 7.5), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkCowStampede(), + new PerkCowAngryHerd(), + new PerkCowMilkSpiral(), + new PerkCowMooshroomMadness() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.MILK_BUCKET); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Angry Herd", + new String[]{ + ChatColor.RESET + "Send forth an angry herd of Cows", + ChatColor.RESET + "which deal damage and knockback", + ChatColor.RESET + "to opponents. Can hit multiple times." + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Milk Spiral", + new String[]{ + ChatColor.RESET + "Spray out a spiral of milk, propelling", + ChatColor.RESET + "yourself forwards through it. Deals damage", + ChatColor.RESET + "to opponents it collides with.", + ChatColor.RESET + "", + ChatColor.RESET + "Crouching cancels propulsion.", + }), + ItemStackFactory.Instance.CreateStack(Material.LEATHER, (byte) 0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede", + new String[]{ + ChatColor.RESET + "As you sprint, you will slowly", + ChatColor.RESET + "build up Speed Levels. You attacks", + ChatColor.RESET + "will deal extra damage and knockback", + ChatColor.RESET + "while you have Speed.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Mooshroom Madness", + new String[]{ + ChatColor.RESET + "Transform into a powerful Mooshroom Cow.", + ChatColor.RESET + "This grants you +1 damage on all attacks", + ChatColor.RESET + "and abilities, halves ability cooldowns,", + ChatColor.RESET + "and increases your health to 15 hearts.", + ChatColor.RESET + "", + ChatColor.RESET + "You remain a Mooshroom until you die.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + + }; + + public KitCow(ArcadeManager manager) { - super(manager, "Cow", KitAvailability.Gem, 6000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 0.9, 0.25, 7.5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkCowStampede(), - new PerkCowAngryHerd(), - new PerkCowMilkSpiral(), - new PerkCowMooshroomMadness(), - }, - EntityType.COW, - new ItemStack(Material.MILK_BUCKET), - "Mooshroom Madness", 0, null); + super(manager, "Cow", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.COW, IN_HAND, "Mooshroom Madness", 0, null); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Angry Herd", - new String[] - { - ChatColor.RESET + "Send forth an angry herd of Cows", - ChatColor.RESET + "which deal damage and knockback", - ChatColor.RESET + "to opponents. Can hit multiple times.", - - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Milk Spiral", - new String[] - { - ChatColor.RESET + "Spray out a spiral of milk, propelling", - ChatColor.RESET + "yourself forwards through it. Deals damage", - ChatColor.RESET + "to opponents it collides with.", - ChatColor.RESET + "", - ChatColor.RESET + "Crouching cancels propulsion.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.LEATHER, (byte)0, 1, - C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede", - new String[] - { - ChatColor.RESET + "As you sprint, you will slowly", - ChatColor.RESET + "build up Speed Levels. You attacks", - ChatColor.RESET + "will deal extra damage and knockback", - ChatColor.RESET + "while you have Speed.", - })); - } - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Mooshroom Madness", - new String[] - { - ChatColor.RESET + "Transform into a powerful Mooshroom Cow.", - ChatColor.RESET + "This grants you +1 damage on all attacks", - ChatColor.RESET + "and abilities, halves ability cooldowns,", - ChatColor.RESET + "and increases your health to 15 hearts.", - ChatColor.RESET + "", - ChatColor.RESET + "You remain a Mooshroom until you die.", - })); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseCow disguise = new DisguiseCow(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java index 444b0aaeb..46d839e2b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseCreeper; @@ -16,110 +9,112 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkCreeperElectricity; -import nautilus.game.arcade.kit.perks.PerkCreeperExplode; -import nautilus.game.arcade.kit.perks.PerkCreeperSulphurBomb; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSmashStats; +import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitCreeper extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.65, 0.4, 3.5), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkCreeperElectricity(), + new PerkCreeperSulphurBomb(), + new PerkCreeperExplode(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.TNT); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Sulphur Bomb", + new String[]{ + ChatColor.RESET + "Throw a small bomb of sulphur.", + ChatColor.RESET + "Explodes on contact with players,", + ChatColor.RESET + "dealing some damage and knockback.", + + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Explode", + new String[]{ + ChatColor.RESET + "You freeze in location and charge up", + ChatColor.RESET + "for 1.5 seconds. Then you explode!", + ChatColor.RESET + "You are sent flying in the direction", + ChatColor.RESET + "you are looking, while opponents take", + ChatColor.RESET + "large damage and knockback.", + + }), + ItemStackFactory.Instance.CreateStack(Material.COAL, (byte) 0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Lightning Shield", + new String[]{ + ChatColor.RESET + "When attacked by a non-melee attack,", + ChatColor.RESET + "you gain Lightning Shield for 2 seconds.", + ChatColor.RESET + "", + ChatColor.RESET + "Lightning Shield blocks 1 melee attack,", + ChatColor.RESET + "striking lightning on the attacker.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Atomic Blast", + new String[] + { + ChatColor.RESET + "After a short duration, you will explode", + ChatColor.RESET + "a gigantic explosion which destroys the", + ChatColor.RESET + "map and everyone nearby. You are sent flying", + ChatColor.RESET + "in the direction you are looking." + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + + }; + public KitCreeper(ArcadeManager manager) { - super(manager, "Creeper", KitAvailability.Gem, 4000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.65, 0.4, 3.5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkCreeperElectricity(), - new PerkCreeperSulphurBomb(), - new PerkCreeperExplode(), - }, - EntityType.CREEPER, - new ItemStack(Material.TNT), - "Atomic Blast", 0, Sound.CREEPER_DEATH); - } + super(manager, "Creeper", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.CREEPER, IN_HAND, "Atomic Blast", 0, Sound.CREEPER_DEATH); + } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Sulphur Bomb", - new String[] - { - ChatColor.RESET + "Throw a small bomb of sulphur.", - ChatColor.RESET + "Explodes on contact with players,", - ChatColor.RESET + "dealing some damage and knockback.", + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Explode", - new String[] - { - ChatColor.RESET + "You freeze in location and charge up", - ChatColor.RESET + "for 1.5 seconds. Then you explode!", - ChatColor.RESET + "You are sent flying in the direction", - ChatColor.RESET + "you are looking, while opponents take", - ChatColor.RESET + "large damage and knockback.", - - })); - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0, 1, - C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Lightning Shield", - new String[] - { - ChatColor.RESET + "When attacked by a non-melee attack,", - ChatColor.RESET + "you gain Lightning Shield for 2 seconds.", - ChatColor.RESET + "", - ChatColor.RESET + "Lightning Shield blocks 1 melee attack,", - ChatColor.RESET + "striking lightning on the attacker.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Atomic Blast", - new String[] - { - ChatColor.RESET + "After a short duration, you will explode", - ChatColor.RESET + "a gigantic explosion which destroys the", - ChatColor.RESET + "map and everyone nearby. You are sent flying", - ChatColor.RESET + "in the direction you are looking." - })); + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseCreeper disguise = new DisguiseCreeper(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java index dacd9344c..d064ad2ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java @@ -1,18 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseEnderman; @@ -25,106 +12,116 @@ import nautilus.game.arcade.game.games.smash.perks.PerkEndermanTeleport; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkBlink; -import nautilus.game.arcade.kit.perks.PerkBlockToss; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkEndermanDragon; -import nautilus.game.arcade.kit.perks.PerkSmashStats; +import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.inventory.ItemStack; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; public class KitEnderman extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(7, 1.3, 0.25, 6), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkBlink("Blink", 16, 6000), + new PerkBlockToss(), + new PerkEndermanTeleport(), + new PerkEndermanDragon() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.ENDER_PEARL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Block Toss", + new String[]{ + ChatColor.RESET + "Picks up a block from the ground, and", + ChatColor.RESET + "then hurls it at opponents, causing huge", + ChatColor.RESET + "damage and knockback if it hits.", + ChatColor.RESET + "", + ChatColor.RESET + "The longer you hold the block, the harder", + ChatColor.RESET + "you throw it. You will hear a 'tick' sound", + ChatColor.RESET + "when it is fully charged.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blink", + new String[]{ + ChatColor.RESET + "Instantly teleport in the direction", + ChatColor.RESET + "you are looking.", + ChatColor.RESET + "", + ChatColor.RESET + "You cannot pass through blocks.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Dragon Rider", + new String[]{ + ChatColor.RESET + "Summon a dragon from The End to fly into", + ChatColor.RESET + "your opponents, dealing devastating damage.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public HashMap _disguises = new HashMap(); public KitEnderman(ArcadeManager manager) { - super(manager, "Enderman", KitAvailability.Gem, 3000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(7, 1.3, 0.25, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkBlink("Blink", 16, 6000), - new PerkBlockToss(), - new PerkEndermanTeleport(), - new PerkEndermanDragon() - }, - EntityType.ENDERMAN, - new ItemStack(Material.ENDER_PEARL), - "Dragon Rider", 30000, Sound.ENDERDRAGON_GROWL); - + super(manager, "Enderman", KitAvailability.Gem, 3000, DESCRIPTION, PERKS, EntityType.ENDERMAN, IN_HAND, "Dragon Rider", 30000, Sound.ENDERDRAGON_GROWL); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Block Toss", - new String[] - { - ChatColor.RESET + "Picks up a block from the ground, and", - ChatColor.RESET + "then hurls it at opponents, causing huge", - ChatColor.RESET + "damage and knockback if it hits.", - ChatColor.RESET + "", - ChatColor.RESET + "The longer you hold the block, the harder", - ChatColor.RESET + "you throw it. You will hear a 'tick' sound", - ChatColor.RESET + "when it is fully charged.", - })); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blink", - new String[] - { - ChatColor.RESET + "Instantly teleport in the direction", - ChatColor.RESET + "you are looking.", - ChatColor.RESET + "", - ChatColor.RESET + "You cannot pass through blocks.", - })); - + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Dragon Rider", - new String[] - { - ChatColor.RESET + "Summon a dragon from The End to fly into", - ChatColor.RESET + "your opponents, dealing devestating damage.", - })); + player.getInventory().addItem(PLAYER_ITEMS[2]); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { player.getInventory().remove(Material.IRON_SWORD); player.getInventory().remove(Material.IRON_AXE); - + UtilInv.Update(player); } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseEnderman disguise = new DisguiseEnderman(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); disguise.a(false); Manager.GetDisguise().disguise(disguise); @@ -141,13 +138,13 @@ public class KitEnderman extends SmashKit @EventHandler public void BlockThrow(PerkBlockThrowEvent event) { - SetBlock(_disguises.get(event.GetPlayer()), 0, (byte)0); + SetBlock(_disguises.get(event.GetPlayer()), 0, (byte) 0); } @EventHandler public void Death(PlayerDeathEvent event) { - SetBlock(_disguises.get(event.getEntity()), 0, (byte)0); + SetBlock(_disguises.get(event.getEntity()), 0, (byte) 0); } public void SetBlock(DisguiseEnderman disguise, int id, byte data) @@ -160,22 +157,21 @@ public class KitEnderman extends SmashKit Manager.GetDisguise().updateDisguise(disguise); } - + @EventHandler public void cleanDisguises(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; - for (Iterator> iterator = _disguises.entrySet().iterator(); iterator.hasNext();) + for (Iterator> iterator = _disguises.entrySet().iterator(); iterator.hasNext(); ) { Entry current = iterator.next(); - + if (!Manager.GetDisguise().isDisguised(current.getKey())) { iterator.remove(); - } - else if (Manager.GetDisguise().getDisguise(current.getKey()) != current.getValue()) + } else if (Manager.GetDisguise().getDisguise(current.getKey()) != current.getValue()) { iterator.remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java index 88549d5da..14d1f20d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitGolem.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseIronGolem; @@ -17,101 +10,105 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitGolem extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(7, 1.0, 0.2, 8), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSlow(0), + new PerkFissure(), + new PerkIronHook(), + new PerkSeismicSlam(), + new PerkEarthquake() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_BLOCK); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fissure", + new String[]{ + ChatColor.RESET + "Smash the ground, creating a fissure", + ChatColor.RESET + "which slowly rises in a line, dealing", + ChatColor.RESET + "damage and knockback to anyone it hits!", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Iron Hook", + new String[]{ + ChatColor.RESET + "Throw a metal hook at opponents.", + ChatColor.RESET + "If it hits, it deals damage and pulls", + ChatColor.RESET + "them towards you with great force.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Seismic Slam", + new String[]{ + ChatColor.RESET + "Take a mighty leap into the air, then", + ChatColor.RESET + "slam back into the ground with huge force.", + ChatColor.RESET + "Nearby opponents take damage and knockback.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Earthquake", + new String[]{ + ChatColor.RESET + "Begin an earthquake that will give damage", + ChatColor.RESET + "and knockback to any player who is touching", + ChatColor.RESET + "the ground, anywhere on the map!", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + public KitGolem(ArcadeManager manager) { - super(manager, "Iron Golem", KitAvailability.Free, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(7, 1.0, 0.2, 8), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkSlow(0), - new PerkFissure(), - new PerkIronHook(), - new PerkSeismicSlam(), - new PerkEarthquake() - - }, - EntityType.IRON_GOLEM, - new ItemStack(Material.IRON_BLOCK), - "Earthquake", 0, Sound.IRONGOLEM_DEATH); + super(manager, "Iron Golem", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.IRON_GOLEM, IN_HAND, "Earthquake", 0, Sound.IRONGOLEM_DEATH); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fissure", - new String[] - { - ChatColor.RESET + "Smash the ground, creating a fissure", - ChatColor.RESET + "which slowly rises in a line, dealing", - ChatColor.RESET + "damage and knockback to anyone it hits!", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_PICKAXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Iron Hook", - new String[] - { - ChatColor.RESET + "Throw a metal hook at opponents.", - ChatColor.RESET + "If it hits, it deals damage and pulls", - ChatColor.RESET + "them towards you with great force.", - })); - - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Seismic Slam", - new String[] - { - ChatColor.RESET + "Take a mighty leap into the air, then", - ChatColor.RESET + "slam back into the ground with huge force.", - ChatColor.RESET + "Nearby opponents take damage and knockback.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Earthquake", - new String[] - { - ChatColor.RESET + "Begin an earthquake that will give damage", - ChatColor.RESET + "and knockback to any player who is touching", - ChatColor.RESET + "the ground, anywhere on the map!", - })); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[3]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseIronGolem disguise = new DisguiseIronGolem(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index 4fca31e49..f90b5c729 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseMagmaCube; @@ -17,53 +10,44 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitMagmaCube extends SmashKit { - public KitMagmaCube(ArcadeManager manager) - { - super(manager, "Magma Cube", KitAvailability.Gem, 5000, + private static final String[] DESCRIPTION = { + }; - new String[] - { - }, + private static final Perk[] PERKS = { + new PerkSmashStats(5, 1.75, 0.35, 5), + new PerkDoubleJump("Double Jump", 1.2, 1, false), + new PerkMagmaBoost(), + new PerkMagmaBlast(), + new PerkFlameDash(), + new PerkMeteorShower() + }; - new Perk[] - { - new PerkSmashStats(5, 1.75, 0.35, 5), - new PerkDoubleJump("Double Jump", 1.2, 1, false), - new PerkMagmaBoost(), - new PerkMagmaBlast(), - new PerkFlameDash(), - new PerkMeteorShower() - - - }, - EntityType.MAGMA_CUBE, - new ItemStack(Material.MAGMA_CREAM), - "Meteor Shower", 0, Sound.AMBIENCE_THUNDER); - } + private static final ItemStack IN_HAND = new ItemStack(Material.MAGMA_CREAM); - @Override - public void giveCoreItems(Player player) - { - UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Magma Blast", - new String[] - { + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Magma Blast", + new String[] + { ChatColor.RESET + "Release a powerful ball of magma which explodes", ChatColor.RESET + "on impact, dealing damage and knockback.", ChatColor.RESET + "", ChatColor.RESET + "You receive strong knockback when you shoot it.", ChatColor.RESET + "Use this knockback to get back onto the map!", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Flame Dash", - new String[] - { + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Flame Dash", + new String[] + { ChatColor.RESET + "Disappear in flames, and fly horizontally", ChatColor.RESET + "in the direction you are looking. You explode", ChatColor.RESET + "when you re-appear, dealing damage to enemies.", @@ -71,45 +55,64 @@ public class KitMagmaCube extends SmashKit ChatColor.RESET + "Damage increases with distance travelled.", ChatColor.RESET + "", ChatColor.RESET + "Right-Click again to end Flame Dash early.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Meteor Shower", - new String[] - { - ChatColor.RESET + "Summon a deadly meteor shower that will rain", - ChatColor.RESET + "down on your target location, causing extreme", - ChatColor.RESET + "damage and knockback to enemies!", - })); + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Meteor Shower", + new String[] + { + ChatColor.RESET + "Summon a deadly meteor shower that will rain", + ChatColor.RESET + "down on your target location, causing extreme", + ChatColor.RESET + "damage and knockback to enemies!", + }) + }; - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + null, + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitMagmaCube(ArcadeManager manager) + { + super(manager, "Magma Cube", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.MAGMA_CUBE, IN_HAND, "Meteor Shower", 0, Sound.AMBIENCE_THUNDER); } - + + @Override + public void giveCoreItems(Player player) + { + UtilInv.Clear(player); + + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[2]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); + } + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseMagmaCube disguise = new DisguiseMagmaCube(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); - + disguise.SetSize(1); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index 4ae1fcb33..23efec302 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -11,12 +11,7 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkPigBaconBomb; -import nautilus.game.arcade.kit.perks.PerkPigBaconBounce; -import nautilus.game.arcade.kit.perks.PerkPigZombie; -import nautilus.game.arcade.kit.perks.PerkSmashStats; - +import nautilus.game.arcade.kit.perks.*; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -27,107 +22,108 @@ import org.bukkit.inventory.ItemStack; public class KitPig extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(5, 1.5, 0.25, 5), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkPigBaconBounce(), + new PerkPigBaconBomb(), + new PerkPigZombie(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.PORK); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bouncy Bacon", + new String[]{ + ChatColor.RESET + "Bouncy Bacon launches a piece of bacon,", + ChatColor.RESET + "dealing damage and knockback to enemies.", + ChatColor.RESET + "", + ChatColor.RESET + "Eat the bacon to restore some Energy.", + ChatColor.RESET + "Bacon that hits an enemy will restore Health.", + + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Baby Bacon Bombs", + new String[]{ + ChatColor.RESET + "Give birth to a baby pig, giving", + ChatColor.RESET + "yourself a boost forwards. ", + ChatColor.RESET + "", + ChatColor.RESET + "Your baby pig will run to annoy", + ChatColor.RESET + "nearby enemies, exploding on them.", + }), + ItemStackFactory.Instance.CreateStack(Material.PORK, (byte) 0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Nether Pig", + new String[]{ + ChatColor.RESET + "When your health drops below 4, you morph", + ChatColor.RESET + "into a Nether Pig. This gives you Speed I,", + ChatColor.RESET + "8 Armor and reduces Energy costs by 33%.", + ChatColor.RESET + "", + ChatColor.RESET + "When your health returns to 6, you return", + ChatColor.RESET + "back to Pig Form.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Pig Stink", + new String[]{ + ChatColor.RESET + "Unleash your inner pig, causing all enemies", + ChatColor.RESET + "to get nausea for a duration, while you become", + ChatColor.RESET + "a powerful Nether Pig!", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + null, + }; + + public KitPig(ArcadeManager manager) { - super(manager, "Pig", KitAvailability.Gem, 7000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(5, 1.5, 0.25, 5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkPigBaconBounce(), - new PerkPigBaconBomb(), - new PerkPigZombie(), - - }, - EntityType.PIG, - new ItemStack(Material.PORK), - "Pig Stink", 40000, Sound.PIG_DEATH); + super(manager, "Pig", KitAvailability.Gem, 7000, DESCRIPTION, PERKS, EntityType.PIG, IN_HAND, "Pig Stink", 40000, Sound.PIG_DEATH); } - + @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bouncy Bacon", - new String[] - { - ChatColor.RESET + "Bouncy Bacon launches a piece of bacon,", - ChatColor.RESET + "dealing damage and knockback to enemies.", - ChatColor.RESET + "", - ChatColor.RESET + "Eat the bacon to restore some Energy.", - ChatColor.RESET + "Bacon that hits an enemy will restore Health.", - - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Baby Bacon Bombs", - new String[] - { - ChatColor.RESET + "Give birth to a baby pig, giving", - ChatColor.RESET + "yourself a boost forwards. ", - ChatColor.RESET + "", - ChatColor.RESET + "Your baby pig will run to annoy", - ChatColor.RESET + "nearby enemies, exploding on them.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.PORK, (byte)0, 1, - C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Nether Pig", - new String[] - { - ChatColor.RESET + "When your health drops below 4, you morph", - ChatColor.RESET + "into a Nether Pig. This gives you Speed I,", - ChatColor.RESET + "8 Armor and reduces Energy costs by 33%.", - ChatColor.RESET + "", - ChatColor.RESET + "When your health returns to 6, you return", - ChatColor.RESET + "back to Pig Form.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Pig Stink", - new String[] - { - ChatColor.RESET + "Unleash your inner pig, causing all enemies", - ChatColor.RESET + "to get nausea for a duration, while you become", - ChatColor.RESET + "a powerful Nether Pig!", - })); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguisePig disguise = new DisguisePig(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - + @EventHandler public void EnergyUpdate(UpdateEvent event) { @@ -142,7 +138,7 @@ public class KitPig extends SmashKit player.setExp((float) Math.min(0.999, player.getExp() + (isSuperActive(player) ? 0.02 : 0.005))); } } - + @Override public void activateSuperCustom(Player player) { @@ -150,7 +146,7 @@ public class KitPig extends SmashKit if (!player.equals(other)) Manager.GetCondition().Factory().Confuse("Pig Stink " + player.getName(), other, player, 40, 0, false, false, false); } - + @Override public void deactivateSuperCustom(Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java index 06e392f7c..f3a600a09 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java @@ -1,13 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.DyeColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.achievement.Achievement; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; @@ -19,114 +11,123 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitSheep extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(5, 1.7, 0.25, 5), + new PerkDoubleJump("Double Jump", 1, 1, false), + new PerkLazer(40, 6000), + new PerkWoolBomb(), + new PerkWoolCloud(), + new PerkSheepHoming() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.WOOL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Static Lazer", + new String[]{ + ChatColor.RESET + "Charge up static electricity in your", + ChatColor.RESET + "wooly coat, and then unleash it upon", + ChatColor.RESET + "enemies in a devastating laser beam!", + + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wool Mine", + new String[]{ + ChatColor.RESET + "Shear yourself and use the wool as", + ChatColor.RESET + "an explosive device. You can Right-Click", + ChatColor.RESET + "a second time to solidify the bomb, and", + ChatColor.RESET + "a third time to detonate it on command.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wooly Rocket", + new String[]{ + ChatColor.RESET + "Become like a cloud and shoot yourself", + ChatColor.RESET + "directly upwards. You deal damage to anyone", + ChatColor.RESET + "you collide with on your ascent.", + ChatColor.RESET + "", + ChatColor.RESET + "Using this recharges your Double Jump.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Homing Sheeples", + new String[]{ + ChatColor.RESET + "Release one Homing Sheeple towards every player.", + ChatColor.RESET + "They will slowly home in on their target and", + ChatColor.RESET + "explode to deal devastating damage.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + null + }; + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.SMASH_MOBS_1V3, + Achievement.SMASH_MOBS_FREE_KITS, + Achievement.SMASH_MOBS_MLG_PRO, + Achievement.SMASH_MOBS_RECOVERY_MASTER, + Achievement.SMASH_MOBS_TRIPLE_KILL, + Achievement.SMASH_MOBS_WINS + }; + + public KitSheep(ArcadeManager manager) { - super(manager, "Sir. Sheep", KitAvailability.Achievement, 99999, + super(manager, "Sir. Sheep", KitAvailability.Achievement, 99999, DESCRIPTION, PERKS, EntityType.SHEEP, IN_HAND, "Homing Sheeples", 0, Sound.SHEEP_IDLE); - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(5, 1.7, 0.25, 5), - new PerkDoubleJump("Double Jump", 1, 1, false), - new PerkLazer(40, 6000), - new PerkWoolBomb(), - new PerkWoolCloud(), - new PerkSheepHoming() - - }, - EntityType.SHEEP, - new ItemStack(Material.WOOL), - "Homing Sheeples", 0, Sound.SHEEP_IDLE); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.SMASH_MOBS_1V3, - Achievement.SMASH_MOBS_FREE_KITS, - Achievement.SMASH_MOBS_MLG_PRO, - Achievement.SMASH_MOBS_RECOVERY_MASTER, - Achievement.SMASH_MOBS_TRIPLE_KILL, - Achievement.SMASH_MOBS_WINS, - }); + this.setAchievementRequirements(ACHIEVEMENTS); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Static Lazer", - new String[] - { - ChatColor.RESET + "Charge up static electricity in your", - ChatColor.RESET + "wooly coat, and then unleash it upon", - ChatColor.RESET + "enemies in a devastating laser beam!", - - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wool Mine", - new String[] - { - ChatColor.RESET + "Shear yourself and use the wool as", - ChatColor.RESET + "an explosive device. You can Right-Click", - ChatColor.RESET + "a second time to solidify the bomb, and", - ChatColor.RESET + "a third time to detonate it on command.", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wooly Rocket", - new String[] - { - ChatColor.RESET + "Become like a cloud and shoot yourself", - ChatColor.RESET + "directly upwards. You deal damage to anyone", - ChatColor.RESET + "you collide with on your ascent.", - ChatColor.RESET + "", - ChatColor.RESET + "Using this recharges your Double Jump.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Homing Sheeples", - new String[] - { - ChatColor.RESET + "Release one Homing Sheeple towards every player.", - ChatColor.RESET + "They will slowly home in on their target and", - ChatColor.RESET + "explode to deal devastating damage.", - })); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[3]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseSheep disguise = new DisguiseSheep(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setColor(DyeColor.WHITE); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java index db9710e9c..119b90b7c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java @@ -1,17 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Horse; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Horse.Variant; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; @@ -23,112 +11,118 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.*; +import org.bukkit.entity.Horse.Variant; +import org.bukkit.inventory.ItemStack; public class KitSkeletalHorse extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.4, 0.3, 6), + new PerkDoubleJump("Double Jump", 1, 1, false), + new PerkHorseKick(), + new PerkBoneRush(), + new PerkDeadlyBones() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BONE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Kick", + new String[]{ + ChatColor.RESET + "Stand on your hind legs and maul enemies", + ChatColor.RESET + "in front of you with your front legs, ", + ChatColor.RESET + "dealing damage and large knockback.", + + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Rush", + new String[]{ + ChatColor.RESET + "Charge forth in a deadly wave of bones.", + ChatColor.RESET + "Bones deal small damage and knockback.", + ChatColor.RESET + "", + ChatColor.RESET + "Holding Crouch will prevent you from", + ChatColor.RESET + "moving forward with the bones.", + }), + ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deadly Bones", + new String[]{ + ChatColor.RESET + "Whenever you take damage, you drop a bone", + ChatColor.RESET + "which will explode after a few seconds", + ChatColor.RESET + "dealing damage and knockback to enemies." + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Storm", + new String[]{ + ChatColor.RESET + "Charge forth in a mighty bone storm.", + ChatColor.RESET + "Bones deal damage and knockback.", + ChatColor.RESET + "", + ChatColor.RESET + "Holding Crouch will prevent you from", + ChatColor.RESET + "moving forward with the bones.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitSkeletalHorse(ArcadeManager manager) { - super(manager, "Skeletal Horse", KitAvailability.Gem, 7000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.4, 0.3, 6), - new PerkDoubleJump("Double Jump", 1, 1, false), - new PerkHorseKick(), - new PerkBoneRush(), - new PerkDeadlyBones() - - }, - EntityType.HORSE, - new ItemStack(Material.BONE), - "Bone Storm", 20000, Sound.HORSE_SKELETON_DEATH); + super(manager, "Skeletal Horse", KitAvailability.Gem, 7000, DESCRIPTION, PERKS, EntityType.HORSE, IN_HAND, "Bone Storm", 20000, Sound.HORSE_SKELETON_DEATH); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Kick", - new String[] - { - ChatColor.RESET + "Stand on your hind legs and maul enemies", - ChatColor.RESET + "in front of you with your front legs, ", - ChatColor.RESET + "dealing damage and large knockback.", - - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Rush", - new String[] - { - ChatColor.RESET + "Charge forth in a deadly wave of bones.", - ChatColor.RESET + "Bones deal small damage and knockback.", - ChatColor.RESET + "", - ChatColor.RESET + "Holding Crouch will prevent you from", - ChatColor.RESET + "moving forward with the bones.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1, - C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deadly Bones", - new String[] - { - ChatColor.RESET + "Whenever you take damage, you drop a bone", - ChatColor.RESET + "which will explode after a few seconds", - ChatColor.RESET + "dealing damage and knockback to enemies." - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Storm", - new String[] - { - ChatColor.RESET + "Charge forth in a mighty bone storm.", - ChatColor.RESET + "Bones deal damage and knockback.", - ChatColor.RESET + "", - ChatColor.RESET + "Holding Crouch will prevent you from", - ChatColor.RESET + "moving forward with the bones.", - })); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { player.getInventory().remove(Material.IRON_SPADE); player.getInventory().remove(Material.IRON_AXE); - + UtilInv.Update(player); } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseHorse disguise = new DisguiseHorse(player); disguise.setType(Variant.SKELETON_HORSE); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - + @Override public Entity SpawnEntity(Location loc) { @@ -145,14 +139,14 @@ public class KitSkeletalHorse extends SmashKit if (type == EntityType.HORSE) { - Horse horse = (Horse)entity; + Horse horse = (Horse) entity; horse.setAdult(); horse.setVariant(Variant.SKELETON_HORSE); } UtilEnt.Vegetate(entity); - SpawnCustom(entity); + SpawnCustom(entity); return entity; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java index 51ae9b75e..cb9adbe24 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeleton.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSkeleton; @@ -16,107 +9,115 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkBoneExplosion; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; -import nautilus.game.arcade.kit.perks.PerkRopedArrow; -import nautilus.game.arcade.kit.perks.PerkSkeletonArrowStorm; -import nautilus.game.arcade.kit.perks.PerkSmashStats; +import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitSkeleton extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(5, 1.25, 0.15, 6), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkFletcher(3, 3, false), + new PerkKnockbackArrow(1.5), + new PerkBoneExplosion(), + new PerkRopedArrow("Roped Arrow", 1, 5000), + new PerkBarrage(5, 300, true, false, true), + new PerkSkeletonArrowStorm() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Explosion", + new String[] + { + ChatColor.RESET + "Releases an explosion of bones from", + ChatColor.RESET + "your body, repelling all nearby enemies.", + }), + ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, + C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Roped Arrow", + new String[] + { + ChatColor.RESET + "Instantly fires an arrow. When it ", + ChatColor.RESET + "collides with something, you are pulled", + ChatColor.RESET + "towards it, with great power.", + }), + ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte) 0, 1, + C.cYellow + C.Bold + "Charge Bow" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Barrage", + new String[] + { + ChatColor.RESET + "Slowly load more arrows into your bow.", + ChatColor.RESET + "When you release, you will quickly fire", + ChatColor.RESET + "all the arrows in succession.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Arrow Storm", + new String[] + { + ChatColor.RESET + "Fire hundreds of arrows in quick succession", + ChatColor.RESET + "which deal damage and knockback to enemies.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + + public KitSkeleton(ArcadeManager manager) { - super(manager, "Skeleton", KitAvailability.Free, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(5, 1.25, 0.15, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkFletcher(3, 3, false), - new PerkKnockbackArrow(1.5), - new PerkBoneExplosion(), - new PerkRopedArrow("Roped Arrow", 1, 5000), - new PerkBarrage(5, 300, true, false, true), - new PerkSkeletonArrowStorm() - }, - EntityType.SKELETON, - new ItemStack(Material.BOW), - "Arrow Storm", 8000, Sound.SKELETON_HURT); + super(manager, "Skeleton", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, "Arrow Storm", 8000, Sound.SKELETON_HURT); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Explosion", - new String[] - { - ChatColor.RESET + "Releases an explosion of bones from", - ChatColor.RESET + "your body, repelling all nearby enemies.", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, - C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Roped Arrow", - new String[] - { - ChatColor.RESET + "Instantly fires an arrow. When it ", - ChatColor.RESET + "collides with something, you are pulled", - ChatColor.RESET + "towards it, with great power.", - })); + + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1, - C.cYellow + C.Bold + "Charge Bow" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Barrage", - new String[] - { - ChatColor.RESET + "Slowly load more arrows into your bow.", - ChatColor.RESET + "When you release, you will quickly fire", - ChatColor.RESET + "all the arrows in succession.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Arrow Storm", - new String[] - { - ChatColor.RESET + "Fire hundreds of arrows in quick succession", - ChatColor.RESET + "which deal damage and knockback to enemies.", - })); + { + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + } - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseSkeleton disguise = new DisguiseSkeleton(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) + { disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + } else + { disguise.setName(player.getName()); - + } + disguise.setCustomNameVisible(true); disguise.hideArmor(); Manager.GetDisguise().disguise(disguise); 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..4f133927e 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 @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSquid; @@ -17,118 +10,122 @@ import nautilus.game.arcade.game.games.smash.perks.PerkFishFlurry; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkInkBlast; -import nautilus.game.arcade.kit.perks.PerkSmashStats; -import nautilus.game.arcade.kit.perks.PerkStormSquid; -import nautilus.game.arcade.kit.perks.PerkSuperSquid; +import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitSkySquid extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.5, 0.25, 5), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkSuperSquid(), + new PerkInkBlast(7, 2), + new PerkFishFlurry(), + new PerkStormSquid() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.INK_SACK); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ink Shotgun", + new String[] + { + ChatColor.RESET + "Blasts 7 ink pellets out at high velocity.", + ChatColor.RESET + "They explode upon hitting something, dealing", + ChatColor.RESET + "damage and knockback.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Super Squid", + new String[]{ + ChatColor.RESET + "You become invulnerable and fly through", + ChatColor.RESET + "the sky in the direction you are looking.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fish Flurry", + new String[]{ + ChatColor.RESET + "Target a location to create a geyser.", + ChatColor.RESET + "After a few seconds, the geyser will explode", + ChatColor.RESET + "with all sorts of marine life which will", + ChatColor.RESET + "damage nearby opponents.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Storm Squid", + new String[]{ + ChatColor.RESET + "Gain permanent flight, as well as the ability", + ChatColor.RESET + "to strike lightning at your target location", + ChatColor.RESET + "after a short delay.", + }), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Lightning Strike", + new String[]{ + ChatColor.RESET + "Strikes lightning at target location after", + ChatColor.RESET + "a short delay. Deals large damage and knockback.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + null + }; + + public KitSkySquid(ArcadeManager manager) { - super(manager, "Sky Squid", KitAvailability.Gem, 3000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.5, 0.25, 5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkSuperSquid(), - new PerkInkBlast(7, 2), - new PerkFishFlurry(), - new PerkStormSquid() - }, - EntityType.SQUID, - new ItemStack(Material.INK_SACK), - "Storm Squid", 24000, Sound.SPLASH2); + super(manager, "Sky Squid", KitAvailability.Gem, 3000, DESCRIPTION, PERKS, EntityType.SQUID, IN_HAND, "Storm Squid", 24000, Sound.SPLASH2); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ink Shotgun", - new String[] - { - ChatColor.RESET + "Blasts 7 ink pellets out at high velocity.", - ChatColor.RESET + "They explode upon hitting something, dealing", - ChatColor.RESET + "damage and knockback.", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Super Squid", - new String[] - { - ChatColor.RESET + "You become invulnerable and fly through", - ChatColor.RESET + "the sky in the direction you are looking.", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fish Flurry", - new String[] - { - ChatColor.RESET + "Target a location to create a geyser.", - ChatColor.RESET + "After a few seconds, the geyser will explode", - ChatColor.RESET + "with all sorts of marine life which will", - ChatColor.RESET + "damage nearby opponents.", - })); - + + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1], PLAYER_ITEMS[2]); + if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Storm Squid", - new String[] - { - ChatColor.RESET + "Gain permanent flight, as well as the ability", - ChatColor.RESET + "to strike lightning at your target location", - ChatColor.RESET + "after a short delay.", - })); + player.getInventory().addItem(PLAYER_ITEMS[3]); - - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { player.getInventory().remove(Material.IRON_SWORD); player.getInventory().remove(Material.IRON_AXE); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Lightning Strike", - new String[] - { - ChatColor.RESET + "Strikes lightning at target location after", - ChatColor.RESET + "a short delay. Deals large damage and knockback.", - })); - + + player.getInventory().addItem(PLAYER_ITEMS[4]); + UtilInv.Update(player); } - + @Override - public void GiveItems(Player player) - { + public void GiveItems(Player player) + { giveCoreItems(player); - + //Disguise DisguiseSquid disguise = new DisguiseSquid(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - + @Override public void activateSuperCustom(Player player) { @@ -137,7 +134,7 @@ public class KitSkySquid extends SmashKit Manager.GetGame().WorldData.World.setThundering(true); Manager.GetGame().WorldData.World.setThunderDuration(9999); } - + @Override public void deactivateSuperCustom(Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java index 1adeb73a4..c8a1915d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSlime.java @@ -1,20 +1,6 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBase; @@ -32,147 +18,160 @@ import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkSlimeRocket; import nautilus.game.arcade.kit.perks.PerkSlimeSlam; import nautilus.game.arcade.kit.perks.PerkSmashStats; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; public class KitSlime extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.75, 0.5, 3), + new PerkDoubleJump("Double Jump", 1.2, 1, false), + new PerkSlimeSlam(), + new PerkSlimeRocket() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SLIME_BALL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Slime Rocket", + new String[]{ + ChatColor.RESET + "Slowly transfer your slimey goodness into", + ChatColor.RESET + "a new slime. When you release block, the", + ChatColor.RESET + "new slime is propelled forward.", + ChatColor.RESET + "", + ChatColor.RESET + "The more you charge the ability, the stronger", + ChatColor.RESET + "the new slime is projected forwards.", + ChatColor.RESET + "", + ChatColor.RESET + C.cAqua + "Slime Rocket uses Energy (Experience Bar)", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Slime Slam", + new String[]{ + ChatColor.RESET + "Throw your slimey body forwards. If you hit", + ChatColor.RESET + "another player before you land, you deal", + ChatColor.RESET + "large damage and knockback to them.", + ChatColor.RESET + "", + ChatColor.RESET + "However, you take 50% of the damage and", + ChatColor.RESET + "knockback in the opposite direction.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Giga Slime", + new String[]{ + ChatColor.RESET + "Grow into a gigantic slime that deals damage", + ChatColor.RESET + "and knockback to anyone that comes nearby.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + null, + null, + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitSlime(ArcadeManager manager) { - super(manager, "Slime", KitAvailability.Free, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.75, 0.5, 3), - new PerkDoubleJump("Double Jump", 1.2, 1, false), - new PerkSlimeSlam(), - new PerkSlimeRocket(), - }, - EntityType.SLIME, - new ItemStack(Material.SLIME_BALL), - "Giga Slime", 24000, Sound.SLIME_ATTACK); + super(manager, "Slime", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND, "Giga Slime", 24000, Sound.SLIME_ATTACK); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Slime Rocket", - new String[] - { - ChatColor.RESET + "Slowly transfer your slimey goodness into", - ChatColor.RESET + "a new slime. When you release block, the", - ChatColor.RESET + "new slime is propelled forward.", - ChatColor.RESET + "", - ChatColor.RESET + "The more you charge the ability, the stronger", - ChatColor.RESET + "the new slime is projected forwards.", - ChatColor.RESET + "", - ChatColor.RESET + C.cAqua + "Slime Rocket uses Energy (Experience Bar)", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Slime Slam", - new String[] - { - ChatColor.RESET + "Throw your slimey body forwards. If you hit", - ChatColor.RESET + "another player before you land, you deal", - ChatColor.RESET + "large damage and knockback to them.", - ChatColor.RESET + "", - ChatColor.RESET + "However, you take 50% of the damage and", - ChatColor.RESET + "knockback in the opposite direction.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Giga Slime", - new String[] - { - ChatColor.RESET + "Grow into a gigantic slime that deals damage", - ChatColor.RESET + "and knockback to anyone that comes nearby.", - })); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[2]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { player.getInventory().remove(Material.IRON_SWORD); player.getInventory().remove(Material.IRON_AXE); - + UtilInv.Update(player); } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseSlime disguise = new DisguiseSlime(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); - + disguise.SetSize(3); } - + @Override public void activateSuperCustom(Player player) { DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); if (disguise != null && disguise instanceof DisguiseSlime) { - DisguiseSlime slime = (DisguiseSlime)disguise; + DisguiseSlime slime = (DisguiseSlime) disguise; slime.SetSize(14); Manager.GetDisguise().updateDisguise(slime); } - + player.setExp(0.99f); - + Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 2, false, false, false); } - + @Override public void deactivateSuperCustom(Player player) { Manager.GetCondition().EndCondition(player, ConditionType.SPEED, "Giga Slime"); } - + @EventHandler(priority = EventPriority.LOW) public void immunityDamagee(CustomDamageEvent event) { if (event.GetDamageePlayer() == null || event.GetDamagerEntity(true) == null) return; - + if (this.isSuperActive(event.GetDamageePlayer())) event.SetCancelled(getSuperName()); } - + @EventHandler(priority = EventPriority.LOW) public void immunityDamager(CustomDamageEvent event) { if (event.GetCause() != DamageCause.ENTITY_ATTACK) return; - + if (event.GetDamagerPlayer(true) == null) return; - + if (isSuperActive(event.GetDamagerPlayer(true))) event.SetCancelled(getSuperName()); } - + @EventHandler public void collide(UpdateEvent event) { @@ -181,19 +180,19 @@ public class KitSlime extends SmashKit { if (player.equals(other)) continue; - + if (Manager.isSpectator(other)) continue; - + if (UtilMath.offset(player.getLocation().add(0, 3, 0), other.getLocation()) < 5) { - Manager.GetDamage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, 8, true, false, false, - player.getName(), GetName()); - + Manager.GetDamage().NewDamageEvent(other, player, null, + DamageCause.CUSTOM, 8, true, false, false, + player.getName(), GetName()); + UtilParticle.PlayParticle(ParticleType.SLIME, other.getLocation().add(0, 0.6, 0), 1f, 1f, 1f, 0, 20, - ViewDist.LONG, UtilServer.getPlayers()); - + ViewDist.LONG, UtilServer.getPlayers()); + player.getWorld().playSound(other.getLocation(), Sound.SLIME_ATTACK, 3f, 1f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index 4771d3865..3b877ec1f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSnowman; @@ -16,111 +9,108 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkArcticAura; -import nautilus.game.arcade.kit.perks.PerkBlizzard; -import nautilus.game.arcade.kit.perks.PerkDamageSnow; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkIcePath; -import nautilus.game.arcade.kit.perks.PerkSmashStats; -import nautilus.game.arcade.kit.perks.PerkSnowTurret; +import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitSnowman extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(5.5, 1.4, 0.3, 6), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkDamageSnow(1, 0.4), + new PerkArcticAura(), + new PerkBlizzard(), + new PerkIcePath(), + new PerkSnowTurret() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blizzard", + new String[]{ + ChatColor.RESET + "Release a windy torrent of snow, able", + ChatColor.RESET + "to blow opponents off the stage.", + ChatColor.RESET + "", + ChatColor.RESET + C.cAqua + "Blizzard uses Energy (Experience Bar)", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ice Path", + new String[]{ + ChatColor.RESET + "Create a temporary icy path in the", + ChatColor.RESET + "direction you are looking.", + }), + ItemStackFactory.Instance.CreateStack(Material.SNOW_BLOCK, (byte) 0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Arctic Aura", + new String[]{ + ChatColor.RESET + "Creates a field of snow around you", + ChatColor.RESET + "granting +1 damage and 60% knockback", + ChatColor.RESET + "to opponents standing on it.", + ChatColor.RESET + "", + ChatColor.RESET + "Your aura shrinks on low energy.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Snow Turret", + new String[]{ + ChatColor.RESET + "Spawn three snow turrets that continously", + ChatColor.RESET + "throw snowballs at the nearest enemy,", + ChatColor.RESET + "dealing damage and knockback.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitSnowman(ArcadeManager manager) { - super(manager, "Snowman", KitAvailability.Gem, 5000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(5.5, 1.4, 0.3, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkDamageSnow(1, 0.4), - new PerkArcticAura(), - new PerkBlizzard(), - new PerkIcePath(), - new PerkSnowTurret(), - }, - EntityType.SNOWMAN, - new ItemStack(Material.SNOW_BALL), - "Snow Turret", 0, Sound.STEP_SNOW); - + super(manager, "Snowman", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SNOWMAN, IN_HAND, "Snow Turret", 0, Sound.STEP_SNOW); setSuperCharges(3); } @Override public void giveCoreItems(Player player) { - + } - + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Blizzard", - new String[] - { - ChatColor.RESET + "Release a windy torrent of snow, able", - ChatColor.RESET + "to blow opponents off the stage.", - ChatColor.RESET + "", - ChatColor.RESET + C.cAqua + "Blizzard uses Energy (Experience Bar)", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ice Path", - new String[] - { - ChatColor.RESET + "Create a temporary icy path in the", - ChatColor.RESET + "direction you are looking.", - })); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BLOCK, (byte)0, 1, - C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Arctic Aura", - new String[] - { - ChatColor.RESET + "Creates a field of snow around you", - ChatColor.RESET + "granting +1 damage and 60% knockback", - ChatColor.RESET + "to opponents standing on it.", - ChatColor.RESET + "", - ChatColor.RESET + "Your aura shrinks on low energy.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Snow Turret", - new String[] - { - ChatColor.RESET + "Spawn three snow turrets that continously", - ChatColor.RESET + "throw snowballs at the nearest enemy,", - ChatColor.RESET + "dealing damage and knockback.", - })); + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); - //Disguise DisguiseSnowman disguise = new DisguiseSnowman(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index 89cfb0379..87ae8f0b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSpider; @@ -16,119 +9,117 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkSmashStats; -import nautilus.game.arcade.kit.perks.PerkSpiderLeap; -import nautilus.game.arcade.kit.perks.PerkNeedler; -import nautilus.game.arcade.kit.perks.PerkSpidersNest; -import nautilus.game.arcade.kit.perks.PerkWebShot; +import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitSpider extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.5, 0.25, 6), + new PerkSpiderLeap(), + new PerkNeedler(), + new PerkWebShot(), + new PerkSpidersNest() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.WEB); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Needler", + new String[]{ + ChatColor.RESET + "Quickly spray up to 5 needles from ", + ChatColor.RESET + "your mouth, dealing damage and small", + ChatColor.RESET + "knockback to opponents.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Spin Web", + new String[]{ + ChatColor.RESET + "Spray out webs behind you, launching", + ChatColor.RESET + "yourself forwards. Webs will damage", + ChatColor.RESET + "opponents and spawn temporary web blocks.", + }), + ItemStackFactory.Instance.CreateStack(Material.SPIDER_EYE, (byte) 0, 1, + C.cYellow + C.Bold + "Double Jump" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Spider Leap", + new String[]{ + ChatColor.RESET + "Your double jump is special. It goes", + ChatColor.RESET + "exactly in the direction you are looking.", + ChatColor.RESET + "", + ChatColor.RESET + C.cAqua + "Spider Leap uses Energy (Experience Bar)", + }), + ItemStackFactory.Instance.CreateStack(Material.FERMENTED_SPIDER_EYE, (byte) 0, 1, + C.cYellow + C.Bold + "Crouch" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wall Climb", + new String[]{ + ChatColor.RESET + "While crouching, you climb up walls.", + ChatColor.RESET + "", + ChatColor.RESET + "Climbing a wall allows you to use", + ChatColor.RESET + "Spider Leap one more time.", + ChatColor.RESET + "", + ChatColor.RESET + C.cAqua + "Wall Climb uses Energy (Experience Bar)", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Spiders Nest", + new String[]{ + ChatColor.RESET + "Spawn a nest of webs around you to trap", + ChatColor.RESET + "enemy players. Your attacks heal you and", + ChatColor.RESET + "permanently increase your health. ", + ChatColor.RESET + "", + ChatColor.RESET + "Your abilities have a one second recharge.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitSpider(ArcadeManager manager) { - super(manager, "Spider", KitAvailability.Free, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.5, 0.25, 6), - new PerkSpiderLeap(), - new PerkNeedler(), - new PerkWebShot(), - new PerkSpidersNest() - }, - EntityType.SPIDER, - new ItemStack(Material.WEB), - "Spider Nest", 30000, Sound.SPIDER_DEATH); + super(manager, "Spider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SPIDER, IN_HAND, "Spider Nest", 30000, Sound.SPIDER_DEATH); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Needler", - new String[] - { - ChatColor.RESET + "Quickly spray up to 5 needles from ", - ChatColor.RESET + "your mouth, dealing damage and small", - ChatColor.RESET + "knockback to opponents.", - })); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Spin Web", - new String[] - { - ChatColor.RESET + "Spray out webs behind you, launching", - ChatColor.RESET + "yourself forwards. Webs will damage", - ChatColor.RESET + "opponents and spawn temporary web blocks.", - })); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SPIDER_EYE, (byte)0, 1, - C.cYellow + C.Bold + "Double Jump" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Spider Leap", - new String[] - { - ChatColor.RESET + "Your double jump is special. It goes", - ChatColor.RESET + "exactly in the direction you are looking.", - ChatColor.RESET + "", - ChatColor.RESET + C.cAqua + "Spider Leap uses Energy (Experience Bar)", - })); + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3], PLAYER_ITEMS[4]); - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FERMENTED_SPIDER_EYE, (byte)0, 1, - C.cYellow + C.Bold + "Crouch" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wall Climb", - new String[] - { - ChatColor.RESET + "While crouching, you climb up walls.", - ChatColor.RESET + "", - ChatColor.RESET + "Climbing a wall allows you to use", - ChatColor.RESET + "Spider Leap one more time.", - ChatColor.RESET + "", - ChatColor.RESET + C.cAqua + "Wall Climb uses Energy (Experience Bar)", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Spiders Nest", - new String[] - { - ChatColor.RESET + "Spawn a nest of webs around you to trap", - ChatColor.RESET + "enemy players. Your attacks heal you and", - ChatColor.RESET + "permanently increase your health. ", - ChatColor.RESET + "", - ChatColor.RESET + "Your abilities have a one second recharge.", - })); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { - + } - - @Override - public void GiveItems(Player player) + + @Override + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseSpider disguise = new DisguiseSpider(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index e9b222193..6a7bfc74f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseWitch; @@ -17,125 +10,134 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitWitch extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.5, 0.3, 5), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkWitchPotion(), + new PerkBatWave(), + new PerkBatForm() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.POTION); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Daze Potion", + new String[] + { + ChatColor.RESET + "Throw a potion that damages and slows", + ChatColor.RESET + "anything it splashes onto!", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bat Wave", + new String[] + { + ChatColor.RESET + "Release a wave of bats which give", + ChatColor.RESET + "damage and knockback to anything they", + ChatColor.RESET + "collide with.", + }), + ItemStackFactory.Instance.CreateStack(Material.LEASH, (byte) 0, 1, + C.cYellow + C.Bold + "Double Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bat Leash", + new String[] + { + ChatColor.RESET + "Attach a rope to your wave of bats,", + ChatColor.RESET + "causing you to be pulled behind them!", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bat Form", + new String[] + { + ChatColor.RESET + "Transform into a bat that can fly and", + ChatColor.RESET + "launch powerful sonic blasts at opponents,", + ChatColor.RESET + "dealing damage and knockback.", + }), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Sonic Boom", + new String[] + { + ChatColor.RESET + "Screech loudly to create a sonic boom", + ChatColor.RESET + "that deals damage and knockback to enemies!", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + null + }; + public KitWitch(ArcadeManager manager) { - super(manager, "Witch", KitAvailability.Gem, 6000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.5, 0.3, 5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkWitchPotion(), - new PerkBatWave(), - new PerkBatForm() - - - }, - EntityType.WITCH, - new ItemStack(Material.POTION), - "Bat Form", 20000, Sound.BAT_HURT); + super(manager, "Witch", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.WITCH, IN_HAND, "Bat Form", 20000, Sound.BAT_HURT); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Daze Potion", - new String[] - { - ChatColor.RESET + "Throw a potion that damages and slows", - ChatColor.RESET + "anything it splashes onto!", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bat Wave", - new String[] - { - ChatColor.RESET + "Release a wave of bats which give", - ChatColor.RESET + "damage and knockback to anything they", - ChatColor.RESET + "collide with.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.LEASH, (byte)0, 1, - C.cYellow + C.Bold + "Double Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bat Leash", - new String[] - { - ChatColor.RESET + "Attach a rope to your wave of bats,", - ChatColor.RESET + "causing you to be pulled behind them!", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bat Form", - new String[] - { - ChatColor.RESET + "Transform into a bat that can fly and", - ChatColor.RESET + "launch powerful sonic blasts at opponents,", - ChatColor.RESET + "dealing damage and knockback.", - })); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { player.getInventory().remove(Material.IRON_SPADE); player.getInventory().remove(Material.IRON_AXE); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Sonic Boom", - new String[] - { - ChatColor.RESET + "Screech loudly to create a sonic boom", - ChatColor.RESET + "that deals damage and knockback to enemies!", - })); - + + player.getInventory().addItem(PLAYER_ITEMS[4]); + UtilInv.Update(player); } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseWitch disguise = new DisguiseWitch(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - + @Override public void activateSuperCustom(Player player) { for (Perk perk : GetPerks()) if (perk instanceof PerkDoubleJump) - ((PerkDoubleJump)perk).disableForPlayer(player); + ((PerkDoubleJump) perk).disableForPlayer(player); } - + @Override public void deactivateSuperCustom(Player player) { for (Perk perk : GetPerks()) if (perk instanceof PerkDoubleJump) - ((PerkDoubleJump)perk).enableForPlayer(player); + ((PerkDoubleJump) perk).enableForPlayer(player); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index 892878acc..b59a1bd66 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -1,13 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton.SkeletonType; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSkeleton; @@ -17,104 +9,111 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSmashStats; -import nautilus.game.arcade.kit.perks.PerkWitherForm; -import nautilus.game.arcade.kit.perks.PerkWitherImage; -import nautilus.game.arcade.kit.perks.PerkWitherSkull; +import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton.SkeletonType; +import org.bukkit.inventory.ItemStack; public class KitWitherSkeleton extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.2, 0.3, 6), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkWitherSkull(), + new PerkWitherImage(), + new PerkWitherForm() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Guided Wither Skull", + new String[]{ + ChatColor.RESET + "Launch a Wither Skull forwards, hold", + ChatColor.RESET + "block to guide the missile! Release", + ChatColor.RESET + "block to detonate it midair.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Image", + new String[]{ + ChatColor.RESET + "Create an exact image of yourself.", + ChatColor.RESET + "The copy is launched forwards with", + ChatColor.RESET + "high speeds. Lasts 8 seconds.", + ChatColor.RESET + "", + ChatColor.RESET + "Use the skill again to swap positions", + ChatColor.RESET + "with your image.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Form", + new String[]{ + ChatColor.RESET + "Transform into a legendary Wither that is", + ChatColor.RESET + "able to launch wither skulls at opponents,", + ChatColor.RESET + "dealing damage and knockback.", + }), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull", + new String[]{ + ChatColor.RESET + "Launch a deadly Wither Skull forwards.", + }) + }; + + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS) + }; + + public KitWitherSkeleton(ArcadeManager manager) { - super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.2, 0.3, 6), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkWitherSkull(), - new PerkWitherImage(), - new PerkWitherForm() - }, - EntityType.SKELETON, - new ItemStack(Material.IRON_SWORD), - "Wither Form", 18000, Sound.WITHER_SPAWN); + super(manager, "Wither Skeleton", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, "Wither Form", 18000, Sound.WITHER_SPAWN); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, - C.cYellow + C.Bold + "Hold Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Guided Wither Skull", - new String[] - { - ChatColor.RESET + "Launch a Wither Skull forwards, hold", - ChatColor.RESET + "block to guide the missile! Release", - ChatColor.RESET + "block to detonate it midair.", - })); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Image", - new String[] - { - ChatColor.RESET + "Create an exact image of yourself.", - ChatColor.RESET + "The copy is launched forwards with", - ChatColor.RESET + "high speeds. Lasts 8 seconds.", - ChatColor.RESET + "", - ChatColor.RESET + "Use the skill again to swap positions", - ChatColor.RESET + "with your image.", - })); - + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Form", - new String[] - { - ChatColor.RESET + "Transform into a legendary Wither that is", - ChatColor.RESET + "able to launch wither skulls at opponents,", - ChatColor.RESET + "dealing damage and knockback.", - })); + player.getInventory().addItem(PLAYER_ITEMS[2]); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { player.getInventory().remove(Material.IRON_SWORD); player.getInventory().remove(Material.IRON_AXE); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull", - new String[] - { - ChatColor.RESET + "Launch a deadly Wither Skull forwards.", - })); - + + player.getInventory().addItem(PLAYER_ARMOR[3]); + UtilInv.Update(player); } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseSkeleton disguise = new DisguiseSkeleton(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); disguise.setCustomNameVisible(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java index 71e08c798..d6bcf19a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWolf.java @@ -1,18 +1,10 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; @@ -21,122 +13,131 @@ import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkSmashStats; import nautilus.game.arcade.kit.perks.PerkWolf; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitWolf extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(5, 1.6, 0.25, 4.5), + new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true), + new PerkWolf() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BONE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cub Tackle", + new String[]{ + ChatColor.RESET + "Launch a wolf cub at an opponent.", + ChatColor.RESET + "If it hits, the cub latches onto the", + ChatColor.RESET + "opponent, preventing them from moving", + ChatColor.RESET + "for up to 5 seconds.", + }), + ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wolf Strike", + new String[]{ + ChatColor.RESET + "Leap forward with great power.", + ChatColor.RESET + "If you collide with an enemy, you deal", + ChatColor.RESET + "damage to them. If they are being tackled", + ChatColor.RESET + "by a cub, it deals 300% Knockback.", + }), + ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, + C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ravage", + new String[]{ + ChatColor.RESET + "When you attack someone, you receive", + ChatColor.RESET + "+1 Damage for 3 seconds. Bonus damage", + ChatColor.RESET + "stacks from multiple hits.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Frenzy", + new String[]{ + ChatColor.RESET + "Gain incredible speed, regeneration", + ChatColor.RESET + "and damage. All your abilities recharge", + ChatColor.RESET + "extremely rapidly.", + }) + }; + + + private static final ItemStack[] PLAYER_ARMOR = { + null, + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + null + }; + + public KitWolf(ArcadeManager manager) { - super(manager, "Wolf", KitAvailability.Gem, 4000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(5, 1.6, 0.25, 4.5), - new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true), - new PerkWolf(), - }, - EntityType.WOLF, - new ItemStack(Material.BONE), - "Frenzy", 30000, Sound.WOLF_HOWL); + super(manager, "Wolf", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.WOLF, IN_HAND, "Frenzy", 30000, Sound.WOLF_HOWL); } @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Cub Tackle", - new String[] - { - ChatColor.RESET + "Launch a wolf cub at an opponent.", - ChatColor.RESET + "If it hits, the cub latches onto the", - ChatColor.RESET + "opponent, preventing them from moving", - ChatColor.RESET + "for up to 5 seconds.", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wolf Strike", - new String[] - { - ChatColor.RESET + "Leap forward with great power.", - ChatColor.RESET + "If you collide with an enemy, you deal", - ChatColor.RESET + "damage to them. If they are being tackled", - ChatColor.RESET + "by a cub, it deals 300% Knockback.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1, - C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Ravage", - new String[] - { - ChatColor.RESET + "When you attack someone, you receive", - ChatColor.RESET + "+1 Damage for 3 seconds. Bonus damage", - ChatColor.RESET + "stacks from multiple hits.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Frenzy", - new String[] - { - ChatColor.RESET + "Gain incredible speed, regeneration", - ChatColor.RESET + "and damage. All your abilities recharge", - ChatColor.RESET + "extremely rapidly.", - })); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); + + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseWolf disguise = new DisguiseWolf(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - + @Override public void activateSuperCustom(Player player) { Manager.GetCondition().Factory().Strength(GetName(), player, player, 30, 1, false, false, false); Manager.GetCondition().Factory().Speed(GetName(), player, player, 30, 2, false, false, false); Manager.GetCondition().Factory().Regen(GetName(), player, player, 30, 2, false, false, false); - + DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); if (disguise instanceof DisguiseWolf) { - ((DisguiseWolf)disguise).setAngry(true); + ((DisguiseWolf) disguise).setAngry(true); Manager.GetDisguise().updateDisguise(disguise); } } - + @Override public void deactivateSuperCustom(Player player) { DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); if (disguise instanceof DisguiseWolf) { - ((DisguiseWolf)disguise).setAngry(false); + ((DisguiseWolf) disguise).setAngry(false); Manager.GetDisguise().updateDisguise(disguise); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java index 7ab935e7c..6f2d17e76 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitZombie.java @@ -1,12 +1,5 @@ package nautilus.game.arcade.game.games.smash.kits; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseZombie; @@ -16,111 +9,110 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkKnockbackArrow; -import nautilus.game.arcade.kit.perks.PerkNightLivingDead; -import nautilus.game.arcade.kit.perks.PerkOvercharge; -import nautilus.game.arcade.kit.perks.PerkSmashStats; -import nautilus.game.arcade.kit.perks.PerkDeathsGrasp; -import nautilus.game.arcade.kit.perks.PerkZombieBile; +import nautilus.game.arcade.kit.perks.*; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitZombie extends SmashKit { + private static final String[] DESCRIPTION = { + }; + + private static final Perk[] PERKS = { + new PerkSmashStats(6, 1.25, 0.25, 5), + new PerkDoubleJump("Double Jump", 0.9, 0.9, false), + new PerkFletcher(2, 2, false), + new PerkKnockbackArrow(1.5), + new PerkOvercharge(6, 250, true), + new PerkZombieBile(), + new PerkDeathsGrasp(), + new PerkNightLivingDead() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bile Blaster", + new String[]{ + ChatColor.RESET + "Spew up your dinner from last night.", + ChatColor.RESET + "Deals damage and knockback to enemies.", + }), + ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, + C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp", + new String[]{ + ChatColor.RESET + "Leap forwards. If you collide with an ", + ChatColor.RESET + "opponent, you deal damage, throw them ", + ChatColor.RESET + "behind you and recharge the ability.", + ChatColor.RESET + "", + ChatColor.RESET + "Arrows deal double damage to enemies", + ChatColor.RESET + "recently hit by Deaths Grasp.", + }), + ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte) 0, 1, + C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Corrupted Arrow", + new String[]{ + ChatColor.RESET + "Charge your arrows to corrupt them,", + ChatColor.RESET + "adding up to an additional 6 damage.", + }), + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 1, + C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Night of the Living Dead", + new String[]{ + ChatColor.RESET + "Cast the world into darkness as hundreds", + ChatColor.RESET + "of undead minions sprout up from the ground", + ChatColor.RESET + "to attack your enemies.", + }) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + null, + }; + + public KitZombie(ArcadeManager manager) { - super(manager, "Zombie", KitAvailability.Gem, 6000, - - new String[] - { - }, - - new Perk[] - { - new PerkSmashStats(6, 1.25, 0.25, 5), - new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkFletcher(2, 2, false), - new PerkKnockbackArrow(1.5), - new PerkOvercharge(6, 250, true), - new PerkZombieBile(), - new PerkDeathsGrasp(), - new PerkNightLivingDead() - - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW), - "Night of the Living Dead", 0, Sound.AMBIENCE_CAVE); + super(manager, "Zombie", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND, "Night of the Living Dead", 0, Sound.AMBIENCE_CAVE); } - + @Override public void giveCoreItems(Player player) { UtilInv.Clear(player); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bile Blaster", - new String[] - { - ChatColor.RESET + "Spew up your dinner from last night.", - ChatColor.RESET + "Deals damage and knockback to enemies.", - })); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, - C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp", - new String[] - { - ChatColor.RESET + "Leap forwards. If you collide with an ", - ChatColor.RESET + "opponent, you deal damage, throw them ", - ChatColor.RESET + "behind you and recharge the ability.", - ChatColor.RESET + "", - ChatColor.RESET + "Arrows deal double damage to enemies", - ChatColor.RESET + "recently hit by Deaths Grasp.", - })); - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1, - C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Corrupted Arrow", - new String[] - { - ChatColor.RESET + "Charge your arrows to corrupt them,", - ChatColor.RESET + "adding up to an additional 6 damage.", - })); - - - if (Manager.GetGame().GetState() == GameState.Recruit) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, - C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Night of the Living Dead", - new String[] - { - ChatColor.RESET + "Cast the world into darkness as hundreds", - ChatColor.RESET + "of undead minions sprout up from the ground", - ChatColor.RESET + "to attack your enemies.", - })); + player.getInventory().addItem(PLAYER_ITEMS[0], PLAYER_ITEMS[1]); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + if (Manager.GetGame().GetState() == GameState.Recruit) + player.getInventory().addItem(PLAYER_ITEMS[2], PLAYER_ITEMS[3]); + + + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void giveSuperItems(Player player) { - + } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { giveCoreItems(player); - + //Disguise DisguiseZombie disguise = new DisguiseZombie(player); - if (Manager.GetGame().GetTeam(player) != null) + if (Manager.GetGame().GetTeam(player) != null) disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - else + else disguise.setName(player.getName()); - + disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitInvulnerable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitInvulnerable.java index b8b523540..40f93512f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitInvulnerable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitInvulnerable.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.snake.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -8,45 +14,37 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Sheep; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseSheep; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitInvulnerable extends Kit +public class KitInvulnerable extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Able to temporarily travel through tails.", + "", + C.cYellow + "Click" + C.cWhite + " with Nether Star to use " + C.cGreen + "Invulnerability",}; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.NETHER_STAR); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte) 0, 2, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Invulnerability") + }; + public KitInvulnerable(ArcadeManager manager) { - super(manager, "Super Snake", KitAvailability.Gem, 5000, - - new String[] - { - "Able to temporarily travel through tails.", - "", - C.cYellow + "Click" + C.cGray + " with Nether Star to use " + C.cGreen + "Invulnerability", - }, - - new Perk[] - { - - }, - EntityType.SHEEP, - new ItemStack(Material.WOOL)); + super(manager, "Super Snake", "snakeinvulnerable", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SHEEP, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 2, - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Invulnerability")); + player.getInventory().addItem(PLAYER_ITEMS); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { - ((Sheep)ent).setColor(DyeColor.LIME); + ((Sheep) ent).setColor(DyeColor.LIME); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitReverser.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitReverser.java index 4a92d484c..05aa3c252 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitReverser.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitReverser.java @@ -1,61 +1,61 @@ package nautilus.game.arcade.game.games.snake.kits; +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Sheep; -import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; -import mineplex.core.achievement.Achievement; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitReverser extends Kit +public class KitReverser extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Stuck in a dead end?! Change direction!", + "", + C.cYellow + "Click" + C.cWhite + " with Cookie to use " + C.cGreen + "Reverse" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.COOKIE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.COOKIE, (byte) 0, 3, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Reverse") + }; + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.SNAKE_CANNIBAL, + Achievement.SNAKE_CHOO_CHOO, + Achievement.SNAKE_SLIMY_SHEEP, + Achievement.SNAKE_WINS + }; + public KitReverser(ArcadeManager manager) { - super(manager, "Reversal Snake", KitAvailability.Achievement, + super(manager, "Reversal Snake", "snakereversal", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.SHEEP, IN_HAND); - new String[] - { - "Stuck in a dead end?! Change direction!", - "", - C.cYellow + "Click" + C.cGray + " with Cookie to use " + C.cGreen + "Reverse" - }, - - new Perk[] - { - - }, - EntityType.SHEEP, - new ItemStack(Material.WOOL)); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.SNAKE_CANNIBAL, - Achievement.SNAKE_CHOO_CHOO, - Achievement.SNAKE_SLIMY_SHEEP, - Achievement.SNAKE_WINS, - }); + this.setAchievementRequirements(ACHIEVEMENTS); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COOKIE, (byte)0, 3, - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Reverse")); + player.getInventory().addItem(PLAYER_ITEMS); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { - ((Sheep)ent).setColor(DyeColor.MAGENTA); + ((Sheep) ent).setColor(DyeColor.MAGENTA); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitSpeed.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitSpeed.java index f6a211b75..7127fe70e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitSpeed.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitSpeed.java @@ -1,5 +1,11 @@ package nautilus.game.arcade.game.games.snake.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -8,45 +14,38 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Sheep; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseSheep; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitSpeed extends Kit +public class KitSpeed extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Can quickly speed up to take out other snakes.", + "", + C.cYellow + "Click" + C.cWhite + " with Feather to use " + C.cGreen + "Speed Boost" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.FEATHER); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte) 0, 5, + C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Speed Boost") + }; + public KitSpeed(ArcadeManager manager) { - super(manager, "Speedy Snake", KitAvailability.Free, - - new String[] - { - "Can quickly speed up to take out other snakes.", - "", - C.cYellow + "Click" + C.cGray + " with Feather to use " + C.cGreen + "Speed Boost" - }, - - new Perk[] - { - - }, - EntityType.SHEEP, - new ItemStack(Material.WOOL)); + super(manager, "Speedy Snake", "snakespeedy", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SHEEP, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte)0, 5, - C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Speed Boost")); + player.getInventory().addItem(PLAYER_ITEMS); } - + @Override - public void SpawnCustom(LivingEntity ent) + public void SpawnCustom(LivingEntity ent) { - ((Sheep)ent).setColor(DyeColor.YELLOW); + ((Sheep) ent).setColor(DyeColor.YELLOW); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitAssassin.java index c1153bfcb..338697f2a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitAssassin.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitAssassin.java @@ -1,36 +1,45 @@ package nautilus.game.arcade.game.games.sneakyassassins.kits; -import nautilus.game.arcade.*; -import nautilus.game.arcade.kit.*; -import nautilus.game.arcade.kit.perks.*; - -import org.bukkit.*; -import org.bukkit.entity.*; -import org.bukkit.inventory.*; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkSmokebomb; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitAssassin extends SneakyAssassinKit { + + private static final String[] DESCRIPTION = { + "Skilled at ranged assassination!", + "", + C.cYellow + "Right-Click" + C.cWhite + " to " + C.cGreen + "Smoke Bomb" + }; + + private static final Perk[] PERKS = { + new PerkSmokebomb(Material.INK_SACK, 3, true), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW), + ItemStackFactory.Instance.CreateStack(Material.ARROW, 32) + }; + public KitAssassin(ArcadeManager manager, EntityType disguiseType) { - super(manager, "Ranged Assassin", KitAvailability.Gem, - new String[] - { - "Skilled at ranged assassination!" - }, - new Perk[] - { - new PerkSmokebomb(Material.INK_SACK, 3, true) - }, - new ItemStack(Material.BOW), - disguiseType); + super(manager, "Ranged Assassin", KitAvailability.Gem, DESCRIPTION, PERKS, IN_HAND, disguiseType); } @Override public void GiveItems(Player player) { super.GiveItems(player); - - player.getInventory().addItem(new ItemStack(Material.BOW)); - player.getInventory().addItem(new ItemStack(Material.ARROW, 32)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitBriber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitBriber.java index aad17b7d1..c1c7b851e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitBriber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitBriber.java @@ -1,55 +1,63 @@ package nautilus.game.arcade.game.games.sneakyassassins.kits; import mineplex.core.achievement.Achievement; -import mineplex.core.common.util.*; -import mineplex.core.itemstack.*; -import nautilus.game.arcade.*; -import nautilus.game.arcade.kit.*; -import nautilus.game.arcade.kit.perks.*; - -import org.bukkit.*; -import org.bukkit.entity.*; -import org.bukkit.inventory.*; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkSmokebomb; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitBriber extends SneakyAssassinKit { + + private static final String[] DESCRIPTION = { + "Pay Villagers to attack other players!", + "", + C.cYellow + "Right-Click" + C.cWhite + " to " + C.cGreen + "Smoke Bomb" + }; + + private static final Perk[] PERKS = { + new PerkSmokebomb(Material.INK_SACK, 3, true), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.EMERALD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 4, + C.cYellow + C.Bold + "Right-Click Villager" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bribe Villager", + new String[]{ + ChatColor.RESET + "Pay a villager to help you.", + ChatColor.RESET + "It will attack the nearest", + ChatColor.RESET + "enemy for 15 seconds.", + }) + }; + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.SNEAK_ASSASSINS_I_SEE_YOU, + Achievement.SNEAK_ASSASSINS_INCOMPETENCE, + Achievement.SNEAK_ASSASSINS_MASTER_ASSASSIN, + Achievement.SNEAK_ASSASSINS_THE_MASTERS_MASTER, + Achievement.SNEAKY_ASSASSINS_WINS, + }; + public KitBriber(ArcadeManager manager, EntityType disguiseType) { - super(manager, "Briber", KitAvailability.Achievement, - new String[] - { - "Pay Villagers to attack other players!" - }, - new Perk[] - { - new PerkSmokebomb(Material.INK_SACK, 3, true), - }, - new ItemStack(Material.EMERALD), - disguiseType); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.SNEAK_ASSASSINS_I_SEE_YOU, - Achievement.SNEAK_ASSASSINS_INCOMPETENCE, - Achievement.SNEAK_ASSASSINS_MASTER_ASSASSIN, - Achievement.SNEAK_ASSASSINS_THE_MASTERS_MASTER, - Achievement.SNEAKY_ASSASSINS_WINS, - }); + super(manager, "Briber", KitAvailability.Achievement, DESCRIPTION, PERKS, IN_HAND, disguiseType); + + this.setAchievementRequirements(ACHIEVEMENTS); } @Override public void GiveItems(Player player) { super.GiveItems(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 4, - C.cYellow + C.Bold + "Right-Click Villager" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bribe Villager", - new String[] - { - ChatColor.RESET + "Pay a villager to help you.", - ChatColor.RESET + "It will attack the nearest", - ChatColor.RESET + "enemy for 15 seconds.", - })); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitEscapeArtist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitEscapeArtist.java index b3a3e8381..1ed4030d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitEscapeArtist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitEscapeArtist.java @@ -1,27 +1,33 @@ package nautilus.game.arcade.game.games.sneakyassassins.kits; -import nautilus.game.arcade.*; -import nautilus.game.arcade.kit.*; -import nautilus.game.arcade.kit.perks.*; -import org.bukkit.*; -import org.bukkit.entity.*; -import org.bukkit.inventory.*; +import mineplex.core.common.util.C; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkSmokebomb; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitEscapeArtist extends SneakyAssassinKit { + + private static final String[] DESCRIPTION = { + "Carries two extra Smoke Bombs!", + "", + C.cYellow + "Right-Click" + C.cWhite + " to " + C.cGreen + "Smoke Bomb" + }; + + private static final Perk[] PERKS = { + new PerkSmokebomb(Material.INK_SACK, 3, true), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.INK_SACK); + public KitEscapeArtist(ArcadeManager manager, EntityType disguiseType) { - super(manager, "Escape Artist", KitAvailability.Free, - new String[] - { - "Carries two extra Smoke Bombs!" - }, - new Perk[] - { - new PerkSmokebomb(Material.INK_SACK, 3, true) - }, - new ItemStack(Material.INK_SACK), - disguiseType); + super(manager, "Escape Artist", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND, disguiseType); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java index 1c54610d0..79894c4fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java @@ -1,46 +1,55 @@ package nautilus.game.arcade.game.games.sneakyassassins.kits; -import mineplex.core.common.util.*; -import mineplex.core.itemstack.*; -import nautilus.game.arcade.*; -import nautilus.game.arcade.kit.*; -import nautilus.game.arcade.kit.perks.*; - -import org.bukkit.*; -import org.bukkit.entity.*; -import org.bukkit.inventory.*; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkRevealer; +import nautilus.game.arcade.kit.perks.PerkSmokebomb; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitRevealer extends SneakyAssassinKit { + + private static final String[] DESCRIPTION = { + "Carries three Revealers which explode", + "and reveal nearby assassins!", + "", + C.cYellow + "Right-Click" + C.cWhite + " to " + C.cGreen + "Smoke Bomb", + C.cYellow + "Right-Click" + C.cWhite + " with Diamond to " + C.cGreen + "Throw Revealer" + }; + + private static final Perk[] PERKS = { + new PerkSmokebomb(Material.INK_SACK, 3, true), + new PerkRevealer() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.INK_SACK); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 3, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Reveal Assassins", + new String[]{ + ChatColor.RESET + "Throw a revealer.", + ChatColor.RESET + "Players within 5 blocks", + ChatColor.RESET + "get revealed for 5 seconds.", + }) + }; + public KitRevealer(ArcadeManager manager, EntityType disguiseType) { - super(manager, "Revealer", KitAvailability.Gem, 5000, - new String[] - { - "Carries three Revealers which explode and reveal nearby assassins!" - }, - new Perk[] - { - new PerkSmokebomb(Material.INK_SACK, 3, true), - new PerkRevealer() - }, - new ItemStack(Material.INK_SACK), - disguiseType); + super(manager, "Revealer", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, IN_HAND, disguiseType); } @Override public void GiveItems(Player player) { super.GiveItems(player); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 3, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Reveal Assassins", - new String[] - { - ChatColor.RESET + "Throw a revealer.", - ChatColor.RESET + "Players within 5 blocks", - ChatColor.RESET + "get revealed for 5 seconds.", - - })); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/SneakyAssassinKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/SneakyAssassinKit.java index 0019ec3d0..957e53a19 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/SneakyAssassinKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/SneakyAssassinKit.java @@ -1,49 +1,56 @@ package nautilus.game.arcade.game.games.sneakyassassins.kits; -import mineplex.core.common.util.*; -import mineplex.core.disguise.*; -import mineplex.core.disguise.disguises.*; -import mineplex.core.itemstack.*; -import nautilus.game.arcade.*; -import nautilus.game.arcade.kit.*; -import org.bukkit.*; -import org.bukkit.entity.*; -import org.bukkit.inventory.*; +import mineplex.core.common.util.C; +import mineplex.core.disguise.DisguiseFactory; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public abstract class SneakyAssassinKit extends Kit +public abstract class SneakyAssassinKit extends ProgressingKit { public static final ItemStack SMOKE_BOMB = ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte) 0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Smoke Bomb", - new String[] - { - ChatColor.RESET + "Throw a Smoke Bomb.", - ChatColor.RESET + "Everyone within 6 blocks", - ChatColor.RESET + "gets Blindness for 6 seconds.", + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Smoke Bomb", + new String[]{ + ChatColor.RESET + "Throw a Smoke Bomb.", + ChatColor.RESET + "Everyone within 6 blocks", + ChatColor.RESET + "gets Blindness for 6 seconds.", + }); - }); + private static final ItemStack[] PLAYER_ARMOR = { + new ItemStack(Material.LEATHER_BOOTS), + new ItemStack(Material.LEATHER_LEGGINGS), + new ItemStack(Material.LEATHER_CHESTPLATE), + new ItemStack(Material.LEATHER_HELMET) + }; + + private static final ItemStack[] PLAYER_ITEMS = { + new ItemStack(Material.WOOD_SWORD), + SMOKE_BOMB.clone(), + }; public SneakyAssassinKit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand, EntityType disguiseType) { - super(manager, name, kitAvailability, kitDesc, kitPerks, disguiseType, itemInHand); + super(manager, name, "sneakyassassins" + name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, disguiseType, itemInHand); } public SneakyAssassinKit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand, EntityType disguiseType) { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, disguiseType, itemInHand); + super(manager, name, "sneakyassassins" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, disguiseType, itemInHand); } @Override public void GiveItems(Player player) { Manager.GetDisguise().disguise(DisguiseFactory.createDisguise(player, _entityType)); - - player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD)); - player.getInventory().setArmorContents(new ItemStack[]{ - new ItemStack(Material.LEATHER_BOOTS), - new ItemStack(Material.LEATHER_LEGGINGS), - new ItemStack(Material.LEATHER_CHESTPLATE), - new ItemStack(Material.LEATHER_HELMET) - }); - player.getInventory().addItem(SMOKE_BOMB.clone()); + + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java index def43a186..1f5cbfee4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitMedic.java @@ -5,12 +5,10 @@ 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.kit.AbbreviatedKit; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import net.md_5.bungee.api.ChatColor; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -21,48 +19,45 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.Potion; import org.bukkit.potion.PotionType; -public class KitMedic extends AbbreviatedKit +public class KitMedic extends ProgressingKit { + private final Potion POTION = new Potion(PotionType.INSTANT_HEAL).splash(); + + private static final String[] DESCRIPTION = { + "Throw warmth potions to heal allies!", + ChatColor.RESET + " ", + C.cWhite + "Receive" + C.cGreen + " 1 " + C.cWhite + "Warmth Potion every" + C.cGreen + " 16 seconds. Maximum of 1.", + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.POTION); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew") + }; + public KitMedic(ArcadeManager manager) { - super(manager, "Medic", KitAvailability.Free, - - new String[] - { - "Throw warmth potions to heal allies!", - ChatColor.RESET + " ", - - C.cGray + "Receive 1 Warmth Potion every 16 seconds. Maximum of 1.", - }, - - new Perk[] - { - - }, - EntityType.SKELETON, - new ItemStack(Material.POTION)); - - + super(manager, "Medic", "snowfightmedic", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - Potion potion = new Potion(PotionType.INSTANT_HEAL); - potion.setSplash(true); - ItemStack stack = potion.toItemStack(1); - ItemMeta meta = stack.getItemMeta(); - meta.setDisplayName(ChatColor.RESET + "Warmth Potion"); - stack.setItemMeta(meta); - - player.getInventory().setItem(1, stack); - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + player.getInventory().setItem(1, getPotion()); + + for (int i = 0; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().setItem(i + 2, PLAYER_ITEMS[i]); + } } - + @Override public void SpawnCustom(LivingEntity ent) { @@ -83,17 +78,21 @@ public class KitMedic extends AbbreviatedKit for (Player player : Manager.GetGame().GetPlayers(true)) { if (!HasKit(player)) + { continue; - - Potion potion = new Potion(PotionType.INSTANT_HEAL); - potion.setSplash(true); - ItemStack stack = potion.toItemStack(1); - ItemMeta meta = stack.getItemMeta(); - meta.setDisplayName("Warmth Potion"); - stack.setItemMeta(meta); - - player.getInventory().setItem(1, stack); + } + + player.getInventory().setItem(1, getPotion()); } } } + + private ItemStack getPotion() + { + ItemStack stack = POTION.toItemStack(1); + ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(ChatColor.RESET + "Warmth Potion"); + stack.setItemMeta(meta); + return stack; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java index f678d80dd..76dca952d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitSportsman.java @@ -1,61 +1,54 @@ package nautilus.game.arcade.game.games.snowfight.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkFallDamage; +import nautilus.game.arcade.kit.perks.PerkSpeed; import org.bukkit.ChatColor; -import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import mineplex.core.common.util.UtilMath; -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.kit.AbbreviatedKit; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkFallDamage; -import nautilus.game.arcade.kit.perks.PerkSpeed; - -public class KitSportsman extends AbbreviatedKit +public class KitSportsman extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Trained to be the fastest on snow and ice.", + }; + + private static final Perk[] PERKS = { + new PerkSpeed(0), + new PerkFallDamage(-2), + new PerkDoubleJump("Snow Jump", 1, 0.8, true, 6000, true), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew") + }; + public KitSportsman(ArcadeManager manager) { - super(manager, "Sportsman", KitAvailability.Free, - - new String[] - { - "Trained to be the fastest on snow and ice.", - ChatColor.RESET + " ", - - }, - - new Perk[] - { - new PerkSpeed(0), - new PerkFallDamage(-2), - new PerkDoubleJump("Snow Jump", 1, 0.8, true, 6000, true), - }, - EntityType.SKELETON, - new ItemStack(Material.SNOW_BALL)); + super(manager, "Sportsman", "snowfightsportsman", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); + for (int i = 0; i < PLAYER_ITEMS.length; i++) + { + player.getInventory().setItem(i + 2, PLAYER_ITEMS[i]); + } } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java index 3e035afb2..c81b8dec2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snowfight/kits/KitTactician.java @@ -1,17 +1,11 @@ package nautilus.game.arcade.game.games.snowfight.kits; 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.monsterleague.perks.PerkStoneWall; -import nautilus.game.arcade.kit.AbbreviatedKit; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkConstructor; -import nautilus.game.arcade.kit.perks.PerkIronSkin; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -19,34 +13,43 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitTactician extends AbbreviatedKit +public class KitTactician extends ProgressingKit { + private static final String[] DESCRIPTION = { + "No Snowfight is complete without a tactical game!", + }; + + private static final Perk[] PERKS = { + new PerkStoneWall("Ice Wall", Material.ICE, Material.CLAY_BALL), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.CLAY_BALL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.CLAY_BALL, (byte) 0, 1, ChatColor.RESET + "Ice Wall"), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte) 0, 1, ChatColor.RESET + "Hearty Winter Stew"), + ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, "§a§lTracking Compass") + }; + public KitTactician(ArcadeManager manager) { - super(manager, "Tactician", KitAvailability.Free, - new String[] - { - "No Snowfight is complete without a tactical game!", - ChatColor.RESET + " ", - - }, new Perk[] - { - new PerkStoneWall("Ice Wall", Material.ICE, Material.CLAY_BALL), - }, - EntityType.SKELETON, - new ItemStack(Material.CLAY_BALL)); - + super(manager, "Tactician", "snowfighttactician", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.CLAY_BALL, (byte)0, 1, ChatColor.RESET + "Ice Wall")); - player.getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP, (byte)0, 1, ChatColor.RESET + "Hearty Winter Stew")); - player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.COMPASS.getId(), (byte) 0, 1, "§a§lTracking Compass")); + player.getInventory().setItem(1, PLAYER_ITEMS[0]); + + for (int i = 1; i < PLAYER_ITEMS.length - 1; i++) + { + player.getInventory().setItem(i + 2, PLAYER_ITEMS[i]); + } + + player.getInventory().setItem(7, PLAYER_ITEMS[4]); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java index ff79b7fc0..a5eb4a5ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java @@ -1,28 +1,29 @@ package nautilus.game.arcade.game.games.speedbuilders.kits; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class DefaultKit extends Kit +public class DefaultKit extends ProgressingKit { + private static final String[] DESCRIPTION = { + "Professional build recreator!", + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_PICKAXE); + public DefaultKit(ArcadeManager manager) { - super(manager, "Speed Builder", KitAvailability.Free, - new String[] - { - "Professional build recreator!", - }, - new Perk[] - { - - }, - EntityType.ZOMBIE, null); + super(manager, "Speed Builder", "speedbuilderskit", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitArcher.java index f3bff9450..04f7c656e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitArcher.java @@ -1,41 +1,48 @@ package nautilus.game.arcade.game.games.spleef.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkKnockback; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitArcher extends Kit +public class KitArcher extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Arrows will damage spleef blocks in a small radius.", + "", + receiveArrowString(1, 2, 2), + "Deal " + C.cGreen + "+30%" + C.cWhite + " knockback per hit" + + }; + + private static final Perk[] PERKS = { + new PerkFletcher(2, 2, false), + new PerkKnockback(0.3) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW), + }; + public KitArcher(ArcadeManager manager) { - super(manager, "Archer", KitAvailability.Gem, 5000, - - new String[] - { - "Arrows will damage spleef blocks in a small radius." - }, - - new Perk[] - { - new PerkFletcher(2, 2, false), - new PerkKnockback(0.3) - }, - EntityType.SKELETON, - new ItemStack(Material.BOW)); - + super(manager, "Archer", "spleefarcher", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitBrawler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitBrawler.java index e9199f4bc..9e7acadbb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitBrawler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitBrawler.java @@ -1,42 +1,50 @@ package nautilus.game.arcade.game.games.spleef.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkKnockback; +import nautilus.game.arcade.kit.perks.PerkLeap; +import nautilus.game.arcade.kit.perks.PerkSmasher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitBrawler extends Kit +public class KitBrawler extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Very leap. Such knockback. Wow.", + "", + leap(), + "Deal " + C.cWhite + "+60%" + C.cWhite + " knockback per hit", + "Hitting blocks damages all surrounding blocks", + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1.2, 1.2, 6000), + new PerkSmasher(), + new PerkKnockback(0.6) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + }; + public KitBrawler(ArcadeManager manager) { - super(manager, "Brawler", KitAvailability.Gem, - - new String[] - { - "Very leap. Such knockback. Wow." - }, - - new Perk[] - { - new PerkLeap("Leap", 1.2, 1.2, 6000), - new PerkSmasher(), - new PerkKnockback(0.6) - }, - EntityType.SKELETON, - new ItemStack(Material.IRON_AXE)); - + super(manager, "Brawler", "spleefbrawler", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitSnowballer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitSnowballer.java index 5e1ecc8d9..bb2b628fe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitSnowballer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitSnowballer.java @@ -1,41 +1,47 @@ package nautilus.game.arcade.game.games.spleef.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkKnockback; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitSnowballer extends Kit +public class KitSnowballer extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Throw snowballs to break blocks!", + "Receive a Snowball when you punch a block!", + "", + "Deal " + C.cWhite + "+30%" + C.cWhite + " knockback per hit", + + }; + + private static final Perk[] PERKS = { + new PerkKnockback(0.3) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BALL); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL), + }; + public KitSnowballer(ArcadeManager manager) { - super(manager, "Snowballer", KitAvailability.Free, - - new String[] - { - "Throw snowballs to break blocks!", - "Receives 1 Snowball when you punch blocks!" - }, - - new Perk[] - { - new PerkKnockback(0.3) - }, - EntityType.SKELETON, - new ItemStack(Material.SNOW_BALL)); + super(manager, "Snowballer", "spleefsnowballer", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } - + @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitRifle.java index 0d5c0b493..b2496c703 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitRifle.java @@ -1,54 +1,26 @@ package nautilus.game.arcade.game.games.squidshooter.kits; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseSquid; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkSquidRifle; import nautilus.game.arcade.kit.perks.PerkSquidSwim; -public class KitRifle extends Kit +public class KitRifle extends SquidShooterKit { + + private static final String[] DESCRIPTION = { + "All rounder squid! Fast projectile and reload!" + }; + + private static final Perk[] PERKS = { + new PerkSquidSwim(), + new PerkSquidRifle() + }; + public KitRifle(ArcadeManager manager) { - super(manager, "Squid Gunner", KitAvailability.Free, - - new String[] - { - "All rounder squid! Fast projectile and reload!" - }, - - new Perk[] - { - new PerkSquidSwim(), - new PerkSquidRifle() - }, - EntityType.SQUID, - new ItemStack(Material.INK_SACK)); + super(manager, "Squid Gunner", KitAvailability.Free, DESCRIPTION, PERKS); } - @Override - public void GiveItems(Player player) - { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - - ItemStack helm = ItemStackFactory.Instance.CreateStack(Material.DIAMOND_HELMET); - helm.addEnchantment(Enchantment.OXYGEN, 3); - player.getInventory().setHelmet(helm); - - //Disguise - DisguiseSquid disguise = new DisguiseSquid(player); - disguise.setName(C.cWhite + player.getName()); - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitShotgun.java index 93e5eaef9..2cb1ab4f8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitShotgun.java @@ -1,54 +1,26 @@ package nautilus.game.arcade.game.games.squidshooter.kits; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseSquid; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkSquidShotgun; import nautilus.game.arcade.kit.perks.PerkSquidSwim; -public class KitShotgun extends Kit +public class KitShotgun extends SquidShooterKit { + + private static final String[] DESCRIPTION = { + "Fires many slow projectiles." + }; + + private static final Perk[] PERKS = { + new PerkSquidSwim(), + new PerkSquidShotgun() + }; + public KitShotgun(ArcadeManager manager) { - super(manager, "Squid Blaster", KitAvailability.Gem, - - new String[] - { - "Fires many slow projectiles." - }, - - new Perk[] - { - new PerkSquidSwim(), - new PerkSquidShotgun() - }, - EntityType.SQUID, - new ItemStack(Material.INK_SACK)); + super(manager, "Squid Blaster", KitAvailability.Gem, DESCRIPTION, PERKS); } - @Override - public void GiveItems(Player player) - { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - - ItemStack helm = ItemStackFactory.Instance.CreateStack(Material.DIAMOND_HELMET); - helm.addEnchantment(Enchantment.OXYGEN, 3); - player.getInventory().setHelmet(helm); - - //Disguise - DisguiseSquid disguise = new DisguiseSquid(player); - disguise.setName(C.cWhite + player.getName()); - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java index 075200baa..56b04737e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java @@ -1,54 +1,25 @@ package nautilus.game.arcade.game.games.squidshooter.kits; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseSquid; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkSquidSniper; import nautilus.game.arcade.kit.perks.PerkSquidSwim; -public class KitSniper extends Kit +public class KitSniper extends SquidShooterKit { + + private static final String[] DESCRIPTION = { + "Hitting someone with Ink Sniper recharges it!" + }; + + private static final Perk[] PERKS = { + new PerkSquidSwim(), + new PerkSquidSniper() + }; + public KitSniper(ArcadeManager manager) { - super(manager, "Squid Sniper", KitAvailability.Gem, 5000, - - new String[] - { - "Hitting someone with Ink Sniper recharges it!" - }, - - new Perk[] - { - new PerkSquidSwim(), - new PerkSquidSniper() - }, - EntityType.SQUID, - new ItemStack(Material.INK_SACK)); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - - ItemStack helm = ItemStackFactory.Instance.CreateStack(Material.DIAMOND_HELMET); - helm.addEnchantment(Enchantment.OXYGEN, 3); - player.getInventory().setHelmet(helm); - - //Disguise - DisguiseSquid disguise = new DisguiseSquid(player); - disguise.setName(C.cWhite + player.getName()); - disguise.setCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); + super(manager, "Squid Sniper", KitAvailability.Gem, 5000, DESCRIPTION, PERKS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/SquidShooterKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/SquidShooterKit.java new file mode 100644 index 000000000..f25b06149 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/SquidShooterKit.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.games.squidshooter.kits; + +import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguiseSquid; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.Material; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +/** + * @author Timothy Andis (TadahTech) on 4/17/2016. + */ +public class SquidShooterKit extends ProgressingKit +{ + + private static final ItemStack IN_HAND = new ItemStack(Material.INK_SACK); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + }; + + private final ItemStack HELMET = new ItemBuilder(Material.DIAMOND_HELMET).setUnbreakable(true).addEnchantment(Enchantment.OXYGEN, 3).build(); + + public SquidShooterKit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks) + { + super(manager, name, "squidshooter" + name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, EntityType.SQUID, IN_HAND); + } + + public SquidShooterKit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks) + { + super(manager, name, "squidshooter" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, EntityType.SQUID, IN_HAND); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(PLAYER_ITEMS); + + player.getInventory().setHelmet(HELMET); + + //Disguise + DisguiseSquid disguise = new DisguiseSquid(player); + disguise.setName(C.cWhite + player.getName()); + disguise.setCustomNameVisible(true); + Manager.GetDisguise().disguise(disguise); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/kits/KitDefault.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/kits/KitDefault.java index 5608d4251..ce4b43809 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/kits/KitDefault.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/kits/KitDefault.java @@ -1,34 +1,30 @@ package nautilus.game.arcade.game.games.stacker.kits; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitDefault extends Kit +public class KitDefault extends ProgressingKit { + + private static final String[] DESCRIPTION = { + + }; + + private static final Perk[] PERKS = { + + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.WOOD_BUTTON); + public KitDefault(ArcadeManager manager) { - super(manager, "Default", KitAvailability.Free, - - new String[] - { - }, - - new Perk[] - { - }, - EntityType.ZOMBIE, - new ItemStack(Material.WOOD_BUTTON)); - + super(manager, "Default", "stackerdefault", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitArcher.java index 0b46d8174..8c9c49bd5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitArcher.java @@ -1,40 +1,34 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitArcher extends Kit +public class KitArcher extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Passively crafts arrows from surrounding terrain.", + "", + receiveArrowString(1, 20, 3), + "Charge Bow to use " + C.cGreen + "Barrage" + }; + + private static final Perk[] PERKS = { + new PerkFletcher(20, 3, true), + new PerkBarrage(5, 250, true, false), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + public KitArcher(ArcadeManager manager) { - super(manager, "Archer", KitAvailability.Gem, - - new String[] - { - "Passively crafts arrows from surrounding terrain." - }, - - new Perk[] - { - new PerkFletcher(20, 3, true), - new PerkBarrage(5, 250, true, false), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - + super(manager, "Archer", KitAvailability.Gem, DESCRIPTION, PERKS, IN_HAND); } - @Override - public void GiveItems(Player player) - { - - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAssassin.java index 121a2ddac..dc6cbb43e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAssassin.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAssassin.java @@ -1,39 +1,32 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkBackstab; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitAssassin extends Kit +public class KitAssassin extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Sneak up on opponents while they're looting chests!", + "Players can only see your name tag", + "when you're 8 blocks away!", + "", + "Deal " + C.cGreen + "+2" + C.cWhite + " damage from behind opponents.", + }; + + private static final Perk[] PERKS = { + new PerkBackstab(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitAssassin(ArcadeManager manager) { - super(manager, "Assassin", KitAvailability.Gem, 5000, - - new String[] - { - "Sneak up on opponents while they're looting chests!", - - "Players can only see your nametag when 8 blocks away!" - }, - - new Perk[] - { - new PerkBackstab(), - }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); - - } - - @Override - public void GiveItems(Player player) - { - + super(manager, "Assassin", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, IN_HAND); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAxeman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAxeman.java index 8ffa85f7a..b06e6a4e0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAxeman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAxeman.java @@ -1,41 +1,34 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkAxeThrower; +import nautilus.game.arcade.kit.perks.PerkAxeman; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitAxeman extends Kit +public class KitAxeman extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Proficient in the art of axe combat!", + "", + C.cYellow + "Right-Click" + C.cWhite + " with Axes to " + C.cGreen + "Throw Axe", + "Deal" + C.cGreen + " +1" + C.cWhite + " Damage with Axes", + }; + + private static final Perk[] PERKS = { + new PerkAxeman(), + new PerkAxeThrower() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + public KitAxeman(ArcadeManager manager) { - super(manager, "Axeman", KitAvailability.Free, - - new String[] - { - "Proficient in the art of axe combat!" - }, - - new Perk[] - { - - new PerkAxeman(), - new PerkAxeThrower(manager) - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_AXE)); - + super(manager, "Axeman", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND); } - @Override - public void GiveItems(Player player) - { - - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBarbarian.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBarbarian.java index b62f2881a..b642c16c2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBarbarian.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBarbarian.java @@ -1,37 +1,38 @@ package nautilus.game.arcade.game.games.survivalgames.kit; +import mineplex.core.common.util.C; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBladeVortex; +import nautilus.game.arcade.kit.perks.PerkCleave; import org.bukkit.Material; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitBarbarian extends Kit +public class KitBarbarian extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Skilled at taking out teams!", + "Abilities disabled for first 30 seconds.", + "", + "Deal " + C.cGreen + (int)(100 * 0.75) + "% damage to nearby enemies", + C.cYellow + "Right-Click" + C.cWhite + " with Sword/Axe to use " + C.cGreen + "Blade Vortex" + + }; + + private static final Perk[] PERKS = { + new PerkCleave(0.75, false), + new PerkBladeVortex() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_SWORD); + public KitBarbarian(ArcadeManager manager) { - super(manager, "Barbarian", KitAvailability.Gem, 6000, - - new String[] - { - "Skilled at taking out teams!", - "Abilities disabled for first 30 seconds." - }, - - new Perk[] - { - - new PerkCleave(0.75, false), - new PerkBladeVortex() - }, - EntityType.ZOMBIE, - new ItemStack(Material.DIAMOND_SWORD)); + super(manager, "Barbarian", KitAvailability.Gem, 6000, DESCRIPTION, PERKS, IN_HAND); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java index 586bd9167..bd9f28189 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java @@ -1,39 +1,32 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkWolfPet; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitBeastmaster extends Kit +public class KitBeastmaster extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Woof woof woof!!", + "", + "Spawn" + C.cGreen + " 1 Wolf " + C.cWhite + "every " + C.cGreen + 30 + C.cWhite + " seconds. Max " + C.cGreen + 1, + C.cYellow + "Right-Click" + C.cWhite + " with Sword/Axe to use " + C.cGreen + "Wolf Tackle", + }; + + private static final Perk[] PERKS = { + new PerkWolfPet(30, 1, false, true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BONE); + public KitBeastmaster(ArcadeManager manager) { - super(manager, "Beastmaster", KitAvailability.Gem, 5000, - - new String[] - { - "Woof woof woof!!" - }, - - new Perk[] - { - new PerkWolfPet(30, 1, false, true) - }, - EntityType.ZOMBIE, - new ItemStack(Material.BONE)); - + super(manager, "Beast Master", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, IN_HAND); } - @Override - public void GiveItems(Player player) - { - - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBomber.java index f098f73f0..23d7e29f0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBomber.java @@ -1,40 +1,33 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkBomberHG; +import nautilus.game.arcade.kit.perks.PerkTNTArrow; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitBomber extends Kit +public class KitBomber extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Here comes the BOOM!", + "", + receiveItem("TNT", 1, 30, 2), + C.cYellow + "Left-Click" + C.cWhite + " with Bow to prepare " + C.cGreen + "Explosive Arrow", + }; + + private static final Perk[] PERKS = { + new PerkBomberHG(30, 2), + new PerkTNTArrow() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.TNT); + public KitBomber(ArcadeManager manager) { - super(manager, "Bomber", KitAvailability.Gem, 5000, - - new String[] - { - "BOOM! BOOM! BOOM!" - }, - - new Perk[] - { - new PerkBomberHG(30, 2), - new PerkTNTArrow() - }, - EntityType.ZOMBIE, - new ItemStack(Material.TNT)); - - } - - @Override - public void GiveItems(Player player) - { - + super(manager, "Bomber", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, IN_HAND); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBrawler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBrawler.java index 16d47b814..e2ca0c3b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBrawler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBrawler.java @@ -1,41 +1,35 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkMammoth; +import nautilus.game.arcade.kit.perks.PerkSeismicSlamHG; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitBrawler extends Kit +public class KitBrawler extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Giant and muscular, easily smacks others around.", + "", + "Take " + C.cGreen + "75%" + C.cWhite + " knockback", + "Deal " + C.cGreen + "125%" + C.cWhite + " knockback", + C.cYellow + "Right-Click" + C.cWhite + " with Sword/Axe to " + C.cGreen + "Ground Pound" + + }; + + private static final Perk[] PERKS = { + new PerkMammoth(), + new PerkSeismicSlamHG() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitBrawler(ArcadeManager manager) { - super(manager, "Brawler", KitAvailability.Gem, - - new String[] - { - "Giant and muscular, easily smacks others around." - }, - - new Perk[] - { - new PerkMammoth(), - - new PerkSeismicSlamHG() - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - - } - - @Override - public void GiveItems(Player player) - { - + super(manager, "Brawler", KitAvailability.Gem, DESCRIPTION, PERKS, IN_HAND); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitHorseman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitHorseman.java index 497d14297..2288b0c3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitHorseman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitHorseman.java @@ -1,48 +1,43 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.achievement.Achievement; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkHorsePet; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; -public class KitHorseman extends Kit +public class KitHorseman extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Proud owner of a (rapidly growing) horse!", + "", + "You have a loyal horse companion.", + + }; + + private static final Perk[] PERKS = { + new PerkHorsePet() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_BARDING); + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.SURVIVAL_GAMES_BLOODLUST, + Achievement.SURVIVAL_GAMES_LIGHT_WEIGHT, + Achievement.SURVIVAL_GAMES_LOOT, + Achievement.SURVIVAL_GAMES_SKELETONS, + Achievement.SURVIVAL_GAMES_WINS, + }; + public KitHorseman(ArcadeManager manager) { - super(manager, "Horseman", KitAvailability.Achievement, + super(manager, "Horseman", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.HORSE, IN_HAND); - new String[] - { - "Proud owner of a horse!" - }, - - new Perk[] - { - new PerkHorsePet() - }, - EntityType.HORSE, - new ItemStack(Material.DIAMOND_BARDING)); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.SURVIVAL_GAMES_BLOODLUST, - Achievement.SURVIVAL_GAMES_LIGHT_WEIGHT, - Achievement.SURVIVAL_GAMES_LOOT, - Achievement.SURVIVAL_GAMES_SKELETONS, - Achievement.SURVIVAL_GAMES_WINS, - }); + this.setAchievementRequirements(ACHIEVEMENTS); } - @Override - public void GiveItems(Player player) - { - - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitKnight.java index 58c5e1b9e..c7f200882 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitKnight.java @@ -1,40 +1,34 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - +import mineplex.core.common.util.C; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkHiltSmash; +import nautilus.game.arcade.kit.perks.PerkIronSkin; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitKnight extends Kit +public class KitKnight extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "A mighty iron-clad knight!", + "", + "Take " + C.cGreen + "0.5" + C.cWhite + " less damage from all attacks", + C.cYellow + "Block on Player" + C.cWhite + " to use " + C.cGreen + "Hilt Smash" + }; + + private static final Perk[] PERKS = { + new PerkIronSkin(0.5), + new PerkHiltSmash() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + public KitKnight(ArcadeManager manager) { - super(manager, "Knight", KitAvailability.Free, - - new String[] - { - - }, - - new Perk[] - { - new PerkIronSkin(0.5), - new PerkHiltSmash() - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - + super(manager, "Knight", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND); } - @Override - public void GiveItems(Player player) - { - - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitLooter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitLooter.java index 2ccf568e6..225710bf0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitLooter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitLooter.java @@ -1,39 +1,31 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkLooter; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitLooter extends Kit +public class KitLooter extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Defeat your opponents with your swag loots!", + "", + "You find extra loot in chests.", + + }; + + private static final Perk[] PERKS = { + new PerkLooter(), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.CHEST); + public KitLooter(ArcadeManager manager) { - super(manager, "Looter", KitAvailability.Free, + super(manager, "Looter", KitAvailability.Free, DESCRIPTION, PERKS, IN_HAND); - new String[] - { - "Defeat your opponents with your swag loots!" - }, - - new Perk[] - { - new PerkLooter(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.CHEST)); - - } - - @Override - public void GiveItems(Player player) - { - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitNecromancer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitNecromancer.java index fdedd9874..95df79bc1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitNecromancer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitNecromancer.java @@ -1,39 +1,30 @@ package nautilus.game.arcade.game.games.survivalgames.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkSkeletons; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; -public class KitNecromancer extends Kit +public class KitNecromancer extends SurvivalGamesKit { + + private static final String[] DESCRIPTION = { + "Harness the power of the dark arts.", + "", + "Killing an opponent summons a skeletal minion." + }; + + private static final Perk[] PERKS = { + new PerkSkeletons(true) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SKULL_ITEM); + public KitNecromancer(ArcadeManager manager) { - super(manager, "Necromancer", KitAvailability.Gem, 5000, - - new String[] - { - "Cool undead guy and stuff" - }, - - new Perk[] - { - new PerkSkeletons(true) - }, - EntityType.ZOMBIE, - new ItemStack(Material.SKULL_ITEM)); - + super(manager, "Necromancer", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, IN_HAND); } - @Override - public void GiveItems(Player player) - { - - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/SurvivalGamesKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/SurvivalGamesKit.java new file mode 100644 index 000000000..fcad4a8ea --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/SurvivalGamesKit.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.game.games.survivalgames.kit; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +/** + * A kit wrapper for Survival Games Kits + */ +public class SurvivalGamesKit extends ProgressingKit +{ + + public SurvivalGamesKit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) + { + super(manager, name, "sg" + name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + } + + public SurvivalGamesKit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) + { + super(manager, name, "sg" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + } + + public SurvivalGamesKit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] perks, ItemStack itemInHand) + { + this(manager, name, kitAvailability, cost, kitDesc, perks, EntityType.ZOMBIE, itemInHand); + } + + public SurvivalGamesKit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] perks, ItemStack itemInHand) + { + this(manager, name, kitAvailability, kitDesc, perks, EntityType.ZOMBIE, itemInHand); + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitArcher.java index f0f2d1de8..61d50a516 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitArcher.java @@ -1,47 +1,52 @@ package nautilus.game.arcade.game.games.tug.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitArcher extends Kit +public class KitArcher extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Passively crafts arrows from surrounding terrain." + }; + + private static final Perk[] PERKS = { + new PerkFletcher(20, 3, true), + new PerkBarrage(5, 250, true, false), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW), + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitArcher(ArcadeManager manager) { - super(manager, "Archer", KitAvailability.Free, - - new String[] - { - "Passively crafts arrows from surrounding terrain." - }, - - new Perk[] - { - new PerkFletcher(20, 3, true), - new PerkBarrage(5, 250, true, false), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - + super(manager, "Archer", "tugarcher", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(new ItemStack(Material.STONE_SWORD)); - player.getInventory().addItem(new ItemStack(Material.BOW)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().addItem(PLAYER_ARMOR); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitSmasher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitSmasher.java index 9f4a8fba3..3949cb975 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitSmasher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitSmasher.java @@ -1,45 +1,50 @@ package nautilus.game.arcade.game.games.tug.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkMammoth; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitSmasher extends Kit +public class KitSmasher extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Giant and muscular, easily smacks others around." + }; + + private static final Perk[] PERKS = { + new PerkMammoth(), + + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + public KitSmasher(ArcadeManager manager) { - super(manager, "Smasher", KitAvailability.Free, - - new String[] - { - "Giant and muscular, easily smacks others around." - }, - - new Perk[] - { - new PerkMammoth(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - + super(manager, "Smasher", "tugsmasher", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { - player.getInventory().addItem(new ItemStack(Material.IRON_SWORD)); - - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().addItem(PLAYER_ARMOR); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitInfiltrator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitInfiltrator.java index 81e91ef6b..6059871c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitInfiltrator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitInfiltrator.java @@ -1,62 +1,53 @@ package nautilus.game.arcade.game.games.turfforts.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkConstructor; -import nautilus.game.arcade.kit.perks.PerkFletcher; - -public class KitInfiltrator extends Kit +public class KitInfiltrator extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Able to travel into the enemies turf, but you", + "must return to your turf fast, or receive Slow.", + "", + receiveItem("Wool", 1, 4, 4), + receiveArrowString(1, 8, 1) + }; + + private static final Perk[] PERKS = { + new PerkConstructor("Constructor", 4, 4, Material.WOOL, "Wool", false), + new PerkFletcher(8, 1, false), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW), + }; + public KitInfiltrator(ArcadeManager manager) { - super(manager, "Infiltrator", KitAvailability.Gem, - new String[] - { - "Able to travel into the enemies turf, but you", - "must return to your turf fast, or receive Slow." - }, - new Perk[] - { - new PerkConstructor("Constructor", 4, 4, Material.WOOL, "Wool", false), - new PerkFletcher(8, 1, false), - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - + super(manager, "Infiltrator", "turffortsinfilitrator", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - - int amount = 6; - if (!Manager.GetGame().IsLive()) - amount = 64; - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); - - - //Update - final Player fPlayer = player; - - UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - public void run() - { - UtilInv.Update(fPlayer); - } - }, 10); + player.getInventory().addItem(PLAYER_ITEMS); + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), Manager.GetGame().IsLive() ? 6 : 64)); + + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), player::updateInventory, 10); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitMarksman.java index ecdd6e791..ecd478fd4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitMarksman.java @@ -1,60 +1,52 @@ package nautilus.game.arcade.game.games.turfforts.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkConstructor; -import nautilus.game.arcade.kit.perks.PerkFletcher; - -public class KitMarksman extends Kit +public class KitMarksman extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Unrivaled in archery. One hit kills anyone.", + "", + receiveItem("Wool", 1, 4, 8), + receiveArrowString(1, 8, 2) + }; + + private static final Perk[] PERKS = { + new PerkConstructor("Constructor", 4, 8, Material.WOOL, "Wool", false), + new PerkFletcher(2, 2, false), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW), + }; + public KitMarksman(ArcadeManager manager) { - super(manager, "Marksman", KitAvailability.Free, - new String[] - { - "Unrivaled in archery. One hit kills anyone." - }, - new Perk[] - { - new PerkConstructor("Constructor", 4, 8, Material.WOOL, "Wool", false), - new PerkFletcher(2, 2, false), - - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - + super(manager, "Marksman", "turffortsmarksman", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - int amount = 6; - if (!Manager.GetGame().IsLive()) - amount = 64; + player.getInventory().addItem(PLAYER_ITEMS); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), Manager.GetGame().IsLive() ? 6 : 64)); - //Update - final Player fPlayer = player; - - UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - public void run() - { - UtilInv.Update(fPlayer); - } - }, 10); + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), player::updateInventory, 10); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java index d2831ab52..b23f051ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java @@ -1,61 +1,55 @@ package nautilus.game.arcade.game.games.turfforts.kits; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkFletcher; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilServer; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkConstructor; -import nautilus.game.arcade.kit.perks.PerkFletcher; - -public class KitShredder extends Kit +public class KitShredder extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Arrows are weaker, but shred through forts.", + "", + receiveItem("Wool", 1, 4, 6), + receiveArrowString(1, 4, 2), + C.cYellow + "Charge" + C.cWhite + " your Bow to use " + C.cGreen + "Barrage" + }; + + private static final Perk[] PERKS = { + new PerkConstructor("Constructor", 4, 6, Material.WOOL, "Wool", false), + new PerkFletcher(4, 2, false), + new PerkBarrage(5, 250, false, false), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.BOW), + }; + public KitShredder(ArcadeManager manager) { - super(manager, "Shredder", KitAvailability.Gem, 5000, - new String[] - { - "Arrows are weaker, but shred through forts." - }, - new Perk[] - { - new PerkConstructor("Constructor", 4, 6, Material.WOOL, "Wool", false), - new PerkFletcher(4, 2, false), - new PerkBarrage(5, 250, false, false), - }, - EntityType.ZOMBIE, - new ItemStack(Material.BOW)); - + super(manager, "Shredder", "turffortsshredder", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().addItem(PLAYER_ITEMS); - int amount = 6; - if (!Manager.GetGame().IsLive()) - amount = 64; + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), Manager.GetGame().IsLive() ? 6 : 64)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount)); - - //Update - final Player fPlayer = player; - - UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - public void run() - { - UtilInv.Update(fPlayer); - } - }, 10); + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), player::updateInventory, 10); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java index 62ed1d88e..e405fc0a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java @@ -7,7 +7,6 @@ import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; import nautilus.game.arcade.game.games.typewars.spells.SpellMassSlow; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -15,22 +14,31 @@ import org.bukkit.inventory.ItemStack; public class KitTactician extends KitTypeWarsBase { + private static final String[] DESCRIPTION = { + "The alphabet Tactician", + "is known for using defensive spells" + }; + + private static final Perk[] PERKS = { + new Perk("Growth Line", new String[]{"Creates a line that grows your minions names"}) + { + }, + new Perk("Mass Slow", new String[]{"Slows down all enemy Minions"}) + { + }, + new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}) + { + } + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.PAPER); + public KitTactician(ArcadeManager manager) { - super(manager, "Alpha. Tactician", KitAvailability.Achievement, - new String[] - { - "The ahlpabet Tactician", - "is known for using deffensive spells" - }, - new Perk[] - { - new Perk("Growth Line", new String[]{"Creates a line that grows your minions names"}){}, - new Perk("Mass Slow", new String[]{"Slows down all enemy Minions"}){}, - new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} - }, - EntityType.SKELETON, new ItemStack(Material.PAPER), - new Spell[]{new SpellGrowthLiner(manager), new SpellMassSlow(manager), new SpellKillEverything(manager)}); + super(manager, "Alpha Tactician", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, + new Spell[]{ + new SpellGrowthLiner(manager), new SpellMassSlow(manager), new SpellKillEverything(manager) + }); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index 3e813d0f9..0998a94b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -5,10 +5,9 @@ import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.MinionSize; import nautilus.game.arcade.game.games.typewars.Spell; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -17,20 +16,21 @@ import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; -public abstract class KitTypeWarsBase extends Kit +public abstract class KitTypeWarsBase extends ProgressingKit { private Spell[] _spells; - + protected ArcadeManager _manager; + public KitTypeWarsBase(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Spell[] spells) { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, "typewars" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); _spells = spells; } public KitTypeWarsBase(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Spell[] spells) { - super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, "typewars" + name.toLowerCase().replace(" ", ""), kitAvailability, kitDesc, kitPerks, entityType, itemInHand); _spells = spells; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java index 4eb64ad90..732ff68a2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java @@ -5,10 +5,8 @@ import nautilus.game.arcade.game.games.typewars.Spell; import nautilus.game.arcade.game.games.typewars.spells.SpellFirebomb; import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; import nautilus.game.arcade.game.games.typewars.spells.SpellSniper; -import nautilus.game.arcade.game.games.typewars.spells.SpellSpeedUp; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -16,23 +14,31 @@ import org.bukkit.inventory.ItemStack; public class KitTyper extends KitTypeWarsBase { + private static final String[] DESCRIPTION = { + "This is the fastest typer ", + "in the land of Mineplex" + }; + + private static final Perk[] PERKS = { + new Perk("Fire Bomb", new String[]{"Kills small and medium sized enemies."}) + { + }, + new Perk("Sniper spell", new String[]{"Shoot a minion and kill it"}) + { + }, + new Perk("Zombie Smash", new String[]{"Kill all enemy minions. One use."}) + { + } + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.FEATHER); + public KitTyper(ArcadeManager manager) { - super(manager, "Typer", KitAvailability.Free, - - new String[] - { - "This is the fastest typer ", - "in the land of Mineplex" - }, - new Perk[] - { - new Perk("Fire Bomb", new String[]{"Kills small and medium sized enemies."}){}, - new Perk("Sniper spell", new String[]{"Shoot a minion and kill it"}){}, - new Perk("Zombie Smash", new String[]{"Kill all enemy minions. One use."}){} - }, - EntityType.ZOMBIE, new ItemStack(Material.FEATHER), - new Spell[]{new SpellFirebomb(manager), new SpellSniper(manager), new SpellKillEverything(manager)}); + super(manager, "Typer", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND, + new Spell[]{ + new SpellFirebomb(manager), new SpellSniper(manager), new SpellKillEverything(manager) + }); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java index de293df7d..e456feb3f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java @@ -7,7 +7,6 @@ import nautilus.game.arcade.game.games.typewars.spells.SpellShrinkLiner; import nautilus.game.arcade.game.games.typewars.spells.SpellSniper; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -15,22 +14,31 @@ import org.bukkit.inventory.ItemStack; public class KitWarrior extends KitTypeWarsBase { + private static final String[] DESCRIPTION = { + "This Legendary Warrior", + "has many Offensive spells" + }; + + private static final Perk[] PERKS = { + new Perk("Shrinking Line", new String[]{"Creates a line that shortens enemy names"}) + { + }, + new Perk("Sniper spell", new String[]{"Shoot a minion and kill it"}) + { + }, + new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}) + { + } + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_SWORD); + public KitWarrior(ArcadeManager manager) { - super(manager, "Letter Warrior", KitAvailability.Gem, 2000, - new String[] - { - "This Legendary Warrior", - "has many Offensive spells" - }, - new Perk[] - { - new Perk("Shrinking Line", new String[]{"Creates a line that shortens enemy names"}){}, - new Perk("Sniper spell", new String[]{"Shoot a minion and kill it"}){}, - new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} - }, - EntityType.SKELETON, new ItemStack(Material.STONE_SWORD), - new Spell[]{new SpellShrinkLiner(manager), new SpellSniper(manager), new SpellKillEverything(manager)}); + super(manager, "Letter Warrior", KitAvailability.Gem, 2000, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, + new Spell[]{ + new SpellShrinkLiner(manager), new SpellSniper(manager), new SpellKillEverything(manager) + }); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/KitUHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/KitUHC.java index 3bbf9130a..8f9f70b7e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/KitUHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/KitUHC.java @@ -1,32 +1,32 @@ package nautilus.game.arcade.game.games.uhc; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitUHC extends Kit +public class KitUHC extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "A really unfortunate guy, who has been", + "forced to fight to the death against", + "a bunch of other guys." + }; + + private static final Perk[] PERKS = { + + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.GOLD_SWORD); + public KitUHC(ArcadeManager manager) { - super(manager, "UHC Player", KitAvailability.Free, - - new String[] - { - "A really unfortunate guy, who has been", - "forced to fight to the death against", - "a bunch of other guys." - }, - - new Perk[] - { - - }, - EntityType.ZOMBIE, - null); + super(manager, "UHC Player", "uhcplayer", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/kit/KitMasterOfLove.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/kit/KitMasterOfLove.java index cc9d89158..268d77132 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/kit/KitMasterOfLove.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/kit/KitMasterOfLove.java @@ -1,38 +1,40 @@ package nautilus.game.arcade.game.games.valentines.kit; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitMasterOfLove extends Kit +public class KitMasterOfLove extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Ain't no mountain high enough!" + }; + + private static final Perk[] PERKS = { + + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.FISHING_ROD, (byte) 0, 1, "Cupids Pig Catcher") + }; + public KitMasterOfLove(ArcadeManager manager) { - super(manager, "Master of Love", KitAvailability.Free, - - new String[] - { - "Ain't no mountain high enough!" - }, - - new Perk[] - { - }, - EntityType.SKELETON, - new ItemStack(Material.BOW)); - + super(manager, "Master of Love", "valentinesmasteroflove", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.FISHING_ROD, (byte)0, 1, "Cupids Pig Catcher")); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java index 74456dc5c..9e8024a27 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java @@ -1,64 +1,56 @@ package nautilus.game.arcade.game.games.wither.kit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.PotionMeta; - -import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkFletcher; -import nautilus.game.arcade.kit.perks.PerkRopedArrow; import nautilus.game.arcade.kit.perks.PerkWitherArrowBlind; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitHumanArcher extends Kit +public class KitHumanArcher extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Skilled in the art of long range combat", + "", + receiveArrowString(1, 4, 4), + "Your arrows give Blindness for" + C.cGreen + 4 + C.cWhite + " seconds", + C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 1.2, 1, true, 4000, true), + new PerkWitherArrowBlind(6), + new PerkFletcher(4, 4, true), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW), + new ItemBuilder(Material.POTION).setAmount(2).setData((short) 16429).setTitle(C.Reset + "Revival Potion").build(), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + }; + public KitHumanArcher(ArcadeManager manager) { - super(manager, "Human Archer", KitAvailability.Free, - - new String[] - { - "" - }, - - new Perk[] - { - new PerkDoubleJump("Double Jump", 1.2, 1, true, 4000, true), - new PerkWitherArrowBlind(6), - new PerkFletcher(4, 4, true), - - }, EntityType.ZOMBIE, null); - + super(manager, "Human Archer", "witherhumanarcher", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - - ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422 - PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); - potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion"); - potion.setItemMeta(potionMeta); - player.getInventory().addItem(potion); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().addItem(PLAYER_ITEMS); } - @Override - public void SpawnCustom(LivingEntity ent) - { - - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanEditor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanEditor.java index 25c0098b1..9be7c213b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanEditor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanEditor.java @@ -1,50 +1,51 @@ package nautilus.game.arcade.game.games.wither.kit; import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkDoubleJump; - -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.PotionMeta; -public class KitHumanEditor extends Kit +public class KitHumanEditor extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Can " + C.cYellow + "Edit " + C.cGray + "the terrain to their benefit", + "", + C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true), + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_PICKAXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE), + ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE), + ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE), + new ItemBuilder(Material.POTION).setAmount(2).setData((short) 16429).setTitle(C.Reset + "Revival Potion").build(), + + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + }; + public KitHumanEditor(ArcadeManager manager) { - super(manager, "Human Editor", KitAvailability.Gem, 5000, - new String[] - { - " ", "Can " + C.cYellow + "Edit " + C.cGray + "the terrain to they and their comrade's benefits", " " - }, - new Perk[] - { - new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true), - }, - EntityType.ZOMBIE, new ItemStack(Material.STONE_PICKAXE)); + super(manager, "Human Editor", "witherhumaneditor", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE)); - - ItemStack potion = new ItemStack(Material.POTION, 2, (short) 16429); // 16422 - PotionMeta potionMeta = (PotionMeta) potion.getItemMeta(); - potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion"); - potion.setItemMeta(potionMeta); - player.getInventory().addItem(potion); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); + player.getInventory().addItem(PLAYER_ITEMS); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java index 2b91f2dc6..1c1218892 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanMedic.java @@ -1,62 +1,62 @@ package nautilus.game.arcade.game.games.wither.kit; -import org.bukkit.ChatColor; +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBlockRestorer; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; +import nautilus.game.arcade.kit.perks.PerkWitherMedicRefill; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.PotionMeta; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBlockRestorer; -import nautilus.game.arcade.kit.perks.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkIronShell; -import nautilus.game.arcade.kit.perks.PerkWitherMedicRefill; - -public class KitHumanMedic extends Kit +public class KitHumanMedic extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Be the hero! Heal other players.", + "", + receiveItem("Healing Bottle", 1, 45, 1), + C.cYellow + "Right-Click" + C.cWhite + " with Axe to " + C.cGreen + "Throw Repairer", + C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump" + }; + + private static final Perk[] PERKS = { + new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true), + new PerkWitherMedicRefill(45, 1), + new PerkBlockRestorer() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.POTION); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE), + ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE), + ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE), + new ItemBuilder(Material.POTION).setAmount(2).setData((short) 16429).setTitle(C.Reset + "Revival Potion").build(), + + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP), + }; + public KitHumanMedic(ArcadeManager manager) { - super(manager, "Human Medic", KitAvailability.Gem, 2000, - - new String[] - { - "" - }, - - new Perk[] - { - new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true), - new PerkWitherMedicRefill(45, 1), - new PerkBlockRestorer() - }, - EntityType.ZOMBIE, - null); + super(manager, "Human Medic", "witherhumanmedic", KitAvailability.Gem, 2000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422 - PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); - potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion"); - potion.setItemMeta(potionMeta); - player.getInventory().addItem(potion); - + player.getInventory().addItem(PLAYER_ITEMS); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java index 92c03e455..724e12eb0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java @@ -1,14 +1,5 @@ package nautilus.game.arcade.game.games.wither.kit; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseWither; @@ -17,69 +8,70 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkWitherArrows; +import nautilus.game.arcade.kit.perks.PerkWitherAttack; +import nautilus.game.arcade.kit.perks.PerkWitherCompassScent; +import nautilus.game.arcade.kit.perks.PerkWitherMinion; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; -public class KitWitherMinion extends Kit +public class KitWitherMinion extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "The most dreaded boss in all of Minecraft!", + "", + C.cYellow + "Hold Block" + C.cWhite + " to use " + C.cGreen + "Fire Storm", + C.cYellow + "Left-Click" + C.cWhite + " with Gold Sword to use " + C.cGreen + "Wither Skull", + C.cYellow + "Left-Click" + C.cWhite + " with Diamond Sword to use " + C.cGreen + "Wither Minions", + C.cYellow + "Right-Click" + C.cWhite + " with a compass to use " + C.cGreen + "Wither Scent" + + }; + + private static final Perk[] PERKS = { + new PerkWitherArrows(), + new PerkWitherAttack(), + new PerkWitherMinion(), + new PerkWitherCompassScent() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.SKULL_ITEM, 1, (short) 1); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull"), + ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte) 0, 1, + C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Skeletal Minions"), + ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte) 0, 1, C.cYellow + C.Bold + "Human Finder X-9000") + }; + public KitWitherMinion(ArcadeManager manager) { - super(manager, "Wither", KitAvailability.Free, - - new String[] - { - "" - }, - - new Perk[] - { - new PerkWitherArrows(), new PerkWitherAttack(), - new PerkWitherMinion(), new PerkWitherCompassScent() - }, EntityType.WITHER, null); - + super(manager, "Wither", "witherwither", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.WITHER, IN_HAND); } - // @Override - // public void SpawnCustom(LivingEntity ent) - // { - // ent.setMaxHealth(300); - // ent.setHealth(300); - // - // DisguiseWither disguise = new DisguiseWither(ent); - // disguise.SetName(C.cYellow + "Wither"); - // disguise.SetCustomNameVisible(true); - // Manager.GetDisguise().disguise(disguise); - // } - @Override public void GiveItems(Player player) { - player.getInventory().addItem( - ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, - (byte) 0, 1, C.cYellow + C.Bold + "Left-Click" - + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold - + "Wither Skull")); - - player.getInventory().addItem( - ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, - (byte) 0, 1, C.cYellow + C.Bold + "Right-Click" - + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold - + "Skeletal Minions")); - - player.getInventory().addItem( - ItemStackFactory.Instance - .CreateStack(Material.COMPASS, (byte) 0, 1, C.cYellow - + C.Bold + "Human Finder X-9000")); - + player.getInventory().addItem(PLAYER_ITEMS); // Disguise DisguiseWither disguise = new DisguiseWither(player); if (Manager.GetGame().GetTeam(player) != null) - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() - + player.getName()); - else disguise.setName(player.getName()); + { + disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + } else + { + disguise.setName(player.getName()); + } disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitMage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitMage.java index 72aa5c7af..c692f146a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitMage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitMage.java @@ -2,23 +2,29 @@ package nautilus.game.arcade.game.games.wizards.kit; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.wizards.Wizards; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitMage extends Kit +public class KitMage extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Start with two extra spells" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_ROD); + public KitMage(ArcadeManager manager) { - super(manager, "Mage", KitAvailability.Free, new String[] - { - "Start with two extra spells" - }, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD)); + super(manager, "Mage", "wizardsmage", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.WITCH, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitMystic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitMystic.java index 2e240ffa0..7904a7384 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitMystic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitMystic.java @@ -2,23 +2,29 @@ package nautilus.game.arcade.game.games.wizards.kit; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.wizards.Wizards; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitMystic extends Kit +public class KitMystic extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Mana regeneration increased by 10%" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.WOOD_HOE); + public KitMystic(ArcadeManager manager) { - super(manager, "Mystic", KitAvailability.Gem, new String[] - { - "Mana regeneration increased by 10%" - }, new Perk[0], EntityType.WITCH, new ItemStack(Material.WOOD_HOE)); + super(manager, "Mystic", "wizardsmystic", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.WITCH, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitSorcerer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitSorcerer.java index d672537cf..1c5d01bd4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitSorcerer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitSorcerer.java @@ -2,23 +2,29 @@ package nautilus.game.arcade.game.games.wizards.kit; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.wizards.Wizards; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitSorcerer extends Kit +public class KitSorcerer extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Start out with an extra wand" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_HOE); + public KitSorcerer(ArcadeManager manager) { - super(manager, "Sorcerer", KitAvailability.Gem, new String[] - { - "Start out with an extra wand" - }, new Perk[0], EntityType.WITCH, new ItemStack(Material.STONE_HOE)); + super(manager, "Sorcerer", "wizardssorcerer", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.WITCH, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitWitchDoctor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitWitchDoctor.java index b76498022..7f888d746 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitWitchDoctor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/kit/KitWitchDoctor.java @@ -3,28 +3,35 @@ package nautilus.game.arcade.game.games.wizards.kit; import mineplex.core.achievement.Achievement; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.wizards.Wizards; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -public class KitWitchDoctor extends Kit +public class KitWitchDoctor extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Max mana increased to 150" + }; + + private static final Perk[] PERKS = { + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_HOE); + + private static final Achievement[] ACHIEVEMENTS = { + Achievement.WIZARDS_WINS + }; + public KitWitchDoctor(ArcadeManager manager) { - super(manager, "Witch Doctor", KitAvailability.Achievement, new String[] - { - "Max mana increased to 150" - }, new Perk[0], EntityType.WITCH, new ItemStack(Material.IRON_HOE)); + super(manager, "Witch Doctor", "wizardswitchdoctor", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.WITCH, IN_HAND); - this.setAchievementRequirements(new Achievement[] - { - Achievement.WIZARDS_WINS - }); + this.setAchievementRequirements(ACHIEVEMENTS); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java index b66be81b1..071588287 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java @@ -1,48 +1,54 @@ package nautilus.game.arcade.game.games.zombiesurvival.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitSurvivorArcher extends Kit +public class KitSurvivorArcher extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Survive with the help of your trusty bow!" + }; + + private static final Perk[] PERKS = { + new PerkFletcher(2, 8, true), + new PerkBarrage(5, 250, true, false) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.BOW); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + ItemStackFactory.Instance.CreateStack(Material.BOW) + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), + }; + public KitSurvivorArcher(ArcadeManager manager) { - super(manager, "Survivor Archer", KitAvailability.Gem, - - new String[] - { - "Survive with the help of your trusty bow!" - }, - - new Perk[] - { - new PerkFletcher(2, 8, true), - new PerkBarrage(5, 250, true, false) - }, - EntityType.SKELETON, - new ItemStack(Material.BOW)); - + super(manager, "Survivor Archer", "zombiesurvivalarcher", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorKnight.java index 8ba4ce416..093e4993f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorKnight.java @@ -1,49 +1,55 @@ package nautilus.game.arcade.game.games.zombiesurvival.kits; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkIronSkin; +import nautilus.game.arcade.kit.perks.PerkMammoth; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitSurvivorKnight extends Kit +public class KitSurvivorKnight extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Smash and kill through Zombies" + }; + + private static final Perk[] PERKS = { + new PerkIronSkin(1), + new PerkMammoth() + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD), + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), + }; + public KitSurvivorKnight(ArcadeManager manager) { - super(manager, "Survivor Knight", KitAvailability.Free, - - new String[] - { - "Smash and kill through Zombies" - }, - - new Perk[] - { - new PerkIronSkin(1), - new PerkMammoth() - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_SWORD)); - + super(manager, "Survivor Knight", "zombiesurvivalknight", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorRogue.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorRogue.java index 9c9cd03d3..070fd4149 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorRogue.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorRogue.java @@ -1,49 +1,55 @@ package nautilus.game.arcade.game.games.zombiesurvival.kits; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkLeap; +import nautilus.game.arcade.kit.perks.PerkSpeed; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public class KitSurvivorRogue extends Kit +public class KitSurvivorRogue extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "You are weaker in combat, but very agile." + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1, 1, 8000), + new PerkSpeed(0) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + }; + + private static final ItemStack[] PLAYER_ARMOR = { + ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET), + }; + public KitSurvivorRogue(ArcadeManager manager) { - super(manager, "Survivor Rogue", KitAvailability.Gem, - - new String[] - { - "You are weaker in combat, but very agile." - }, - - new Perk[] - { - new PerkLeap("Leap", 1, 1, 8000), - new PerkSpeed(0) - }, - EntityType.ZOMBIE, - new ItemStack(Material.IRON_AXE)); - + super(manager, "Survivor Rogue", "zombiesurvivalrogue", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.LEATHER_HELMET)); - player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); - player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.LEATHER_LEGGINGS)); - player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + player.getInventory().addItem(PLAYER_ITEMS); + player.getInventory().setArmorContents(PLAYER_ARMOR); } - + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitUndeadAlpha.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitUndeadAlpha.java index a68b2b298..e7642e16d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitUndeadAlpha.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitUndeadAlpha.java @@ -1,49 +1,53 @@ package nautilus.game.arcade.game.games.zombiesurvival.kits; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkIronSkin; +import nautilus.game.arcade.kit.perks.PerkLeap; +import nautilus.game.arcade.kit.perks.PerkRegeneration; +import nautilus.game.arcade.kit.perks.PerkStrength; import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.inventory.ItemStack; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitUndeadAlpha extends Kit +public class KitUndeadAlpha extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Leap at those undead" + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1, 1, 8000), + new PerkStrength(2), + new PerkIronSkin(2), + new PerkRegeneration(1) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.STONE_AXE); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE), + }; + public KitUndeadAlpha(ArcadeManager manager) { - super(manager, "Alpha Undead", KitAvailability.Free, - - new String[] - { - "Leap at those undead" - }, - - new Perk[] - { - new PerkLeap("Leap", 1, 1, 8000), - new PerkStrength(2), - new PerkIronSkin(2), - new PerkRegeneration(1) - }, - EntityType.SKELETON, - new ItemStack(Material.STONE_AXE)); - + super(manager, "Alpha Undead", "zombiesurvivalalpha", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); - + player.getInventory().addItem(PLAYER_ITEMS); + DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.SetSkeletonType(SkeletonType.WITHER); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitUndeadZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitUndeadZombie.java index 77e569d30..d6bd6fe1a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitUndeadZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitUndeadZombie.java @@ -1,49 +1,55 @@ package nautilus.game.arcade.game.games.zombiesurvival.kits; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.perks.PerkIronSkin; +import nautilus.game.arcade.kit.perks.PerkLeap; +import nautilus.game.arcade.kit.perks.PerkRegeneration; +import nautilus.game.arcade.kit.perks.PerkStrength; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitUndeadZombie extends Kit +public class KitUndeadZombie extends ProgressingKit { + + private static final String[] DESCRIPTION = { + "Just a standard Zombie..." + }; + + private static final Perk[] PERKS = { + new PerkLeap("Leap", 1, 1, 8000), + new PerkStrength(1), + new PerkIronSkin(1), + new PerkRegeneration(0) + }; + + private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); + + private static final ItemStack[] PLAYER_ITEMS = { + ItemStackFactory.Instance.CreateStack(Material.STONE_AXE), + }; + + public KitUndeadZombie(ArcadeManager manager) { - super(manager, "Undead", KitAvailability.Hide, - - new String[] - { - "Just a standard Zombie..." - }, - - new Perk[] - { - new PerkLeap("Leap", 1, 1, 8000), - new PerkStrength(1), - new PerkIronSkin(1), - new PerkRegeneration(0) - }, - EntityType.ZOMBIE, - new ItemStack(Material.STONE_AXE)); - + super(manager, "Undead", "zombiesurvivalundead", KitAvailability.Hide, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); - + player.getInventory().addItem(PLAYER_ITEMS); + DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } } + diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ChampionsKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ChampionsKit.java new file mode 100644 index 000000000..8886b615e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ChampionsKit.java @@ -0,0 +1,21 @@ +package nautilus.game.arcade.kit; + +import nautilus.game.arcade.ArcadeManager; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +/** + * Champions kit class to ensure backwards compatibility with the new KitProgression System + */ +public abstract class ChampionsKit extends Kit +{ + public ChampionsKit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) + { + super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + } + + public ChampionsKit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) + { + super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java index 8169f2c4a..37e11c948 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java @@ -1,22 +1,13 @@ package nautilus.game.arcade.kit; import mineplex.core.achievement.Achievement; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.*; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.events.PlayerKitGiveEvent; - import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; +import org.bukkit.entity.*; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; @@ -25,8 +16,8 @@ public abstract class Kit implements Listener { public ArcadeManager Manager; - private String _kitName; - private String[] _kitDesc; + protected String _kitName; + protected String[] _kitDesc; private KitAvailability _kitAvailability; private int _cost; @@ -39,6 +30,8 @@ public abstract class Kit implements Listener protected Achievement[] _achivementCategory; + protected LivingEntity _entity; + public Kit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { this(manager, name, kitAvailability, 2000, kitDesc, kitPerks, entityType, itemInHand); @@ -66,6 +59,11 @@ public abstract class Kit implements Listener _displayItem = itemInHand.getType(); } + public LivingEntity getLivingEntity() + { + return _entity; + } + public String GetFormattedName() { return GetAvailability().GetColor() + "§l" + _kitName; @@ -131,8 +129,9 @@ public abstract class Kit implements Listener { EntityType type = _entityType; if (type == EntityType.PLAYER) + { type = EntityType.ZOMBIE; - + } final LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); @@ -151,7 +150,9 @@ public abstract class Kit implements Listener UtilEnt.ghost(entity, true, false); UtilEnt.setFakeHead(entity, true); - SpawnCustom(entity); + SpawnCustom(entity); + + _entity = entity; return entity; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitProgressionData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitProgressionData.java new file mode 100644 index 000000000..ee5caa4e1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitProgressionData.java @@ -0,0 +1,36 @@ +package nautilus.game.arcade.kit; + +import nautilus.game.arcade.game.Game; + +/** + * Wrapper for in game kit data earned. + */ +public class KitProgressionData +{ + + private ProgressingKit _kit; + private Game _game; + private int _xpGained; + + public KitProgressionData(ProgressingKit kit, Game game, int xpGained) + { + _kit = kit; + _game = game; + _xpGained = xpGained; + } + + public int getXpGained() + { + return _xpGained; + } + + public Game getGame() + { + return _game; + } + + public ProgressingKit getKit() + { + return _kit; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java index 7a151660a..922b0daca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Perk.java @@ -1,7 +1,7 @@ package nautilus.game.arcade.kit; import nautilus.game.arcade.ArcadeManager; - +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.Listener; @@ -64,4 +64,9 @@ public abstract class Perk implements Listener { // When listener has been registered } + + public Material getIcon() + { + return Material.SLIME_BALL; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java new file mode 100644 index 000000000..8eeb0aa3c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java @@ -0,0 +1,360 @@ +package nautilus.game.arcade.kit; + +import com.google.common.collect.Lists; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilServer; +import mineplex.core.donation.Donor; +import mineplex.core.progression.ProgressiveKit; +import mineplex.core.progression.data.KitAbilityDetail; +import mineplex.core.progression.data.PlayerKit; +import mineplex.core.progression.data.PlayerKitDataManager; +import mineplex.core.progression.gui.Menu; +import mineplex.core.progression.math.Calculations; +import nautilus.game.arcade.ArcadeManager; +import net.minecraft.server.v1_8_R3.EntityFireworks; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_8_R3.World; +import org.bukkit.*; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Firework; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.FireworkMeta; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +/** + * Kit wrapper for all new kits + */ +public abstract class ProgressingKit extends Kit implements ProgressiveKit +{ + + private static final FireworkEffect EFFECT = FireworkEffect.builder() + .withColor(Color.AQUA) + .with(Type.BALL) + .build(); + + private String _internalName; + private PlayerKitDataManager _dataManager; + private List _kitAbilityDetails; + + public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) + { + super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + _internalName = internalName; + _dataManager = manager.getKitProgressionManager().getDataManager(); + _kitAbilityDetails = Lists.newArrayList(); + for (Perk perk : kitPerks) + { + _kitAbilityDetails.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc())); + } + } + + public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) + { + super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + _internalName = internalName; + _dataManager = manager.getKitProgressionManager().getDataManager(); + _kitAbilityDetails = Lists.newArrayList(); + for (Perk perk : kitPerks) + { + _kitAbilityDetails.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc())); + } + } + + + @Override + public String getDisplayName() + { + return _kitName; + } + + @Override + public String getInternalName() + { + return _internalName; + } + + @Override + public Material getIcon() + { + return _displayItem; + } + + @Override + public String[] getDescription() + { + return _kitDesc; + } + + @Override + public List getAbilityDetails() + { + return _kitAbilityDetails; + } + + @Override + public int getLevel(UUID player) + { + return _dataManager.get(player).getLevel(getInternalName()); + } + + @Override + public int getXp(UUID player) + { + int xp = _dataManager.get(player).getXp(getInternalName()); + if (xp <= 0) + { + xp = 1; + setXp(1, player); + } + return xp; + } + + @Override + public int getUpgradeLevel(UUID player) + { + return _dataManager.get(player).getUpgradeLevel(getInternalName()); + } + + @Override + public boolean isDefault(UUID player) + { + return _dataManager.get(player).isDefault(getInternalName()); + } + + @Override + public void upgrade(int upgradeLevel, UUID player) + { + _dataManager.get(player).setUpgradeLevel(upgradeLevel, getInternalName()); + } + + @Override + public void setDefault(boolean defaultValue, UUID player) + { + _dataManager.get(player).setDefault(defaultValue, getInternalName()); + } + + @Override + public void setLevel(int level, UUID player) + { + _dataManager.get(player).setLevel(level, getInternalName()); + } + + @Override + public void setXp(int xp, UUID player) + { + _dataManager.get(player).setXp(xp, getInternalName()); + } + + @Override + public void setUpgradeLevel(int upgradeLevel, UUID player) + { + _dataManager.get(player).setUpgradeLevel(upgradeLevel, getInternalName()); + } + + @Override + public void onSelected(UUID player) + { + _dataManager.get(player).setCurrentKit(getInternalName()); + Manager.GetGame().SetKit(Bukkit.getPlayer(player), this, true); + Manager.getProgressionKitManager().displayParticles(this, player); + } + + @Override + public void onSetDefault(UUID player) + { + Player bukkitPlayer = Bukkit.getPlayer(player); + + bukkitPlayer.sendMessage(F.main("Kit", "Set " + C.cYellowB + getDisplayName() + C.cGray + " as your default kit.")); + bukkitPlayer.closeInventory(); + //Undefault any kits and update the DB + for (Kit kit : Manager.GetGame().GetKits()) + { + if (kit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) kit; + if (progressingKit.isDefault(player) && !progressingKit.getInternalName().equalsIgnoreCase(getInternalName())) + { + progressingKit.setDefault(false, player); + } + } + } + boolean isDefault = isDefault(player); + Manager.getKitProgressionManager().getRepository().updateDefault(_dataManager.get(player), getInternalName(), isDefault ? 1 : 0); + Menu.remove(player); + } + + @Override + public void onLevelUp(UUID player) + { + PlayerKit playerKit = _dataManager.get(player); + playerKit.levelUp(); + + Player bukkitPlayer = UtilServer.getServer().getPlayer(player); + + List circle = circle(bukkitPlayer.getLocation(), 5, 1, true, false, 10); + + new BukkitRunnable() + { + + private int index = 0; + private int total = circle.size(); + + @Override + public void run() + { + Player[] players = UtilServer.getPlayers(); + Location location = circle.get(index); + CustomFirework.spawn(location, EFFECT, players); + if (++index == total) + { + cancel(); + bukkitPlayer.getWorld().strikeLightningEffect(bukkitPlayer.getLocation()); + } + } + }.runTaskTimer(Manager.getPlugin(), 0L, 1L); + } + + @Override + public boolean canPurchaseUpgrade(UUID player, int upgradeLevel) + { + PlayerKit playerKit = _dataManager.get(player); + Donor donor = Manager.GetDonation().Get(Bukkit.getPlayer(player)); + return Calculations.canUpgrade(playerKit.getLevel(getInternalName()), donor.GetGems()); + } + + @Override + public boolean isSelected(UUID player) + { + Kit kit = Manager.GetGame().GetKit(Bukkit.getPlayer(player)); + return kit instanceof ProgressingKit && ((ProgressingKit) kit).getInternalName().equals(getInternalName()); + } + + @Override + public boolean alreadyLeveledUp(UUID player) + { + return _dataManager.get(player).hasLeveledUp(); + } + + private List circle(Location loc, Integer r, Integer h, Boolean hollow, Boolean sphere, int plusY) + { + List circleblocks = new ArrayList<>(); + + int cx = loc.getBlockX(); + int cy = loc.getBlockY(); + int cz = loc.getBlockZ(); + + for (int x = cx - r; x <= cx + r; x++) + { + for (int z = cz - r; z <= cz + r; z++) + { + for (int y = (sphere ? cy - r : cy); y < (sphere ? cy + r : cy + h); y++) + { + double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0); + if (dist < r * r && !(hollow && dist < (r - 1) * (r - 1))) + { + Location l = new Location(loc.getWorld(), x, y + plusY, z); + circleblocks.add(l); + } + } + } + } + + return circleblocks; + } + + + public static String leap() + { + return C.cYellow + "Right-Click" + C.cWhite + " with Axe to " + C.cGreen + "Leap"; + } + + public static String receiveItem(String item, int amount, double time, int max) + { + return "Receive " + C.cGreen + amount + C.cWhite + " " + item + " every " + C.cGreen + time + C.cWhite + " second" + (time == 1 ? "" : "s") + + (max > 0 ? ". Max " + C.cGreen + max : ""); + } + + public static String click(boolean left, String comp) + { + return C.cYellow + (left ? "Left" : "Right") + "-Click " + C.cWhite + comp; + } + + public static String receiveArrowString(int amount, int per, int max) + { + return C.cWhite + "Receive " + C.cGreen + amount + C.cWhite + " arrow" + (amount == 1 ? "" : "s") + " every " + C.cGreen + per + C.cWhite + " seconds. Max " + C.cGreen + max; + } + + private static class CustomFirework extends EntityFireworks + { + + private Player[] players; + private boolean gone = false; + + public CustomFirework(World world, Player... p) + { + super(world); + this.players = p; + this.a(0.25F, 0.25F); + } + + + @Override + public void t_() + { + if (gone) + { + return; + } + + if (!this.world.isClientSide) + { + this.gone = true; + + if (players != null) + { + if (players.length > 0) + { + for (Player player : players) + { + (((CraftPlayer) player).getHandle()).playerConnection.sendPacket(new PacketPlayOutEntityStatus(this, (byte) 17)); + } + } else + { + world.broadcastEntityEffect(this, (byte) 17); + } + this.die(); + } + } + } + + public static void spawn(Location location, FireworkEffect effect, Player... players) + { + try + { + CustomFirework firework = new CustomFirework(((CraftWorld) location.getWorld()).getHandle(), players); + FireworkMeta meta = ((Firework) firework.getBukkitEntity()).getFireworkMeta(); + meta.addEffect(effect); + ((Firework) firework.getBukkitEntity()).setFireworkMeta(meta); + firework.setPosition(location.getX(), location.getY(), location.getZ()); + + if ((((CraftWorld) location.getWorld()).getHandle()).addEntity(firework)) + { + firework.setInvisible(true); + } + + } catch (Exception e) + { + e.printStackTrace(); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java index 72bfc668f..139b0c22f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java @@ -1,20 +1,10 @@ package nautilus.game.arcade.kit; -import java.util.Collection; -import java.util.Iterator; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.*; import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -25,8 +15,14 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; -public abstract class SmashKit extends Kit -{ +import java.util.Collection; +import java.util.Iterator; + +public abstract class SmashKit extends ProgressingKit +{ + + protected static final String DOUBLE_JUMP = C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump"; + private NautHashMap _superActive = new NautHashMap(); private int _superCharges = 1; @@ -39,7 +35,7 @@ public abstract class SmashKit extends Kit EntityType entityType, ItemStack itemInHand, String superName, long superDuration, Sound superSound) { - super(manager, name, kitAvailability, 3000, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, "smash" + name.toLowerCase().replace(" ", ""), kitAvailability, 3000, kitDesc, kitPerks, entityType, itemInHand); _superName = superName; _superDuration = superDuration; @@ -51,7 +47,7 @@ public abstract class SmashKit extends Kit EntityType entityType, ItemStack itemInHand, String superName, long superDuration, Sound superSound) { - super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, "smash" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); _superName = superName; _superDuration = superDuration; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java index b17f86772..116183c92 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java @@ -1,5 +1,16 @@ package nautilus.game.arcade.kit.perks; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -11,23 +22,10 @@ import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilInv; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Perk; - public class PerkApple extends Perk implements IThrown { - public PerkApple(ArcadeManager manager) + public PerkApple() { super("Apple Thrower", new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeThrower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeThrower.java index 5878156a5..b2b49cb86 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeThrower.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkAxeThrower.java @@ -25,7 +25,7 @@ import nautilus.game.arcade.kit.Perk; public class PerkAxeThrower extends Perk implements IThrown { - public PerkAxeThrower(ArcadeManager manager) + public PerkAxeThrower() { super("Axe Thrower", new String[] { 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..fbf651d22 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 @@ -34,7 +34,7 @@ public class PerkChicken extends Perk private long _lastEgg = 0; - public PerkChicken(ArcadeManager manager) + public PerkChicken() { super("Animal Tamer", new String[] { 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..0d8d8acb0 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 @@ -1,42 +1,19 @@ package nautilus.game.arcade.kit.perks; -import java.util.Arrays; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseBlaze; -import mineplex.core.disguise.disguises.DisguiseCow; -import mineplex.core.disguise.disguises.DisguiseInsentient; -import mineplex.core.disguise.disguises.DisguisePig; -import mineplex.core.disguise.disguises.DisguisePigZombie; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.disguise.disguises.DisguiseSlime; -import mineplex.core.disguise.disguises.DisguiseSpider; -import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Perk; - import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.entity.Cow; import org.bukkit.entity.Creature; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -47,12 +24,14 @@ import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; +import java.util.Arrays; + public class PerkMadScientist extends Perk implements IThrown { private NautHashMap _activeKitHolders = new NautHashMap(); - public PerkMadScientist(ArcadeManager manager) + public PerkMadScientist() { super("Mad Scientist", new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoSpillMilk.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoSpillMilk.java index 5752294ee..fd4400d73 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoSpillMilk.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoSpillMilk.java @@ -12,7 +12,7 @@ import org.bukkit.event.EventHandler; public class PerkNoSpillMilk extends Perk { - public PerkNoSpillMilk(ArcadeManager manager) + public PerkNoSpillMilk() { super("Steady Hands", new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkThrower.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkThrower.java index f46f3433e..a9cf87a76 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkThrower.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkThrower.java @@ -24,7 +24,7 @@ import nautilus.game.arcade.kit.Perk; public class PerkThrower extends Perk implements IThrown { - public PerkThrower(ArcadeManager manager) + public PerkThrower() { super("Thrower", new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index a18b55a08..899786190 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -1,37 +1,23 @@ package nautilus.game.arcade.managers; -import java.util.ArrayList; - -import mineplex.core.common.CurrencyType; 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.core.common.util.UtilServer; import mineplex.core.common.util.UtilTabTitle; -import mineplex.core.donation.Donor; import mineplex.core.recharge.Recharge; -import mineplex.core.shop.page.ConfirmationPage; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.PlayerKitApplyEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.shop.ArcadeShop; -import nautilus.game.arcade.shop.KitPackage; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; - +import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -44,6 +30,9 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.ArrayList; public class GamePlayerManager implements Listener { @@ -100,6 +89,33 @@ public class GamePlayerManager implements Listener { Manager.Clear(player); player.teleport(Manager.GetLobby().GetSpawn()); + //Load default kit for this game + if (Manager.GetGame() != null && Manager.GetGame().GetType().name().toLowerCase().contains("champions")) + { + return; + } + new BukkitRunnable() + { + @Override + public void run() + { + player.sendMessage(F.main("Kit", "Loading default kit for " + C.cGreenB + Manager.GetGame().GetName() + C.cGray + "...")); + for (Kit kit : Manager.GetGame().GetKits()) + { + //Set default kit + if (kit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) kit; + if (progressingKit.isDefault(player.getUniqueId())) + { + progressingKit.onSelected(player.getUniqueId()); + return; + } + } + } + player.sendMessage(F.main("Kit", "No default kit found for " + C.cGreenB + Manager.GetGame().GetName())); + } + }.runTaskLater(Manager.getPlugin(), 10L); return; } @@ -110,14 +126,12 @@ public class GamePlayerManager implements Listener if (loc != null && !loc.getWorld().getName().equalsIgnoreCase("world")) { player.teleport(loc); - } - else + } else { Manager.Clear(player); player.teleport(Manager.GetGame().GetTeam(player).GetSpawn()); } - } - else + } else { Manager.Clear(player); Manager.addSpectator(player, true); @@ -279,7 +293,7 @@ public class GamePlayerManager implements Listener return; } - KitClick(player, kit, event.getRightClicked()); + KitClick(player, kit); event.setCancelled(true); } @@ -311,111 +325,56 @@ public class GamePlayerManager implements Listener UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); return; } - - KitClick(player, kit, target); + + KitClick(player, kit); } - public void KitClick(final Player player, final Kit kit, final Entity entity) + public void KitClick(final Player player, final Kit kit) { - PlayerKitApplyEvent kitEvent = new PlayerKitApplyEvent(Manager.GetGame(), kit, player); - UtilServer.getServer().getPluginManager().callEvent(kitEvent); - if (!kitEvent.isCancelled()) - { - kit.DisplayDesc(player); - - if (Manager.GetGame() == null) - return; - - if (!Manager.GetGame().HasKit(kit)) - return; - - Donor donor = Manager.GetDonation().Get(player.getName()); - - if (kit.GetAvailability() == KitAvailability.Free || //Free - - Manager.hasKitsUnlocked(player) || //YouTube - - (kit.GetAvailability() == KitAvailability.Achievement && //Achievement - Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) || - - donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + kit.GetName()) || //Green - - Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF - - donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old) - - Manager.GetServerConfig().Tournament) //Tournament - { - Manager.GetGame().SetKit(player, kit, true); - } - else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.GEM) >= kit.GetCost()) - { - Manager.GetShop().openPageForPlayer(player, new ConfirmationPage( - Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable() - { - public void run() - { - if (player.isOnline()) - { - Manager.GetGame().SetKit(player, kit, true); - UtilPlayer.sendPacket(player, new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true)); - } - } - }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.GEM, player)); - } - else if (kit.GetAvailability() == KitAvailability.Achievement) - { - UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + ".")); - } - else - { - player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); - - UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + ".")); - } - } - else - UtilPlayer.message(player, F.main("Game", kitEvent.getCancelMessage())); + /** + * Moved to {@link ProgressingKitManager#entityClick(Player, Kit)} + */ + Manager.getProgressionKitManager().entityClick(player, kit); } - + @EventHandler(priority = EventPriority.HIGHEST) public void TeleportCommand(PlayerCommandPreprocessEvent event) { Game game = Manager.GetGame(); if (game == null) return; - + Player player = event.getPlayer(); - + if (Manager.GetClients().Get(player).GetRank().has(Rank.MODERATOR)) return; - + if (event.getMessage().toLowerCase().startsWith("/tp")) { UtilPlayer.message(player, F.main("Game", "Spectate Teleport changed to " + F.elem("/spec ") + ".")); event.setCancelled(true); return; } - + if (!event.getMessage().toLowerCase().startsWith("/spec")) return; - + event.setCancelled(true); - + if (game.IsAlive(player) || !Manager.isSpectator(player)) { UtilPlayer.message(player, F.main("Game", "Only Spectators can use this command.")); return; } - + String[] tokens = event.getMessage().split(" "); - + if (tokens.length != 2) { UtilPlayer.message(player, F.main("Game", "Invalid Input. " + F.elem("/spec ") + ".")); return; } - + Player target = UtilPlayer.searchOnline(player, tokens[1], true); if (target != null) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java new file mode 100644 index 000000000..88d327582 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java @@ -0,0 +1,306 @@ +package nautilus.game.arcade.managers; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +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.progression.data.PlayerKit; +import mineplex.core.progression.gui.guis.KitDisplayMenu; +import mineplex.core.progression.math.Calculations; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerKitApplyEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.kit.ChampionsKit; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitProgressionData; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import java.util.Map; +import java.util.UUID; + +/** + * Manages all things related to the ProgressingKit System for Arcade + */ +public class ProgressingKitManager implements Listener +{ + + private ArcadeManager _manager; + private Map _data; + private final Map _tasks = Maps.newHashMap(); + + private static final String LINE = ArcadeFormat.Line; + private static final String INFO = C.cWhiteB + "Kit Progression Progress"; + private static final String SPACE = " "; + + public ProgressingKitManager(ArcadeManager manager) + { + _manager = manager; + _manager.getPlugin().getServer().getPluginManager().registerEvents(this, _manager.getPlugin()); + _data = Maps.newHashMap(); + } + + public void displayParticles(ProgressingKit kit, UUID player) + { + if(_tasks.containsKey(player)) + { + //He has one selected + _tasks.remove(player).cancel(); + } + + Game storedGame = _manager.GetGame(); + Location storedLocation = kit.getLivingEntity().getLocation(); + + _tasks.put(player, new BukkitRunnable() + { + @Override + public void run() + { + if (!_manager.GetGame().GetName().equalsIgnoreCase(storedGame.GetName())) + { + cancel(); + _tasks.remove(player); + return; + } + if (kit.getLivingEntity() == null || !kit.getLivingEntity().getLocation().equals(storedLocation)) + { + cancel(); + _tasks.remove(player); + return; + } + kit.displaySelectedEffect(kit.getLivingEntity(), Bukkit.getPlayer(player)); + } + }.runTaskTimer(_manager.getPlugin(), 0L, 1L)); + } + + public void cancelParticles(Player player) + { + BukkitTask task = _tasks.remove(player.getUniqueId()); + if (task != null) + { + task.cancel(); + } + } + + public void entityClick(Player player, Kit kit) + { + PlayerKitApplyEvent kitEvent = new PlayerKitApplyEvent(_manager.GetGame(), kit, player); + UtilServer.getServer().getPluginManager().callEvent(kitEvent); + if (kitEvent.isCancelled()) + { + UtilPlayer.message(player, F.main("Game", kitEvent.getCancelMessage())); + return; + } + if (kit instanceof ChampionsKit) + { + _manager.GetGame().SetKit(player, kit, true); + return; + } + if (!(kit instanceof ProgressingKit)) + { + //Odd, someone else is using a kit system. + //Shouldn't ever happen, but we'll be careful. + return; + } + new KitDisplayMenu((ProgressingKit) kit).open(player); + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + PlayerKit playerKit = _manager.getKitProgressionManager().getDataManager().get(player.getUniqueId()); + + if (playerKit == null) + { + new BukkitRunnable() + { + @Override + public void run() + { + _manager.getKitProgressionManager().getRepository().getInfo(player.getUniqueId()); + } + + }.runTaskLater(_manager.getPlugin(), 5L); + } + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + //Fail safe updating in case a player leaves the game before we do data + Player player = event.getPlayer(); + + PlayerKit playerKit = _manager.getKitProgressionManager().getDataManager().get(player.getUniqueId()); + for (Kit kit : _manager.GetGame().GetKits()) + { + if (kit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) kit; + _manager.getKitProgressionManager().getRepository().insertOrUpdate(playerKit, progressingKit.getInternalName()); + } + } + _manager.getKitProgressionManager().getDataManager().remove(playerKit); + } + + @EventHandler + public void cancelParticles(GameStateChangeEvent event) + { + if(event.GetState() == GameState.Prepare) + { + return; + } + event.GetGame().GetPlayers(true).forEach(this::cancelParticles); + } + + + @EventHandler + public void onChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Dead) + { + return; + } + //Upon coming back into the lobby, reset player kits so they don't have to select it again + _manager.getPlugin().getServer().getScheduler().runTaskLater(_manager.getPlugin(), this::resetDefaultKits, 80); + //Show the data for the previous game + _manager.getPlugin().getServer().getScheduler().runTaskLater(_manager.getPlugin(), this::displayKitData, 140); + //Wait for achievements + } + + private void resetDefaultKits() + { + Lists.newArrayList(UtilServer.getPlayers()).stream() + .forEach(player -> { + for (Kit kit : _manager.GetGame().GetKits()) + { + //Set default kit + if (kit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) kit; + if (progressingKit.isDefault(player.getUniqueId())) + { + progressingKit.onSelected(player.getUniqueId()); + break; + } + } + } + }); + } + + private void displayKitData() + { + Lists.newArrayList(UtilServer.getPlayers()).stream() + .forEach(player -> { + KitProgressionData data = _data.remove(player.getUniqueId()); + if (data == null) + { + return; + } + + player.sendMessage(SPACE); + + player.sendMessage(LINE); + player.sendMessage(INFO); + player.sendMessage(SPACE); + + int xpGained = data.getXpGained(); + ProgressingKit kit = data.getKit(); + + PlayerKit playerKit = _manager.getKitProgressionManager().getDataManager().get(player.getUniqueId()); + + //We only want them leveling up once a game, and to make sure XP stays the same + //Limit their total gained to the max amount they can gain, if they've reached it or exceeded it + if (xpGained >= Calculations.getXpForNextLevel(kit.getLevel(player.getUniqueId()))) + { + xpGained = Calculations.getXpForNextLevel(kit.getLevel(player.getUniqueId())); + } + + + kit.setXp(kit.getXp(player.getUniqueId()) + xpGained, player.getUniqueId()); + boolean leveledUp = false; + + if (kit.isLevelUpReady(player.getUniqueId())) + { + leveledUp = true; + kit.levelUp(player.getUniqueId()); + } + + int currentLevel = kit.getLevel(player.getUniqueId()); + int difference = kit.getXpDifference(player.getUniqueId()); + + //We shouldn't need to update the database, but there are some cases where we'll need too (found through testing) + _manager.getKitProgressionManager().getRepository().insertOrUpdate(playerKit, kit.getInternalName()); + + StringBuilder builder = new StringBuilder(); + String kitName = C.cGoldB + kit.getDisplayName(); + + //Name of the kit + builder.append(kitName) + .append(" ") + .append(C.Reset); + + //Current level out of 100 + builder.append(C.cYellow) + .append(currentLevel) + .append(C.cGold) + .append("/") + .append(C.cYellow) + .append(100) + .append(" ") + .append(C.Reset); + + //The amount of XP the player gained + builder.append(C.cGreen) + .append("+") + .append(xpGained) + .append(" ") + .append(C.Reset); + + if (!leveledUp) + { + //The XP required to level up + builder.append(C.cYellow) + .append(difference) + .append(" to next level"); + } else + { + builder.append(C.cAquaB) + .append("LEVEL UP! ") + .append(C.cYellow) + .append(Calculations.getXpForNextLevel(currentLevel)) + .append(" to next level"); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + } + + //Send the message finally + player.sendMessage(builder.toString()); + player.sendMessage(C.cWhite + "Level up by using this kit in game!"); + + player.sendMessage(SPACE); + player.sendMessage(LINE); + }); + } + + public void addData(Player player, int xpGained, Game game, ProgressingKit kit) + { + _data.put(player.getUniqueId(), new KitProgressionData(kit, game, xpGained)); + } + + +} + diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java index 6ecf5b229..abe7cf097 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java @@ -1,16 +1,17 @@ package nautilus.game.arcade.stats; -import java.util.List; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerQuitEvent; - import mineplex.core.common.util.NautHashMap; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GemData; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.ProgressingKit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerQuitEvent; + +import java.util.List; public class ExperienceStatTracker extends StatTracker { @@ -94,8 +95,14 @@ public class ExperienceStatTracker extends StatTracker mult = 1.5; //Exp - int expGained = (int)(((timeExp + gemExp)*mult)*getGame().XpMult); - + int expGained = (int)(((timeExp + gemExp)*mult)*getGame().XpMult); + //Exp + Kit kit = event.GetGame().GetKit(player); + if (kit instanceof ProgressingKit) + { + ProgressingKit progressingKit = (ProgressingKit) kit; + event.GetGame().Manager.getProgressionKitManager().addData(player, expGained, event.GetGame(), progressingKit); + } //Record Global and per Game addStat(player, "ExpEarned", expGained, false, true); addStat(player, "ExpEarned", expGained, false, false); From a753a3ab075fc7de8ebb98b08730efe8ef54e262 Mon Sep 17 00:00:00 2001 From: samczsun Date: Wed, 1 Jun 2016 18:50:48 -0400 Subject: [PATCH 02/34] Clean up legendary code --- .../mineplex/core/common/util/UtilWorld.java | 5 ++ .../game/clans/items/GearManager.java | 10 ++-- .../items/legendaries/AlligatorsTooth.java | 30 ++++------ .../items/legendaries/EnergyCrossbow.java | 33 ++++++----- .../items/legendaries/GiantsBroadsword.java | 10 ++-- .../clans/items/legendaries/HyperAxe.java | 32 +++++------ .../items/legendaries/LegendaryItem.java | 13 +++-- .../clans/items/legendaries/MagneticMaul.java | 57 ++++++++++--------- .../items/legendaries/MeridianScepter.java | 8 +-- .../clans/items/legendaries/WindBlade.java | 2 +- 10 files changed, 100 insertions(+), 100 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java index fe44de9c8..99979144b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilWorld.java @@ -33,6 +33,11 @@ public class UtilWorld return chunkToStr(chunk.getWorld().getName(), chunk.getX(), chunk.getZ()); } + public static String chunkToStr(Location location) + { + return chunkToStr(location.getWorld().getName(), location.getBlockX() >> 4, location.getBlockZ() >> 4); + } + public static String chunkToStr(String world, int x, int z) { return world + "," + x + "," + z; 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 071aebc74..9a93d4b44 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 @@ -439,13 +439,15 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable private static String getItemSerialization(ItemStack item) { if (item == null || item.getItemMeta() == null || item.getItemMeta().getLore() == null) return null; - + + // fixme Each call to getItemMeta creates a new ItemMeta, a clone of an ArrayList, and a clone of a Hashmap + // Each call to getLore re-clones that ArrayList again + // Reflection may be too slow, but perhaps MethodHandles would be good? ItemMeta meta = item.getItemMeta(); - + for (String lore : meta.getLore()) { - if (lore.startsWith(ITEM_SERIALIZATION_TAG)) // Found serialization - // lore-line + if (lore.startsWith(ITEM_SERIALIZATION_TAG)) { int tagLength = ITEM_SERIALIZATION_TAG.length(); String serialization = lore.substring(tagLength); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/AlligatorsTooth.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/AlligatorsTooth.java index b444b690d..82e7ba1f3 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/AlligatorsTooth.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/AlligatorsTooth.java @@ -1,13 +1,9 @@ package mineplex.game.clans.items.legendaries; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; - +import mineplex.core.common.util.UtilAction; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; @@ -18,12 +14,11 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class AlligatorsTooth extends LegendaryItem { - private static ValueDistribution boostGen = generateDistribution(0.8d, 1.4d); - - private double _landDamageBonus = 7; - private double _waterDamageBonus = 11; + private static ValueDistribution BOOST_GEN = generateDistribution(0.8d, 1.4d); + private static double LAND_DAMAGE_BONUS = 7; + private static double WATER_DAMAGE_BONUS = 11; + private double _swimSpeed; - private int _soundUpdateCounter; public AlligatorsTooth() @@ -38,7 +33,7 @@ public class AlligatorsTooth extends LegendaryItem C.cYellow + "Right-Click" + C.cWhite + " to use" + C.cGreen + " Swim", }, Material.RECORD_4); - _swimSpeed = boostGen.generateValue(); + _swimSpeed = BOOST_GEN.generateValue(); } @Override @@ -46,8 +41,7 @@ public class AlligatorsTooth extends LegendaryItem { if (isInWater(wielder)) { - // Player gain water breathing while under water with legendary - // equipped + // Player gain water breathing while under water with legendary equipped grantPotionEffect(wielder, PotionEffectType.WATER_BREATHING, 0, 50); if (isHoldingRightClick()) @@ -56,7 +50,6 @@ public class AlligatorsTooth extends LegendaryItem if (++_soundUpdateCounter % 3 == 0) { wielder.playSound(wielder.getLocation(), Sound.SPLASH2, .5f, 1.25f); - wielder.getLocation().getWorld().playEffect(wielder.getLocation(), Effect.STEP_SOUND, Material.LAPIS_BLOCK.getId()); } } @@ -68,12 +61,12 @@ public class AlligatorsTooth extends LegendaryItem { if (isInWater(wielder)) { - event.AddMod("Alligators Tooth", _waterDamageBonus); - event.AddKnockback("Alligators Tooth", 0.5d); + event.AddMod("Alligators Tooth Water Bonus", WATER_DAMAGE_BONUS); + event.AddKnockback("Alligators Tooth Water Bonus", 0.5d); } else { - event.AddMod("Alligators Tooth", _landDamageBonus); + event.AddMod("Alligators Tooth Land Bonus", LAND_DAMAGE_BONUS); } } @@ -87,6 +80,7 @@ public class AlligatorsTooth extends LegendaryItem private boolean isInWater(Player player) { - return player.getLocation().getBlock().getType() == Material.WATER || player.getLocation().getBlock().getType() == Material.STATIONARY_WATER; + Material type = player.getLocation().getBlock().getType(); + return type == Material.WATER || type == Material.STATIONARY_WATER; } } 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 index 473627884..d1fa24314 100644 --- 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 @@ -1,5 +1,6 @@ package mineplex.game.clans.items.legendaries; +import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -35,32 +36,31 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; +/* + @deprecated Code probably doesn't work and needs a rewrite + */ +@Deprecated public class EnergyCrossbow extends LegendaryItem { - private long _lastFire = System.currentTimeMillis(); + private static final List PRE_CALCULATED_SPHERE = Collections.unmodifiableList( + UtilTrig.GetSpherePoints(new Vector(0, 0, 0), 1.8d, 1.8d, true, .4d) + ); + 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); + 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 (timeSinceLastBlock() < 98 && (System.currentTimeMillis() - _interactWait) >= 98) { if (Recharge.Instance.use(wielder, "Crossbow", 6500, true, true)) { @@ -82,6 +82,7 @@ public class EnergyCrossbow extends LegendaryItem private RGBData[] colors = { UtilColor.RgbLightRed, UtilColor.RgbLightRed.Lighten(), UtilColor.RgbLightRed.Darken() }; { + // Pretty sure this won't work _player = player; Arrow arrow = _player.shootArrow(); @@ -125,7 +126,7 @@ public class EnergyCrossbow extends LegendaryItem { HandlerList.unregisterAll(this); - for (Vector vector : _preCalculatedSphere) + for (Vector vector : PRE_CALCULATED_SPHERE) { UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, _arrow.getLocation().add(vector), UtilColor.RgbLightRed.ToVector(), 1.0f, 0, ViewDist.MAX); } @@ -182,7 +183,5 @@ public class EnergyCrossbow extends LegendaryItem } }); - - _lastFire = System.currentTimeMillis(); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/GiantsBroadsword.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/GiantsBroadsword.java index d3581ebc7..172f71b5f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/GiantsBroadsword.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/GiantsBroadsword.java @@ -14,8 +14,8 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class GiantsBroadsword extends LegendaryItem { - public static final int SLOW_AMPLIFIER = 43; - public static final int REGEN_AMPLIFIER = 1; + private static final int SLOW_AMPLIFIER = 43; + private static final int REGEN_AMPLIFIER = 1; public GiantsBroadsword() { @@ -33,7 +33,8 @@ public class GiantsBroadsword extends LegendaryItem @Override public void update(Player wielder) { - if (isHoldingRightClick()) { + if (isHoldingRightClick()) + { buffPlayer(wielder); UtilParticle.PlayParticle(ParticleType.HEART, wielder.getEyeLocation().add(0, 0.25, 0), -.5f + (float) Math.random(), -.5f + (float) Math.random(), -.5f + (float) Math.random(), .2f, 1, ViewDist.NORMAL); @@ -56,8 +57,7 @@ public class GiantsBroadsword extends LegendaryItem event.AddMod("Giants Bonus", 9); event.AddKnockback("Giants Sword", 0.5d); } - - + private void buffPlayer(Player player) { grantPotionEffect(player, PotionEffectType.SLOW, 40, SLOW_AMPLIFIER); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/HyperAxe.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/HyperAxe.java index 5a695ba27..c0bef5df0 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/HyperAxe.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/HyperAxe.java @@ -1,4 +1,4 @@ - package mineplex.game.clans.items.legendaries; +package mineplex.game.clans.items.legendaries; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -12,9 +12,9 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class HyperAxe extends LegendaryItem { - public static final long ATTACK_RATE_DURATION = 1000 / 10; - private static ValueDistribution amountGen = generateDistribution(0, 3); // [1, 4] speed amount - private static ValueDistribution durationGen = generateDistribution(80, 320); // [4, 16] seconds speed duration + private static final long ATTACK_RATE_DURATION = 1000 / 10; + private static ValueDistribution AMOUNT_GEN = generateDistribution(0, 3); // [1, 4] speed amount + private static ValueDistribution DURATION_GEN = generateDistribution(80, 320); // [4, 16] seconds speed duration private int _speedAmount; private int _speedDuration; @@ -34,15 +34,15 @@ public class HyperAxe extends LegendaryItem C.cWhite + "Deals " + C.cYellow + "3 Damage" + C.cWhite + " with attack", C.cYellow + "Right-Click" + C.cWhite + " to use " + C.cGreen + "Dash", }, Material.RECORD_3); - _speedAmount = amountGen.generateIntValue(); - _speedDuration = durationGen.generateIntValue(); + _speedAmount = AMOUNT_GEN.generateIntValue(); + _speedDuration = DURATION_GEN.generateIntValue(); _lastAttack = 0; } @Override public void update(Player wielder) { - if (isHoldingRightClick() && canBuff(wielder)) + if (isHoldingRightClick()) { buffPlayer(wielder); } @@ -64,22 +64,18 @@ public class HyperAxe extends LegendaryItem } } - public long timeSinceLastAttack() + private long timeSinceLastAttack() { return System.currentTimeMillis() - _lastAttack; } private void buffPlayer(Player wielder) { - Recharge.Instance.use(wielder, "Hyper Rush", 16000, true, false); - - // Give player speed buff - wielder.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, _speedDuration, _speedAmount)); - log("Buffing"); - } - - private boolean canBuff(Player wielder) - { - return Recharge.Instance.usable(wielder, "Hyper Rush", true); + if (Recharge.Instance.usable(wielder, "Hyper Rush", true)) + { + Recharge.Instance.use(wielder, "Hyper Rush", 16000, true, false); + // Give player speed buff + wielder.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, _speedDuration, _speedAmount)); + } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java index 0d21efc43..f01f68886 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java @@ -13,16 +13,15 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class LegendaryItem extends CustomItem { - public final long BLOCK_COOLDOWN = 200l; // Right clicking activates right click for 200ms + private 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 LegendaryItem(String name, String[] description, Material material) { super(name, description, material); - _lastBlock = 0l; + _lastBlock = 0L; } public void update(Player wielder) @@ -66,6 +65,11 @@ public class LegendaryItem extends CustomItem { return timeSinceLastBlock() <= BLOCK_COOLDOWN; } + + public long timeSinceLastBlock() + { + return System.currentTimeMillis() - _lastBlock; + } protected void log(String message) { @@ -92,7 +96,6 @@ public class LegendaryItem extends CustomItem */ public static void grantPotionEffect(Player player, PotionEffectType type, int tickDuration, int amplifier) { - player.removePotionEffect(type); - player.addPotionEffect(new PotionEffect(type, amplifier, tickDuration)); + player.addPotionEffect(new PotionEffect(type, amplifier, tickDuration), true); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/MagneticMaul.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/MagneticMaul.java index 3fb814e50..8b05823fb 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/MagneticMaul.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/MagneticMaul.java @@ -1,6 +1,7 @@ package mineplex.game.clans.items.legendaries; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; @@ -8,9 +9,11 @@ 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.UtilTextBottom; import mineplex.core.common.util.UtilWorld; import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import org.bukkit.Location; @@ -21,30 +24,28 @@ import org.bukkit.util.Vector; public class MagneticMaul extends LegendaryItem { - public static final double PULL_RANGE = 10d; + private static final double PULL_RANGE = 10d; private double _power; private double _heat; public MagneticMaul() { - super("Magnetic Maul", new String[] { - C.cWhite + "This brutal weapon allows you to pull your enemies towards you with magnetic force!" - + " ", + super("Magnetic Maul", UtilText.splitLinesToArray(new String[] { + C.cWhite + "This brutal weapon allows you to pull your enemies towards you with magnetic force!", + " ", C.cYellow + "Right-Click" + C.cWhite + " to use Maul." - }, Material.RECORD_5); + }, LineFormat.LORE), Material.RECORD_5); } @Override public void update(Player wielder) { Location loc = wielder.getLocation(); - if (ClansManager.getInstance().getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk()))) + ClanTerritory territory = ClansManager.getInstance().getClaimMap().get(UtilWorld.chunkToStr(loc)); + if (territory != null && territory.isSafe(loc)) { - if (ClansManager.getInstance().getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).isSafe(wielder.getLocation())) - { - return; - } + return; } if (isHoldingRightClick() && canPull()) @@ -94,9 +95,9 @@ public class MagneticMaul extends LegendaryItem if (otherTargetDistance < targetDistance && otherDistance <= PULL_RANGE) { // If entity is in safe zone, don't allow pulling of that entity. - if (ClansManager.getInstance().getClaimMap().containsKey(UtilWorld.chunkToStr(entity.getLocation().getChunk()))) + if (ClansManager.getInstance().getClaimMap().containsKey(UtilWorld.chunkToStr(entity.getLocation()))) { - if (ClansManager.getInstance().getClaimMap().get(UtilWorld.chunkToStr(entity.getLocation().getChunk())).isSafe(entity.getLocation())) + if (ClansManager.getInstance().getClaimMap().get(UtilWorld.chunkToStr(entity.getLocation())).isSafe(entity.getLocation())) { continue; } @@ -107,23 +108,23 @@ public class MagneticMaul extends LegendaryItem } // Do Particles - for (int i=0 ; i<6 ; i++) + for (int i = 0; i < 6; i++) { - Vector random = new Vector(Math.random() * 4 - 2, Math.random() * 4 - 2, Math.random() * 4 - 2); - - Location origin = player.getLocation().add(0, 1.3, 0); - origin.add(player.getLocation().getDirection().multiply(10)); - origin.add(random); - - Vector vel = UtilAlg.getTrajectory(origin, player.getLocation().add(0, 1.3, 0)); - vel.multiply(7); - - UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, - origin, - (float)vel.getX(), - (float)vel.getY(), - (float)vel.getZ(), - 1, 0, ViewDist.LONG, UtilServer.getPlayers()); + Vector random = new Vector(Math.random() * 4 - 2, Math.random() * 4 - 2, Math.random() * 4 - 2); + + Location origin = player.getLocation().add(0, 1.3, 0); + origin.add(player.getLocation().getDirection().multiply(10)); + origin.add(random); + + Vector vel = UtilAlg.getTrajectory(origin, player.getLocation().add(0, 1.3, 0)); + vel.multiply(7); + + UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, + origin, + (float)vel.getX(), + (float)vel.getY(), + (float)vel.getZ(), + 1, 0, ViewDist.LONG, UtilServer.getPlayers()); } removePower(1.75); 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 index 1e8701c32..0ef767d7a 100644 --- 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 @@ -35,10 +35,10 @@ import org.bukkit.util.Vector; public class MeridianScepter extends LegendaryItem { + private static final RGBData[] COLORS = { UtilColor.RgbPurple, UtilColor.RgbPurple.Lighten(), UtilColor.RgbPurple.Darken() }; + private long _interactWait; - private RGBData[] colors = { UtilColor.RgbPurple, UtilColor.RgbPurple.Lighten(), UtilColor.RgbPurple.Darken() }; - private transient HashMap _animations = new HashMap(); public MeridianScepter() @@ -53,7 +53,7 @@ public class MeridianScepter extends LegendaryItem @Override public void update(Player wielder) { - if ((System.currentTimeMillis() - _lastBlock) < 98 && (System.currentTimeMillis() - _interactWait) >= 98) + if (timeSinceLastBlock() < 98 && (System.currentTimeMillis() - _interactWait) >= 98) { if (ClansManager.getInstance().hasTimer(wielder)) { @@ -248,7 +248,7 @@ public class MeridianScepter extends LegendaryItem { for (Location loc : UtilShapes.getLinesDistancedPoints(start, end, 0.06)) { - UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, UtilCollections.random(colors).ToVector(), 1f, 0, ViewDist.LONG); + 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/legendaries/WindBlade.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/WindBlade.java index a467146bd..382f0cf0e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/WindBlade.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/WindBlade.java @@ -44,7 +44,7 @@ public class WindBlade extends LegendaryItem } } - public static final double FLIGHT_VELOCITY = 0.75d; + private static final double FLIGHT_VELOCITY = 0.75d; private double _power; private double _burnoutThreshold; From 45e6cb902fba58ab697e8879b2420d02ba7e09c6 Mon Sep 17 00:00:00 2001 From: samczsun Date: Wed, 1 Jun 2016 23:06:13 -0400 Subject: [PATCH 03/34] Save changes --- .../core/common/weight/WeightSet.java | 13 +- .../mineplex/game/clans/items/CustomItem.java | 2 +- .../game/clans/items/GearManager.java | 518 +++++++++++------- .../game/clans/items/ItemListener.java | 104 ++-- .../mineplex/game/clans/items/PlayerGear.java | 142 ++--- .../game/clans/items/economy/GoldToken.java | 2 +- 6 files changed, 411 insertions(+), 370 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java index 08327f982..8198c12af 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java @@ -10,18 +10,11 @@ public class WeightSet private static Random random = new Random(); - private Set> _weights; - - public WeightSet() - { - _weights = new HashSet>(); - } + private Set> _weights = new HashSet>(); @SafeVarargs public WeightSet(Weight... weights) { - this(); - for (Weight weight : weights) { _weights.add(weight); @@ -31,8 +24,6 @@ public class WeightSet @SafeVarargs public WeightSet(T... elements) { - this(); - for (T element : elements) { _weights.add(new Weight(1, element)); // Constant weight of 1 means all elements are equally likely @@ -41,8 +32,6 @@ public class WeightSet public WeightSet(Collection elements) { - this(); - for (T element : elements) { _weights.add(new Weight(1, element)); // Constant weight of 1 means all elements are equally likely diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java index 281846d4e..2396ac2a8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java @@ -112,7 +112,7 @@ public class CustomItem implements Listener String attributeLine = ATTRIBUTE_COLOR + "• " + attribute.getDescription(); lore.add(attributeLine); } - + // Add encoded JSON form of this item, not seen by user. String serialization = GearManager.getItemSerialization(this); lore.add(serialization); 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 9a93d4b44..1d8032815 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 @@ -1,5 +1,6 @@ package mineplex.game.clans.items; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.EnumSet; import java.util.HashMap; @@ -10,15 +11,16 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +import com.google.gson.JsonSyntaxException; +import net.minecraft.server.v1_8_R3.NBTBase; +import net.minecraft.server.v1_8_R3.NBTTagByte; +import net.minecraft.server.v1_8_R3.NBTTagString; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; @@ -62,14 +64,12 @@ import mineplex.game.clans.items.attributes.weapon.SharpAttribute; import mineplex.game.clans.items.commands.GearCommand; import mineplex.game.clans.items.economy.GoldToken; import mineplex.game.clans.items.legendaries.AlligatorsTooth; -import mineplex.game.clans.items.legendaries.EnergyCrossbow; 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.MeridianScepter; import mineplex.game.clans.items.legendaries.WindBlade; -import mineplex.game.clans.items.rares.Crossbow; import mineplex.game.clans.items.rares.RareItem; import mineplex.game.clans.items.rares.RunedPickaxe; import mineplex.game.clans.items.smelting.SmeltingListener; @@ -84,158 +84,179 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutWindowItems; * Manages creation and retrieval of associated {@link PlayerGear}s with online * players, as well as offering methods for parsing and handling * {@link CustomItem}s. - * + * * @author MrTwiggy - * + * */ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { + private static final Field UNHANDLED_TAGS_FIELD; + + static + { + try + { + UNHANDLED_TAGS_FIELD = Class.forName("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem").getDeclaredField("unhandledTags"); + UNHANDLED_TAGS_FIELD.setAccessible(true); + } + catch (Throwable t) + { + throw new RuntimeException("Error getting unhandledTags field", t); + } + } + private static final String ITEM_SERIALIZATION_TAG = "-JSON-"; private static Gson _gson; + static + { + + } private static GearManager _instance; // Singleton instance - - private Map _playerGears; // Mapping of player names - // (key) to cached gear set - // (value). - private WeightSet _attributeWeights; // Weightings for randomly - // selecting number of - // attributes (1, 2, 3) - private WeightSet _typeWeights; // Weightings for randomly - // selecting item type - // (legendary/weapon/armor/bow) - private Set _creativePlayers; // Set of names for all players - // currently in Creative gamemode - - // Legendary generation - public WeightSet> LegendaryWeights; - - // Rare generation - public WeightSet> RareWeights; - - // Weapon generation - public WeightSet WeaponTypes; - - // Armor generation - public WeightSet ArmorTypes; - - // Attribute generation - public WeightSet> WeaponAttributes; - public WeightSet> ArmorAttributes; - public WeightSet> BowAttributes; + + // Mapping of player names (key) to cached gear set (value). + private Map _playerGears = new HashMap<>(); + + // Weightings for randomly selecting number of attributes (1, 2, 3) + private static final WeightSet ATTRIBUTE_WEIGHTS = new WeightSet<>( + new Weight<>(3, 3), + new Weight<>(20, 2), + new Weight<>(77, 1) + ); + + // Weightings for randomly selecting item type (legendary/weapon/armor/bow) + private static final WeightSet TYPE_WEIGHTS = new WeightSet<>( + new Weight<>(6, ItemType.LEGENDARY), + new Weight<>(9, ItemType.RARE), + new Weight<>(46 - 9, ItemType.ARMOR), + new Weight<>(25, ItemType.WEAPON), + new Weight<>(23, ItemType.BOW) + ); + + private static final WeightSet> LEGENDARY_WEIGHTS = new WeightSet<>( + MeridianScepter.class, + AlligatorsTooth.class, + WindBlade.class, + GiantsBroadsword.class, + HyperAxe.class, + MagneticMaul.class + ); + + private static final WeightSet> RARE_WEIGHTS = new WeightSet<>( + RunedPickaxe.class + ); + + private static final WeightSet WEAPON_TYPES = new WeightSet<>( + Material.DIAMOND_SWORD, + Material.GOLD_SWORD, + Material.IRON_SWORD, + Material.DIAMOND_AXE, + Material.GOLD_AXE, + Material.IRON_AXE + ); + + private static final WeightSet ARMOR_TYPES = new WeightSet<>( + Material.DIAMOND_HELMET, + Material.DIAMOND_CHESTPLATE, + Material.DIAMOND_LEGGINGS, + Material.DIAMOND_BOOTS, + Material.IRON_HELMET, + Material.IRON_CHESTPLATE, + Material.IRON_LEGGINGS, + Material.IRON_BOOTS, + Material.GOLD_HELMET, + Material.GOLD_CHESTPLATE, + Material.GOLD_LEGGINGS, + Material.GOLD_BOOTS + ); + + private static final WeightSet> WEAPON_ATTRIBUTES = new WeightSet<>( + FrostedAttribute.class, + SharpAttribute.class, + JaggedAttribute.class, + HasteAttribute.class, + FlamingAttribute.class, + ConqueringAttribute.class + ); + + private static final WeightSet> ARMOR_ATTRIBUTES = new WeightSet<>( + SlantedAttribute.class, + ReinforcedAttribute.class, + ConqueringArmorAttribute.class, + PaddedAttribute.class, + LavaAttribute.class + ); + + private static final WeightSet> BOW_ATTRIBUTES = new WeightSet<>( + HeavyArrowsAttribute.class, + HuntingAttribute.class, + InverseAttribute.class, + LeechingAttribute.class, + RecursiveAttribute.class, + ScorchingAttribute.class, + SlayingAttribute.class + ); // Attribute Masks - private EnumSet _maskAttributes; - + private static final EnumSet MASK_ATTRIBUTES = EnumSet.of( + Material.GOLD_RECORD, + Material.GREEN_RECORD, + Material.RECORD_3, + Material.RECORD_4, + Material.RECORD_5, + Material.RECORD_6, + Material.RECORD_7, + Material.RECORD_8, + Material.RECORD_9, + Material.RECORD_10, + Material.RECORD_11, + Material.RECORD_12 + ); + private GearShop _shop; - + + private static Map customItemCache = new HashMap<>(); + public GearManager(JavaPlugin plugin, PacketHandler packetHandler, CoreClientManager clientManager, DonationManager donationManager) { super("CustomGear", plugin); - + _instance = this; - + _shop = new GearShop(this, clientManager, donationManager); - - _creativePlayers = new HashSet(); - _playerGears = new HashMap(); - // TODO: Introduce configurable non-hardcoded values for generation - // weights? - _attributeWeights = new WeightSet(new Weight(3, 3), new Weight(20, 2), new Weight(77, 1)); - _typeWeights = new WeightSet(new Weight(6, ItemType.LEGENDARY), - new Weight(9, ItemType.RARE), - new Weight(46 - 9, ItemType.ARMOR), - new Weight(25, ItemType.WEAPON), - new Weight(23, ItemType.BOW)); - - // Weapon-based attributes - WeaponAttributes = new WeightSet>(FrostedAttribute.class, SharpAttribute.class, JaggedAttribute.class, HasteAttribute.class, FlamingAttribute.class, ConqueringAttribute.class); - - // Armor-based attributes - ArmorAttributes = new WeightSet>(SlantedAttribute.class, ReinforcedAttribute.class, ConqueringArmorAttribute.class, PaddedAttribute.class, LavaAttribute.class); - - // Bow-based attributes - BowAttributes = new WeightSet>(HeavyArrowsAttribute.class, HuntingAttribute.class, InverseAttribute.class, LeechingAttribute.class, RecursiveAttribute.class, ScorchingAttribute.class, SlayingAttribute.class); - - // Weapon material types - WeaponTypes = new WeightSet(Material.DIAMOND_SWORD, Material.GOLD_SWORD, Material.IRON_SWORD, Material.DIAMOND_AXE, Material.GOLD_AXE, Material.IRON_AXE); - - // Armor material types - ArmorTypes = new WeightSet(Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS, Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS, Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS); - - // TODO: Initialize list of attributes and types - - // Initialize various LegendaryItem types - LegendaryWeights = new WeightSet>(MeridianScepter.class, AlligatorsTooth.class, WindBlade.class, GiantsBroadsword.class, HyperAxe.class, MagneticMaul.class); - - RareWeights = new WeightSet>(RunedPickaxe.class); - // TODO: Add rest of legendaries, find better way? - + // Register listeners UtilServer.getServer().getPluginManager().registerEvents(new ItemListener(getPlugin()), getPlugin()); UtilServer.getServer().getPluginManager().registerEvents(new SmeltingListener(), getPlugin()); - + // Initialize attribute types factory for JSON handling of polymorphism. RuntimeTypeAdapterFactory attributeFactory = RuntimeTypeAdapterFactory.of(ItemAttribute.class); - - for (Class attributeType : ArmorAttributes.elements()) - { - attributeFactory.registerSubtype(attributeType); - } - for (Class attributeType : WeaponAttributes.elements()) - { - attributeFactory.registerSubtype(attributeType); - } - for (Class attributeType : BowAttributes.elements()) - { - attributeFactory.registerSubtype(attributeType); - } - - // Initialize legendary item type factory for JSON handling of - // polymorphism. + ARMOR_ATTRIBUTES.elements().forEach(attributeFactory::registerSubtype); + WEAPON_ATTRIBUTES.elements().forEach(attributeFactory::registerSubtype); + BOW_ATTRIBUTES.elements().forEach(attributeFactory::registerSubtype); + + // Initialize legendary item type factory for JSON handling of polymorphism. RuntimeTypeAdapterFactory customItemType = RuntimeTypeAdapterFactory.of(CustomItem.class); customItemType.registerSubtype(CustomItem.class); customItemType.registerSubtype(LegendaryItem.class); customItemType.registerSubtype(RareItem.class); customItemType.registerSubtype(GoldToken.class); - for (Class itemType : LegendaryWeights.elements()) - { - customItemType.registerSubtype(itemType); - } - - for (Class itemType : RareWeights.elements()) - { - customItemType.registerSubtype(itemType); - } - + LEGENDARY_WEIGHTS.elements().forEach(customItemType::registerSubtype); + RARE_WEIGHTS.elements().forEach(customItemType::registerSubtype); + // Build GSON instance off factories for future serialization of items. _gson = new GsonBuilder().registerTypeAdapterFactory(attributeFactory).registerTypeAdapterFactory(customItemType).create(); - - packetHandler.addPacketHandler(this, PacketPlayOutSetSlot.class, PacketPlayOutWindowItems.class); - - plugin.getServer().getScheduler().runTaskTimer(plugin, this, 1l, 1l); - _maskAttributes = EnumSet.of(Material.GOLD_RECORD, Material.GREEN_RECORD, Material.RECORD_3, Material.RECORD_4, Material.RECORD_5, Material.RECORD_6, - Material.RECORD_7, Material.RECORD_8, Material.RECORD_9, Material.RECORD_10, Material.RECORD_11, Material.RECORD_12); + packetHandler.addPacketHandler(this, PacketPlayOutSetSlot.class, PacketPlayOutWindowItems.class); + + plugin.getServer().getScheduler().runTaskTimer(plugin, this, 1L, 1L); } - + @Override public void addCommands() { addCommand(new GearCommand(this)); } - - public void addCreativePlayer(Player player) - { - _creativePlayers.add(player.getName()); - player.updateInventory(); - } - - public void removeCreativePlayer(Player player) - { - _creativePlayers.remove(player.getName()); - player.updateInventory(); - } - + /** * Tick & update internal logic for {@link GearManager}. Called once per * tick. @@ -257,7 +278,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable } } } - + /** * @param player - the player whose {@link PlayerGear} set is to be fetched. * @return the cached or newly instantiated {@link PlayerGear} associated @@ -271,38 +292,38 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable PlayerGear gear = new PlayerGear(playerName); _playerGears.put(playerName, gear); } - + return _playerGears.get(playerName); } - + public CustomItem generateItem() { - int attributeCount = _attributeWeights.generateRandom(); - ItemType itemType = _typeWeights.generateRandom(); - + int attributeCount = ATTRIBUTE_WEIGHTS.generateRandom(); + ItemType itemType = TYPE_WEIGHTS.generateRandom(); + RareItemFactory factory = RareItemFactory.begin(itemType); - + if (itemType == ItemType.RARE) { - factory.setRare(RareWeights.generateRandom()); + factory.setRare(RARE_WEIGHTS.generateRandom()); } else if (itemType == ItemType.LEGENDARY) { - factory.setLegendary(LegendaryWeights.generateRandom()); + factory.setLegendary(LEGENDARY_WEIGHTS.generateRandom()); } else if (itemType == ItemType.ARMOR) { - factory.setType(ArmorTypes.generateRandom()); + factory.setType(ARMOR_TYPES.generateRandom()); } else if (itemType == ItemType.WEAPON) { - factory.setType(WeaponTypes.generateRandom()); + factory.setType(WEAPON_TYPES.generateRandom()); } else if (itemType == ItemType.BOW) { factory.setType(Material.BOW); } - + if (itemType != ItemType.LEGENDARY) // Only non-legendaries have // attributes { @@ -311,7 +332,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable System.out.println("Generating attributes..."); System.out.println("Remaining size: " + attributes.getRemainingTypes().size()); - + if (attributes.getSuperPrefix() != null) { System.out.println("Set super prefix: " + attributes.getSuperPrefix().getClass()); @@ -328,10 +349,10 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable factory.setSuffix(attributes.getSuffix().getClass()); } } - + return factory.getWrapper(); } - + private void generateAttributes(AttributeContainer container, ItemType type, int count) { for (int i = 0; i < count; i++) @@ -339,85 +360,152 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable int attempts = 0; Set remaining = container.getRemainingTypes(); ItemAttribute attribute = null; - + while (remaining.size() > 0 && attempts < 10 && attribute == null) { ItemAttribute sampleAttribute = null; - + switch (type) { case ARMOR: - sampleAttribute = instantiate(ArmorAttributes.generateRandom()); + sampleAttribute = instantiate(ARMOR_ATTRIBUTES.generateRandom()); break; case WEAPON: - sampleAttribute = instantiate(WeaponAttributes.generateRandom()); + sampleAttribute = instantiate(WEAPON_ATTRIBUTES.generateRandom()); break; case BOW: - sampleAttribute = instantiate(BowAttributes.generateRandom()); + sampleAttribute = instantiate(BOW_ATTRIBUTES.generateRandom()); break; default: break; } - + if (sampleAttribute != null && remaining.contains(sampleAttribute.getType())) { - attribute = sampleAttribute; // Select valid attribute to - // add + attribute = sampleAttribute; // Select valid attribute to add } - + attempts++; } - + container.addAttribute(attribute); } } - + public void spawnItem(Location location) { CustomItem item = generateItem(); location.getWorld().dropItem(location, item.toItemStack()); } - + public static CustomItem parseItem(ItemStack item) { - String serialization = getItemSerialization(item); - - if (serialization != null) + if (item == null) { - CustomItem customItem = null; - + return null; + } + Map data = getUnhandledTags(item); + if (data.containsKey("gearmanager.uuid")) + { + String strUUID = ((NBTTagString) data.get("gearmanager.uuid")).a_(); try { - customItem = deserialize(serialization); + UUID uuid = UUID.fromString(strUUID); + CustomItem customItem = customItemCache.get(uuid); + if (customItem == null) + { + String json = ((NBTTagString) data.get("gearmanager.json")).a_(); + customItem = deserialize(json); + customItemCache.put(uuid, customItem); + } + return customItem; } + // Not an UUID? + catch (IllegalArgumentException exception) + { + if (!data.containsKey("gearmanager.warnuuid")) + { + // Add to the lore that this item is corrupted + List lore = item.getItemMeta().getLore(); + lore.add(""); + lore.add(C.cRedB + "Corrupted item (Error 1)"); + data.put("gearmanager.warnuuid", new NBTTagByte((byte) 1)); + exception.printStackTrace(); + } + return null; + } + // Failed to parse + catch (JsonSyntaxException exception) + { + if (!data.containsKey("gearmanager.warnsyntax")) + { + // Add to the lore that this item is corrupted + List lore = item.getItemMeta().getLore(); + lore.add(""); + lore.add(C.cRedB + "Corrupted item (Error 2)"); + data.put("gearmanager.warnsyntax", new NBTTagByte((byte) 1)); + System.out.println(((NBTTagString) data.get("gearmanager.json")).a_()); + exception.printStackTrace(); + } + return null; + } + // Other catch (Exception exception) { - exception.printStackTrace(); - System.out.println("=========="); - System.out.println("GearManager parse problem :"); - System.out.println(serialization); - System.out.println("=========="); + if (!data.containsKey("gearmanager.warnother")) + { + // Add to the lore that this item is corrupted + List lore = item.getItemMeta().getLore(); + lore.add(""); + lore.add(C.cRedB + "Corrupted item (Error 3)"); + data.put("gearmanager.warnother", new NBTTagByte((byte) 1)); + exception.printStackTrace(); + } + return null; } - - return customItem; } - - return null; // No serialization found in item's lore, not a custom - // item! + else // This is stored in the old format + { + String serialization = getItemSerialization(item); + if (serialization == null) + { + return null; + } + try + { + CustomItem customItem = deserialize(serialization); + + data.put("gearmanager.uuid", new NBTTagString(customItem._uuid)); + data.put("gearmanager.json", new NBTTagString(serialization)); + customItemCache.put(UUID.fromString(customItem._uuid), customItem); + return customItem; + } + catch (Exception e) + { + System.out.println(serialization); + e.printStackTrace(); + } + return null; + } } - + public static boolean isCustomItem(ItemStack item) { + Map data = getUnhandledTags(item); + if (data.containsKey("gearmanager.uuid") && data.containsKey("gearmanager.json")) + { + return true; + } return getItemSerialization(item) != null; } - + public static String getItemSerialization(CustomItem customItem) { String serialization = serialize(customItem); - + return ITEM_SERIALIZATION_TAG + serialization; } - + /** * @param type - the class-type of the object to be instantiated. (must have * zero-argument constructor) @@ -435,7 +523,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return null; } } - + private static String getItemSerialization(ItemStack item) { if (item == null || item.getItemMeta() == null || item.getItemMeta().getLore() == null) return null; @@ -451,35 +539,30 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { int tagLength = ITEM_SERIALIZATION_TAG.length(); String serialization = lore.substring(tagLength); - + return serialization; } } - + return null; // Unable to find any serialized lore lines, hence not a // CustomItem. } - + public static String serialize(CustomItem customItem) { return _gson.toJson(customItem, CustomItem.class); } - - public static String serialize(AttributeContainer attributes) - { - return _gson.toJson(attributes, AttributeContainer.class); - } - + public static CustomItem deserialize(String serialization) { return _gson.fromJson(serialization, CustomItem.class); } - + public static T deserialize(String serialization, Class type) { return _gson.fromJson(serialization, type); } - + /** * @return singleton instance of {@link GearManager}. */ @@ -487,12 +570,12 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { return _instance; } - + public static void notify(Player player, String message) { UtilPlayer.message(player, F.main("Gear", message)); } - + /** * @param player - the player to see if they should have their out-going * packets masked on CustomGear items. @@ -501,17 +584,17 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable */ private boolean maskGearPacket(Player player) { - return player.getGameMode() != GameMode.CREATIVE && !_creativePlayers.contains(player.getName()); + return player.getGameMode() != GameMode.CREATIVE; } - + public void handle(PacketInfo packetInfo) { // Don't mask custom gear lore for creative players, as this will break // them. if (!maskGearPacket(packetInfo.getPlayer())) return; - + Packet packet = packetInfo.getPacket(); - + if (packet instanceof PacketPlayOutSetSlot) { PacketPlayOutSetSlot slotPacket = (PacketPlayOutSetSlot) packet; @@ -521,14 +604,14 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable else if (packet instanceof PacketPlayOutWindowItems) { PacketPlayOutWindowItems itemsPacket = (PacketPlayOutWindowItems) packet; - + for (int i = 0; i < itemsPacket.b.length; i++) { itemsPacket.b[i] = maskItem(itemsPacket.b[i], packetInfo.getPlayer()); // Mask all // out-going // item packets ItemStack item = CraftItemStack.asCraftMirror(itemsPacket.b[i]); - if (item != null && _maskAttributes.contains(item.getType())) + if (item != null && MASK_ATTRIBUTES.contains(item.getType())) itemsPacket.b[i] = removeAttributes(itemsPacket.b[i]); } } @@ -547,7 +630,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return item; } - + private net.minecraft.server.v1_8_R3.ItemStack maskItem(net.minecraft.server.v1_8_R3.ItemStack item, Player player) { // Cannot mask a null item @@ -555,20 +638,20 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { return null; } - + CraftItemStack originalItem = CraftItemStack.asCraftMirror(item); ItemMeta originalMeta = originalItem.getItemMeta(); - + // No need to modify item packets with no lore if (originalMeta == null || originalMeta.getLore() == null) { return item; } - + List lore = new ArrayList(); - + CustomItem ci = parseItem(originalItem); - + for (String line : originalMeta.getLore()) { if (!line.startsWith(ITEM_SERIALIZATION_TAG)) @@ -576,13 +659,13 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable lore.add(line); } } - - if (ci != null && LegendaryWeights.elements().contains(ci.getClass())) + + if (ci != null && LEGENDARY_WEIGHTS.elements().contains(ci.getClass())) { lore.add(" "); lore.add(C.cWhite + "Original Owner: " + C.cYellow + (ci.OriginalOwner == null ? "You" : Bukkit.getOfflinePlayer(UUID.fromString(ci.OriginalOwner)).getName())); } - + net.minecraft.server.v1_8_R3.ItemStack newItem = CraftItemStack.asNMSCopy(originalItem); CraftItemStack newCopy = CraftItemStack.asCraftMirror(newItem); ItemMeta newMeta = newCopy.getItemMeta(); @@ -590,9 +673,44 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable newCopy.setItemMeta(newMeta); return newItem; } - + public void openShop(Player player) { _shop.attemptShopOpen(player); } + + // WARNING + // This will not be persistent if the ItemStack is a block and placed then picked up + private static Map getUnhandledTags(ItemStack itemStack) + { + ItemMeta itemMeta = itemStack.getItemMeta(); + if (itemMeta == null) + { + return null; + } + try + { + return (Map) UNHANDLED_TAGS_FIELD.get(itemMeta); + } + catch (IllegalAccessException e) + { + System.out.println("Could not get unhandledTags"); + e.printStackTrace(); + } + return null; + } + + public static void save(ItemStack itemStack, boolean remove) + { + CustomItem item = parseItem(itemStack); + if (item != null) + { + Map data = getUnhandledTags(itemStack); + data.put("gearmanager.json", new NBTTagString(serialize(item))); + if (remove) + { + customItemCache.remove(item); + } + } + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java index 8e499d6a5..24f1897b5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java @@ -1,5 +1,10 @@ package mineplex.game.clans.items; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilOfflinePlayer; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import net.minecraft.server.v1_8_R3.PlayerInventory; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.entity.Entity; @@ -14,6 +19,8 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.java.JavaPlugin; @@ -23,62 +30,50 @@ import mineplex.game.clans.items.attributes.ItemAttribute; import mineplex.minecraft.game.core.damage.CustomDamageEvent; /** - * Listens for item-related trigger events and accordingly triggers appropriate + * Listens for item-related trigger events and accordingly triggers appropriate * {@link PlayerGear} events for {@link CustomItem} abilities and attributes. - * @author MrTwiggy * + * @author MrTwiggy */ -public class ItemListener implements Listener +public class ItemListener implements Listener, Runnable { + private static final String PROJECTILE_META_TAG = "[CustomGearProj]"; - public static final String PROJECTILE_META_TAG = "[CustomGearProj]"; - private JavaPlugin _plugin; - + public ItemListener(JavaPlugin plugin) { _plugin = plugin; + _plugin.getServer().getScheduler().runTaskTimer(_plugin, this, 20 * 60 * 5, 0); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onGamemodeChange(PlayerGameModeChangeEvent event) + @Override + public void run() { - if (event.getNewGameMode() == GameMode.CREATIVE) // Entering creative mode + for (Player player : UtilServer.getPlayersCollection()) { - GearManager.getInstance().addCreativePlayer(event.getPlayer()); - } - else if (event.getPlayer().getGameMode() == GameMode.CREATIVE) // Exiting creative mode - { - GearManager.getInstance().removeCreativePlayer(event.getPlayer()); - - // Update/refresh the players inventory in 5 ticks once they're in survival mode again - final Player player = event.getPlayer(); - Bukkit.getScheduler().runTaskLater(_plugin, new Runnable() - { - @Override - public void run() - { - player.updateInventory(); - } - }, 5l); + save(player, false); } } - - /** - * Handle players shuffling CustomItems around by properly updating - * and managing their movement. - * @param event - */ - @EventHandler - public void onInventoryClick(InventoryClickEvent event) + + @EventHandler(priority = EventPriority.LOWEST) + public void on(PlayerQuitEvent event) { - // TODO: Update any custom-items that are selected/moved to save proper stats if they - // TODO: are active. (IE: PlayerGear possesses it as armor slot or weapon) + save(event.getPlayer(), true); } - + + private void save(Player player, boolean remove) + { + for (ItemStack item : UtilInv.getItems(player)) + { + GearManager.save(item, remove); + } + } + /** * Handle updated CustomItem stats and lore upon player * switching items. + * * @param event */ @EventHandler @@ -86,37 +81,38 @@ public class ItemListener implements Listener { Player player = event.getPlayer(); PlayerGear gear = getGear(player); - + gear.onItemHeldChanged(event); } /** * Handle the trigger of custom gear related effects and abilities. + * * @param event */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerAttack(CustomDamageEvent event) { - if (event.IsCancelled()) return; // Checks for Pre-Cancelled event and stops - - Player damager = event.GetDamagerPlayer(false); // For non-ranged attacks + if (event.IsCancelled()) return; // Checks for Pre-Cancelled event and stops + + Player damager = event.GetDamagerPlayer(false); // For non-ranged attacks Player damagee = event.GetDamageePlayer(); Projectile projectile = event.GetProjectile(); - + // Trigger custom gear effects for attacker melee weapons if (damager != null && event.GetCause() == DamageCause.ENTITY_ATTACK) { PlayerGear attackerGear = getGear(damager); attackerGear.onAttack(event); } - + // Trigger custom gear effects for defender armor if (damagee != null) { PlayerGear defenderGear = getGear(damagee); defenderGear.onAttacked(event); } - + // Trigger bow-related attribute effects properly if (projectile != null) { @@ -124,9 +120,8 @@ public class ItemListener implements Listener { for (MetadataValue data : projectile.getMetadata(PROJECTILE_META_TAG)) { - String serialization = data.asString(); - AttributeContainer container = GearManager.deserialize(serialization, AttributeContainer.class); - + AttributeContainer container = (AttributeContainer) data.value(); + for (ItemAttribute attribute : container.getAttributes()) { attribute.onAttack(event); @@ -135,9 +130,10 @@ public class ItemListener implements Listener } } } - + /** * Properly marks projectiles shot from a custom-gear bow so that it will properly trigger events. + * * @param event */ @EventHandler @@ -147,24 +143,24 @@ public class ItemListener implements Listener { Player player = (Player) event.getEntity(); PlayerGear gear = getGear(player); - + CustomItem weapon = gear.getWeapon(); - + if (weapon != null) { // Copy weapon attributes onto projectile for later processing AttributeContainer attributes = weapon.getAttributes(); - String serialization = GearManager.serialize(attributes); Entity projectile = event.getProjectile(); - projectile.setMetadata(PROJECTILE_META_TAG, new FixedMetadataValue(_plugin, serialization)); - + projectile.setMetadata(PROJECTILE_META_TAG, new FixedMetadataValue(_plugin, attributes)); + } } } - + /** * Handle weapon ability activation of custom gear. + * * @param event */ @EventHandler @@ -174,7 +170,7 @@ public class ItemListener implements Listener PlayerGear playerGear = getGear(event.getPlayer()); playerGear.onInteract(event); } - + /** * @param player - the player whose gear is to be fetched * @return the {@link PlayerGear} associated with {@code player}. diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java index 64fec8dcf..260f82a99 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java @@ -2,6 +2,7 @@ package mineplex.game.clans.items; import java.util.HashSet; import java.util.Set; +import java.util.function.Consumer; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -29,13 +30,6 @@ public class PlayerGear { private String _playerName; // Name of player who owns the gear - // Cached custom item information for player's gear - private CustomItem _weapon; - private CustomItem _helmet; - private CustomItem _chestplate; - private CustomItem _leggings; - private CustomItem _boots; - /** * Class constructor * @@ -85,15 +79,6 @@ public class PlayerGear return Bukkit.getPlayer(_playerName); } - /** - * @return the {@link PlayerInventory} associated with the owner of this - * {@link PlayerGear}. - */ - public PlayerInventory getInventory() - { - return getPlayer().getInventory(); - } - public String getPlayerName() { return _playerName; @@ -107,11 +92,9 @@ public class PlayerGear */ public void onInteract(PlayerInteractEvent event) { - for (CustomItem item : getGear()) - { - item.onInteract(event); - } + forEachGear(item -> item.onInteract(event)); } + /** * Trigger on-attack events for the set of equipped {@link CustomItem}s in @@ -121,10 +104,7 @@ public class PlayerGear */ public void onAttack(CustomDamageEvent event) { - for (CustomItem item : getGear()) - { - item.onAttack(event); - } + forEachGear(item -> item.onAttack(event)); } /** @@ -135,10 +115,7 @@ public class PlayerGear */ public void onAttacked(CustomDamageEvent event) { - for (CustomItem item : getGear()) - { - item.onAttacked(event); - } + forEachGear(item -> item.onAttacked(event)); } /** @@ -156,97 +133,58 @@ public class PlayerGear weapon.update(item); // Update held-item's stats. } } - + + private void forEachGear(Consumer itemConsumer) + { + CustomItem weapon = getWeapon(); + if (weapon != null) + { + itemConsumer.accept(weapon); + } + CustomItem helmet = getHelmet(); + if (helmet != null) + { + itemConsumer.accept(helmet); + } + CustomItem chestplate = getChestplate(); + if (chestplate != null) + { + itemConsumer.accept(chestplate); + } + CustomItem leggings = getLeggings(); + if (leggings != null) + { + itemConsumer.accept(leggings); + } + CustomItem boots = getBoots(); + if (boots != null) + { + itemConsumer.accept(boots); + } + } + public CustomItem getWeapon() { - ItemStack weaponItem = getPlayer().getInventory().getItemInHand(); - - if (!itemsMatch(_weapon, weaponItem)) - { - _weapon = parseItem(weaponItem); - } - - return _weapon; + return GearManager.parseItem(getPlayer().getInventory().getItemInHand()); } public CustomItem getHelmet() { - ItemStack helmetItem = getPlayer().getInventory().getHelmet(); - - if (!itemsMatch(_helmet, helmetItem)) - { - _helmet = parseItem(helmetItem); - } - - return _helmet; + return GearManager.parseItem(getPlayer().getInventory().getHelmet()); } public CustomItem getChestplate() { - ItemStack chestplateItem = getPlayer().getInventory().getChestplate(); - - if (!itemsMatch(_chestplate, chestplateItem)) - { - _chestplate = parseItem(chestplateItem); - } - - return _chestplate; + return GearManager.parseItem(getPlayer().getInventory().getChestplate()); } public CustomItem getLeggings() { - ItemStack leggingsItem = getPlayer().getInventory().getLeggings(); - - if (!itemsMatch(_leggings, leggingsItem)) - { - _leggings = parseItem(leggingsItem); - } - - return _leggings; + return GearManager.parseItem(getPlayer().getInventory().getLeggings()); } public CustomItem getBoots() { - ItemStack bootsItem = getPlayer().getInventory().getBoots(); - - if (!itemsMatch(_boots, bootsItem)) - { - _boots = parseItem(bootsItem); - } - - return _boots; - } - - /** - * @return set of currently equipped {@link CustomItem}s in the gear set. - */ - public Set getGear() - { - Set items = new HashSet(); - if (getWeapon() != null) items.add(getWeapon()); - if (getHelmet() != null) items.add(getHelmet()); - if (getChestplate() != null) items.add(getChestplate()); - if (getLeggings() != null) items.add(getLeggings()); - if (getBoots() != null) items.add(getBoots()); - - return items; - } - - private boolean itemsMatch(CustomItem customItem, ItemStack item) - { - if (customItem == null || item == null) return false; - - if (GearManager.isCustomItem(item)) - { - CustomItem customItem2 = GearManager.parseItem(item); - return customItem2.matches(customItem); - } - - return false; - } - - private CustomItem parseItem(ItemStack item) - { - return GearManager.parseItem(item); + return GearManager.parseItem(getPlayer().getInventory().getBoots()); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/economy/GoldToken.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/economy/GoldToken.java index 2cdc2da23..4028d851a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/economy/GoldToken.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/economy/GoldToken.java @@ -7,7 +7,7 @@ import mineplex.game.clans.items.CustomItem;; public class GoldToken extends CustomItem { private int _goldValue; - + public GoldToken() { this(0); From 808e506911e72bf69fb319ff888487efae032337 Mon Sep 17 00:00:00 2001 From: samczsun Date: Fri, 10 Jun 2016 20:13:52 -0400 Subject: [PATCH 04/34] Revert "Revert "Clans optimizations"" This reverts commit 25a315ac052942116471dd0681967e68ea8f9a35. --- .../game/clans/clans/map/ItemMapManager.java | 585 +++++++++--------- .../game/clans/clans/map/ItemMapRenderer.java | 2 +- .../clans/map/events/PlayerGetMapEvent.java | 3 + .../clans/clans/regions/ClansRegions.java | 13 +- .../clans/tutorial/TutorialWorldManager.java | 5 +- 5 files changed, 308 insertions(+), 300 deletions(-) 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 f73eb2280..04e2fb410 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 @@ -1,30 +1,26 @@ package mineplex.game.clans.clans.map; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.PrintWriter; +import java.io.*; 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.*; import java.util.Map.Entry; +import mineplex.core.common.util.*; import mineplex.game.clans.tutorial.TutorialManager; -import mineplex.game.clans.tutorial.map.TutorialMapManager; +import net.minecraft.server.v1_8_R3.*; import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; -import org.bukkit.Chunk; import org.bukkit.Location; 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.craftbukkit.v1_8_R3.util.LongHash; +import org.bukkit.craftbukkit.v1_8_R3.util.LongObjectHashMap; import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; @@ -35,6 +31,8 @@ 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.event.world.ChunkLoadEvent; +import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.map.MapRenderer; @@ -46,13 +44,6 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Multisets; import mineplex.core.MiniPlugin; -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.UtilTextBottom; -import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.portal.ServerTransferEvent; @@ -62,82 +53,119 @@ 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; -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; +/* + * This class manages what the Clans map will show. + * It will scan all relevant chunks (eg players nearby) every ticks + */ public class ItemMapManager extends MiniPlugin { - private int _blocksScan = 16 * 3; + // Every BLOCK_SCAN_INTERVAL we add as a new region to scan + private static final int BLOCK_SCAN_INTERVAL = 16 * 3; + // 1536 is the width of the entire world from one borderland to the other + private static final int HALF_WORLD_SIZE = 1536 / 2; + // This slot is where the Clans Map will go by default + private static final int CLANS_MAP_SLOT = 8; + + private static final String[] ZOOM_INFO; + + static + { + ZOOM_INFO = new String[4]; + for (int zoomLevel = 0; zoomLevel <= 3; zoomLevel++) + { + StringBuilder progressBar = new StringBuilder(C.cBlue); + + boolean colorChange = false; + for (int i = 2; i >= 0; i--) + { + if (!colorChange && i < zoomLevel) + { + progressBar.append(C.cGray); + colorChange = true; + } + char c; + switch (i) + { + case 0: + c = '█'; + break; + case 1: + c = '▆'; + break; + default: + c = '▄'; + break; + } + for (int a = 0; a < 4; a++) + { + progressBar.append(c); + } + + if (i > 0) + { + progressBar.append(" "); + } + } + ZOOM_INFO[zoomLevel] = progressBar.toString(); + } + } + private ClansUtility _clansUtility; private Comparator> _comparator; - private int _halfMapSize = 1536 / 2; - private int[][] _heightMap = new int[(_halfMapSize * 2) + 16][]; - private boolean _loadWorld = true; + private int[][] _heightMap = new int[(HALF_WORLD_SIZE * 2) + 16][]; private HashMap _map = new HashMap(); private short _mapId = -1; private HashMap _mapInfo = new HashMap(); private HashMap _scale = new HashMap(); - private ArrayList> _scanList = new ArrayList>(); + // Use LinkedList because operations are either add(Entry) which is O(1) and remove(0) which is O(1) on LinkedList but O(n) on ArrayList + private LinkedList> _scanList = new LinkedList>(); private World _world; + private WorldServer _nmsWorld; + private ChunkProviderServer _chunkProviderServer; + private ChunkRegionLoader _chunkRegionLoader; private WorldEventManager _eventManager; private TutorialManager _tutorial; public ItemMapManager(ClansManager clansManager, TutorialManager tutorial, WorldEventManager eventManager) { super("ItemMapManager", clansManager.getPlugin()); - + _clansUtility = clansManager.getClanUtility(); _eventManager = eventManager; _tutorial = tutorial; - _comparator = new Comparator>() + _comparator = (o1, o2) -> { + // Render the places outside the map first to speed up visual errors fixing + int outsideMap = Boolean.compare(o1.getValue() < -HALF_WORLD_SIZE, o2.getValue() < -HALF_WORLD_SIZE); - @Override - public int compare(Entry o1, Entry o2) + if (outsideMap != 0) { - // Render the places outside the map first to speed up visual errors fixing - int outsideMap = Boolean.compare(o1.getValue() < -_halfMapSize, o2.getValue() < -_halfMapSize); + return -outsideMap; + } - if (outsideMap != 0) - { - return -outsideMap; - } + double dist1 = 0; + double dist2 = 0; - 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); + 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)); - } - } - _scale.put(0, 1); // _scale.put(1, 2); _scale.put(1, 4); @@ -147,7 +175,7 @@ public class ItemMapManager extends MiniPlugin for (Entry entry : _scale.entrySet()) { - int size = (_halfMapSize * 2) / entry.getValue(); + int size = (HALF_WORLD_SIZE * 2) / entry.getValue(); Byte[][] bytes = new Byte[size][]; for (int i = 0; i < size; i++) @@ -165,6 +193,23 @@ public class ItemMapManager extends MiniPlugin _world = Bukkit.getWorld("world"); + try + { + Field chunkLoader = ChunkProviderServer.class.getDeclaredField("chunkLoader"); + chunkLoader.setAccessible(true); + _nmsWorld = ((CraftWorld) _world).getHandle(); + _chunkProviderServer = _nmsWorld.chunkProviderServer; + _chunkRegionLoader = (ChunkRegionLoader) chunkLoader.get(_chunkProviderServer); + if (_chunkRegionLoader == null) + { + throw new RuntimeException("Did not expect null chunkLoader"); + } + } + catch (ReflectiveOperationException e) + { + throw new RuntimeException("Could not reflectively access ChunkRegionLoader", e); + } + try { File file = new File("world/clans_map_id"); @@ -238,6 +283,58 @@ public class ItemMapManager extends MiniPlugin } rebuildScan(); + initialScan(); + } + + private void initialScan() + { + System.out.println("Beginning initial scan. There are " + _scanList.size() + " regions to scan"); + + // How many regions before logging an update (Currently set to every 20%) + int logPer = _scanList.size() / 5; + + while (!_scanList.isEmpty()) + { + Entry entry = _scanList.remove(0); + if (_scanList.size() % logPer == 0) + { + System.out.println("Running initial render... " + _scanList.size() + " sections to go"); + } + + int startingX = entry.getKey(); + int startingZ = entry.getValue(); + + boolean outsideMap = startingZ < -HALF_WORLD_SIZE; + + scanWorldMap(startingX, startingZ, !outsideMap, true); + + if (outsideMap) + { + continue; + } + + for (int scale = 1; scale < _scale.size(); scale++) + { + if (scale == 3) + continue; + + drawWorldScale(scale, startingX, startingZ); + colorWorldHeight(scale, startingX, startingZ); + } + + colorWorldHeight(0, startingX, startingZ); + } + + for (int x = -HALF_WORLD_SIZE; x < HALF_WORLD_SIZE; x += BLOCK_SCAN_INTERVAL) + { + for (int z = -HALF_WORLD_SIZE; z < HALF_WORLD_SIZE; z += BLOCK_SCAN_INTERVAL) + { + drawWorldScale(3, x, z); + colorWorldHeight(3, x, z); + } + } + + System.out.println("Finished first map scan and render"); } private void setupRenderer(MapView view) @@ -256,10 +353,7 @@ public class ItemMapManager extends MiniPlugin if (!(event.getRightClicked() instanceof ItemFrame)) return; - ItemStack item = event.getPlayer().getItemInHand(); - - if (item == null || item.getType() != Material.MAP || item.getDurability() < _mapId - || item.getDurability() > _mapId + 100) + if (!isItemClansMap(event.getPlayer().getItemInHand())) return; event.setCancelled(true); @@ -270,7 +364,7 @@ public class ItemMapManager extends MiniPlugin */ public int calcMapCenter(int zoom, int cord) { - int mapSize = _halfMapSize / zoom; // This is how large the map is in pixels + int mapSize = HALF_WORLD_SIZE / 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 @@ -309,7 +403,7 @@ public class ItemMapManager extends MiniPlugin Byte[][] map = _map.get(scale); int zoom = getZoom(scale); - for (int x = startingX; x < startingX + _blocksScan; x += zoom) + for (int x = startingX; x < startingX + BLOCK_SCAN_INTERVAL; x += zoom) { double d0 = 0; @@ -319,10 +413,10 @@ public class ItemMapManager extends MiniPlugin { for (int addZ = 0; addZ < zoom; addZ++) { - int hX = x + addX + _halfMapSize; - int hZ = (startingZ - zoom) + addZ + _halfMapSize; + int hX = x + addX + HALF_WORLD_SIZE; + int hZ = (startingZ - zoom) + addZ + HALF_WORLD_SIZE; - if (hX >= _halfMapSize * 2 || hZ >= _halfMapSize * 2) + if (hX >= HALF_WORLD_SIZE * 2 || hZ >= HALF_WORLD_SIZE * 2) { continue; } @@ -331,7 +425,7 @@ public class ItemMapManager extends MiniPlugin } } - for (int z = startingZ; z < startingZ + _blocksScan; z += zoom) + for (int z = startingZ; z < startingZ + BLOCK_SCAN_INTERVAL; z += zoom) { // Water depth colors not included double d1 = 0; @@ -340,10 +434,10 @@ public class ItemMapManager extends MiniPlugin { for (int addZ = 0; addZ < zoom; addZ++) { - int hX = x + addX + _halfMapSize; - int hZ = z + addZ + _halfMapSize; + int hX = x + addX + HALF_WORLD_SIZE; + int hZ = z + addZ + HALF_WORLD_SIZE; - if (hX >= _halfMapSize * 2 || hZ >= _halfMapSize * 2) + if (hX >= HALF_WORLD_SIZE * 2 || hZ >= HALF_WORLD_SIZE * 2) { continue; } @@ -370,7 +464,7 @@ public class ItemMapManager extends MiniPlugin b0 = 0; } - int origColor = map[(x + _halfMapSize) / zoom][(z + _halfMapSize) / zoom] - 1; + int origColor = map[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] - 1; /*if (color < 4) { @@ -388,7 +482,7 @@ public class ItemMapManager extends MiniPlugin }*/ byte color = (byte) (origColor + b0); - map[(x + _halfMapSize) / zoom][(z + _halfMapSize) / zoom] = color; + map[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] = color; } } } @@ -399,9 +493,9 @@ public class ItemMapManager extends MiniPlugin Byte[][] second = _map.get(scale); int zoom = getZoom(scale); - for (int x = startingX; x < startingX + _blocksScan; x += zoom) + for (int x = startingX; x < startingX + BLOCK_SCAN_INTERVAL; x += zoom) { - for (int z = startingZ; z < startingZ + _blocksScan; z += zoom) + for (int z = startingZ; z < startingZ + BLOCK_SCAN_INTERVAL; z += zoom) { HashMultiset hashmultiset = HashMultiset.create(); @@ -409,8 +503,8 @@ public class ItemMapManager extends MiniPlugin { for (int addZ = 0; addZ < zoom; addZ++) { - int pX = x + addX + _halfMapSize; - int pZ = z + addZ + _halfMapSize; + int pX = x + addX + HALF_WORLD_SIZE; + int pZ = z + addZ + HALF_WORLD_SIZE; if (pX >= first.length || pZ >= first.length) { @@ -432,7 +526,7 @@ public class ItemMapManager extends MiniPlugin { color = (byte) 0; } - second[(x + _halfMapSize) / zoom][(z + _halfMapSize) / zoom] = color; + second[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] = color; } } } @@ -440,25 +534,16 @@ public class ItemMapManager extends MiniPlugin @EventHandler public void dropItem(ItemSpawnEvent event) { - ItemStack item = event.getEntity().getItemStack(); - - if (item != null && item.getType() == Material.MAP && item.getDurability() >= _mapId - && item.getDurability() <= _mapId + 100) - { + if (isItemClansMap(event.getEntity().getItemStack())) event.getEntity().remove(); - } } - + public void removeMap(Player player) { for (int slot = 0; slot < player.getInventory().getSize(); slot++) { - ItemStack item = player.getInventory().getItem(slot); - - if (item != null && item.getType() == Material.MAP && item.getDurability() >= _mapId && item.getDurability() <= _mapId + 100) - { + if (isItemClansMap(player.getInventory().getItem(slot))) player.getInventory().setItem(slot, null); - } } } @@ -477,7 +562,7 @@ public class ItemMapManager extends MiniPlugin private double getDistance(Entry entry, double x1, double z1) { - return getDistance(x1, z1, entry.getKey() + (_blocksScan / 2), entry.getValue() + (_blocksScan / 2)); + return getDistance(x1, z1, entry.getKey() + (BLOCK_SCAN_INTERVAL / 2), entry.getValue() + (BLOCK_SCAN_INTERVAL / 2)); } public Byte[][] getMap(int scale) @@ -492,7 +577,7 @@ public class ItemMapManager extends MiniPlugin public int getMapSize() { - return _halfMapSize; + return HALF_WORLD_SIZE; } public int getZoom(int scale) @@ -500,35 +585,7 @@ public class ItemMapManager extends MiniPlugin return _scale.get(scale); } - @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 - || item.getDurability() > _mapId + 100) - 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; - } - } - + //fixme So what appears to happen is that after you die, if your map is is the same then the map is frozen @EventHandler public void onDeath(PlayerDeathEvent event) { @@ -542,14 +599,10 @@ public class ItemMapManager extends MiniPlugin { Player player = event.getPlayer(); - ItemStack item = player.getInventory().getItem(event.getNewSlot()); - - if (item == null || item.getType() != Material.MAP || item.getDurability() < _mapId - || item.getDurability() > _mapId + 100) + if (!isItemClansMap(player.getInventory().getItem(event.getNewSlot()))) return; showZoom(player, getMap(player)); - } @EventHandler @@ -558,10 +611,7 @@ public class ItemMapManager extends MiniPlugin if (event.getAction() == Action.PHYSICAL) return; - ItemStack item = event.getItem(); - - if (item == null || item.getType() != Material.MAP || item.getDurability() < _mapId - || item.getDurability() > _mapId + 100) + if (!isItemClansMap(event.getItem())) return; event.setCancelled(true); @@ -666,36 +716,11 @@ public class ItemMapManager extends MiniPlugin private void rebuildScan() { - for (int x = -_halfMapSize; x < _halfMapSize; x += _blocksScan) + for (int x = -HALF_WORLD_SIZE; x < HALF_WORLD_SIZE; x += BLOCK_SCAN_INTERVAL) { - for (int z = -_halfMapSize - 16; z < _halfMapSize; z += (z < -_halfMapSize ? 16 : _blocksScan)) + for (int z = -HALF_WORLD_SIZE - 16; z < HALF_WORLD_SIZE; z += (z < -HALF_WORLD_SIZE ? 16 : BLOCK_SCAN_INTERVAL)) { - _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(); - } + _scanList.add(new HashMap.SimpleEntry<>(x, z)); } } @@ -744,101 +769,117 @@ public class ItemMapManager extends MiniPlugin if (event.getType() != UpdateType.FAST) return; - if (_scanList.isEmpty()) + if (_scanList.isEmpty() && UtilServer.getPlayers().length > 0) { - if (_loadWorld) - { - for (int x = -_halfMapSize; x < _halfMapSize; x += _blocksScan) - { - for (int z = -_halfMapSize; z < _halfMapSize; z += _blocksScan) - { - drawWorldScale(3, x, z); - colorWorldHeight(3, x, z); - } - } - - System.out.print("Finished first map scan and render"); - } - - _loadWorld = false; - - if (UtilServer.getPlayers().length == 0) - return; - rebuildScan(); } - else if (_scanList.size() % 20 == 0) + + 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; + boolean outsideMap = startingZ < -HALF_WORLD_SIZE; + + scanWorldMap(startingX, startingZ, !outsideMap, false); - scanWorldMap(startingX, startingZ, !outsideMap); - if (outsideMap) - { return; - } for (int scale = 1; scale < _scale.size(); scale++) { - if (scale == 3 && _loadWorld) - continue; - - if (!outsideMap) - { - drawWorldScale(scale, startingX, startingZ); - } - + drawWorldScale(scale, startingX, startingZ); colorWorldHeight(scale, startingX, startingZ); } - + colorWorldHeight(0, startingX, startingZ); } - public void scanWorldMap(int startingX, int startingZ, boolean setColors) + + // Let's not create hundreds of thousands of BlockPositions + // Single thread = should be thread safe + private BlockPosition.MutableBlockPosition _blockPosition = new BlockPosition.MutableBlockPosition(); + + // Maps the cached chunks which were loaded from disk to save IO operations + private LongObjectHashMap _chunkCache = new LongObjectHashMap<>(); + + /* + * Remove the cached chunks when the real chunks are loaded in + */ + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void LoadChunk(ChunkLoadEvent event) + { + _chunkCache.remove(LongHash.toLong(event.getChunk().getX(), event.getChunk().getZ())); + } + + /* + * Given a particular coordinate, this method will scan up to BLOCK_SCAN_INTERVAL and record the color of ever 16th block + * If a chunk has not been loaded, the following steps will be taken: + * * Attempt to load the chunk from disk. + * * If the chunk could not be loaded, generate it froms scratch + * Otherwise, the loaded chunk will be used + */ + public void scanWorldMap(int startingX, int startingZ, boolean setColors, boolean isFirstScan) { Byte[][] map = _map.get(0); - - for (int beginX = startingX; beginX < startingX + _blocksScan; beginX += 16) + for (int beginX = startingX; beginX < startingX + BLOCK_SCAN_INTERVAL; beginX += 16) { - for (int beginZ = startingZ - (startingZ > -_halfMapSize ? 16 : 0); beginZ < startingZ - + (setColors ? _blocksScan : 16); beginZ += 16) + for (int beginZ = startingZ - (startingZ > -HALF_WORLD_SIZE ? 16 : 0); beginZ < startingZ + + (setColors ? BLOCK_SCAN_INTERVAL : 16); beginZ += 16) { - Chunk chunk = _world.getChunkAt(beginX / 16, beginZ / 16); - boolean loaded = false; - - if (!chunk.isLoaded()) + int chunkX = beginX / 16; + int chunkZ = beginZ / 16; + net.minecraft.server.v1_8_R3.Chunk nmsChunk = _chunkProviderServer.getChunkIfLoaded(chunkX, chunkZ); + if (nmsChunk == null) { - if (_loadWorld) + long key = LongHash.toLong(chunkX, chunkZ); + nmsChunk = _chunkCache.get(key); + if (nmsChunk == null) { - loaded = chunk.load(); - } - else - { - continue; + if (!isFirstScan) + { + continue; + } + try + { + Object[] data = _chunkRegionLoader.loadChunk(_nmsWorld, chunkX, chunkZ); + if (data == null) + { + // Something is wrong with the chunk + System.out.println("Chunk is not generated or missing level/block data. Regenerating (" + chunkX + "," + chunkZ + ")"); + nmsChunk = ((CraftChunk) _world.getChunkAt(chunkX, chunkZ)).getHandle(); + } + else + { + nmsChunk = (net.minecraft.server.v1_8_R3.Chunk) data[0]; + } + } + catch (IOException e) + { + throw new RuntimeException("Chunk is corrupt or not readable!", e); + } + _chunkCache.put(key, nmsChunk); } } - net.minecraft.server.v1_8_R3.Chunk nmsChunk = ((CraftChunk) chunk).getHandle(); - - for (int x = beginX; x < beginX + 16; x++) + if (!nmsChunk.isEmpty()) { - for (int z = beginZ; z < beginZ + 16; z++) + for (int x = beginX; x < beginX + 16; x++) { - int color = 0; - - if (!nmsChunk.isEmpty()) + for (int z = beginZ; z < beginZ + 16; z++) { + int color = 0; + int k3 = x & 0xF; int l3 = z & 0xF; @@ -850,7 +891,8 @@ public class ItemMapManager extends MiniPlugin do { l4--; - iblockdata= nmsChunk.getBlockData(new BlockPosition(k3, l4, l3)); + _blockPosition.c(k3, l4, l3); + iblockdata = nmsChunk.getBlockData(_blockPosition); } while (iblockdata.getBlock().g(iblockdata) == MaterialMapColor.b && (l4 > 0)); @@ -860,34 +902,31 @@ public class ItemMapManager extends MiniPlugin Block block1; do { - block1 = nmsChunk.getType(new BlockPosition(k3, j5--, l3)); + _blockPosition.c(k3, j5--, l3); + block1 = nmsChunk.getType(_blockPosition); } while ((j5 > 0) && (block1.getMaterial().isLiquid())); } } - _heightMap[x + _halfMapSize + 16][z + _halfMapSize + 16] = l4; + _heightMap[x + HALF_WORLD_SIZE + 16][z + HALF_WORLD_SIZE + 16] = l4; if (setColors) { //color = block.f(i5).M; - IBlockData data = nmsChunk.getBlockData(new BlockPosition(k3, l4, l3)); + _blockPosition.c(k3, l4, l3); + IBlockData data = nmsChunk.getBlockData(_blockPosition); color = data.getBlock().g(data).M; color = (byte) ((color * 4) + 1); } - } - if (setColors && beginZ >= startingZ) - { - map[x + _halfMapSize][z + _halfMapSize] = (byte) color; + if (setColors && beginZ >= startingZ) + { + map[x + HALF_WORLD_SIZE][z + HALF_WORLD_SIZE] = (byte) color; + } } } - - if (loaded) - { - chunk.unload(); - } } } } @@ -898,10 +937,10 @@ public class ItemMapManager extends MiniPlugin 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)) + if (isItemClansMap(item)) { return; } @@ -909,62 +948,38 @@ public class ItemMapManager extends MiniPlugin ItemStack item = new ItemBuilder(Material.MAP, 1, (short) getMap(player).getMap()).setTitle("Clans Map").build(); - int slot = player.getInventory().firstEmpty(); + int slot = CLANS_MAP_SLOT; + + ItemStack mapSlot = player.getInventory().getItem(slot); + if (mapSlot != null && mapSlot.getType() != Material.AIR) + { + 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); } } + /* + * Displays the action bar to a player given their zoom level. Implementation may change + */ private void showZoom(Player player, MapInfo info) { - String progressBar = C.cBlue + ""; - - boolean colorChange = false; - - for (int i = 2; i >= 0; i--) - { - if (!colorChange && i < info.getScale()) - { - progressBar += C.cGray; - colorChange = true; - } - - char c; - - switch (i) - { - case 0: - c = '█'; - break; - case 1: - c = '▆'; - break; - default: - c = '▄'; - break; - } - - for (int a = 0; a < 4; a++) - { - progressBar += c; - } - - if (i > 0) - { - progressBar += " "; - } - } - - UtilTextBottom.display(progressBar, player); + UtilTextBottom.display(ZOOM_INFO[info.getScale()], player); } + /* + * Check whether an {@link ItemStack} is also a Clans Map + * + * @param itemStack The {@link ItemStack} to check + * @returns Whether the {@link ItemStack} is also a Clans Map + */ + private boolean isItemClansMap(ItemStack itemStack) + { + return UtilItem.matchesMaterial(itemStack, Material.MAP) + && itemStack.getDurability() >= _mapId + && itemStack.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 d64552b15..e0f3ca941 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 @@ -143,7 +143,7 @@ public class ItemMapRenderer extends MapRenderer if (_manager.getClansUtility().relPT(player, chunk) == ClansUtility.ClanRelation.SAFE) clanColor2 = new Color(50, 150, 255); } - else if (owningClan.getName().equals("Spawn")) + else if (owningClan.getName().equals("Spawn")) { clanColor = Color.WHITE; clanColor2 = new Color(0, 255, 100); 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 index 5e5bccc4a..e13645b8a 100644 --- 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 @@ -4,6 +4,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +/* + * This event is called when a Player is about to receive a Clans Map + */ public class PlayerGetMapEvent extends Event { private static final HandlerList handlers = new HandlerList(); 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 797f63f24..6c9424634 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 @@ -197,18 +197,7 @@ public class ClansRegions extends MiniPlugin { int x = chunkX + xOffset; int z = chunkZ + zOffset; - Chunk chunk; - try - { //Corrupted chunk will hold up whole server - chunk = location.getWorld().getChunkAt(x, z); - } - catch(Exception e) - { - System.out.println("UNABLE TO LOAD CHUNK AT " + x + " , " + z); - e.printStackTrace(); - continue; - } - String chunkStr = UtilWorld.chunkToStr(chunk); + String chunkStr = location.getWorld().getName() + "," + x + "," + z; if (addNegative) { 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 index 40ac68fc6..e6714847a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialWorldManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/TutorialWorldManager.java @@ -2,6 +2,7 @@ package mineplex.game.clans.tutorial; import java.io.File; import java.io.IOException; +import java.util.LinkedList; import java.util.Stack; import org.bukkit.Bukkit; @@ -25,7 +26,7 @@ public class TutorialWorldManager extends MiniPlugin private final World _tutorialWorld; private final Schematic _schematic; - private Stack _regionStack; + private LinkedList _regionStack; private TutorialRegion _centerRegion; public TutorialWorldManager(JavaPlugin plugin, String worldName, String schematicName) throws IOException @@ -56,7 +57,7 @@ public class TutorialWorldManager extends MiniPlugin private void populateRegionStack() { - _regionStack = new Stack<>(); + _regionStack = new LinkedList<>(); // Populate the stack with 100 available tutorial regions for (int x = 0; x < 10; x++) From d49ce27a1be962944a9c7859efd859893cb0d78e Mon Sep 17 00:00:00 2001 From: samczsun Date: Fri, 10 Jun 2016 20:18:17 -0400 Subject: [PATCH 05/34] Make GearShop work again --- .../core/common/weight/WeightSet.java | 27 +++- .../mineplex/game/clans/items/CustomItem.java | 6 +- .../game/clans/items/GearManager.java | 140 ++++++++---------- .../mineplex/game/clans/items/PlayerGear.java | 44 +++--- 4 files changed, 105 insertions(+), 112 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java index 8198c12af..17ee9245f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/weight/WeightSet.java @@ -1,9 +1,11 @@ package mineplex.core.common.weight; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.Random; import java.util.Set; +import java.util.stream.Collectors; public class WeightSet { @@ -11,6 +13,13 @@ public class WeightSet private static Random random = new Random(); private Set> _weights = new HashSet>(); + + private volatile transient Set _keyset; + + public WeightSet() + { + + } @SafeVarargs public WeightSet(Weight... weights) @@ -19,6 +28,7 @@ public class WeightSet { _weights.add(weight); } + computeKeyset(); } @SafeVarargs @@ -28,6 +38,7 @@ public class WeightSet { _weights.add(new Weight(1, element)); // Constant weight of 1 means all elements are equally likely } + computeKeyset(); } public WeightSet(Collection elements) @@ -36,11 +47,13 @@ public class WeightSet { _weights.add(new Weight(1, element)); // Constant weight of 1 means all elements are equally likely } + computeKeyset(); } public void add(int weight, T element) { _weights.add(new Weight(weight, element)); + computeKeyset(); } private int getTotalWeight() @@ -76,13 +89,11 @@ public class WeightSet public Set elements() { - Set elements = new HashSet(); - - for (Weight weight : _weights) - { - elements.add(weight.getValue()); - } - - return elements; + return this._keyset; + } + + private void computeKeyset() + { + _keyset = Collections.unmodifiableSet(_weights.stream().map(Weight::getValue).collect(Collectors.toSet())); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java index 2396ac2a8..7fba3c5ec 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java @@ -112,10 +112,6 @@ public class CustomItem implements Listener String attributeLine = ATTRIBUTE_COLOR + "• " + attribute.getDescription(); lore.add(attributeLine); } - - // Add encoded JSON form of this item, not seen by user. - String serialization = GearManager.getItemSerialization(this); - lore.add(serialization); return lore; } @@ -200,6 +196,8 @@ public class CustomItem implements Listener meta.setLore(lore); item.setItemMeta(meta); + + GearManager.writeNBT(this, item); } public static String prettifyName(Material material) 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 1d8032815..84ebdc60b 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 @@ -2,9 +2,9 @@ package mineplex.game.clans.items; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -21,6 +21,9 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; @@ -81,12 +84,7 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot; import net.minecraft.server.v1_8_R3.PacketPlayOutWindowItems; /** - * Manages creation and retrieval of associated {@link PlayerGear}s with online - * players, as well as offering methods for parsing and handling - * {@link CustomItem}s. - * - * @author MrTwiggy - * + * Handles converting legendary itemstacks to their respective CustomItem objects */ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { @@ -106,15 +104,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable } private static final String ITEM_SERIALIZATION_TAG = "-JSON-"; - private static Gson _gson; - static - { - - } - private static GearManager _instance; // Singleton instance - - // Mapping of player names (key) to cached gear set (value). - private Map _playerGears = new HashMap<>(); + private static final Gson GSON; // Weightings for randomly selecting number of attributes (1, 2, 3) private static final WeightSet ATTRIBUTE_WEIGHTS = new WeightSet<>( @@ -212,22 +202,8 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable Material.RECORD_12 ); - private GearShop _shop; - - private static Map customItemCache = new HashMap<>(); - - public GearManager(JavaPlugin plugin, PacketHandler packetHandler, CoreClientManager clientManager, DonationManager donationManager) + static { - super("CustomGear", plugin); - - _instance = this; - - _shop = new GearShop(this, clientManager, donationManager); - - // Register listeners - UtilServer.getServer().getPluginManager().registerEvents(new ItemListener(getPlugin()), getPlugin()); - UtilServer.getServer().getPluginManager().registerEvents(new SmeltingListener(), getPlugin()); - // Initialize attribute types factory for JSON handling of polymorphism. RuntimeTypeAdapterFactory attributeFactory = RuntimeTypeAdapterFactory.of(ItemAttribute.class); ARMOR_ATTRIBUTES.elements().forEach(attributeFactory::registerSubtype); @@ -244,7 +220,35 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable RARE_WEIGHTS.elements().forEach(customItemType::registerSubtype); // Build GSON instance off factories for future serialization of items. - _gson = new GsonBuilder().registerTypeAdapterFactory(attributeFactory).registerTypeAdapterFactory(customItemType).create(); + GSON = new GsonBuilder().registerTypeAdapterFactory(attributeFactory).registerTypeAdapterFactory(customItemType).create(); + } + + + private static GearManager _instance; // Singleton instance + + // Mapping of player names (key) to cached gear set (value). + private Map _playerGears = new HashMap<>(); + + private GearShop _shop; + + private static Map customItemCache = new HashMap<>(); + + public GearManager(JavaPlugin plugin, PacketHandler packetHandler, CoreClientManager clientManager, DonationManager donationManager) + { + super("CustomGear", plugin); + + if (_instance != null) + { + throw new RuntimeException("GearManager is already initialized"); + } + + _instance = this; + + _shop = new GearShop(this, clientManager, donationManager); + + // Register listeners + UtilServer.getServer().getPluginManager().registerEvents(new ItemListener(getPlugin()), getPlugin()); + UtilServer.getServer().getPluginManager().registerEvents(new SmeltingListener(), getPlugin()); packetHandler.addPacketHandler(this, PacketPlayOutSetSlot.class, PacketPlayOutWindowItems.class); @@ -258,8 +262,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable } /** - * Tick & update internal logic for {@link GearManager}. Called once per - * tick. + * Tick & update internal logic for {@link GearManager}. Called once per tick. */ @Override public void run() @@ -268,13 +271,13 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable while (iterator.hasNext()) { PlayerGear gear = iterator.next(); - if (gear.isOnline()) + if (gear.cleanup()) { - gear.update(); + iterator.remove(); } else { - iterator.remove(); + gear.update(); } } } @@ -286,14 +289,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable */ public PlayerGear getPlayerGear(Player player) { - String playerName = player.getName(); - if (!_playerGears.containsKey(playerName)) - { - PlayerGear gear = new PlayerGear(playerName); - _playerGears.put(playerName, gear); - } - - return _playerGears.get(playerName); + return _playerGears.computeIfAbsent(player, PlayerGear::new); } public CustomItem generateItem() @@ -405,6 +401,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return null; } Map data = getUnhandledTags(item); + System.out.println(data); if (data.containsKey("gearmanager.uuid")) { String strUUID = ((NBTTagString) data.get("gearmanager.uuid")).a_(); @@ -471,6 +468,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { return null; } + System.out.println("Is old format " + serialization); try { CustomItem customItem = deserialize(serialization); @@ -489,6 +487,13 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable } } + public static void writeNBT(CustomItem customItem, ItemStack item) + { + Map data = getUnhandledTags(item); + data.put("gearmanager.uuid", new NBTTagString(customItem._uuid)); + data.put("gearmanager.json", new NBTTagString(serialize(customItem))); + } + public static boolean isCustomItem(ItemStack item) { Map data = getUnhandledTags(item); @@ -499,13 +504,6 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return getItemSerialization(item) != null; } - public static String getItemSerialization(CustomItem customItem) - { - String serialization = serialize(customItem); - - return ITEM_SERIALIZATION_TAG + serialization; - } - /** * @param type - the class-type of the object to be instantiated. (must have * zero-argument constructor) @@ -524,6 +522,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable } } + @Deprecated private static String getItemSerialization(ItemStack item) { if (item == null || item.getItemMeta() == null || item.getItemMeta().getLore() == null) return null; @@ -538,9 +537,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable if (lore.startsWith(ITEM_SERIALIZATION_TAG)) { int tagLength = ITEM_SERIALIZATION_TAG.length(); - String serialization = lore.substring(tagLength); - - return serialization; + return lore.substring(tagLength); } } @@ -550,17 +547,12 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable public static String serialize(CustomItem customItem) { - return _gson.toJson(customItem, CustomItem.class); + return GSON.toJson(customItem, CustomItem.class); } public static CustomItem deserialize(String serialization) { - return _gson.fromJson(serialization, CustomItem.class); - } - - public static T deserialize(String serialization, Class type) - { - return _gson.fromJson(serialization, type); + return GSON.fromJson(serialization, CustomItem.class); } /** @@ -571,11 +563,6 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return _instance; } - public static void notify(Player player, String message) - { - UtilPlayer.message(player, F.main("Gear", message)); - } - /** * @param player - the player to see if they should have their out-going * packets masked on CustomGear items. @@ -591,15 +578,14 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { // Don't mask custom gear lore for creative players, as this will break // them. - if (!maskGearPacket(packetInfo.getPlayer())) return; +// if (!maskGearPacket(packetInfo.getPlayer())) return; Packet packet = packetInfo.getPacket(); if (packet instanceof PacketPlayOutSetSlot) { PacketPlayOutSetSlot slotPacket = (PacketPlayOutSetSlot) packet; - slotPacket.c = maskItem(slotPacket.c, packetInfo.getPlayer()); // Mask all out-going item - // packets + slotPacket.c = maskItem(slotPacket.c, packetInfo.getPlayer()); // Mask all out-going item packets } else if (packet instanceof PacketPlayOutWindowItems) { @@ -607,9 +593,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable for (int i = 0; i < itemsPacket.b.length; i++) { - itemsPacket.b[i] = maskItem(itemsPacket.b[i], packetInfo.getPlayer()); // Mask all - // out-going - // item packets + itemsPacket.b[i] = maskItem(itemsPacket.b[i], packetInfo.getPlayer()); // Mask all out-going item packets ItemStack item = CraftItemStack.asCraftMirror(itemsPacket.b[i]); if (item != null && MASK_ATTRIBUTES.contains(item.getType())) itemsPacket.b[i] = removeAttributes(itemsPacket.b[i]); @@ -648,18 +632,10 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return item; } - List lore = new ArrayList(); + List lore = originalMeta.getLore(); CustomItem ci = parseItem(originalItem); - for (String line : originalMeta.getLore()) - { - if (!line.startsWith(ITEM_SERIALIZATION_TAG)) - { - lore.add(line); - } - } - if (ci != null && LEGENDARY_WEIGHTS.elements().contains(ci.getClass())) { lore.add(" "); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java index 260f82a99..23b83f63c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java @@ -28,16 +28,13 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; */ public class PlayerGear { - private String _playerName; // Name of player who owns the gear - - /** - * Class constructor - * - * @param playerName - */ - public PlayerGear(String playerName) + private boolean _cleanedUp = false; + + private Player _owner; + + public PlayerGear(Player owner) { - _playerName = playerName; + this._owner = owner; } /** @@ -46,7 +43,7 @@ public class PlayerGear */ public void update() { - if (isOnline()) + if (_owner.isOnline()) { CustomItem item = getWeapon(); @@ -65,23 +62,17 @@ public class PlayerGear } } - public boolean isOnline() - { - Player player = getPlayer(); - return player != null && player.isOnline(); - } - /** * @return the {@link Player} that owns this gear set. */ public Player getPlayer() { - return Bukkit.getPlayer(_playerName); + return this._owner; } public String getPlayerName() { - return _playerName; + return getPlayer().getName(); } /** @@ -187,4 +178,21 @@ public class PlayerGear { return GearManager.parseItem(getPlayer().getInventory().getBoots()); } + + /* + * Perform cleanup if necessary. If cleanup was performed, return true. Otherwise return false + */ + public boolean cleanup() + { + if (_cleanedUp) + { + throw new RuntimeException("Already cleaned up... bug?"); + } + if (getPlayer().isOnline()) + { + return false; + } + forEachGear(item -> UtilServer.Unregister(item)); + return true; + } } From 1e5d91e3922f1c8142c8430d640f4efed261172f Mon Sep 17 00:00:00 2001 From: samczsun Date: Fri, 10 Jun 2016 20:56:03 -0400 Subject: [PATCH 06/34] Make porting from old legendaries work, fix null commandcenter --- .../core/command/MultiCommandBase.java | 11 +++ .../mineplex/game/clans/items/CustomItem.java | 38 ++++---- .../game/clans/items/GearManager.java | 89 ++++++++++++++----- 3 files changed, 93 insertions(+), 45 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java b/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java index fdcf318ac..2d4dd27a4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/command/MultiCommandBase.java @@ -36,6 +36,17 @@ public abstract class MultiCommandBase extends Co command.SetCommandCenter(_commandCenter); } } + + @Override + public void SetCommandCenter(CommandCenter commandCenter) + { + super.SetCommandCenter(commandCenter); + for (ICommand iCommand : Commands.values()) + { + iCommand.SetCommandCenter(commandCenter); + } + } + @Override public void Execute(Player caller, String[] args) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java index 7fba3c5ec..ea79134f3 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java @@ -31,30 +31,17 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; */ public class CustomItem implements Listener { - - private static final ChatColor TITLE_COLOR = ChatColor.GOLD; // Chat color - // used for - // item - // display - // name - private static final ChatColor ATTRIBUTE_COLOR = ChatColor.WHITE; // Chat - // color - // used - // for - // attribute - // descriptions - + // Chat color used for item display name + private static final ChatColor TITLE_COLOR = ChatColor.GOLD; + // Chat color used for attribute descriptions + private static final ChatColor ATTRIBUTE_COLOR = ChatColor.WHITE; + + protected transient String _displayName; + protected transient String[] _description; + protected transient Material _material; + private AttributeContainer _attributes; - - public AttributeContainer getAttributes() - { - return _attributes; - } - - protected String _displayName; - protected String[] _description; - protected Material _material; - + protected String _uuid; protected boolean _dullEnchantment; @@ -218,4 +205,9 @@ public class CustomItem implements Listener { return _material; } + + public AttributeContainer getAttributes() + { + return _attributes; + } } 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 84ebdc60b..6b394cf10 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 @@ -19,6 +19,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.OfflinePlayer; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -108,18 +109,18 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable // Weightings for randomly selecting number of attributes (1, 2, 3) private static final WeightSet ATTRIBUTE_WEIGHTS = new WeightSet<>( - new Weight<>(3, 3), - new Weight<>(20, 2), - new Weight<>(77, 1) + new Weight<>(3, 3), + new Weight<>(20, 2), + new Weight<>(77, 1) ); // Weightings for randomly selecting item type (legendary/weapon/armor/bow) private static final WeightSet TYPE_WEIGHTS = new WeightSet<>( - new Weight<>(6, ItemType.LEGENDARY), - new Weight<>(9, ItemType.RARE), - new Weight<>(46 - 9, ItemType.ARMOR), - new Weight<>(25, ItemType.WEAPON), - new Weight<>(23, ItemType.BOW) + new Weight<>(6, ItemType.LEGENDARY), + new Weight<>(9, ItemType.RARE), + new Weight<>(46 - 9, ItemType.ARMOR), + new Weight<>(25, ItemType.WEAPON), + new Weight<>(23, ItemType.BOW) ); private static final WeightSet> LEGENDARY_WEIGHTS = new WeightSet<>( @@ -285,7 +286,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable /** * @param player - the player whose {@link PlayerGear} set is to be fetched. * @return the cached or newly instantiated {@link PlayerGear} associated - * with {@code player}. + * with {@code player}. */ public PlayerGear getPlayerGear(Player player) { @@ -321,7 +322,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable } if (itemType != ItemType.LEGENDARY) // Only non-legendaries have - // attributes + // attributes { AttributeContainer attributes = new AttributeContainer(); generateAttributes(attributes, itemType, attributeCount); @@ -401,7 +402,10 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return null; } Map data = getUnhandledTags(item); - System.out.println(data); + if (data == null) + { + return null; + } if (data.containsKey("gearmanager.uuid")) { String strUUID = ((NBTTagString) data.get("gearmanager.uuid")).a_(); @@ -428,6 +432,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable lore.add(C.cRedB + "Corrupted item (Error 1)"); data.put("gearmanager.warnuuid", new NBTTagByte((byte) 1)); exception.printStackTrace(); + saveUnhandledTags(item, data); } return null; } @@ -443,6 +448,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable data.put("gearmanager.warnsyntax", new NBTTagByte((byte) 1)); System.out.println(((NBTTagString) data.get("gearmanager.json")).a_()); exception.printStackTrace(); + saveUnhandledTags(item, data); } return null; } @@ -457,6 +463,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable lore.add(C.cRedB + "Corrupted item (Error 3)"); data.put("gearmanager.warnother", new NBTTagByte((byte) 1)); exception.printStackTrace(); + saveUnhandledTags(item, data); } return null; } @@ -468,13 +475,13 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { return null; } - System.out.println("Is old format " + serialization); try { CustomItem customItem = deserialize(serialization); data.put("gearmanager.uuid", new NBTTagString(customItem._uuid)); data.put("gearmanager.json", new NBTTagString(serialization)); + saveUnhandledTags(item, data); customItemCache.put(UUID.fromString(customItem._uuid), customItem); return customItem; } @@ -492,6 +499,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable Map data = getUnhandledTags(item); data.put("gearmanager.uuid", new NBTTagString(customItem._uuid)); data.put("gearmanager.json", new NBTTagString(serialize(customItem))); + saveUnhandledTags(item, data); } public static boolean isCustomItem(ItemStack item) @@ -506,9 +514,9 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable /** * @param type - the class-type of the object to be instantiated. (must have - * zero-argument constructor) + * zero-argument constructor) * @return a newly instantiated instance of {@code type} class-type. - * Instantied with zero argument constructor. + * Instantied with zero argument constructor. */ private static T instantiate(Class type) { @@ -541,8 +549,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable } } - return null; // Unable to find any serialized lore lines, hence not a - // CustomItem. + return null; // Unable to find any serialized lore lines, hence not a CustomItem. } public static String serialize(CustomItem customItem) @@ -565,9 +572,9 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable /** * @param player - the player to see if they should have their out-going - * packets masked on CustomGear items. + * packets masked on CustomGear items. * @return true, if the player should have their gear lore masked, false - * otherwise. + * otherwise. */ private boolean maskGearPacket(Player player) { @@ -576,9 +583,10 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable public void handle(PacketInfo packetInfo) { - // Don't mask custom gear lore for creative players, as this will break - // them. -// if (!maskGearPacket(packetInfo.getPlayer())) return; + // Don't mask custom gear lore for creative players, as this will break them. + // To be precise, the lore is added more than once because the creative client spawns in new items with the existing lore + // fixme + if (!maskGearPacket(packetInfo.getPlayer())) return; Packet packet = packetInfo.getPacket(); @@ -638,8 +646,25 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable if (ci != null && LEGENDARY_WEIGHTS.elements().contains(ci.getClass())) { + String originalOwner = null; + if (ci.OriginalOwner == null) + { + originalOwner = "You"; + } + else + { + if (player.getUniqueId().toString().equals(ci.OriginalOwner)) + { + originalOwner = "You"; + } + else + { + OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(UUID.fromString(ci.OriginalOwner)); + originalOwner = offlinePlayer.getName(); + } + } lore.add(" "); - lore.add(C.cWhite + "Original Owner: " + C.cYellow + (ci.OriginalOwner == null ? "You" : Bukkit.getOfflinePlayer(UUID.fromString(ci.OriginalOwner)).getName())); + lore.add(C.cWhite + "Original Owner: " + C.cYellow + originalOwner); } net.minecraft.server.v1_8_R3.ItemStack newItem = CraftItemStack.asNMSCopy(originalItem); @@ -676,6 +701,25 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return null; } + private static void saveUnhandledTags(ItemStack itemStack, Map map) + { + ItemMeta itemMeta = itemStack.getItemMeta(); + if (itemMeta == null) + { + return; + } + try + { + UNHANDLED_TAGS_FIELD.set(itemMeta, map); + } + catch (IllegalAccessException e) + { + System.out.println("Could not get unhandledTags"); + e.printStackTrace(); + } + itemStack.setItemMeta(itemMeta); + } + public static void save(ItemStack itemStack, boolean remove) { CustomItem item = parseItem(itemStack); @@ -683,6 +727,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { Map data = getUnhandledTags(itemStack); data.put("gearmanager.json", new NBTTagString(serialize(item))); + saveUnhandledTags(itemStack, data); if (remove) { customItemCache.remove(item); From 67f4361959e783591a0169a39e7339a582cc3b30 Mon Sep 17 00:00:00 2001 From: samczsun Date: Fri, 10 Jun 2016 21:51:47 -0400 Subject: [PATCH 07/34] Cleanup CustomItems after a while --- .../mineplex/game/clans/items/CustomItem.java | 58 +++++++++---------- .../game/clans/items/GearManager.java | 42 +++++++++----- .../game/clans/items/ItemListener.java | 1 + .../mineplex/game/clans/items/PlayerGear.java | 11 +--- 4 files changed, 59 insertions(+), 53 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java index ea79134f3..116cb315c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java @@ -43,16 +43,16 @@ public class CustomItem implements Listener private AttributeContainer _attributes; protected String _uuid; - + protected boolean _dullEnchantment; - + public String OriginalOwner = null; - + public String getUuid() { return _uuid; } - + public CustomItem(String displayName, String[] description, Material material) { _displayName = displayName; @@ -62,12 +62,12 @@ public class CustomItem implements Listener _uuid = UUID.randomUUID().toString(); UtilServer.RegisterEvents(this); } - + public CustomItem(Material material) { this(prettifyName(material), null, material); } - + /** * @return the name displayed to players for the item. */ @@ -75,16 +75,16 @@ public class CustomItem implements Listener { return ChatColor.RESET.toString() + TITLE_COLOR + _attributes.formatItemName(_displayName); } - + public String[] getDescription() { return _description; } - + public List getLore() { List lore = new ArrayList(); - + if (getDescription() != null) { for (String desc : getDescription()) @@ -92,45 +92,45 @@ public class CustomItem implements Listener lore.add(ATTRIBUTE_COLOR + desc); } } - + // Display attribute descriptions and stats in lore for (ItemAttribute attribute : _attributes.getAttributes()) { String attributeLine = ATTRIBUTE_COLOR + "• " + attribute.getDescription(); lore.add(attributeLine); } - + return lore; } - + public ItemStack toItemStack(int amount) { ItemStack item = new ItemStack(_material, amount); update(item); - + if (_dullEnchantment) { UtilInv.addDullEnchantment(item); } - + return item; } - + public ItemStack toItemStack() { return toItemStack(1); } - + public void addDullEnchantment() { _dullEnchantment = true; } - + public void removeDullEnchantment() { _dullEnchantment = false; } - + public void onInteract(PlayerInteractEvent event) { for (ItemAttribute attribute : _attributes.getAttributes()) @@ -138,7 +138,7 @@ public class CustomItem implements Listener attribute.onInteract(event); } } - + public void onAttack(CustomDamageEvent event) { for (ItemAttribute attribute : _attributes.getAttributes()) @@ -146,7 +146,7 @@ public class CustomItem implements Listener attribute.onAttack(event); } } - + public void onAttacked(CustomDamageEvent event) { for (ItemAttribute attribute : _attributes.getAttributes()) @@ -154,7 +154,7 @@ public class CustomItem implements Listener attribute.onAttacked(event); } } - + /** * @param item - the item to check for a matching link * @return true, if {@code item} matches this CustomItem via UUID, false @@ -164,40 +164,40 @@ public class CustomItem implements Listener { return item.getUuid().equals(_uuid); } - + /** * Update {@code item} with the proper meta properties suited for this * {@link CustomItem}. - * + * * @param item - the item whose meta properties are being updated to become * a version of this updated custom item. */ public void update(ItemStack item) { ItemMeta meta = item.getItemMeta(); - + String displayName = getDisplayName(); List lore = getLore(); - + meta.setDisplayName(displayName); meta.setLore(lore); - + item.setItemMeta(meta); GearManager.writeNBT(this, item); } - + public static String prettifyName(Material material) { String name = ""; String[] words = material.toString().split("_"); - + for (String word : words) { word = word.toLowerCase(); name += word.substring(0, 1).toUpperCase() + word.substring(1) + " "; } - + return name; } 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 6b394cf10..4507eb560 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 @@ -1,8 +1,6 @@ package mineplex.game.clans.items; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; @@ -22,9 +20,6 @@ import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; @@ -35,8 +30,6 @@ import com.google.gson.GsonBuilder; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; 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.common.weight.Weight; import mineplex.core.common.weight.WeightSet; @@ -224,7 +217,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable GSON = new GsonBuilder().registerTypeAdapterFactory(attributeFactory).registerTypeAdapterFactory(customItemType).create(); } - + private static Map _customItemCache = new HashMap<>(); private static GearManager _instance; // Singleton instance // Mapping of player names (key) to cached gear set (value). @@ -232,8 +225,6 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable private GearShop _shop; - private static Map customItemCache = new HashMap<>(); - public GearManager(JavaPlugin plugin, PacketHandler packetHandler, CoreClientManager clientManager, DonationManager donationManager) { super("CustomGear", plugin); @@ -411,13 +402,15 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable String strUUID = ((NBTTagString) data.get("gearmanager.uuid")).a_(); try { + System.out.println("Is new item: " + strUUID); UUID uuid = UUID.fromString(strUUID); - CustomItem customItem = customItemCache.get(uuid); + CustomItem customItem = _customItemCache.get(uuid); if (customItem == null) { + System.out.println("Reparsing"); String json = ((NBTTagString) data.get("gearmanager.json")).a_(); customItem = deserialize(json); - customItemCache.put(uuid, customItem); + _customItemCache.put(uuid, customItem); } return customItem; } @@ -478,11 +471,13 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable try { CustomItem customItem = deserialize(serialization); + System.out.println("Is old format: " + customItem._uuid); + System.out.println(serialization); data.put("gearmanager.uuid", new NBTTagString(customItem._uuid)); data.put("gearmanager.json", new NBTTagString(serialization)); saveUnhandledTags(item, data); - customItemCache.put(UUID.fromString(customItem._uuid), customItem); + _customItemCache.put(UUID.fromString(customItem._uuid), customItem); return customItem; } catch (Exception e) @@ -730,7 +725,26 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable saveUnhandledTags(itemStack, data); if (remove) { - customItemCache.remove(item); + _customItemCache.remove(item); + } + } + } + + public static void cleanup() + { + Iterator it = _customItemCache.values().iterator(); + while (it.hasNext()) + { + CustomItem item = it.next(); + if (item.OriginalOwner != null) + { + UUID uuid = UUID.fromString(item.OriginalOwner); + Player player = Bukkit.getPlayer(uuid); + if (player == null || !player.isOnline()) + { + UtilServer.Unregister(item); + it.remove(); + } } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java index 24f1897b5..245cf91b7 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java @@ -54,6 +54,7 @@ public class ItemListener implements Listener, Runnable { save(player, false); } + GearManager.cleanup(); } @EventHandler(priority = EventPriority.LOWEST) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java index 23b83f63c..0efe55a34 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java @@ -184,15 +184,6 @@ public class PlayerGear */ public boolean cleanup() { - if (_cleanedUp) - { - throw new RuntimeException("Already cleaned up... bug?"); - } - if (getPlayer().isOnline()) - { - return false; - } - forEachGear(item -> UtilServer.Unregister(item)); - return true; + return !getPlayer().isOnline(); } } From 9933345a7bf4202ef29f16bacd4f33a52c0c1af7 Mon Sep 17 00:00:00 2001 From: samczsun Date: Fri, 10 Jun 2016 21:54:34 -0400 Subject: [PATCH 08/34] Remove debug messages --- .../src/mineplex/game/clans/items/GearManager.java | 4 ---- 1 file changed, 4 deletions(-) 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 4507eb560..07663b47d 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 @@ -402,12 +402,10 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable String strUUID = ((NBTTagString) data.get("gearmanager.uuid")).a_(); try { - System.out.println("Is new item: " + strUUID); UUID uuid = UUID.fromString(strUUID); CustomItem customItem = _customItemCache.get(uuid); if (customItem == null) { - System.out.println("Reparsing"); String json = ((NBTTagString) data.get("gearmanager.json")).a_(); customItem = deserialize(json); _customItemCache.put(uuid, customItem); @@ -471,8 +469,6 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable try { CustomItem customItem = deserialize(serialization); - System.out.println("Is old format: " + customItem._uuid); - System.out.println(serialization); data.put("gearmanager.uuid", new NBTTagString(customItem._uuid)); data.put("gearmanager.json", new NBTTagString(serialization)); From 5564b07a36996419e7f915deb733a883bc9ccf34 Mon Sep 17 00:00:00 2001 From: samczsun Date: Fri, 10 Jun 2016 22:03:12 -0400 Subject: [PATCH 09/34] Remove unnecessary serializations --- .../mineplex/game/clans/items/ItemListener.java | 15 --------------- .../mineplex/game/clans/items/PlayerGear.java | 17 ----------------- 2 files changed, 32 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java index 245cf91b7..c3bbbf9a8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java @@ -71,21 +71,6 @@ public class ItemListener implements Listener, Runnable } } - /** - * Handle updated CustomItem stats and lore upon player - * switching items. - * - * @param event - */ - @EventHandler - public void onItemHeldChanged(PlayerItemHeldEvent event) - { - Player player = event.getPlayer(); - PlayerGear gear = getGear(player); - - gear.onItemHeldChanged(event); - } - /** * Handle the trigger of custom gear related effects and abilities. * diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java index 0efe55a34..3601524c7 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/PlayerGear.java @@ -56,7 +56,6 @@ public class PlayerGear if (legendary.OriginalOwner == null) { legendary.OriginalOwner = getPlayer().getUniqueId().toString(); - getPlayer().setItemInHand(legendary.toItemStack()); } } } @@ -108,22 +107,6 @@ public class PlayerGear { forEachGear(item -> item.onAttacked(event)); } - - /** - * Update appropriate gear status and item lores. - * - * @param event - the triggering item held change event. - */ - public void onItemHeldChanged(PlayerItemHeldEvent event) - { - ItemStack item = getPlayer().getItemInHand(); - CustomItem weapon = getWeapon(); - - if (weapon != null) - { - weapon.update(item); // Update held-item's stats. - } - } private void forEachGear(Consumer itemConsumer) { From 18d7eba9db5785947986ec0e977d8cfffb513577 Mon Sep 17 00:00:00 2001 From: samczsun Date: Mon, 13 Jun 2016 22:05:52 -0400 Subject: [PATCH 10/34] Let's not eagerly delete clans --- .../tutorial/tutorials/clans/ClansMainTutorial.java | 13 +++++++++++-- .../clans/objective/goals/clan/CreateClanGoal.java | 10 ++++++++++ .../objective/goals/finalobj/DisbandClanGoal.java | 5 +++++ 3 files changed, 26 insertions(+), 2 deletions(-) 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 index a7080e3d9..bee18499e 100644 --- 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 @@ -209,7 +209,8 @@ public class ClansMainTutorial extends Tutorial ClanInfo clan = ClansManager.getInstance().getClan(player); if (clan != null) { - ClansManager.getInstance().getClanDataAccess().delete(clan, null); + UtilPlayer.message(player, F.main("Clans", "You are part of a clan - please leave or disband the clan before doing the tutorial")); + ClansManager.getInstance().getTutorial().finishTutorial(player); //nopenopenopenopenope } } @@ -465,7 +466,15 @@ public class ClansMainTutorial extends Tutorial if (!_taskManager.hasCompletedTask(event.getPlayer(), getTaskIdentifier())) { - start(event.getPlayer()); + ClanInfo clan = ClansManager.getInstance().getClan(event.getPlayer()); + if (clan == null) + { + start(event.getPlayer()); + } + else + { + UtilPlayer.message(event.getPlayer(), F.main("Clans", "It seems you already have a clan here, so we can skip the tutorial")); + } } else if (!event.getPlayer().hasPlayedBefore() || !event.getPlayer().getLocation().getWorld().equals(Spawn.getSpawnWorld())) { 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 index 693b7cda2..8413cdb5a 100644 --- 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 @@ -1,6 +1,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; import mineplex.core.common.util.F; +import mineplex.game.clans.clans.event.ClanCreatedEvent; import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -42,6 +43,15 @@ public class CreateClanGoal extends ObjectiveGoal } + @EventHandler + public void onClanPreCreate(ClanCreatedEvent event) + { + if (contains(event.getFounder())) + { + event.setName("TUTORIAL-" + event.getName()); + } + } + @EventHandler public void onClanCreate(ClanCreationCompleteEvent event) { 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 index 60a243659..9de897421 100644 --- 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 @@ -47,6 +47,11 @@ public class DisbandClanGoal extends ObjectiveGoal { return; } + if (!event.getClan().getName().startsWith("TUTORIAL-")) // How??? + { + UtilPlayer.message(event.getDisbander(), F.main("Clans", "Something has gone terribly wrong while disbanding your clan")); + return; + } event.setCancelled(true); UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan.")); From 2d8b7f4ecd9f7db7018b19f171689eed780510cc Mon Sep 17 00:00:00 2001 From: samczsun Date: Mon, 13 Jun 2016 22:09:07 -0400 Subject: [PATCH 11/34] Cleanse lore --- .../game/clans/items/GearManager.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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 07663b47d..015ad9280 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 @@ -1,6 +1,7 @@ package mineplex.game.clans.items; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; @@ -631,7 +632,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return item; } - List lore = originalMeta.getLore(); + List newLore = cleanseLore(originalMeta.getLore()); CustomItem ci = parseItem(originalItem); @@ -654,18 +655,31 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable originalOwner = offlinePlayer.getName(); } } - lore.add(" "); - lore.add(C.cWhite + "Original Owner: " + C.cYellow + originalOwner); + newLore.add(" "); + newLore.add(C.cWhite + "Original Owner: " + C.cYellow + originalOwner); } net.minecraft.server.v1_8_R3.ItemStack newItem = CraftItemStack.asNMSCopy(originalItem); CraftItemStack newCopy = CraftItemStack.asCraftMirror(newItem); ItemMeta newMeta = newCopy.getItemMeta(); - newMeta.setLore(lore); + newMeta.setLore(newLore); newCopy.setItemMeta(newMeta); return newItem; } + private List cleanseLore(List input) + { + List cleansed = new ArrayList<>(); + for (String s : input) + { + if (!s.startsWith(ITEM_SERIALIZATION_TAG)) + { + cleansed.add(s); + } + } + return cleansed; + } + public void openShop(Player player) { _shop.attemptShopOpen(player); From 5c2a9d5807de5bed7f9ab296d028c555771902c1 Mon Sep 17 00:00:00 2001 From: samczsun Date: Wed, 15 Jun 2016 21:34:34 -0400 Subject: [PATCH 12/34] Prefixes are too long or something --- .../clans/objective/goals/clan/CreateClanGoal.java | 9 --------- .../clans/objective/goals/finalobj/DisbandClanGoal.java | 6 +----- 2 files changed, 1 insertion(+), 14 deletions(-) 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 index 8413cdb5a..d44f63869 100644 --- 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 @@ -43,15 +43,6 @@ public class CreateClanGoal extends ObjectiveGoal } - @EventHandler - public void onClanPreCreate(ClanCreatedEvent event) - { - if (contains(event.getFounder())) - { - event.setName("TUTORIAL-" + event.getName()); - } - } - @EventHandler public void onClanCreate(ClanCreationCompleteEvent event) { 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 index 9de897421..e70f7009c 100644 --- 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 @@ -47,11 +47,7 @@ public class DisbandClanGoal extends ObjectiveGoal { return; } - if (!event.getClan().getName().startsWith("TUTORIAL-")) // How??? - { - UtilPlayer.message(event.getDisbander(), F.main("Clans", "Something has gone terribly wrong while disbanding your clan")); - return; - } + event.setCancelled(true); UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan.")); From d6d8d288ca584db5d6077528d58a0558ea2f13e3 Mon Sep 17 00:00:00 2001 From: samczsun Date: Wed, 15 Jun 2016 20:09:26 -0400 Subject: [PATCH 13/34] Prevent TNT duping in Bridges. Fixes PC-132 --- .../game/arcade/game/games/bridge/Bridge.java | 22 --- .../game/arcade/kit/perks/PerkBomber.java | 128 ++++++++++++++---- 2 files changed, 98 insertions(+), 52 deletions(-) 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 3f979be43..8f18e73cc 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 @@ -258,28 +258,6 @@ public class Bridge extends TeamGame implements OreObsfucation _tournament = Manager.IsTournamentServer(); } - @EventHandler - public void blockTntDupe(InventoryClickEvent event) - { - Player player = (Player) event.getWhoClicked(); - ItemStack itemStack = event.getCurrentItem(); - InventoryView view = player.getOpenInventory(); - if(view.getTopInventory() == null || itemStack == null || itemStack.getType() != Material.TNT) - { - return; - } - if(event.getClickedInventory() == null) - { - return; - } - if(event.getClickedInventory().getType() == InventoryType.PLAYER) - { - return; - } - - event.setCancelled(true); - } - @EventHandler public void PlayerOut(final PlayerDeathOutEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java index db7bd7830..95ca01a94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java @@ -13,11 +13,13 @@ import org.bukkit.entity.*; import org.bukkit.event.*; import org.bukkit.event.block.*; import org.bukkit.event.entity.*; -import org.bukkit.event.inventory.*; import org.bukkit.event.player.*; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.metadata.FixedMetadataValue; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; public class PerkBomber extends Perk { @@ -51,7 +53,11 @@ public class PerkBomber extends Perk } } - private HashMap _tntMap = new HashMap(); + private static final String THROWING_TNT_DISPLAY_NAME = F.item("Throwing TNT"); + + // Maps how many TNT each player has gotten, regardless of where that TNT is + private Map _tntCount = new HashMap<>(); + private Map _tntMap = new HashMap(); private int _spawnRate; private int _max; @@ -92,13 +98,16 @@ public class PerkBomber extends Perk if (!Recharge.Instance.use(cur, GetName(), _spawnRate * 1000, false, false)) continue; - if (UtilInv.contains(cur, Material.TNT, (byte) 0, _max)) + if (_tntCount.get(cur).get() >= _max) continue; //Add - cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte) 0, 1, F.item("Throwing TNT"))); + ItemStack tnt = new ItemBuilder(Material.TNT).addLore(generateLore(cur)).setTitle(THROWING_TNT_DISPLAY_NAME).build(); + cur.getInventory().addItem(tnt); cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); + + _tntCount.get(cur).incrementAndGet(); } } @@ -108,7 +117,7 @@ public class PerkBomber extends Perk if (event.isCancelled()) return; - if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.TNT, (byte) 0)) + if (!isThrowingTnt(event.getItemDrop().getItemStack())) return; //Cancel @@ -124,54 +133,70 @@ public class PerkBomber extends Perk HashSet remove = new HashSet(); for (org.bukkit.inventory.ItemStack item : event.getDrops()) - if (UtilInv.IsItem(item, Material.TNT, (byte) 0)) + if (isThrowingTnt(item)) remove.add(item); + int oldAmount = _tntCount.get(event.getEntity()).get(); + if (oldAmount < remove.size()) + { + System.out.println("Strange.... expected " + oldAmount + " of tnt for " + event.getEntity().getName() + " but removed " + remove.size() + " instead"); + _tntCount.get(event.getEntity()).set(0); + } + else + { + _tntCount.get(event.getEntity()).set(oldAmount - remove.size()); + } + for (org.bukkit.inventory.ItemStack item : remove) event.getDrops().remove(item); } @EventHandler - public void TNTInvClick(InventoryClickEvent event) + public void on(PlayerQuitEvent event) { - // If they have a inventory open - if (event.getView().getTopInventory().getHolder() instanceof Player) - { - return; - } + _tntCount.remove(event.getPlayer()); + } - // If they are clicking in their own inventory - if (event.getClickedInventory() != null && event.getClickedInventory().getHolder() instanceof Player) + @Override + public void registeredEvents() + { + _tntCount.clear(); + for (Player player : UtilServer.getPlayersCollection()) { - // If its not a shift click - if (!event.isShiftClick()) - { - return; - } - } // Else if they are not clicking in their own inventory make sure they don't have tnt in their hands - else if (event.getCursor() == null || event.getCursor().getType() != Material.TNT) - { - return; + _tntCount.put(player, new AtomicInteger()); } + } - UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte) 0, true); + @Override + public void unregisteredEvents() + { + _tntCount.clear(); } @EventHandler public void TNTThrow(PlayerInteractEvent event) { - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK && - event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR) + if (!UtilEvent.isAction(event, UtilEvent.ActionType.L) && !UtilEvent.isAction(event, UtilEvent.ActionType.R)) return; Player player = event.getPlayer(); - if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0)) - return; - if (!Kit.HasKit(player)) return; + if (!isThrowingTnt(event.getItem())) + return; + + ItemMeta meta = player.getItemInHand().getItemMeta(); + List lore = meta.getLore(); + String[] ownerInfo = ChatColor.stripColor(lore.get(1)).split(":"); + ownerInfo[1] = ownerInfo[1].trim(); + if (!player.getName().equals(ownerInfo[1])) + { + UtilPlayer.message(player, F.main(GetName(), "You cannot throw TNT owned by " + C.cGreen + ownerInfo[1])); + return; + } + event.setCancelled(true); if (!Manager.GetGame().CanThrowTNT(player.getLocation())) @@ -181,7 +206,14 @@ public class PerkBomber extends Perk return; } - UtilInv.remove(player, Material.TNT, (byte) 0, 1); + if (event.getItem().getAmount() > 1) + { + event.getItem().setAmount(event.getItem().getAmount() - 1); + } + else + { + player.getInventory().remove(event.getItem()); + } UtilInv.Update(player); TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); @@ -194,6 +226,7 @@ public class PerkBomber extends Perk tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); _tntMap.put(tnt, player); + _tntCount.get(player).decrementAndGet(); } @EventHandler @@ -229,4 +262,39 @@ public class PerkBomber extends Perk } } } + + private boolean isThrowingTnt(ItemStack in) + { + if (in == null) + { + return false; + } + ItemMeta meta = in.getItemMeta(); + if (meta == null) + { + return false; + } + if (!THROWING_TNT_DISPLAY_NAME.equals(meta.getDisplayName())) + { + return false; + } + List lore = meta.getLore(); + if (lore.size() != 2) + { + return false; + } + if (!lore.get(1).contains("Owned by:")) + { + return false; + } + return true; + } + + private String[] generateLore(Player input) + { + return new String[]{ + " ", + C.cYellow + "Owned by: " + C.Reset + C.cGreen + input.getName() + }; + } } From e7d76e2ef4fe67c8294657be1b66cd9e08c40947 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 16 Jun 2016 03:42:33 -0500 Subject: [PATCH 14/34] Hot fixes. --- .../gui/buttons/KitIconButton.java | 3 - .../buttons/KitPermanentDefaultButton.java | 2 - .../gui/buttons/KitSelectButton.java | 5 - .../src/nautilus/game/arcade/game/Game.java | 6 +- .../game/arcade/game/games/bridge/Bridge.java | 125 +++++++----------- .../game/games/bridge/kits/KitBeserker.java | 49 ------- .../game/arcade/kit/ProgressingKit.java | 51 +++++++ .../arcade/managers/GameLobbyManager.java | 83 ++++-------- .../managers/ProgressingKitManager.java | 13 +- 9 files changed, 134 insertions(+), 203 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBeserker.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitIconButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitIconButton.java index f0e7576ca..24b94d19a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitIconButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitIconButton.java @@ -5,7 +5,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.progression.ProgressiveKit; -import mineplex.core.progression.gui.Menu; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -72,7 +71,5 @@ public class KitIconButton extends KitButton public void onClick(Player player) { getKit().onSelected(player.getUniqueId()); - Menu.remove(player.getUniqueId()); - player.closeInventory(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitPermanentDefaultButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitPermanentDefaultButton.java index 48c8db40d..efaafd3cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitPermanentDefaultButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitPermanentDefaultButton.java @@ -41,8 +41,6 @@ public class KitPermanentDefaultButton extends KitButton { getKit().onSelected(player.getUniqueId()); - getKit().setDefault(!getKit().isDefault(player.getUniqueId()), player.getUniqueId()); - getKit().onSetDefault(player.getUniqueId()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitSelectButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitSelectButton.java index 1817eb337..acdf770fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitSelectButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitSelectButton.java @@ -4,7 +4,6 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.progression.ProgressiveKit; -import mineplex.core.progression.gui.Menu; import net.md_5.bungee.api.ChatColor; import org.bukkit.DyeColor; import org.bukkit.Material; @@ -35,9 +34,5 @@ public class KitSelectButton extends KitButton public void onClick(Player player) { getKit().onSelected(player.getUniqueId()); - - Menu.remove(player.getUniqueId()); - - player.closeInventory(); } } 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 f6bc99724..08cb04cb6 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 @@ -700,9 +700,6 @@ public abstract class Game implements Listener team.AddPlayer(player, in); - // Ensure Valid Kit - ValidateKit(player, team); - // Game Scoreboard Scoreboard.SetPlayerTeam(player, team.GetName().toUpperCase()); @@ -711,6 +708,9 @@ public abstract class Game implements Listener // Save Tournament Team Manager.GetGameTournamentManager().setTournamentTeam(player, team); + + // Ensure Valid Kit + ValidateKit(player, team); } public GameTeam ChooseTeam(Player player) 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 8f18e73cc..086a9a5fc 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 @@ -1,75 +1,9 @@ package nautilus.game.arcade.game.games.bridge; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; - -import org.bukkit.ChatColor; -import org.bukkit.Effect; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.Chest; -import org.bukkit.craftbukkit.v1_8_R3.block.CraftBlock; -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Cow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Item; -import org.bukkit.entity.Pig; -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.BlockFormEvent; -import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerBucketFillEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.CraftingInventory; -import org.bukkit.inventory.InventoryView; -import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.util.Vector; - import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.*; 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.UtilTextMiddle; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; import mineplex.core.explosion.ExplosionEvent; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -82,21 +16,34 @@ import nautilus.game.arcade.events.PlayerDeathOutEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.bridge.kits.KitApple; -import nautilus.game.arcade.game.games.bridge.kits.KitArcher; -import nautilus.game.arcade.game.games.bridge.kits.KitBeserker; -import nautilus.game.arcade.game.games.bridge.kits.KitBomber; -import nautilus.game.arcade.game.games.bridge.kits.KitDestructor; -import nautilus.game.arcade.game.games.bridge.kits.KitMammoth; -import nautilus.game.arcade.game.games.bridge.kits.KitMiner; +import nautilus.game.arcade.game.games.bridge.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.ore.OreHider; import nautilus.game.arcade.ore.OreObsfucation; -import nautilus.game.arcade.stats.BridgesSniperStatTracker; -import nautilus.game.arcade.stats.DeathBomberStatTracker; -import nautilus.game.arcade.stats.FoodForTheMassesStatTracker; -import nautilus.game.arcade.stats.KillFastStatTracker; -import nautilus.game.arcade.stats.TntMinerStatTracker; +import nautilus.game.arcade.stats.*; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.Chest; +import org.bukkit.entity.*; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.event.player.*; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.util.Vector; + +import java.util.*; public class Bridge extends TeamGame implements OreObsfucation { @@ -186,7 +133,8 @@ public class Bridge extends TeamGame implements OreObsfucation new Kit[] { new KitApple(manager), - new KitBeserker(manager), + new KitBerserker(manager), + new KitBrawler(manager), new KitMammoth(manager), new KitArcher(manager), new KitMiner(manager), @@ -201,6 +149,23 @@ public class Bridge extends TeamGame implements OreObsfucation "The last team alive wins!" }); + boolean foundBrawler = false; + for(int i = 0; i < GetKits().length; i++) + { + Kit kit = GetKits()[i]; + if(kit.GetName().equalsIgnoreCase("Brawler")) + { + if(!foundBrawler) + { + foundBrawler = true; + } + else + { + GetKits()[i] = null; + } + } + } + _ore = new OreHider(); // Flags diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBeserker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBeserker.java deleted file mode 100644 index 27060a45c..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBeserker.java +++ /dev/null @@ -1,49 +0,0 @@ -package nautilus.game.arcade.game.games.bridge.kits; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.bridge.Bridge; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; - -public class KitBeserker extends Kit -{ - public KitBeserker(ArcadeManager manager) - { - super(manager, "Beserker", KitAvailability.Free, - - new String[] - { - "Agile warrior trained in the ways of axe combat." - }, - - new Perk[] - { - new PerkLeap("Beserker Leap", 1.2, 1.2, 8000), - new PerkAxeman(), - }, - EntityType.ZOMBIE, - new ItemStack(Material.STONE_AXE)); - - } - - @Override - public void GiveItems(Player player) - { - if(!(Manager.GetGame() instanceof Bridge)) - { - return; - } - - Bridge bridge = (Bridge) Manager.GetGame(); - if(!bridge.hasUsedRevive(player)) - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java index 8eeb0aa3c..ee521010c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java @@ -1,8 +1,11 @@ package nautilus.game.arcade.kit; import com.google.common.collect.Lists; +import mineplex.core.common.CurrencyType; +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.core.common.util.UtilServer; import mineplex.core.donation.Donor; import mineplex.core.progression.ProgressiveKit; @@ -11,7 +14,9 @@ import mineplex.core.progression.data.PlayerKit; import mineplex.core.progression.data.PlayerKitDataManager; import mineplex.core.progression.gui.Menu; import mineplex.core.progression.math.Calculations; +import mineplex.core.shop.page.ConfirmationPage; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.shop.KitPackage; import net.minecraft.server.v1_8_R3.EntityFireworks; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; import net.minecraft.server.v1_8_R3.World; @@ -163,6 +168,10 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit @Override public void onSelected(UUID player) { + if(!canEquipKit(Bukkit.getPlayer(player))) + { + return; + } _dataManager.get(player).setCurrentKit(getInternalName()); Manager.GetGame().SetKit(Bukkit.getPlayer(player), this, true); Manager.getProgressionKitManager().displayParticles(this, player); @@ -171,6 +180,13 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit @Override public void onSetDefault(UUID player) { + if(!canEquipKit(Bukkit.getPlayer(player))) + { + return; + } + + setDefault(!isDefault(player), player); + Player bukkitPlayer = Bukkit.getPlayer(player); bukkitPlayer.sendMessage(F.main("Kit", "Set " + C.cYellowB + getDisplayName() + C.cGray + " as your default kit.")); @@ -271,6 +287,41 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit return circleblocks; } + public boolean canEquipKit(Player player) + { + Donor donor = Manager.GetDonation().Get(player); + + if (this.GetAvailability() == KitAvailability.Free || + Manager.hasKitsUnlocked(player) || + (this.GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, this.getAchievementRequirement())) || + donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + this.GetName()) || + Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || + donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament) + { + return true; + } + else if (this.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.GEM) >= this.GetCost()) + { + Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<>( + Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), () -> { + if (player.isOnline()) + { + Manager.GetGame().SetKit(player, this, true); + } + }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), this), CurrencyType.GEM, player)); + } + else if (this.GetAvailability() == KitAvailability.Achievement) + { + UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + ".")); + } + else + { + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); + + UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + ".")); + } + return false; + } public static String leap() { 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 027865cbb..3f57172cf 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 @@ -1,28 +1,31 @@ package nautilus.game.arcade.managers; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.DyeColor; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilBlockText.TextAlign; +import mineplex.core.donation.Donor; +import mineplex.core.elo.EloManager.EloDivision; +import mineplex.core.event.CustomTagEvent; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.uhc.UHC; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.KitSorter; +import org.bukkit.*; import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Sheep; -import org.bukkit.entity.Slime; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -37,40 +40,8 @@ import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; -import mineplex.core.account.CoreClient; -import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlockText; -import mineplex.core.common.util.UtilBlockText.TextAlign; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; -import mineplex.core.cosmetic.event.ActivateGemBoosterEvent; -import mineplex.core.donation.Donor; -import mineplex.core.elo.EloManager.EloDivision; -import mineplex.core.event.CustomTagEvent; -import mineplex.core.packethandler.PacketHandler; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.booster.BoosterPodium; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.games.uhc.UHC; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.KitSorter; +import java.util.*; +import java.util.Map.Entry; public class GameLobbyManager implements Listener { @@ -562,6 +533,10 @@ public class GameLobbyManager implements Listener ArrayList kits = new ArrayList(); for (Kit kit : game.GetKits()) { + if (kit == null) + { + continue; + } if (kit.GetAvailability() != KitAvailability.Hide) kits.add(kit); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java index 88d327582..675469c76 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java @@ -20,7 +20,6 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitProgressionData; import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Bukkit; -import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -62,21 +61,18 @@ public class ProgressingKitManager implements Listener _tasks.remove(player).cancel(); } - Game storedGame = _manager.GetGame(); - Location storedLocation = kit.getLivingEntity().getLocation(); - _tasks.put(player, new BukkitRunnable() { @Override public void run() { - if (!_manager.GetGame().GetName().equalsIgnoreCase(storedGame.GetName())) + if(kit.getLivingEntity() == null) { cancel(); _tasks.remove(player); return; } - if (kit.getLivingEntity() == null || !kit.getLivingEntity().getLocation().equals(storedLocation)) + if(Bukkit.getPlayer(player) == null) { cancel(); _tasks.remove(player); @@ -116,6 +112,10 @@ public class ProgressingKitManager implements Listener //Shouldn't ever happen, but we'll be careful. return; } + if(!((ProgressingKit) kit).canEquipKit(player)) + { + return; + } new KitDisplayMenu((ProgressingKit) kit).open(player); } @@ -301,6 +301,5 @@ public class ProgressingKitManager implements Listener _data.put(player.getUniqueId(), new KitProgressionData(kit, game, xpGained)); } - } From 5ac6249684de48b8ba25764d79ddc3f12332c966 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 16 Jun 2016 14:22:44 -0500 Subject: [PATCH 15/34] Fix Bridges Kits not getting their items. Fix Kits breaking at Level 5 --- .../gui/buttons/KitUpgradeMenuButton.java | 15 ++++++------- .../src/nautilus/game/arcade/game/Game.java | 9 ++++++++ .../game/games/bridge/modes/SpeedBridges.java | 8 ------- .../managers/ProgressingKitManager.java | 21 +++++++++++++++++++ 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java index 7195032c8..d8792c357 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/gui/buttons/KitUpgradeMenuButton.java @@ -1,5 +1,6 @@ package mineplex.core.progression.gui.buttons; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.progression.ProgressiveKit; import mineplex.core.progression.gui.guis.KitInformationTrackerMenu; @@ -21,6 +22,11 @@ import static mineplex.core.common.util.UtilServer.getPlugin; public class KitUpgradeMenuButton extends KitButton { + private static final ItemStack ITEM_STACK = new ItemBuilder(Material.ENCHANTMENT_TABLE) + .setTitle(C.cYellow + "Upgrade Level") + .setLore(" ", C.cRed + "Upgrades Coming Soon!") + .build(); + private ItemStack _item; private boolean _flash; private BukkitTask _task; @@ -29,6 +35,7 @@ public class KitUpgradeMenuButton extends KitButton { super(kit, null); + _item = ITEM_STACK; //The current upgrade level out of 5 for this kit int upgradeLevel = kit.getUpgradeLevel(player.getUniqueId()); //The players level @@ -50,12 +57,6 @@ public class KitUpgradeMenuButton extends KitButton ChatColor color = Calculations.getColor(level, nextUpgradeLevelPlayer); - ItemBuilder builder = new ItemBuilder(Material.ENCHANTMENT_TABLE); - - builder.setTitle(ChatColor.YELLOW + "Upgrade Level"); - builder.setLore(" ", ChatColor.RED + "Upgrades Coming Soon!"); - - _item = builder.build(); } @Override @@ -75,7 +76,7 @@ public class KitUpgradeMenuButton extends KitButton this._task = new BukkitRunnable() { - private ItemStack itemClone = getItemStack().clone(); + private ItemStack itemClone = ITEM_STACK.clone(); private ItemStack AIR = new ItemStack(Material.AIR); 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 08cb04cb6..0b9b8d8df 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 @@ -659,6 +659,10 @@ public abstract class Game implements Listener { for (Kit kit : _kits) { + if(kit == null) + { + continue; + } UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.getPlugin()); for (Perk perk : kit.GetPerks()) @@ -673,6 +677,11 @@ public abstract class Game implements Listener { for (Kit kit : _kits) { + if(kit == null) + { + continue; + } + HandlerList.unregisterAll(kit); for (Perk perk : kit.GetPerks()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java index 8e71d6081..7e826c85a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java @@ -9,14 +9,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.games.bridge.Bridge; -import nautilus.game.arcade.game.games.bridge.kits.KitApple; -import nautilus.game.arcade.game.games.bridge.kits.KitArcher; -import nautilus.game.arcade.game.games.bridge.kits.KitBeserker; -import nautilus.game.arcade.game.games.bridge.kits.KitBomber; -import nautilus.game.arcade.game.games.bridge.kits.KitDestructor; -import nautilus.game.arcade.game.games.bridge.kits.KitMammoth; -import nautilus.game.arcade.game.games.bridge.kits.KitMiner; -import nautilus.game.arcade.kit.Kit; /** * SpeedBridges gamemode for Bridges diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java index 675469c76..7895fb33c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java @@ -24,6 +24,7 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scheduler.BukkitRunnable; @@ -157,6 +158,26 @@ public class ProgressingKitManager implements Listener _manager.getKitProgressionManager().getDataManager().remove(playerKit); } + @EventHandler + public void testCommand(PlayerCommandPreprocessEvent event) + { + //This needs to stay in for testing sakes if the issue arises connor + String message = event.getMessage(); + if(!event.getPlayer().getName().equalsIgnoreCase("TadahTech")) + { + return; + } + if(!message.startsWith("/kpsetlevel")) + { + return; + } + event.setCancelled(true); + int level = Integer.parseInt(message.split(" ")[1]); + ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer()); + kit.setLevel(level, event.getPlayer().getUniqueId()); + event.getPlayer().sendMessage("Set level for "+ kit.GetName() + " to " + level); + } + @EventHandler public void cancelParticles(GameStateChangeEvent event) { From 01409af5bd0cb41a163fd4d0b823ecc865782e67 Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 16 Jun 2016 15:46:12 -0400 Subject: [PATCH 16/34] Fix misc bugs Change UtilServer to return proper plugin instance Remove /energyshop debug command Add warning for opening chests while in vanish Fix item maps being broken Fix tutorials possibly wiping inventory Make the project compile --- .../mineplex/core/common/util/UtilServer.java | 3 +- .../game/clans/clans/ClanEnergyManager.java | 9 -- .../game/clans/clans/ClansManager.java | 4 +- .../game/clans/clans/map/ItemMapManager.java | 10 +- .../game/clans/clans/map/ItemMapRenderer.java | 123 ++++++++++-------- .../game/clans/gameplay/Gameplay.java | 29 ----- .../clans/gameplay/HiddenChestManager.java | 111 ++++++++++++++++ .../game/clans/tutorial/Tutorial.java | 7 + .../tutorials/clans/ClansMainTutorial.java | 19 ++- 9 files changed, 210 insertions(+), 105 deletions(-) create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java 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 1f05befb8..840f78586 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 @@ -11,6 +11,7 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import java.lang.reflect.Field; @@ -112,7 +113,7 @@ public class UtilServer public static Plugin getPlugin() { - return getPluginManager().getPlugins()[0]; + return JavaPlugin.getProvidingPlugin(UtilServer.class); } public static PluginManager getPluginManager() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyManager.java index 38ccfd24f..9184bd800 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyManager.java @@ -85,15 +85,6 @@ public class ClanEnergyManager extends MiniPlugin implements Runnable return _clansManager; } - @EventHandler - public void command(PlayerCommandPreprocessEvent event) - { - if (event.getMessage().startsWith("/energyshop")) - { - openShop(event.getPlayer()); - } - } - public int convertEnergyToGold(int energy) { return (energy / 8) + (energy % 8 == 0 ? 0 : 1); 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 01ac1cc8a..e4c59cab3 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 @@ -71,6 +71,7 @@ import mineplex.game.clans.core.repository.tokens.ClanToken; import mineplex.game.clans.economy.GoldManager; import mineplex.game.clans.fields.Field; import mineplex.game.clans.gameplay.Gameplay; +import mineplex.game.clans.gameplay.HiddenChestManager; import mineplex.game.clans.gameplay.safelog.SafeLog; import mineplex.game.clans.gameplay.safelog.npc.NPCManager; import mineplex.game.clans.items.GearManager; @@ -290,6 +291,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati new Weapon(plugin, energy); new Gameplay(plugin, this, blockRestore, _damageManager); + new HiddenChestManager(this, packetHandler); _projectileManager = new ProjectileManager(plugin); Fire fire = new Fire(plugin, _condition, _damageManager); @@ -619,7 +621,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati continue; } - other.sendMessage(F.sys("Quit ", event.getPlayer().getName())); + other.sendMessage(F.sys("Quit", event.getPlayer().getName())); } } 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 04e2fb410..d103b3139 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 @@ -482,7 +482,15 @@ public class ItemMapManager extends MiniPlugin }*/ byte color = (byte) (origColor + b0); - map[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] = color; + if((color <= -113 || color >= 0) && color <= 127) + { + map[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] = color; + } + else + { + System.out.println(String.format("Tried to set color to %s in colorWorldHeight scale: %s, sx: %s, sz: %s, x: %z, z: %s, zoom: %s", + color, scale, startingX, startingZ, x, z, zoom)); + } } } } 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 e0f3ca941..69835e4ae 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 @@ -184,74 +184,83 @@ public class ItemMapRenderer extends MapRenderer if (clanColor != null) { - int chunkBX = blockX & 0xF; - int chunkBZ = blockZ & 0xF; - int chunkX1 = (int) Math.floor(blockX / 16D); - int chunkZ1 = (int) Math.floor(blockZ / 16D); - - //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)))) + if(! ((color <= -113 || color >= 0) && color <= 127)) { - 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) - { - 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); + color = (byte) 0; + System.out.println(String.format("Tried to draw invalid color %s, player: %s, mapX: %s, mapZ: %s", + color, player.getName(), mapX, mapZ)); } - - - //Inside else { - Color cColor = MapPalette.getColor(color); + int chunkBX = blockX & 0xF; + int chunkBZ = blockZ & 0xF; + int chunkX1 = (int) Math.floor(blockX / 16D); + int chunkZ1 = (int) Math.floor(blockZ / 16D); - double clans = 0.065; + //Border + if (colorAll || - //Stripes - boolean checker = (mapX + (mapZ % 4)) % 4 == 0; - Color drawColor = clanColor; - if (checker && owningClan.isAdmin() && clanColor2 != null) + ((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)))) { - drawColor = clanColor2; - clans = 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) + { + 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); } - 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)); + //Inside + else + { + Color cColor = MapPalette.getColor(color); - color = MapPalette.matchColor(r, g, b); + double clans = 0.065; + + //Stripes + boolean checker = (mapX + (mapZ % 4)) % 4 == 0; + Color drawColor = clanColor; + if (checker && owningClan.isAdmin() && clanColor2 != null) + { + 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); + } } } } 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 a25e82325..05e00963b 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 @@ -332,35 +332,6 @@ public class Gameplay extends MiniPlugin } } - @EventHandler - public void onInteract(PlayerInteractEvent event) - { - if (!_clansManager.getIncognitoManager().Get(event.getPlayer()).Status) - { - return; - } - - if (event.getAction() != Action.RIGHT_CLICK_BLOCK) - { - return; - } - - if (event.getClickedBlock() == null) - { - return; - } - - Material type = event.getClickedBlock().getType(); - if (type != Material.CHEST && type != Material.TRAPPED_CHEST) - { - return; - } - - Chest chest = (Chest) event.getClickedBlock().getState(); - event.getPlayer().openInventory(chest.getInventory()); - event.setCancelled(true); - } - /** * Disable all Piston related events in Clans * diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java new file mode 100644 index 000000000..6f2f53e2e --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java @@ -0,0 +1,111 @@ +package mineplex.game.clans.gameplay; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.game.clans.clans.ClansManager; +import net.minecraft.server.v1_8_R3.BaseBlockPosition; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; +import org.bukkit.Location; +import org.bukkit.Material; +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.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +public class HiddenChestManager implements Listener +{ + private final Set _locationsToCancel = Collections.synchronizedSet(new HashSet<>()); + private final Set _fine = new HashSet<>(); + private final ClansManager _clansManager; + + public HiddenChestManager(ClansManager clansManager, PacketHandler packetHandler) + { + this._clansManager = clansManager; + + UtilServer.RegisterEvents(this); +// packetHandler.addPacketHandler(this, PacketPlayOutBlockAction.class, PacketPlayOutNamedSoundEffect.class); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onInteract(PlayerInteractEvent event) + { + if (!_clansManager.getIncognitoManager().Get(event.getPlayer()).Status) + { + return; + } + + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) + { + return; + } + + if (event.getClickedBlock() == null) + { + return; + } + + Material type = event.getClickedBlock().getType(); + if (type != Material.CHEST && type != Material.TRAPPED_CHEST) + { + return; + } + + Location location = event.getClickedBlock().getLocation(); + + if (!_fine.contains(event.getPlayer().getName())) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Clans", "Opening chests while vanished will still make the chest open noise")); + UtilPlayer.message(event.getPlayer(), F.main("Clans", "If you are sure, run /IUnderstandOpeningChestsWillMakeNoise")); + } + +// _locationsToCancel.add(new BaseBlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())); + } + + @EventHandler + public void areYouReallySureYouWantTo(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().equalsIgnoreCase("/IUnderstandOpeningChestsWillMakeNoise")) + { + _fine.add(event.getPlayer().getName()); + event.setCancelled(true); + } + } + +// @Override +// public void handle(PacketInfo packetInfo) +// { +// if (packetInfo.getPacket() instanceof PacketPlayOutBlockAction) +// { +// PacketPlayOutBlockAction blockAction = (PacketPlayOutBlockAction) packetInfo.getPacket(); +// if (_locationsToCancel.contains(blockAction.a)) +// { +// System.out.println(blockAction.b + " " + blockAction.c); +// packetInfo.setCancelled(true); +// if (blockAction.c == 0) +// { +// _locationsToCancel.remove(blockAction.a); +// } +// } +// } +// else if (packetInfo.getPacket() instanceof PacketPlayOutNamedSoundEffect) +// { +// PacketPlayOutNamedSoundEffect soundEffect = (PacketPlayOutNamedSoundEffect) packetInfo.getPacket(); +// +// System.out.println(soundEffect.a); +// } +// } +} 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 index 1771b70be..81069bc2e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java @@ -74,6 +74,11 @@ public abstract class Tutorial implements Listener, ObjectiveListener public void start(Player player) { + if (!canStart(player)) + { + return; + } + System.out.println(String.format("Tutorial> [%s] started tutorial [%s]", player.getName(), getName())); TutorialSession session = new TutorialSession(); @@ -223,6 +228,8 @@ public abstract class Tutorial implements Listener, ObjectiveListener */ protected abstract void onQuit(Player player); + protected abstract boolean canStart(Player player); + public void unregisterAll() { HandlerList.unregisterAll(this); 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 index bee18499e..f9d21b850 100644 --- 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 @@ -171,6 +171,18 @@ public class ClansMainTutorial extends Tutorial */ } + @Override + protected boolean canStart(Player player) + { + ClanInfo clan = ClansManager.getInstance().getClan(player); + if (clan != null) + { + UtilPlayer.message(player, F.main("Clans", "You are part of a clan - please leave or disband the clan before doing the tutorial")); + return false; + } + return true; + } + @Override protected void onStart(Player player) { @@ -205,13 +217,6 @@ public class ClansMainTutorial extends Tutorial addHologram(player, getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -23), "Jump Off!"); - - ClanInfo clan = ClansManager.getInstance().getClan(player); - if (clan != null) - { - UtilPlayer.message(player, F.main("Clans", "You are part of a clan - please leave or disband the clan before doing the tutorial")); - ClansManager.getInstance().getTutorial().finishTutorial(player); //nopenopenopenopenope - } } @Override From 1893e980361549b0efedfc897cbb82ab14e24fb0 Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 16 Jun 2016 15:53:35 -0400 Subject: [PATCH 17/34] Don't run chat filtering on the main thread --- .../src/mineplex/core/chat/Chat.java | 88 +++++++++++-------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index fcdb2aafa..effa0f484 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -22,6 +22,7 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import org.apache.commons.lang3.Validate; +import org.bukkit.block.Sign; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -59,7 +60,7 @@ public class Chat extends MiniPlugin 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"; private String _appId = "34018d65-466d-4a91-8e92-29ca49f022c4"; @@ -69,22 +70,22 @@ public class Chat extends MiniPlugin private int _chatSlow = 0; private long _silenced = 0; private boolean _threeSecondDelay = true; - + private List> _highPriorityFilters = new ArrayList<>(); private List> _lowPriorityFilters = new ArrayList<>(); - + private HashMap _playerLastMessage = new HashMap(); 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; _achievements = achievements; - + try { trustCert(); @@ -207,7 +208,7 @@ public class Chat extends MiniPlugin { if (event.isCancelled()) return; - + if (event.isAsynchronous()) { for (Iterator playerIterator = event.getRecipients().iterator(); playerIterator.hasNext();) @@ -230,24 +231,41 @@ public class Chat extends MiniPlugin return; } - for (int i = 0; i < event.getLines().length; i++) + String[] lines = event.getLines(); + + runAsync(() -> { - String line = event.getLine(i); - if (line != null && line.length() > 0) + for (int i = 0; i < lines.length; i++) { - String filteredLine = getFilteredMessage(event.getPlayer(), line); - if (filteredLine != null) - event.setLine(i, filteredLine); + String line = lines[i]; + if (line != null && line.length() > 0) + { + String filteredLine = getFilteredMessage(event.getPlayer(), line); + if (filteredLine != null) + { + lines[i] = filteredLine; + } + } } - } + + runSync(() -> + { + Sign sign = (Sign) event.getBlock().getState(); + for (int i = 0; i < lines.length; i++) + { + sign.setLine(i, lines[i]); + } + sign.update(); + }); + }); } - + @EventHandler(priority = EventPriority.LOWEST) public void filterChat(AsyncPlayerChatEvent event) { if (event.isCancelled()) return; - + if (event.isAsynchronous()) { event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage())); @@ -266,7 +284,7 @@ public class Chat extends MiniPlugin JSONObject message = buildJsonChatObject(filterType, displayName, playerName, originalMessage, _serverName, 1); String response = getResponseFromCleanSpeak(message, filterType); - + if (response == null) { System.out.println("[ERROR] Unable to filter chat message...thanks a lot CleanSpeak."); @@ -284,7 +302,7 @@ public class Chat extends MiniPlugin System.out.println(o.toString()); } */ - + String filteredMsg = ""; filteredMsg = ((JSONObject) JSONValue.parse(response)).get("content").toString(); @@ -293,7 +311,7 @@ public class Chat extends MiniPlugin filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("parts").toString(); filteredMsg = filteredMsg.replace('[', ' ').replace(']', ' ').trim(); filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("replacement").toString(); - + return filteredMsg; } else @@ -301,7 +319,7 @@ public class Chat extends MiniPlugin return originalMessage; } } - + @EventHandler(priority = EventPriority.LOW) public void HandleChat(AsyncPlayerChatEvent event) { @@ -309,14 +327,14 @@ public class Chat extends MiniPlugin return; Player sender = event.getPlayer(); - + if (_incognitoManager != null && _incognitoManager.Get(sender).Status) { UtilPlayer.message(sender, C.cYellow + "You can not chat while incognito."); event.setCancelled(true); return; } - + for (Function filter : _highPriorityFilters) { if (filter.apply(event).booleanValue()) @@ -325,7 +343,7 @@ public class Chat extends MiniPlugin return; } } - + if (SilenceCheck(sender)) { event.setCancelled(true); @@ -349,7 +367,7 @@ public class Chat extends MiniPlugin else if (!_clientManager.Get(sender).GetRank().has(Rank.HELPER) && msgContainsHack(event.getMessage())) { - UtilPlayer.message(sender, F.main("Chat", + UtilPlayer.message(sender, F.main("Chat", "Accusing players of cheating in-game is against the rules." + "If you think someone is cheating, please gather evidence and report it at " + F.link("www.mineplex.com/reports"))); @@ -372,10 +390,10 @@ public class Chat extends MiniPlugin event.setCancelled(true); } } - + if (!event.isCancelled()) _playerLastMessage.put(sender.getUniqueId(), new MessageData(event.getMessage())); - + for (Function filter : _lowPriorityFilters) { if (filter.apply(event).booleanValue()) @@ -442,17 +460,17 @@ public class Chat extends MiniPlugin JSONObject content = new JSONObject(); content.put("content", msg); content.put("type", "text"); - + JSONArray parts = new JSONArray(); parts.add(content); - + JSONObject mainContent = new JSONObject(); mainContent.put("applicationId", _appId); mainContent.put("createInstant", System.currentTimeMillis()); mainContent.put("parts", parts); mainContent.put("senderDisplayName", name); mainContent.put("senderId", player); - + message.put("content", mainContent); break; case "username": @@ -558,7 +576,7 @@ public class Chat extends MiniPlugin e.printStackTrace(); } } - + if (inputStream != null) { try @@ -573,10 +591,10 @@ public class Chat extends MiniPlugin } String pmresponse = null; - + if (response != null) pmresponse = response.toString(); - + return pmresponse; } @@ -627,18 +645,18 @@ public class Chat extends MiniPlugin _playerLastMessage.remove(event.getPlayer().getUniqueId()); } - public void setThreeSecondDelay(boolean b) + public void setThreeSecondDelay(boolean b) { _threeSecondDelay = b; } - + /** * If the function returns Boolean.TRUE then the message will be CANCELLED. */ public void AddFilter(Function restriction, FilterPriority priority) { Validate.isTrue(priority != null, "Priority must not be null."); - + switch (priority) { case HIGH: @@ -648,5 +666,5 @@ public class Chat extends MiniPlugin _lowPriorityFilters.add(restriction); } } - + } From e28d411ee4ba6fda0d5b809a98d219bb0d16b8a5 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 16 Jun 2016 18:32:19 -0500 Subject: [PATCH 18/34] Fix evolution not progression. Fixed incorrect description in Gladiators Reformatted kits in Bridges --- .../game/arcade/game/games/bridge/Bridge.java | 12 +++- .../game/games/evolution/Evolution.java | 59 ++++++++----------- .../games/gladiators/kits/KitGladiator.java | 4 -- .../game/arcade/kit/ProgressingKit.java | 7 +++ .../arcade/stats/ExperienceStatTracker.java | 7 +++ 5 files changed, 47 insertions(+), 42 deletions(-) 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 086a9a5fc..e09833334 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 @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.bridge; +import com.google.common.collect.Lists; import mineplex.core.common.Rank; import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; @@ -149,10 +150,13 @@ public class Bridge extends TeamGame implements OreObsfucation "The last team alive wins!" }); + List kits = Lists.newArrayList(GetKits()); + List finalKits = Lists.newArrayList(kits); + boolean foundBrawler = false; - for(int i = 0; i < GetKits().length; i++) + for(int i = 0; i < kits.size(); i++) { - Kit kit = GetKits()[i]; + Kit kit = kits.get(i); if(kit.GetName().equalsIgnoreCase("Brawler")) { if(!foundBrawler) @@ -161,11 +165,13 @@ public class Bridge extends TeamGame implements OreObsfucation } else { - GetKits()[i] = null; + finalKits.remove(i); } } } + setKits(finalKits.toArray(new Kit[finalKits.size()])); + _ore = new OreHider(); // Flags 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..65eaad951 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 @@ -1,26 +1,10 @@ package nautilus.game.arcade.game.games.evolution; -import java.util.AbstractMap.SimpleEntry; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; +import com.google.common.collect.Maps; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; -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.UtilTextMiddle; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -37,29 +21,16 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; -import nautilus.game.arcade.game.games.evolution.events.EvolutionAttemptingTickEvent; -import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; -import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; -import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; +import nautilus.game.arcade.game.games.evolution.events.*; import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager; import nautilus.game.arcade.game.games.evolution.kits.KitAbility; import nautilus.game.arcade.game.games.evolution.kits.KitEvolveSpeed; import nautilus.game.arcade.game.games.evolution.kits.KitHealth; -import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze; -import nautilus.game.arcade.game.games.evolution.mobs.KitChicken; -import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper; -import nautilus.game.arcade.game.games.evolution.mobs.KitGolem; -import nautilus.game.arcade.game.games.evolution.mobs.KitSlime; -import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; -import nautilus.game.arcade.game.games.evolution.trackers.EvoWinWithoutDyingTracker; -import nautilus.game.arcade.game.games.evolution.trackers.KillsWhileEvolvingTracker; -import nautilus.game.arcade.game.games.evolution.trackers.NoAbilityTracker; -import nautilus.game.arcade.game.games.evolution.trackers.NoDamageWhileEvolvingTracker; -import nautilus.game.arcade.game.games.evolution.trackers.NoMeleeTracker; +import nautilus.game.arcade.game.games.evolution.mobs.*; +import nautilus.game.arcade.game.games.evolution.trackers.*; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.stats.KillFastStatTracker; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -76,6 +47,9 @@ import org.bukkit.event.player.PlayerItemHeldEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.util.Vector; +import java.util.AbstractMap.SimpleEntry; +import java.util.*; + public class Evolution extends SoloGame { /** @@ -87,6 +61,7 @@ public class Evolution extends SoloGame private ArrayList _mobKits = new ArrayList(); private ArrayList _kits = new ArrayList(); + private Map _startedKit = Maps.newHashMap(); private NautHashMap _tokens = new NautHashMap(); @@ -174,6 +149,20 @@ public class Evolution extends SoloGame ); } + public void select(UUID player, ProgressingKit kit) + { + _startedKit.put(player, kit); + } + + public ProgressingKit getStartedKit(UUID player, boolean remove) + { + if(remove) + { + return _startedKit.remove(player); + } + return _startedKit.get(player); + } + public EvolveManager getEvolve() { return _evolve; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/kits/KitGladiator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/kits/KitGladiator.java index 2d06066a3..d8ebf592d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/kits/KitGladiator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/kits/KitGladiator.java @@ -4,7 +4,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; -import nautilus.game.arcade.kit.perks.PerkLeap; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -16,12 +15,9 @@ public class KitGladiator extends ProgressingKit private static final String[] DESCRIPTION = { "At my signal, unleash hell.", - "", - leap() }; private static final Perk[] PERKS = { - new PerkLeap("Leap", 1.2, 1.0, 8000), }; private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java index ee521010c..910464f8b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java @@ -16,6 +16,8 @@ import mineplex.core.progression.gui.Menu; import mineplex.core.progression.math.Calculations; import mineplex.core.shop.page.ConfirmationPage; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.games.evolution.Evolution; import nautilus.game.arcade.shop.KitPackage; import net.minecraft.server.v1_8_R3.EntityFireworks; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; @@ -172,6 +174,11 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit { return; } + if(Manager.GetGame().GetType() == GameType.Evolution) + { + Evolution evolution = (Evolution) Manager.GetGame(); + evolution.select(player, this); + } _dataManager.get(player).setCurrentKit(getInternalName()); Manager.GetGame().SetKit(Bukkit.getPlayer(player), this, true); Manager.getProgressionKitManager().displayParticles(this, player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java index abe7cf097..90ae84bce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java @@ -1,9 +1,11 @@ package nautilus.game.arcade.stats; import mineplex.core.common.util.NautHashMap; +import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GemData; +import nautilus.game.arcade.game.games.evolution.Evolution; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.entity.Player; @@ -98,6 +100,11 @@ public class ExperienceStatTracker extends StatTracker int expGained = (int)(((timeExp + gemExp)*mult)*getGame().XpMult); //Exp Kit kit = event.GetGame().GetKit(player); + if(event.GetGame().GetType() == GameType.Evolution) + { + Evolution evolution = (Evolution) event.GetGame(); + kit = evolution.getStartedKit(player.getUniqueId(), true); + } if (kit instanceof ProgressingKit) { ProgressingKit progressingKit = (ProgressingKit) kit; From 2e0965a0640e50e7b00c27ccacabad4b3afc3f65 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 16 Jun 2016 19:35:36 -0500 Subject: [PATCH 19/34] Fix Infestor kit Fix rare occurrence of players getting a GUI they shouldn't (reported) --- .../arcade/game/games/hideseek/HideSeek.java | 108 ++++++------------ .../game/games/hideseek/kits/KitHider.java | 6 - .../games/hideseek/kits/KitHiderQuick.java | 9 +- .../games/hideseek/kits/KitHiderShocker.java | 7 ++ .../games/hideseek/kits/KitHiderSwapper.java | 9 +- .../hideseek/kits/KitHiderTeleporter.java | 67 ----------- .../game/arcade/kit/ProgressingKit.java | 14 --- 7 files changed, 56 insertions(+), 164 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderTeleporter.java 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 e283ad0fa..55535e846 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 @@ -1,74 +1,9 @@ package nautilus.game.arcade.game.games.hideseek; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map.Entry; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.FireworkEffect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.FireworkEffect.Type; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Cow; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.FallingSand; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Pig; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Sheep; -import org.bukkit.entity.Slime; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.FireworkMeta; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; @@ -83,8 +18,8 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.hideseek.forms.BlockForm; import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm; import nautilus.game.arcade.game.games.hideseek.forms.Form; @@ -96,13 +31,36 @@ import nautilus.game.arcade.stats.BadHiderStatTracker; import nautilus.game.arcade.stats.HunterKillerStatTracker; import nautilus.game.arcade.stats.HunterOfTheYearStatTracker; import nautilus.game.arcade.stats.MeowStatTracker; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.Navigation; -import net.minecraft.server.v1_8_R3.NavigationAbstract; -import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.*; +import org.bukkit.*; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.*; +import org.bukkit.entity.Entity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.entity.*; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.FireworkMeta; +import org.bukkit.util.Vector; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map.Entry; @SuppressWarnings("deprecation") public class HideSeek extends TeamGame @@ -1613,7 +1571,7 @@ public class HideSeek extends TeamGame // Invisible for (Player player : GetPlayers(true)) { - if (!(GetKit(player) instanceof KitHiderTeleporter)) + if (!(GetKit(player) instanceof KitHiderInfestor)) continue; if (_infested.containsKey(player) || player.getVehicle() != null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHider.java index ba07f5c6c..68392f56b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHider.java @@ -8,7 +8,6 @@ import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; public abstract class KitHider extends ProgressingKit @@ -28,9 +27,4 @@ public abstract class KitHider extends ProgressingKit super(manager, name, "hideseek" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); } - @Override - public void GiveItems(Player player) - { - player.getInventory().setItem(3, PLAYER_ITEM); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java index 6ad3185c5..274d510a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderQuick.java @@ -6,6 +6,7 @@ import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; @@ -26,7 +27,13 @@ public class KitHiderQuick extends KitHider { super(manager, "Instant Hider", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); } - + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(3, PLAYER_ITEM); + } + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java index 1d820bc7e..94849e48c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java @@ -7,6 +7,7 @@ import nautilus.game.arcade.kit.perks.PerkShockingStrike; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; @@ -27,6 +28,12 @@ public class KitHiderShocker extends KitHider { super(manager, "Shocking Hider", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(3, PLAYER_ITEM); + } @Override public void SpawnCustom(LivingEntity ent) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java index d720ada47..157354c17 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java @@ -6,6 +6,7 @@ import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; @@ -25,7 +26,13 @@ public class KitHiderSwapper extends KitHider { super(manager, "Swapper Hider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); } - + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(3, PLAYER_ITEM); + } + @Override public void SpawnCustom(LivingEntity ent) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderTeleporter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderTeleporter.java deleted file mode 100644 index 21ed7eb6e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderTeleporter.java +++ /dev/null @@ -1,67 +0,0 @@ -package nautilus.game.arcade.game.games.hideseek.kits; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Slime; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.achievement.Achievement; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.disguises.DisguiseSlime; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -public class KitHiderTeleporter extends Kit -{ - public KitHiderTeleporter(ArcadeManager manager) - { - super(manager, "Infestor Hider", KitAvailability.Achievement, - - new String[] - { - "Can instantly infest a target block.", - "This is the only way you can hide." - - }, - - new Perk[] - { - - }, - EntityType.SLIME, - new ItemStack(Material.SLIME_BALL)); - - this.setAchievementRequirements(new Achievement[] - { - Achievement.BLOCK_HUNT_BAD_HIDER, - Achievement.BLOCK_HUNT_HUNTER_KILLER, - Achievement.BLOCK_HUNT_HUNTER_OF_THE_YEAR, - Achievement.BLOCK_HUNT_MEOW, - Achievement.BLOCK_HUNT_WINS, - }); - } - - @Override - public void GiveItems(Player player) - { - //Swap - player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MAGMA_CREAM, (byte)0, 1, C.cYellow + C.Bold + "Click Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Infest Block/Animal")); - - DisguiseSlime slime = new DisguiseSlime(player); - slime.SetSize(2); - slime.setName(C.cAqua + player.getName()); - Manager.GetDisguise().disguise(slime); - } - - @Override - public void SpawnCustom(LivingEntity ent) - { - ((Slime)ent).setSize(2); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java index 910464f8b..e5fae0623 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java @@ -170,15 +170,6 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit @Override public void onSelected(UUID player) { - if(!canEquipKit(Bukkit.getPlayer(player))) - { - return; - } - if(Manager.GetGame().GetType() == GameType.Evolution) - { - Evolution evolution = (Evolution) Manager.GetGame(); - evolution.select(player, this); - } _dataManager.get(player).setCurrentKit(getInternalName()); Manager.GetGame().SetKit(Bukkit.getPlayer(player), this, true); Manager.getProgressionKitManager().displayParticles(this, player); @@ -187,11 +178,6 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit @Override public void onSetDefault(UUID player) { - if(!canEquipKit(Bukkit.getPlayer(player))) - { - return; - } - setDefault(!isDefault(player), player); Player bukkitPlayer = Bukkit.getPlayer(player); From 3dc93e5c8f81d55d6bfad2d82c8629adbcb8ca56 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 16 Jun 2016 19:40:03 -0500 Subject: [PATCH 20/34] Fix rare GUI reported bug. --- .../src/nautilus/game/arcade/kit/ProgressingKit.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java index e5fae0623..609d3ba39 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java @@ -170,6 +170,11 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit @Override public void onSelected(UUID player) { + if(Manager.GetGame().GetType() == GameType.Evolution) + { + Evolution evolution = (Evolution) Manager.GetGame(); + evolution.select(player, this); + } _dataManager.get(player).setCurrentKit(getInternalName()); Manager.GetGame().SetKit(Bukkit.getPlayer(player), this, true); Manager.getProgressionKitManager().displayParticles(this, player); From 16f6d75deaadc6fd2e51de7ed0994085f98222ad Mon Sep 17 00:00:00 2001 From: cnr Date: Thu, 16 Jun 2016 20:36:33 -0500 Subject: [PATCH 21/34] Revert kit name changes We can change this back whenever we've migrated to the new name in mssql --- .../nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java | 2 +- .../arcade/game/games/survivalgames/kit/KitBeastmaster.java | 2 +- .../game/arcade/game/games/typewars/kits/KitTactician.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java index db10ef792..a6b96843b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBeserker.java @@ -35,7 +35,7 @@ public class KitBeserker extends ProgressingKit public KitBeserker(ArcadeManager manager) { - super(manager, "Berserker", "sheepbeserker", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); + super(manager, "Beserker", "sheepbeserker", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java index bd9f28189..371b53d8e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java @@ -26,7 +26,7 @@ public class KitBeastmaster extends SurvivalGamesKit public KitBeastmaster(ArcadeManager manager) { - super(manager, "Beast Master", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, IN_HAND); + super(manager, "Beastmaster", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, IN_HAND); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java index e405fc0a7..f1fe1598e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java @@ -35,7 +35,7 @@ public class KitTactician extends KitTypeWarsBase public KitTactician(ArcadeManager manager) { - super(manager, "Alpha Tactician", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, + super(manager, "Alpha. Tactician", KitAvailability.Achievement, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND, new Spell[]{ new SpellGrowthLiner(manager), new SpellMassSlow(manager), new SpellKillEverything(manager) }); From d16f83af005abda263ab63e22cdae4733f6f6ce3 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Thu, 16 Jun 2016 20:20:05 -0500 Subject: [PATCH 22/34] Attempt to fix duplicate messages bug. I cannot reproduce in testing. --- .../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 0b9b8d8df..5f358ddd0 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 @@ -813,7 +813,7 @@ public abstract class Game implements Listener .stream().filter(team::KitAllowed).findFirst(); if (newKit.isPresent()) { - SetKit(player, newKit.get(), true); + SetKit(player, newKit.get(), false); return; } return; From 95649a5f14e705fff2b2183ba326c11240078b12 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 11 Jun 2016 00:28:30 +0200 Subject: [PATCH 23/34] adjust amount of gems as win reward --- .../src/nautilus/game/arcade/game/games/uhc/UHC.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 6eaba6e26..0dec2a931 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 @@ -1228,8 +1228,13 @@ public class UHC extends TeamGame if (teamsAlive.size() <= 1) { if (teamsAlive.size() > 0) + { for (Player player : teamsAlive.get(0).GetPlayers(false)) - AddGems(player, 8000, "Winning Team", false, false); + { + int gems = Math.round((System.currentTimeMillis() - getPlayerIngameTime(player))/1000); + AddGems(player, gems, "Winning Team", false, false); + } + } AnnounceEnd(teamsAlive.get(0)); SetState(GameState.End); From 5316dfe0c6cda880669dc5a297e3f63ea9856fc0 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Sun, 19 Jun 2016 02:09:17 -0500 Subject: [PATCH 24/34] Remove Spammy "Loaded default kit message". Fixed SSM kits not closing the GUI when the central item is clicked. Fixed Smash Crystals being carried over into the next game. --- .../src/nautilus/game/arcade/game/Game.java | 8 +-- .../arcade/game/games/smash/SuperSmash.java | 49 +++---------------- .../nautilus/game/arcade/kit/SmashKit.java | 14 ++++++ 3 files changed, 25 insertions(+), 46 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 5f358ddd0..aa6fe3de0 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 @@ -880,10 +880,6 @@ public abstract class Game implements Listener if (announce) { player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); - if (kit instanceof ProgressingKit && ((ProgressingKit) kit).isDefault(player.getUniqueId())) - { - player.sendMessage(F.main("Kit", "Loaded default kit " + F.elem(kit.GetFormattedName()))); - } UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); } @@ -891,6 +887,10 @@ public abstract class Game implements Listener { kit.ApplyKit(player); } + else + { + player.closeInventory(); + } } public Kit GetKit(Player player) 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 75c3bf46d..2ce62d81c 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 @@ -1,17 +1,7 @@ package nautilus.game.arcade.game.games.smash; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; - import mineplex.core.common.block.BlockData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.*; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -24,40 +14,11 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.smash.kits.KitBlaze; -import nautilus.game.arcade.game.games.smash.kits.KitChicken; -import nautilus.game.arcade.game.games.smash.kits.KitCow; -import nautilus.game.arcade.game.games.smash.kits.KitCreeper; -import nautilus.game.arcade.game.games.smash.kits.KitEnderman; -import nautilus.game.arcade.game.games.smash.kits.KitGolem; -import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube; -import nautilus.game.arcade.game.games.smash.kits.KitPig; -import nautilus.game.arcade.game.games.smash.kits.KitSheep; -import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse; -import nautilus.game.arcade.game.games.smash.kits.KitSkeleton; -import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; -import nautilus.game.arcade.game.games.smash.kits.KitSlime; -import nautilus.game.arcade.game.games.smash.kits.KitSnowman; -import nautilus.game.arcade.game.games.smash.kits.KitSpider; -import nautilus.game.arcade.game.games.smash.kits.KitWitch; -import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton; -import nautilus.game.arcade.game.games.smash.kits.KitWolf; -import nautilus.game.arcade.game.games.smash.kits.KitZombie; +import nautilus.game.arcade.game.games.smash.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.stats.FreeKitWinStatTracker; -import nautilus.game.arcade.stats.KillFastStatTracker; -import nautilus.game.arcade.stats.OneVThreeStatTracker; -import nautilus.game.arcade.stats.RecoveryMasterStatTracker; -import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; +import org.bukkit.*; import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.Player; @@ -72,6 +33,9 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; +import java.util.HashMap; +import java.util.HashSet; + public abstract class SuperSmash extends Game { private HashMap _lives = new HashMap(); @@ -375,6 +339,7 @@ public abstract class SuperSmash extends Game if (announce) { + player.closeInventory(); player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); kit.ApplyKit(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java index 139b0c22f..a277c147e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java @@ -5,6 +5,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -117,6 +118,19 @@ public abstract class SmashKit extends ProgressingKit UtilTextMiddle.display("Smash Crystal", event.getPlayer().getName() + " used " + C.cGreen + _superName, 5, 50, 5, UtilServer.getPlayers()); } } + + @EventHandler + public void onEnd(GameStateChangeEvent event) + { + Iterator superIter = _superActive.keySet().iterator(); + + while (superIter.hasNext()) + { + Player player = superIter.next(); + superIter.remove(); + deactivateSuper(player); + } + } @EventHandler public void expireSuper(UpdateEvent event) From d572635e996f16d41e00bee8a1bb1bbca7496dcb Mon Sep 17 00:00:00 2001 From: TadahTech Date: Sun, 19 Jun 2016 02:19:33 -0500 Subject: [PATCH 25/34] Fix spelling mistake --- .../game/arcade/game/games/wither/kit/KitHumanArcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java index 9e8024a27..586b126e0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java @@ -22,7 +22,7 @@ public class KitHumanArcher extends ProgressingKit "Skilled in the art of long range combat", "", receiveArrowString(1, 4, 4), - "Your arrows give Blindness for" + C.cGreen + 4 + C.cWhite + " seconds", + "Your arrows give Blindness for " + C.cGreen + 4 + C.cWhite + " seconds", C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump" }; From 1c1912b92acc9a824c09448589d3a165cf57b4e3 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 20 Jun 2016 00:48:33 -0500 Subject: [PATCH 26/34] Update fountain goals again --- .../src/mineplex/core/brawl/fountain/FountainManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java index b0b956f10..802b81b5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java @@ -12,6 +12,7 @@ import mineplex.core.hologram.HologramManager; import mineplex.core.stats.StatsManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.serverdata.Region; import mineplex.serverdata.redis.counter.Counter; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -24,6 +25,8 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; + /** * @author Shaun Bennett */ @@ -47,8 +50,10 @@ public class FountainManager extends MiniPlugin _brawlShopProvider = shopProvider; World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5 + + int goal = !new File("eu.dat").exists() ? 300000000 : 5000000; _gemFountain = new Fountain(new Location(world, -32.5, 72, -23.5), new Location(world, -43.5, 67, -38.5), - C.cGreen + "Gem Fountain", "GemFountain_01", 10000000, this, clientManager, donationManager, _hologramManager, _statsManager); + C.cGreen + "Gem Fountain", "GemFountain_01", goal, this, clientManager, donationManager, _hologramManager, _statsManager); } @Override From d739df862334fe1d0472d6532cb1de72b9d36dc8 Mon Sep 17 00:00:00 2001 From: samczsun Date: Wed, 8 Jun 2016 16:51:21 -0400 Subject: [PATCH 27/34] UHC is faster now --- .../mineplex/core/common/util/MapUtil.java | 45 +- .../game/arcade/game/games/uhc/UHC.java | 521 +++++++++--------- .../nautilus/game/arcade/world/WorldData.java | 4 + 3 files changed, 274 insertions(+), 296 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java index 9df45eeac..1f51c77bf 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java @@ -256,33 +256,36 @@ public class MapUtil @SuppressWarnings({ "rawtypes" }) public static boolean ClearWorldReferences(String worldName) { - HashMap regionfiles = (HashMap) RegionFileCache.a; - - try + synchronized (RegionFileCache.class) { - for (Iterator iterator = regionfiles.entrySet().iterator(); iterator.hasNext();) - { - Map.Entry e = (Map.Entry) iterator.next(); - RegionFile file = (RegionFile) e.getValue(); + HashMap regionfiles = (HashMap) RegionFileCache.a; - try + try + { + for (Iterator iterator = regionfiles.entrySet().iterator(); iterator.hasNext(); ) { - file.c(); - iterator.remove(); - } - catch (Exception ex) - { - ex.printStackTrace(); + Map.Entry e = (Map.Entry) iterator.next(); + RegionFile file = (RegionFile) e.getValue(); + + try + { + file.c(); + iterator.remove(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } } } - } - catch (Exception ex) - { - System.out.println("Exception while removing world reference for '" + worldName + "'!"); - ex.printStackTrace(); - } + catch (Exception ex) + { + System.out.println("Exception while removing world reference for '" + worldName + "'!"); + ex.printStackTrace(); + } - return true; + return true; + } } public static BlockPosition getBlockPos(int x, int y, int z) 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 0dec2a931..d46f2f7f6 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 @@ -1,8 +1,13 @@ package nautilus.game.arcade.game.games.uhc; +import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -35,6 +40,19 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_8_R3.BiomeCache; +import net.minecraft.server.v1_8_R3.ChunkCoordIntPair; +import net.minecraft.server.v1_8_R3.ChunkProviderServer; +import net.minecraft.server.v1_8_R3.EmptyChunk; +import net.minecraft.server.v1_8_R3.ExceptionWorldConflict; +import net.minecraft.server.v1_8_R3.FileIOThread; +import net.minecraft.server.v1_8_R3.IChunkLoader; +import net.minecraft.server.v1_8_R3.IChunkProvider; +import net.minecraft.server.v1_8_R3.LongHashMap; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.World; +import net.minecraft.server.v1_8_R3.WorldChunkManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -46,6 +64,9 @@ import org.bukkit.WorldBorder; import org.bukkit.World.Environment; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.generator.NormalChunkGenerator; +import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -86,19 +107,21 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; +import org.spigotmc.WatchdogThread; public class UHC extends TeamGame { private NautHashMap _teamReqs = new NautHashMap(); - + private NautHashMap _deathTime = new NautHashMap(); // private NautHashMap _combatTime = new NautHashMap(); - private boolean _mapLoaded = false; - private double _mapLoadPercent = 0; - private int _chunksPerTick = 1; + private volatile boolean _mapLoaded = false; + private volatile double _mapLoadPercent = 0; + private volatile int _chunksPerTick = 1; + private volatile boolean stopGen = false; + private int _chunkTotal; - private Chunk _chunk = null; private int _chunkX = 0; private int _chunkZ = 0; private int _chunksLoaded = 0; @@ -111,7 +134,7 @@ public class UHC extends TeamGame private long _createTime; private long _serverTime; - + private boolean xrayDebug = false; @@ -139,21 +162,21 @@ public class UHC extends TeamGame { super(manager, type, - new Kit[] - { - new KitUHC(manager) - }, + new Kit[] + { + new KitUHC(manager) + }, - new String[] - { - "10 minutes of no PvP", "Only Golden Apples restore health", "Ores can only be found in caves", - "Borders shrink over time", "Last player/team alive wins!" - }); + new String[] + { + "10 minutes of no PvP", "Only Golden Apples restore health", "Ores can only be found in caves", + "Borders shrink over time", "Last player/team alive wins!" + }); this.HideTeamSheep = true; - + this.StrictAntiHack = true; - + AnnounceStay = false; this.GameTimeout = 10800000; @@ -203,7 +226,7 @@ public class UHC extends TeamGame this.GadgetsDisabled = true; WorldTimeSet = -1; - + CraftRecipes(); // Disable Custom Mob Drops (and EXP Disable) @@ -225,8 +248,8 @@ public class UHC extends TeamGame @Override public void ParseData() { - WorldData.World.setDifficulty(Difficulty.HARD); - + WorldData.World.setDifficulty(Difficulty.HARD); + _chunkX = (int) -(_currentBorder / 16); _chunkZ = (int) -(_currentBorder / 16); _chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16)); @@ -368,84 +391,6 @@ public class UHC extends TeamGame return borders; } - @EventHandler - public void loadMap(UpdateEvent event) - { - if (_mapLoaded) - return; - - if (WorldData.World == null) - return; - - if (GetState() != GameState.Recruit) - return; - - // Print Debug - if (event.getType() == UpdateType.SLOWER) - { - Announce(C.cGreen + C.Bold + "Generating Map: " + C.cWhite + getMapLoadETA() + " Remaining...", false); - - TimingManager.endTotal("UHC Generation", true); - return; - } - - if (event.getType() != UpdateType.TICK) - return; - - // Timings - TimingManager.startTotal("UHC Generation"); - - for (int i = 0; i < _chunksPerTick ; i++) - { - // Unload Previous -// if (_chunk != null) -// _chunk.unload(true); - - // Load Chunks - _chunk = WorldData.World.getChunkAt(_chunkX, _chunkZ); - _chunk.load(true); - - // Scan Map - if (_chunkX < _currentBorder / 16) - { - _chunkX++; - } - else if (_chunkZ < _currentBorder / 16) - { - _chunkX = (int) -(_currentBorder / 16); - _chunkZ++; - } - else - { - _mapLoaded = true; - System.out.println("Map Loading Finished!"); - generateSpawns(); - break; - } - - _chunksLoaded++; - } - - _mapLoadPercent = (double)_chunksLoaded / (double)_chunkTotal; - - // Timings - TimingManager.stopTotal("UHC Generation"); - } - - @EventHandler - public void chunkUnload(ChunkUnloadEvent event) - { - //Allow unloading after players in - if (IsLive()) - return; - - if (WorldData.World != null && event.getWorld().equals(WorldData.World)) - { - System.out.println("Disallowing Unload of World"); - event.setCancelled(true); - } - } - public void generateSpawns() { // Wipe Spawns @@ -467,7 +412,7 @@ public class UHC extends TeamGame double dist = (2 * _currentBorder) / (Math.sqrt(this.GetPlayers(true).size()) + 3); // Ensure distance between Teams - 500 Attempts - for (int i=0 ; i<500 ; i++) + for (int i = 0; i < 500; i++) { boolean clash = false; @@ -500,7 +445,7 @@ public class UHC extends TeamGame double dist = (2 * _currentBorder) / (Math.sqrt(GetTeamList().size()) + 3); // Ensure distance between Teams - 500 Attempts - for (int i=0 ; i<500 ; i++) + for (int i = 0; i < 500; i++) { boolean clash = false; @@ -622,63 +567,183 @@ public class UHC extends TeamGame } } - /*@EventHandler - public void WorldBoundaryCheck(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - for (Player player : GetPlayers(true)) - { - //Damage - if (Math.abs(player.getLocation().getX()) > _borderSize || Math.abs(player.getLocation().getZ()) > _borderSize) - { - player.damage(0.75); - } - } - } - @EventHandler - public void WorldBoundaryShrink(UpdateEvent event) + public void generateWorld(GameStateChangeEvent event) { - if (!IsLive()) + if (event.GetState() == GameState.Dead) + { + stopGen = true; return; + } - if (event.getType() == UpdateType.SLOW) - if (_borderSize > 16) - _borderSize--; - } - - //@EventHandler - public void WorldBoundarySet(GameStateChangeEvent event) - { if (event.GetState() != GameState.Recruit) + { return; + } - long time = System.currentTimeMillis(); - - this.WorldData.MinX = -_borderSize; - this.WorldData.MaxX = _borderSize; - this.WorldData.MinZ = -_borderSize; - this.WorldData.MaxZ = _borderSize; - - this.WorldData.MinY = -1000; - this.WorldData.MaxY = 1000; - - //Find Y Max - for (int x=-16 ; x<16 ; x++) - for (int z=-16 ; z<16 ; z++) + new Thread(() -> + { + try { - int y = UtilBlock.getHighest(WorldData.World, x, z).getY(); + Field fileIOThreadB = FileIOThread.class.getDeclaredField("b"); + fileIOThreadB.setAccessible(true); - if (y > _yMax) - _yMax = y; + // This list is the list of chunks to be saved on the File IO Thread + List list = (List) fileIOThreadB.get(FileIOThread.a()); + + net.minecraft.server.v1_8_R3.WorldServer worldServer = ((CraftWorld) WorldData.World).getHandle(); + + WorldChunkManager manager = worldServer.getWorldChunkManager(); + + Field biomeCacheField = manager.getClass().getDeclaredField("d"); + biomeCacheField.setAccessible(true); + + // A thread safe BiomeCache + // The implementation is literally a copy/paste from the original BiomeCache, but with some synchronization + // Reason being while the server is ticking the world (for some reason, if you want to dig through the entire Arcade codebase go for it) + // it stores stuff in the BiomeCache, and chunk gen needs that BiomeCache info too + // Causing desynchronization in the cache + biomeCacheField.set(manager, new BiomeCache(manager) + { + private final Object _lock = new Object(); + + private long _lastCleanTime; // b -> _lastCleanTime + private Map _blockByCoord = new HashMap<>(); // LongHashMap -> HashMap, c -> _blockByCoord + private List _blocks = new ArrayList<>(); // d -> _blocks + + @Override + public BiomeCache.BiomeCacheBlock a(int x, int z) + { + x >>= 4; + z >>= 4; + long var3 = hash(x, z); + BiomeCache.BiomeCacheBlock var5 = this._blockByCoord.get(var3); + if (var5 == null) + { + var5 = new BiomeCache.BiomeCacheBlock(x, z); + synchronized (_lock) + { + this._blockByCoord.put(var3, var5); + this._blocks.add(var5); + } + } + + var5.e = MinecraftServer.az(); + return var5; + } + + @Override + public void a() + { + long currentTime = MinecraftServer.az(); + long deltaTime = currentTime - this._lastCleanTime; + if (deltaTime > 7500L || deltaTime < 0L) + { + this._lastCleanTime = currentTime; + + synchronized (_lock) + { + for (int i = 0; i < this._blocks.size(); ++i) + { + BiomeCache.BiomeCacheBlock biomeCacheBlock = (BiomeCache.BiomeCacheBlock) this._blocks.get(i); + long var7 = currentTime - biomeCacheBlock.e; + if (var7 > 30000L || var7 < 0L) + { + this._blocks.remove(i--); + this._blockByCoord.remove(hash(biomeCacheBlock.c, biomeCacheBlock.d)); + } + } + } + } + } + + private long hash(int x, int z) + { + return (long) x & 4294967295L | ((long) z & 4294967295L) << 32; + } + }); + + ChunkProviderServer cps = worldServer.chunkProviderServer; + IChunkProvider icp = cps.chunkProvider; + System.out.println("Using chunk provider " + icp.getClass()); + + TimingManager.start("Map Generation"); + + long start = System.currentTimeMillis(); + long last = start; + + while (!stopGen) + { + long now = System.currentTimeMillis(); + if ((now - last) >= 4000) + { + Announce(C.cGreen + C.Bold + "Generating Map: " + C.cWhite + getMapLoadETA() + " Remaining...", false); + last = now; + } + + long hash = LongHash.toLong(_chunkX, _chunkZ); + + // This is just a shortcut to how the Minecraft server would have generated a chunk if it doesn't exist. + // This should always create a chunk because we're not loading any chunks beforehand... + // /me looks at new maintainer + net.minecraft.server.v1_8_R3.Chunk chunk = icp.getOrCreateChunk(_chunkX, _chunkZ); + + // Run the copypasted code for chunk saving. + cps.saveChunk(chunk); + cps.saveChunkNOP(chunk); + cps.unloadQueue.remove(_chunkX, _chunkZ); + cps.chunks.remove(hash); + + if (_chunkX < _currentBorder / 16) + { + _chunkX++; + } + else if (_chunkZ < _currentBorder / 16) + { + _chunkX = (int) -(_currentBorder / 16); + _chunkZ++; + } + else + { + _mapLoaded = true; + System.out.println("Map Loading Finished! Took " + TimeUnit.MILLISECONDS.toSeconds(now - start) + " seconds"); + break; + } + + _chunksLoaded++; + + // Clamp it so we don't get 101% + _mapLoadPercent = UtilMath.clamp((double) _chunksLoaded / (double) _chunkTotal, 0.0, 1.0); + _chunksPerTick = (int) (_chunksLoaded / ((now - start) / 50.0)); + } + + TimingManager.stop("Map Generation"); + + if (stopGen) + { + return; + } + + TimingManager.start("Map Saving"); + + // Wait for all the chunks to save (but do we need this?) + while (!list.isEmpty()) + { + Thread.sleep(100); + } + + TimingManager.stop("Map Saving"); + + getArcadeManager().runSync(this::generateSpawns); } - - System.out.println("Y Max: " + _yMax); - - System.out.println("Time: " + UtilTime.MakeStr(System.currentTimeMillis() - time)); - }*/ + catch (Throwable t) + { + // todo proper exception handling + // maybe force shutdown? + t.printStackTrace(); + } + }, "WorldGen Thread").start(); + } @EventHandler public void WorldBoundaryYLimit(BlockPlaceEvent event) @@ -865,45 +930,6 @@ public class UHC extends TeamGame event.setLeaveMessage(null); } - /* - @EventHandler(priority = EventPriority.LOWEST) - public void PlayerQuit(PlayerQuitEvent event) - { - Player player = event.getPlayer(); - - GameTeam team = GetTeam(player); - if (team == null) return; - - if (!team.IsAlive(player)) - return; - - team.RemovePlayer(player); - - if (player.isDead()) - return; - - - if (true) - { - //Announcement - Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting."); - - player.damage(5000); - return; - } - - - if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000)) - { - //Announcement - Announce(team.GetColor() + C.Bold + player.getName() + " was killed for disconnecting during combat."); - - player.damage(5000); - return; - } - } - */ - @EventHandler public void CreatureCull(UpdateEvent event) { @@ -1074,37 +1100,6 @@ public class UHC extends TeamGame } } - /* - @EventHandler - public void HeadEat(PlayerInteractEvent event) - { - if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.SKULL_ITEM)) - { - UtilPlayer.message(event.getPlayer(), "You ate " + event.getPlayer().getItemInHand().getItemMeta().getDisplayName() + ChatColor.RESET + "."); - - (new PotionEffect(PotionEffectType.ABSORPTION, 2400, 0)).apply(event.getPlayer()); - (new PotionEffect(PotionEffectType.REGENERATION, 200, 1)).apply(event.getPlayer()); - - event.getPlayer().setItemInHand(null); - event.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.MONITOR) - public void DamageHealCancel(EntityDamageEvent event) - { - if (event.isCancelled()) - return; - - if (event.getEntity() instanceof Player) - { - Player player = (Player)event.getEntity(); - player.removePotionEffect(PotionEffectType.REGENERATION); - - UtilPlayer.message(player, "You took damage and lost " + F.elem(C.cGreen + "Regeneration") + ChatColor.RESET + "."); - } - }*/ - @EventHandler public void ConsumeHeadApple(PlayerItemConsumeEvent event) { @@ -1139,30 +1134,6 @@ public class UHC extends TeamGame { if (event.getMessage().startsWith("/kill")) event.setCancelled(true); - - // if (event.getMessage().startsWith("/uhc time day")) - // { - // this.WorldTimeSet = 4000; - // event.setCancelled(true); - // - // Announce(event.getPlayer().getName() + " set time to Always Day!"); - // } - // - // if (event.getMessage().startsWith("/uhc time night")) - // { - // this.WorldTimeSet = 16000; - // event.setCancelled(true); - // - // Announce(event.getPlayer().getName() + " set time to Always Night!"); - // } - // - // if (event.getMessage().startsWith("/uhc time cycle")) - // { - // this.WorldTimeSet = -1; - // event.setCancelled(true); - // - // Announce(event.getPlayer().getName() + " set time to Day and Night!"); - // } } @EventHandler(priority = EventPriority.LOWEST) @@ -1645,27 +1616,27 @@ public class UHC extends TeamGame return _mapLoaded; } - public String getMapLoadPercent() + public String getMapLoadPercent() { - return (int)(_mapLoadPercent * 100) + "%"; + return (int) (_mapLoadPercent * 100) + "%"; } - - public String getMapLoadETA() + + public String getMapLoadETA() { int chunksToGo = _chunkTotal - _chunksLoaded; - - return UtilTime.MakeStr((long) ((double)chunksToGo / (double)(_chunksPerTick * 20) * 1000d), 1); + + return UtilTime.MakeStr((long) ((double) chunksToGo / (double) (_chunksPerTick * 20) * 1000d), 1); } - + @EventHandler(priority = EventPriority.HIGH) public void teamSelectInteract(PlayerInteractEntityEvent event) { if (GetState() != GameState.Recruit) return; - + if (event.getRightClicked() == null) return; - + if (!(event.getRightClicked() instanceof Player)) return; @@ -1678,34 +1649,34 @@ public class UHC extends TeamGame return; } - selectTeamMate(player, (Player)event.getRightClicked()); + selectTeamMate(player, (Player) event.getRightClicked()); } - + @EventHandler public void teamSelectCommand(PlayerCommandPreprocessEvent event) { if (GetState() != GameState.Recruit) return; - + if (!event.getMessage().toLowerCase().startsWith("/team ")) return; - + event.setCancelled(true); - + Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true); if (target == null) return; - + //Observer if (Manager.IsObserver(event.getPlayer())) { UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games.")); return; } - + if (event.getPlayer().equals(target)) return; - + selectTeamMate(event.getPlayer(), target); } @@ -1717,28 +1688,28 @@ public class UHC extends TeamGame //Remove Prefs _teamReqs.remove(player); _teamReqs.remove(ally); - + //Inform UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!")); UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!")); - + //Leave Old Teams if (GetTeam(player) != null) GetTeam(player).DisbandTeam(); - + if (GetTeam(ally) != null) GetTeam(ally).DisbandTeam(); - + //Get Team GameTeam team = getEmptyTeam(); if (team == null) return; - - team.setDisplayName(player.getName() + " & " + ally.getName()); - + + team.setDisplayName(player.getName() + " & " + ally.getName()); + //Join Team SetPlayerTeam(player, team, true); - SetPlayerTeam(ally, team, true); + SetPlayerTeam(ally, team, true); } //Send Invite else @@ -1747,33 +1718,33 @@ public class UHC extends TeamGame if (GetTeam(player) != null) if (GetTeam(player).HasPlayer(ally)) return; - + //Inform Player UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!")); - + //Inform Target if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false)) { UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!")); UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!")); } - + //Add Pref _teamReqs.put(player, ally); } } - + @EventHandler public void teamQuit(PlayerQuitEvent event) { if (GetState() != GameState.Recruit) return; - + Player player = event.getPlayer(); - + if (GetTeam(player) != null) GetTeam(player).DisbandTeam(); - + Iterator teamIter = _teamReqs.keySet().iterator(); while (teamIter.hasNext()) { @@ -1782,7 +1753,7 @@ public class UHC extends TeamGame teamIter.remove(); } } - + public GameTeam getEmptyTeam() { for (GameTeam team : GetTeamList()) @@ -1790,7 +1761,7 @@ public class UHC extends TeamGame if (team.GetPlayers(false).isEmpty()) return team; } - + return null; } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java index 3117bbcbd..63b45effa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -416,6 +416,10 @@ public class WorldData public boolean LoadChunks(long maxMilliseconds) { + if (Host instanceof UHC) + { + return true; + } long startTime = System.currentTimeMillis(); for (; CurX <= MaxX; CurX += 16) From 2e1bb25b0b21a7c2941ea1796f6c274e91a9ea91 Mon Sep 17 00:00:00 2001 From: samczsun Date: Sat, 18 Jun 2016 17:09:48 -0400 Subject: [PATCH 28/34] Fix exceptions --- .../src/mineplex/game/clans/clans/ClansManager.java | 1 + .../src/mineplex/game/clans/clans/map/ItemMapManager.java | 4 ++-- .../src/mineplex/minecraft/game/core/boss/EventCreature.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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 e4c59cab3..314623f33 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 @@ -242,6 +242,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati _condition = new SkillConditionManager(plugin); _damageManager = new DamageManager(plugin, _combatManager, _npcManager, _disguiseManager, _condition); _damageManager.addCommand(new KillCommand(_damageManager)); + _condition.setDamageManager(_damageManager); _worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null); 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 d103b3139..fc736b4f8 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 @@ -488,8 +488,8 @@ public class ItemMapManager extends MiniPlugin } else { - System.out.println(String.format("Tried to set color to %s in colorWorldHeight scale: %s, sx: %s, sz: %s, x: %z, z: %s, zoom: %s", - color, scale, startingX, startingZ, x, z, zoom)); +// System.out.println(String.format("Tried to set color to %s in colorWorldHeight scale: %s, sx: %s, sz: %s, x: %s, z: %s, zoom: %s", +// color, scale, startingX, startingZ, x, z, zoom)); } } } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/EventCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/EventCreature.java index f0ba4026a..a41376eae 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/EventCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/EventCreature.java @@ -258,7 +258,7 @@ public abstract class EventCreature implements Listener @EventHandler public void onChunkUnload(ChunkUnloadEvent event) { - if (_entity.getLocation().getChunk().equals(event.getChunk())) + if (_entity != null && _entity.getLocation().getChunk().equals(event.getChunk())) event.setCancelled(true); } From 032b6a77c0e49667473200b3228bb49fdc4e51b4 Mon Sep 17 00:00:00 2001 From: samczsun Date: Sat, 18 Jun 2016 17:12:24 -0400 Subject: [PATCH 29/34] Display UUID for CMod+ --- .../src/mineplex/game/clans/items/GearManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 015ad9280..df7bbaef0 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 @@ -11,6 +11,9 @@ import java.util.Set; import java.util.UUID; import com.google.gson.JsonSyntaxException; +import mineplex.core.account.CoreClient; +import mineplex.core.common.Rank; +import mineplex.game.clans.clans.ClansManager; import net.minecraft.server.v1_8_R3.NBTBase; import net.minecraft.server.v1_8_R3.NBTTagByte; import net.minecraft.server.v1_8_R3.NBTTagString; @@ -658,6 +661,15 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable newLore.add(" "); newLore.add(C.cWhite + "Original Owner: " + C.cYellow + originalOwner); } + if (ci != null) + { + CoreClient client = ClansManager.getInstance().getClientManager().Get(player); + if (client.GetRank().has(Rank.CMOD)) + { + newLore.add(" "); + newLore.add(C.cWhite + "UUID: " + C.cYellow + ci._uuid); + } + } net.minecraft.server.v1_8_R3.ItemStack newItem = CraftItemStack.asNMSCopy(originalItem); CraftItemStack newCopy = CraftItemStack.asCraftMirror(newItem); From 14c6c4215c692a0bf4a6b5e663b35e70c13ddb71 Mon Sep 17 00:00:00 2001 From: samczsun Date: Sat, 18 Jun 2016 22:48:59 -0400 Subject: [PATCH 30/34] Silent chest opening! --- .../clans/gameplay/HiddenChestManager.java | 70 ++----------------- 1 file changed, 7 insertions(+), 63 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java index 6f2f53e2e..5c6efc612 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/HiddenChestManager.java @@ -1,42 +1,26 @@ package mineplex.game.clans.gameplay; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; -import mineplex.core.packethandler.PacketInfo; import mineplex.game.clans.clans.ClansManager; -import net.minecraft.server.v1_8_R3.BaseBlockPosition; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; -import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; -import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Chest; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_8_R3.inventory.InventoryWrapper; 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.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; public class HiddenChestManager implements Listener { - private final Set _locationsToCancel = Collections.synchronizedSet(new HashSet<>()); - private final Set _fine = new HashSet<>(); private final ClansManager _clansManager; public HiddenChestManager(ClansManager clansManager, PacketHandler packetHandler) { this._clansManager = clansManager; - UtilServer.RegisterEvents(this); -// packetHandler.addPacketHandler(this, PacketPlayOutBlockAction.class, PacketPlayOutNamedSoundEffect.class); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -63,49 +47,9 @@ public class HiddenChestManager implements Listener return; } - Location location = event.getClickedBlock().getLocation(); - - if (!_fine.contains(event.getPlayer().getName())) - { - event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main("Clans", "Opening chests while vanished will still make the chest open noise")); - UtilPlayer.message(event.getPlayer(), F.main("Clans", "If you are sure, run /IUnderstandOpeningChestsWillMakeNoise")); - } - -// _locationsToCancel.add(new BaseBlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())); + Chest chest = (Chest) event.getClickedBlock().getState(); + event.getPlayer().openInventory(new CraftInventory(new InventoryWrapper(chest.getInventory()))); + event.setCancelled(true); + //fixme opened chest has name "container.chest" and that looks bad } - - @EventHandler - public void areYouReallySureYouWantTo(PlayerCommandPreprocessEvent event) - { - if (event.getMessage().equalsIgnoreCase("/IUnderstandOpeningChestsWillMakeNoise")) - { - _fine.add(event.getPlayer().getName()); - event.setCancelled(true); - } - } - -// @Override -// public void handle(PacketInfo packetInfo) -// { -// if (packetInfo.getPacket() instanceof PacketPlayOutBlockAction) -// { -// PacketPlayOutBlockAction blockAction = (PacketPlayOutBlockAction) packetInfo.getPacket(); -// if (_locationsToCancel.contains(blockAction.a)) -// { -// System.out.println(blockAction.b + " " + blockAction.c); -// packetInfo.setCancelled(true); -// if (blockAction.c == 0) -// { -// _locationsToCancel.remove(blockAction.a); -// } -// } -// } -// else if (packetInfo.getPacket() instanceof PacketPlayOutNamedSoundEffect) -// { -// PacketPlayOutNamedSoundEffect soundEffect = (PacketPlayOutNamedSoundEffect) packetInfo.getPacket(); -// -// System.out.println(soundEffect.a); -// } -// } } From 956cfeac448140d93fb82505874e18cc944b3166 Mon Sep 17 00:00:00 2001 From: samczsun Date: Wed, 22 Jun 2016 21:14:50 -0400 Subject: [PATCH 31/34] Don't recall if player is dead, show UUID for custom items --- .../src/mineplex/game/clans/items/GearManager.java | 8 ++------ .../minecraft/game/classcombat/Skill/Assassin/Recall.java | 4 ++++ 2 files changed, 6 insertions(+), 6 deletions(-) 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 df7bbaef0..21befc0b9 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 @@ -663,12 +663,8 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable } if (ci != null) { - CoreClient client = ClansManager.getInstance().getClientManager().Get(player); - if (client.GetRank().has(Rank.CMOD)) - { - newLore.add(" "); - newLore.add(C.cWhite + "UUID: " + C.cYellow + ci._uuid); - } + newLore.add(" "); + newLore.add(C.cWhite + "UUID: " + C.cYellow + ci._uuid); } net.minecraft.server.v1_8_R3.ItemStack newItem = CraftItemStack.asNMSCopy(originalItem); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java index dc3fd9dde..1918c5cf4 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java @@ -88,6 +88,10 @@ public class Recall extends Skill return; Factory.runSync(() -> { + if (player.isDead()) + { + return; + } //Heal double newHealth = Math.min(health.getLast(), player.getHealth() + 3 + level); player.setHealth(newHealth); From a33b070ae76e69f69da0ed65d98f44b453b79c90 Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 23 Jun 2016 15:34:29 -0400 Subject: [PATCH 32/34] Deny placing skulls --- .../src/mineplex/game/clans/clans/ClansGame.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java index 11f7fdf5d..7ec9d898a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java @@ -304,10 +304,11 @@ public class ClansGame extends MiniPlugin return; } - // Banners/String + // Banners/String/Heads if (player.getGameMode() != GameMode.CREATIVE && player.getItemInHand() != null) { - if (player.getItemInHand().getType() == Material.BANNER || player.getItemInHand().getType() == Material.STRING) + if (player.getItemInHand().getType() == Material.BANNER || player.getItemInHand().getType() == Material.STRING + || player.getItemInHand().getType() == Material.SKULL_ITEM) { Location destLocation = event.getClickedBlock().getRelative(event.getBlockFace()).getLocation(); ClanTerritory territory = _clans.getClanUtility().getClaim(destLocation); From 399ab5c36367ac321e650ada7311baf35e223edf Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Fri, 17 Jun 2016 20:25:57 +0200 Subject: [PATCH 33/34] fix supply chest protection, absorbtion effect, tnt and level bugs --- .../src/nautilus/game/arcade/GameType.java | 23 ++++--- .../src/nautilus/game/arcade/game/Game.java | 2 +- .../game/arcade/game/games/AbsorptionFix.java | 2 +- .../games/bridge/modes/OverpoweredBridge.java | 61 ++++++++++++++----- .../game/arcade/kit/ProgressingKit.java | 4 +- .../arcade/managers/GameLobbyManager.java | 2 +- 6 files changed, 68 insertions(+), 26 deletions(-) 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 ec3f1e5bb..0e44d3a63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -218,7 +218,7 @@ public enum GameType Pair[] _resourcePacks; Class _gameClass; - GameMode[] _gameModes; + private GameMode[] _gameModes; private boolean _gameMaps; private int _gameId; // Unique identifying id for this gamemode (used for statistics) @@ -322,16 +322,15 @@ public enum GameType return _display.getGameCategory(); } - public String GetKitGameName() + public String GetKitGameName(Game game) { + if (hasGamemodes()) + { + return getModeGameType(game.getClass())._display.getKitGameName(); + } return _display.getKitGameName(); } - public boolean isUsingGameModes() - { - return _gameMaps; - } - public GameType getModeGameType(Class game) { for (GameMode mode : getGameModes()) @@ -343,4 +342,14 @@ public enum GameType } return null; } + + public boolean isUsingGameModesMaps() + { + return _gameMaps; + } + + public boolean hasGamemodes() + { + return _gameModes.length != 0; + } } 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 aa6fe3de0..e75edf107 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 @@ -462,7 +462,7 @@ public abstract class Game implements Listener } } - if (GetType().isUsingGameModes()) + if (GetType().isUsingGameModesMaps()) { GameType mode = GetType().getModeGameType(getClass()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/AbsorptionFix.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/AbsorptionFix.java index c4b3dde6c..12e76f397 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/AbsorptionFix.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/AbsorptionFix.java @@ -48,7 +48,7 @@ public class AbsorptionFix implements Listener { player.removePotionEffect(PotionEffectType.ABSORPTION); player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); - player.setHealth(player.getMaxHealth()); + player.setHealth(player.getHealth() + 4); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java index a81bdfde5..54c93ec8b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; @@ -21,6 +22,7 @@ import org.bukkit.potion.Potion; import org.bukkit.potion.PotionType; 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 nautilus.game.arcade.ArcadeManager; @@ -49,6 +51,8 @@ public class OverpoweredBridge extends Bridge WorldBoundaryKill = true; + Manager.GetDamage().SetEnabled(false); + new AbsorptionFix(this); } @@ -128,6 +132,10 @@ public class OverpoweredBridge extends Bridge public void supplyChest(PlayerPrepareTeleportEvent event) { Location chestLoc = event.GetPlayer().getLocation().clone().add(0, 0, 1); + + while (chestLoc.getBlock().getType() == Material.CHEST) + chestLoc.add(2, 0, 0); + _starterChests.put(event.GetPlayer(), chestLoc); Block block = chestLoc.getBlock(); @@ -136,8 +144,9 @@ public class OverpoweredBridge extends Bridge Chest chest = (Chest) block.getState(); - event.GetPlayer().getLocation().getBlock().setType(Material.WALL_SIGN); - Sign sign = (Sign) event.GetPlayer().getLocation().getBlock().getState(); + Block signBlock = chestLoc.clone().add(0, 0, -1).getBlock(); + signBlock.setType(Material.WALL_SIGN); + Sign sign = (Sign) signBlock.getState(); sign.setLine(0, "§b============="); sign.setLine(1, "§4§l" + event.GetPlayer().getName() + ChatColor.RESET + "§4's"); sign.setLine(2, "§4Supply Chest"); @@ -182,20 +191,18 @@ public class OverpoweredBridge extends Bridge if (event.getClickedBlock().getType() != Material.CHEST) return; - for (Player player : _starterChests.keySet()) - { - if (player == event.getPlayer()) - continue; - - if (_starterChests.get(player).getBlock().getLocation() - .equals(event.getClickedBlock().getLocation())) - { - event.setCancelled(true); - break; - } - } + event.setCancelled(disallow(event.getPlayer(), event.getClickedBlock())); } } + + @EventHandler + public void placeChest(BlockPlaceEvent event) + { + if (event.getBlockPlaced().getType() != Material.CHEST) + return; + + event.setCancelled(disallow(event.getPlayer(), event.getBlock())); + } @EventHandler public void CheatChestBreak(BlockBreakEvent event) @@ -219,6 +226,32 @@ public class OverpoweredBridge extends Bridge } } } + + private boolean disallow(Player clicker, Block block) + { + for (Player player : _starterChests.keySet()) + { + System.out.println("test4"); + if (player == clicker) + continue; + + System.out.println("test2"); + Location chest = _starterChests.get(player); + + if (chest.getBlock().getLocation().equals(block.getLocation())) + { + System.out.println("test1"); + return true; + } + + for (Block surround : UtilBlock.getSurrounding(block, false)) + { + if(chest.getBlock().getLocation().equals(surround.getLocation())) + return true; + } + } + return false; + } @Override public void ParseOre(ArrayList teamOre) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java index 609d3ba39..4985238d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/ProgressingKit.java @@ -292,7 +292,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit if (this.GetAvailability() == KitAvailability.Free || Manager.hasKitsUnlocked(player) || (this.GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, this.getAchievementRequirement())) || - donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + this.GetName()) || + donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()) + " " + this.GetName()) || Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament) { @@ -306,7 +306,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit { Manager.GetGame().SetKit(player, this, true); } - }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), this), CurrencyType.GEM, player)); + }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()), this), CurrencyType.GEM, player)); } else if (this.GetAvailability() == KitAvailability.Achievement) { 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 3f57172cf..4c5e08125 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 @@ -1177,7 +1177,7 @@ public class GameLobbyManager implements Listener Manager.hasKitsUnlocked(player) || //YouTube (ent.GetKit().GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, ent.GetKit().getAchievementRequirement())) || //Achievement - donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + ent.GetKit().GetName()) || //Green + donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(game) + " " + ent.GetKit().GetName()) || //Green Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old) Manager.GetServerConfig().Tournament) //Tournament From e09df7ccfd6495192cc4e9439333dc9d06610601 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Thu, 23 Jun 2016 22:16:49 +0200 Subject: [PATCH 34/34] fix chests being opened by specs --- .../arcade/game/games/bridge/modes/OverpoweredBridge.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java index 54c93ec8b..7627cc3ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java @@ -191,7 +191,8 @@ public class OverpoweredBridge extends Bridge if (event.getClickedBlock().getType() != Material.CHEST) return; - event.setCancelled(disallow(event.getPlayer(), event.getClickedBlock())); + if (disallow(event.getPlayer(), event.getClickedBlock())) + event.setCancelled(true); } } @@ -201,7 +202,8 @@ public class OverpoweredBridge extends Bridge if (event.getBlockPlaced().getType() != Material.CHEST) return; - event.setCancelled(disallow(event.getPlayer(), event.getBlock())); + if (disallow(event.getPlayer(), event.getBlock())) + event.setCancelled(true); } @EventHandler