From 460cb08f54bf04b8ee064ff17bd6bb9024c128b3 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 25 May 2016 12:19:06 -0300 Subject: [PATCH 01/49] Adds old gadget names Adds another fix for winroom speed Moves gadgets to individual packages, easier to manage in a future update Adds gadget persistence (Or maybe not) Changed mount locked item data to 8 instead of 7 --- .../core/cosmetic/ui/page/MountPage.java | 6 +- .../mineplex/core/gadget/GadgetManager.java | 264 ++++++++++++------ .../core/gadget/event/GadgetEnableEvent.java | 1 - .../gadgets/arrowtrail/ArrowTrailHearts.java | 42 --- .../{ => candycane}/ArrowTrailCandyCane.java | 2 +- .../{ => cupidslove}/ArrowTrailCupid.java | 2 +- .../{ => emerald}/ArrowTrailEmerald.java | 2 +- .../{ => frostlord}/ArrowTrailFrostLord.java | 2 +- .../{ => howlingwinds}/ArrowTrailStorm.java | 2 +- .../{ => music}/ArrowTrailMusic.java | 2 +- .../{ => party}/ArrowTrailConfetti.java | 2 +- .../{ => shadow}/ArrowTrailShadow.java | 2 +- .../{ => titan}/ArrowTrailTitan.java | 2 +- .../{ => vampire}/ArrowTrailBlood.java | 2 +- .../{ => wisdom}/ArrowTrailEnchant.java | 2 +- .../gadget/gadgets/death/DeathHearts.java | 40 --- .../death/{ => candycane}/DeathCandyCane.java | 2 +- .../DeathCupidsBrokenHeart.java | 2 +- .../death/{ => emerald}/DeathEmerald.java | 2 +- .../death/{ => frostlord}/DeathFrostLord.java | 2 +- .../death/{ => howlingwinds}/DeathStorm.java | 2 +- .../gadgets/death/{ => music}/DeathMusic.java | 2 +- .../death/{ => party}/DeathPinataBurst.java | 2 +- .../death/{ => shadow}/DeathShadow.java | 2 +- .../gadgets/death/{ => titan}/DeathTitan.java | 2 +- .../death/{ => vampire}/DeathBlood.java | 2 +- .../death/{ => wisdom}/DeathEnchant.java | 2 +- .../gadgets/doublejump/DoubleJumpHearts.java | 35 --- .../{ => candycane}/DoubleJumpCandyCane.java | 2 +- .../DoubleJumpCupidsWings.java | 2 +- .../{ => emerald}/DoubleJumpEmerald.java | 2 +- .../{ => frostlord}/DoubleJumpFrostLord.java | 2 +- .../{ => howlingwinds}/DoubleJumpStorm.java | 2 +- .../{ => music}/DoubleJumpMusic.java | 2 +- .../{ => party}/DoubleJumpFirecracker.java | 2 +- .../{ => shadow}/DoubleJumpShadow.java | 2 +- .../{ => titan}/DoubleJumpTitan.java | 2 +- .../{ => vampire}/DoubleJumpBlood.java | 2 +- .../{ => wisdom}/DoubleJumpEnchant.java | 2 +- .../gadget/gadgets/hat/HatLovestruck.java | 2 +- .../outfit/windupsuit/OutfitWindUpSuit.java | 4 +- .../gadgets/particle/ParticleCoalFumes.java | 1 - .../{ => candycane}/ParticleCandyCane.java | 31 +- .../{ => cupidslove}/ParticleHeart.java | 118 ++++---- .../{ => emerald}/ParticleEmerald.java | 2 +- .../{ => frostlord}/ParticleFrostLord.java | 2 +- .../{ => howlingwinds}/ParticleRain.java | 2 +- .../particle/{ => music}/ParticleMusic.java | 2 +- .../{ => party}/ParticlePartyTime.java | 2 +- .../particle/{ => shadow}/ParticleFoot.java | 2 +- .../particle/{ => titan}/ParticleTitan.java | 2 +- .../particle/{ => vampire}/ParticleBlood.java | 2 +- .../{ => wisdom}/ParticleEnchant.java | 2 +- .../persistence/GadgetPersistenceManager.java | 77 +++++ .../gadget/persistence/LoadPersistence.java | 127 +++++++++ .../persistence/PersistenceRepository.java | 112 ++++++++ .../persistence/UserGadgetPersistence.java | 58 ++++ .../core/gadget/set/SetCandyCane.java | 8 +- .../core/gadget/set/SetCupidsLove.java | 8 +- .../mineplex/core/gadget/set/SetEmerald.java | 8 +- .../core/gadget/set/SetFrostLord.java | 11 +- .../core/gadget/set/SetHowlingWinds.java | 9 +- .../src/mineplex/core/gadget/set/SetLove.java | 26 -- .../mineplex/core/gadget/set/SetMusic.java | 8 +- .../mineplex/core/gadget/set/SetParty.java | 8 +- .../mineplex/core/gadget/set/SetShadow.java | 8 +- .../mineplex/core/gadget/set/SetTitan.java | 11 +- .../mineplex/core/gadget/set/SetVampire.java | 9 +- .../mineplex/core/gadget/set/SetWisdom.java | 8 +- .../core/gadget/types/OutfitGadget.java | 20 +- .../core/gadget/types/WinEffectGadget.java | 2 + .../mineplex/core/reward/RewardManager.java | 84 +++--- .../Mineplex.Hub/src/mineplex/hub/Hub.java | 1 + .../src/mineplex/hub/HubManager.java | 4 +- .../src/nautilus/game/arcade/Arcade.java | 5 +- 75 files changed, 788 insertions(+), 452 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => candycane}/ArrowTrailCandyCane.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => cupidslove}/ArrowTrailCupid.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => emerald}/ArrowTrailEmerald.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => frostlord}/ArrowTrailFrostLord.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => howlingwinds}/ArrowTrailStorm.java (94%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => music}/ArrowTrailMusic.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => party}/ArrowTrailConfetti.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => shadow}/ArrowTrailShadow.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => titan}/ArrowTrailTitan.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => vampire}/ArrowTrailBlood.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => wisdom}/ArrowTrailEnchant.java (97%) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => candycane}/DeathCandyCane.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => cupidslove}/DeathCupidsBrokenHeart.java (94%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => emerald}/DeathEmerald.java (93%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => frostlord}/DeathFrostLord.java (93%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => howlingwinds}/DeathStorm.java (94%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => music}/DeathMusic.java (97%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => party}/DeathPinataBurst.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => shadow}/DeathShadow.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => titan}/DeathTitan.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => vampire}/DeathBlood.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/{ => wisdom}/DeathEnchant.java (97%) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => candycane}/DoubleJumpCandyCane.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => cupidslove}/DoubleJumpCupidsWings.java (97%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => emerald}/DoubleJumpEmerald.java (97%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => frostlord}/DoubleJumpFrostLord.java (94%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => howlingwinds}/DoubleJumpStorm.java (94%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => music}/DoubleJumpMusic.java (97%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => party}/DoubleJumpFirecracker.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => shadow}/DoubleJumpShadow.java (94%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => titan}/DoubleJumpTitan.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => vampire}/DoubleJumpBlood.java (95%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => wisdom}/DoubleJumpEnchant.java (97%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => candycane}/ParticleCandyCane.java (73%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => cupidslove}/ParticleHeart.java (94%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => emerald}/ParticleEmerald.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => frostlord}/ParticleFrostLord.java (97%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => howlingwinds}/ParticleRain.java (96%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => music}/ParticleMusic.java (98%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => party}/ParticlePartyTime.java (98%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => shadow}/ParticleFoot.java (98%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => titan}/ParticleTitan.java (98%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => vampire}/ParticleBlood.java (97%) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/{ => wisdom}/ParticleEnchant.java (96%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/GadgetPersistenceManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/LoadPersistence.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/PersistenceRepository.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 12475e8d9..599ab9339 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -145,18 +145,18 @@ public class MountPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); } else if (mount.GetCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index c6cec55e7..b6041c9de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1,12 +1,15 @@ package mineplex.core.gadget; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.function.Predicate; import mineplex.core.gadget.commands.LockCosmeticsCommand; +import mineplex.core.gadget.event.GadgetDisableEvent; +import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; +import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; +import mineplex.core.gadget.persistence.GadgetPersistenceManager; +import mineplex.core.gadget.persistence.LoadPersistence; +import mineplex.core.gadget.persistence.UserGadgetPersistence; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -24,7 +27,6 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.Rank; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; @@ -36,39 +38,39 @@ import mineplex.core.gadget.commands.AmmoCommand; import mineplex.core.gadget.commands.UnlockCosmeticsCommand; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan; -import mineplex.core.gadget.gadgets.death.DeathBlood; -import mineplex.core.gadget.gadgets.death.DeathCandyCane; -import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart; -import mineplex.core.gadget.gadgets.death.DeathEmerald; -import mineplex.core.gadget.gadgets.death.DeathEnchant; -import mineplex.core.gadget.gadgets.death.DeathFrostLord; -import mineplex.core.gadget.gadgets.death.DeathMusic; -import mineplex.core.gadget.gadgets.death.DeathPinataBurst; -import mineplex.core.gadget.gadgets.death.DeathShadow; -import mineplex.core.gadget.gadgets.death.DeathStorm; -import mineplex.core.gadget.gadgets.death.DeathTitan; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan; +import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; +import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; +import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; +import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; +import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; +import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; +import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; +import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; +import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; +import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; +import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; +import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord; +import mineplex.core.gadget.gadgets.death.music.DeathMusic; +import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; +import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; +import mineplex.core.gadget.gadgets.death.titan.DeathTitan; +import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; +import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; +import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; +import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; +import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; +import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; +import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; +import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; +import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; @@ -125,29 +127,26 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; -import mineplex.core.gadget.gadgets.particle.ParticleBlood; -import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; +import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; -import mineplex.core.gadget.gadgets.particle.ParticleEmerald; -import mineplex.core.gadget.gadgets.particle.ParticleEnchant; +import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; +import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; -import mineplex.core.gadget.gadgets.particle.ParticleFoot; -import mineplex.core.gadget.gadgets.particle.ParticleFrostLord; -import mineplex.core.gadget.gadgets.particle.ParticleHeart; +import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; +import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; +import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; import mineplex.core.gadget.gadgets.particle.ParticleLegend; -import mineplex.core.gadget.gadgets.particle.ParticleMusic; -import mineplex.core.gadget.gadgets.particle.ParticlePartyTime; -import mineplex.core.gadget.gadgets.particle.ParticleRain; -import mineplex.core.gadget.gadgets.particle.ParticleTitan; +import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; +import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; +import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; +import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; import mineplex.core.gadget.gadgets.particle.ParticleYinYang; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; -import mineplex.core.gadget.gadgets.wineffect.WinEffectFireworks; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; @@ -204,7 +203,7 @@ public class GadgetManager extends MiniPlugin private final MountManager _mountManager; private final PacketHandler _packetManager; private final HologramManager _hologramManager; - private final OutfitWindUpSuitBoosterManager _boosterManager; + private final OutfitWindUpSuitBoosterManager _boosterManager; private NautHashMap> _gadgets; @@ -212,6 +211,8 @@ public class GadgetManager extends MiniPlugin private final NautHashMap> _playerActiveGadgetMap = new NautHashMap<>(); private final HashSet _sets = new HashSet<>(); + + private GadgetPersistenceManager _gadgetPetsistenceManager; private boolean _hideParticles = false; private int _activeItemSlot = 3; @@ -220,7 +221,7 @@ public class GadgetManager extends MiniPlugin public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager, - PacketHandler packetHandler, HologramManager hologramManager) + PacketHandler packetHandler, HologramManager hologramManager, GadgetPersistenceManager persistenceManager) { super("Gadget Manager", plugin); @@ -236,6 +237,7 @@ public class GadgetManager extends MiniPlugin _packetManager = packetHandler; _mountManager = mountManager; _hologramManager = hologramManager; + _gadgetPetsistenceManager = persistenceManager; _boosterManager = new OutfitWindUpSuitBoosterManager(this); CreateGadgets(); @@ -256,9 +258,6 @@ public class GadgetManager extends MiniPlugin addSet(new SetFrostLord(this)); addSet(new SetCandyCane(this)); addSet(new SetTitan(this)); - - // Removes Lovely Set (Duplicate of Cupid's Love) - //addSet(new SetLove(this)); //Costumes addSet(new SetRaveSuit(this)); @@ -277,7 +276,7 @@ public class GadgetManager extends MiniPlugin private void CreateGadgets() { - _gadgets = new NautHashMap>(); + _gadgets = new NautHashMap<>(); // Items addGadget(new ItemEtherealPearl(this)); @@ -371,8 +370,6 @@ public class GadgetManager extends MiniPlugin addGadget(new ArrowTrailStorm(this)); addGadget(new ArrowTrailBlood(this)); addGadget(new ArrowTrailMusic(this)); - // Removes Lovely Set (Duplicate of Cupid's Love) - //addGadget(new ArrowTrailHearts(this)); // Death Effect addGadget(new DeathFrostLord(this)); @@ -386,8 +383,6 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathStorm(this)); addGadget(new DeathBlood(this)); addGadget(new DeathMusic(this)); - // Removes Lovely Set (Duplicate of Cupid's Love) - //addGadget(new DeathHearts(this)); // Double Jump addGadget(new DoubleJumpFrostLord(this)); @@ -401,8 +396,6 @@ public class GadgetManager extends MiniPlugin addGadget(new DoubleJumpStorm(this)); addGadget(new DoubleJumpBlood(this)); addGadget(new DoubleJumpMusic(this)); - // Removes Lovely Set (Duplicate of Cupid's Love) - //addGadget(new DoubleJumpHearts(this)); // Hat addGadget(new HatSanta(this)); @@ -457,12 +450,12 @@ public class GadgetManager extends MiniPlugin addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Knife_M9_Bayonette_Fade, -2)); - //Blue only + //Blue only addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.P2000_Fire_Elemental, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.FAMAS_Pulse, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.M4A4_Howl, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Steyr_AUG_Torque, -2)); - //Red only + //Red only addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Glock_18_Fade, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Galil_AR_Eco, -2)); addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.AK_47_Vulcan, -2)); @@ -544,28 +537,29 @@ public class GadgetManager extends MiniPlugin @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { + // Fixes win room speed bug event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); - // UnlockCosmetics command fixes this part -// if (_clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR)) -// { -// for (GadgetType gadgetType : _gadgets.keySet()) -// { -// if (gadgetType == GadgetType.Particle && _clientManager.Get(event.getPlayer()).GetRank().has(Rank.ADMIN)) -// { -// for (Gadget gadget : _gadgets.get(gadgetType)) -// { -// _donationManager.Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(gadget.GetName()); -// } -// } -// } -// } + // Loads persistence gadgets for players + LoadPersistence loadPersistence = new LoadPersistence(this, event.getPlayer()); + loadPersistence.givePlayer(); } public List getGadgets(GadgetType gadgetType) { return _gadgets.get(gadgetType); } + + public Gadget getGadget(String name, GadgetType gadgetType) + { + List gadgets = getGadgets(gadgetType); + for (Gadget gadget : gadgets) + { + if (gadget.GetName().equalsIgnoreCase(name)) + return gadget; + } + return null; + } public List getGameModifiers(GameModifierType gameType) { @@ -922,10 +916,115 @@ public class GadgetManager extends MiniPlugin } @EventHandler - public void GadgetActivate(GadgetEnableEvent event) + public void onGadgetEnable(GadgetEnableEvent event) { + System.out.print("GADGET ENABLED!"); if (!_gadgetsEnabled) event.setCancelled(true); + + UserGadgetPersistence userGadgetPersistence = _gadgetPetsistenceManager.Get(event.getPlayer()); + Gadget gadget = event.getGadget(); + String name = gadget.GetName(); + switch (event.getGadget().getGadgetType()) + { + case Item: + userGadgetPersistence._gadgetItem = name; + break; + case Morph: + userGadgetPersistence._morph = name; + break; + case Particle: + userGadgetPersistence._particleEffect = name; + break; + case Costume: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + userGadgetPersistence.addCostume(outfitGadget.GetSlot().getSlot(), name); + break; + case DoubleJump: + userGadgetPersistence._doubleJump = name; + break; + case ArrowTrail: + userGadgetPersistence._arrowEffect = name; + break; + case Death: + userGadgetPersistence._deathAnimation = name; + break; + case Hat: + userGadgetPersistence._hat = name; + break; + case WinEffect: + userGadgetPersistence._winEffect = name; + break; + case GameModifier: + GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; + switch (gadgetGameModifier.getGameType()) + { + case MineStrike: + userGadgetPersistence._minestrikeModifiers = userGadgetPersistence.addGameModifier(userGadgetPersistence._minestrikeModifiers, name); + break; + case SurvivalGames: + userGadgetPersistence._survivalGamesModifiers = userGadgetPersistence.addGameModifier(userGadgetPersistence._survivalGamesModifiers, name); + break; + case Bridges: + userGadgetPersistence._bridgeModifiers = userGadgetPersistence.addGameModifier(userGadgetPersistence._bridgeModifiers, name); + break; + } + } + _gadgetPetsistenceManager.savePersistence(event.getPlayer()); + } + + @EventHandler + public void onGadgetDisable(GadgetDisableEvent event) + { + UserGadgetPersistence userGadgetPersistence = _gadgetPetsistenceManager.Get(event.getPlayer()); + Gadget gadget = event.getGadget(); + String name = gadget.GetName(); + switch (event.getGadget().getGadgetType()) + { + case Item: + userGadgetPersistence._gadgetItem = "NONE"; + break; + case Morph: + userGadgetPersistence._morph = "NONE"; + break; + case Particle: + userGadgetPersistence._particleEffect = "NONE"; + break; + case Costume: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + userGadgetPersistence.addCostume(outfitGadget.GetSlot().getSlot(), "NONE"); + break; + case DoubleJump: + userGadgetPersistence._doubleJump = "NONE"; + break; + case ArrowTrail: + userGadgetPersistence._arrowEffect = "NONE"; + break; + case Death: + userGadgetPersistence._deathAnimation = "NONE"; + break; + case Hat: + userGadgetPersistence._hat = "NONE"; + break; + case WinEffect: + userGadgetPersistence._winEffect = "NONE"; + break; + case GameModifier: + GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; + switch (gadgetGameModifier.getGameType()) + { + case MineStrike: + userGadgetPersistence._minestrikeModifiers = userGadgetPersistence.removeGameModifier(userGadgetPersistence._minestrikeModifiers, name); + break; + case SurvivalGames: + userGadgetPersistence._survivalGamesModifiers = userGadgetPersistence.removeGameModifier(userGadgetPersistence._survivalGamesModifiers, name); + break; + case Bridges: + userGadgetPersistence._bridgeModifiers = userGadgetPersistence.removeGameModifier(userGadgetPersistence._bridgeModifiers, name); + break; + } + } + _gadgetPetsistenceManager.savePersistence(event.getPlayer()); } @EventHandler @@ -950,4 +1049,9 @@ public class GadgetManager extends MiniPlugin if (event.getPlayer().getName().equalsIgnoreCase("sterling_")) event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.PIG_IDLE, 1f, 1f); } + + public UserGadgetPersistence getUserGadgetPersistence(Player player) + { + return _gadgetPetsistenceManager.Get(player); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java index 05112dfbf..57cb590d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java @@ -1,7 +1,6 @@ package mineplex.core.gadget.event; import mineplex.core.gadget.types.Gadget; -import mineplex.core.mount.Mount; import org.bukkit.entity.Player; import org.bukkit.event.Event; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java deleted file mode 100644 index 1c9ca8eec..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHearts.java +++ /dev/null @@ -1,42 +0,0 @@ -package mineplex.core.gadget.gadgets.arrowtrail; - -import org.bukkit.Material; -import org.bukkit.entity.Arrow; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -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.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.ArrowEffectGadget; - -public class ArrowTrailHearts extends ArrowEffectGadget -{ - /** - * Created by: Mysticate - * Timestamp: February 4, 2016 - */ - - public ArrowTrailHearts(GadgetManager manager) - { - super(manager, "Arrows of Cupid", - UtilText.splitLineToArray(C.cGray + "Tether your love to an arrow, then spear someone with it. Maybe they'll fall in love!", LineFormat.LORE), - -6, - Material.APPLE, (byte) 0); - } - - @Override - public void doTrail(Arrow arrow) - { - UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .1F, .1F, .1F, 0F, 1, ViewDist.LONGER); - } - - @Override - public void doHitEffect(Arrow arrow) - { - UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java index d528c4a7c..73010a753 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/candycane/ArrowTrailCandyCane.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.candycane; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java index d13aa5f67..813147704 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCupid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.cupidslove; import org.bukkit.Color; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java index b7b8a6df2..8592bc16b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/emerald/ArrowTrailEmerald.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.emerald; import mineplex.core.common.util.*; import org.bukkit.Location; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java index 3a7c910b5..6ae8d9b43 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/frostlord/ArrowTrailFrostLord.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.frostlord; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java index 084611017..a3cc14165 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailStorm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/howlingwinds/ArrowTrailStorm.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.howlingwinds; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java index 6c6a3006e..d535035af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/music/ArrowTrailMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.music; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java index be2cd9b90..d8f06ce45 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailConfetti.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/party/ArrowTrailConfetti.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.party; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java index 8db14cbdb..aec688901 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailShadow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/shadow/ArrowTrailShadow.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.shadow; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java index e84e26318..d0b1fcf4c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.titan; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java index 180e336de..f54c9ae92 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/vampire/ArrowTrailBlood.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.vampire; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java index b33723020..00e47e049 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/wisdom/ArrowTrailEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.wisdom; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java deleted file mode 100644 index 736fd0a25..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathHearts.java +++ /dev/null @@ -1,40 +0,0 @@ -package mineplex.core.gadget.gadgets.death; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import mineplex.core.blood.BloodEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -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.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.DeathEffectGadget; - -public class DeathHearts extends DeathEffectGadget -{ - /** - * Created by: Mysticate - * Timestamp: February 4, 2016 - */ - - public DeathHearts(GadgetManager manager) - { - super(manager, "Broken Hearted", - UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", - LineFormat.LORE), - -6, Material.APPLE, (byte) 0); - } - - @Override - public void onBlood(Player player, BloodEvent event) - { - event.setCancelled(true); - Location loc = event.getLocation().clone().add(0, .5, 0); - - UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, 0F, 0F, 0F, 0F, 1, ViewDist.NORMAL); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java index 2d100b3fe..45a7028d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/candycane/DeathCandyCane.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.candycane; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java index d0053f9df..1c92abc02 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCupidsBrokenHeart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/cupidslove/DeathCupidsBrokenHeart.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.cupidslove; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java index 85fb2db18..79ea0b404 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/emerald/DeathEmerald.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.emerald; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java index 72cd2c3cb..0ce7b546f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/frostlord/DeathFrostLord.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.frostlord; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java index c3cf2f0da..00cf6d607 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathStorm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/howlingwinds/DeathStorm.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.howlingwinds; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java index d6c4176ad..2bf566254 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/music/DeathMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.music; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java index 0adc3dfb8..09ccfe10a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathPinataBurst.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/party/DeathPinataBurst.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.party; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java index f80b4ad9b..3adb240f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathShadow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/shadow/DeathShadow.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.shadow; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java index b0c4aab37..a10c9bd60 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.titan; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java index 7101aba36..5365e3e14 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/vampire/DeathBlood.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.vampire; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java index 35532906d..7229b155d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/wisdom/DeathEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.death; +package mineplex.core.gadget.gadgets.death.wisdom; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java deleted file mode 100644 index 2b2b7af15..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHearts.java +++ /dev/null @@ -1,35 +0,0 @@ -package mineplex.core.gadget.gadgets.doublejump; - -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.DoubleJumpEffectGadget; - -public class DoubleJumpHearts extends DoubleJumpEffectGadget -{ - /** - * Created by: Mysticate - * Timestamp: February 4, 2016 - */ - - public DoubleJumpHearts(GadgetManager manager) - { - super(manager, "Wings of Love", - UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE), - -6, Material.APPLE, (byte) 0); - } - - @Override - public void doEffect(Player player) - { - UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java index 62f3ad6c4..d6a7620c7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/candycane/DoubleJumpCandyCane.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.candycane; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java index a7f19b097..f5bda1408 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpCupidsWings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.cupidslove; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java index f74859c2c..0453e0b57 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/emerald/DoubleJumpEmerald.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.emerald; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java index 64cc9f962..62325731c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/frostlord/DoubleJumpFrostLord.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.frostlord; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java index 9cd07ef15..6b04d1f00 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpStorm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/howlingwinds/DoubleJumpStorm.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.howlingwinds; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java index 2a4d5c1ba..5b7459f0d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/music/DoubleJumpMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.music; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java index 65ce9bd80..06ee124f7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpFirecracker.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/party/DoubleJumpFirecracker.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.party; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java index c64052bca..005c3403c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpShadow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/shadow/DoubleJumpShadow.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.shadow; import mineplex.core.common.util.C; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java index 31cf84cce..03423b740 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.titan; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java index 2f910416c..882133687 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/vampire/DoubleJumpBlood.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.vampire; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java index d9d4db576..ec1120f3b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/wisdom/DoubleJumpEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.wisdom; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java index d5cec5785..03a516090 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java @@ -14,7 +14,7 @@ public class HatLovestruck extends HatGadget { super(manager, "Love Struck", UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), - -6, SkinData.LOVESTRUCK.getSkull()); + -6, SkinData.LOVESTRUCK.getSkull(), "Love Struck Hat", "Lovestruck"); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java index fd69b58e1..47ec2f651 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java @@ -19,8 +19,8 @@ import java.util.Iterator; public class OutfitWindUpSuit extends OutfitGadget { - private HashMap _colorPhase = new HashMap(); - private HashMap _percentage = new HashMap(); + private HashMap _colorPhase = new HashMap<>(); + private HashMap _percentage = new HashMap<>(); private OutfitWindUpSuitBoosterManager _boosterManager; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java index ecfa3af17..63bdd7b12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCoalFumes.java @@ -41,5 +41,4 @@ public class ParticleCoalFumes extends ParticleGadget UtilParticle.PlayParticleToAll(type, player.getLocation(), xz, 0, xz, 0, amount, ViewDist.NORMAL); } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java similarity index 73% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java index 3b536a30d..aead78417 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/candycane/ParticleCandyCane.java @@ -1,8 +1,16 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.candycane; import java.util.HashMap; import java.util.UUID; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -10,25 +18,14 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.util.Vector; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - public class ParticleCandyCane extends ParticleGadget { - private HashMap _map = new HashMap(); + private HashMap _map = new HashMap<>(); public ParticleCandyCane(GadgetManager manager) { - super(manager, "Crushed Candy Cane", + super(manager, "Crushed Candy Cane", UtilText.splitLineToArray(C.cGray + "There's no such thing as too much Christmas Candy. Don't listen to your dentist.", LineFormat.LORE), -3, Material.INK_SACK, (byte)1); } @@ -64,9 +61,9 @@ public class ParticleCandyCane extends ParticleGadget loc.add(v); } - UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, ViewDist.NORMAL); - UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, UtilParticle.ViewDist.NORMAL); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java index a969e9495..669ea32f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHeart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java @@ -1,59 +1,59 @@ -package mineplex.core.gadget.gadgets.particle; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerQuitEvent; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.LineFormat; -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.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - -public class ParticleHeart extends ParticleGadget -{ - - public ParticleHeart(GadgetManager manager) - { - super(manager, "Cupid's Love", - UtilText.splitLineToArray(C.cGray + "Share the love you feel in your heart with everybody near you!", LineFormat.LORE), -2, - Material.APPLE, (byte) 0, "I Heart You", "Cupids Love", "Heartfelt Halo"); - } - - @Override - public void playParticle(Player player, UpdateEvent event) - { - if (event.getType() != UpdateType.FASTEST) return; - - if (Manager.isMoving(player)) - { - if(getSet() == null || !getSet().isActive(player)) return; - - UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), null, 0, 1, ViewDist.NORMAL); - } - else - { - UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1, ViewDist.NORMAL); - } - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); - } - - @EventHandler - public void quit(PlayerQuitEvent event) - { - } - -} +package mineplex.core.gadget.gadgets.particle.cupidslove; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +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.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleHeart extends ParticleGadget +{ + + public ParticleHeart(GadgetManager manager) + { + super(manager, "Cupid's Love", + UtilText.splitLineToArray(C.cGray + "Share the love you feel in your heart with everybody near you!", LineFormat.LORE), -2, + Material.APPLE, (byte) 0, "I Heart You", "Cupids Love", "Heartfelt Halo"); + } + + @Override + public void playParticle(Player player, UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) return; + + if (Manager.isMoving(player)) + { + if(getSet() == null || !getSet().isActive(player)) return; + + UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), null, 0, 1, ViewDist.NORMAL); + } + else + { + UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1, ViewDist.NORMAL); + } + } + + @Override + public void DisableCustom(Player player) + { + if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java index f81361c66..417587dbb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/emerald/ParticleEmerald.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.emerald; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java index a103778cf..39127dd15 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.frostlord; import org.bukkit.Material; import org.bukkit.Sound; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java index 449e7bc45..f463f648d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleRain.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/howlingwinds/ParticleRain.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.howlingwinds; import java.util.ArrayList; import java.util.List; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java similarity index 98% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java index 26344e68f..3422ae096 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/music/ParticleMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.music; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java similarity index 98% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java index 4f2ed6371..eada07e8d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticlePartyTime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/party/ParticlePartyTime.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.party; import java.util.Arrays; import java.util.Collections; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java similarity index 98% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java index f3b8d3e3b..e44905184 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFoot.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/shadow/ParticleFoot.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.shadow; import java.util.HashMap; import java.util.Iterator; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java similarity index 98% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java index 6cb6bd816..5cd6b70d2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.titan; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java index 40c98ca1a..e7c8d66ae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleBlood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/vampire/ParticleBlood.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.vampire; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java index 706c32fbd..f8d734e74 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/wisdom/ParticleEnchant.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.particle; +package mineplex.core.gadget.gadgets.particle.wisdom; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/GadgetPersistenceManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/GadgetPersistenceManager.java new file mode 100644 index 000000000..703d7cfed --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/GadgetPersistenceManager.java @@ -0,0 +1,77 @@ +package mineplex.core.gadget.persistence; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.java.JavaPlugin; + +public class GadgetPersistenceManager extends MiniDbClientPlugin +{ + + private final PersistenceRepository _persistenceRepository; + + private Map _saveBuffer = new HashMap<>(); + + public GadgetPersistenceManager(JavaPlugin plugin, CoreClientManager manager) + { + super("GadgetPersistence", plugin, manager); + _persistenceRepository = new PersistenceRepository(plugin); + } + + public void savePersistence(Player caller) + { + _saveBuffer.put(caller.getUniqueId().toString(), Get(caller)); + } + + @EventHandler + public void storeBuffer(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + Map bufferCopy = new HashMap<>(); + + for (Map.Entry entry : _saveBuffer.entrySet()) + { + bufferCopy.put(entry.getKey(), entry.getValue()); + } + + _saveBuffer.clear(); + + getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() + { + @Override + public void run() + { + _persistenceRepository.savePersistence(bufferCopy); + } + }); + } + + @Override + public UserGadgetPersistence AddPlayer(String player) + { + return new UserGadgetPersistence(); + } + + @Override + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + Set(playerName, _persistenceRepository.loadClientPersistence(resultSet)); + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT particleEffect, arrowEffect, doubleJump, deathAnimation, gadgetItem, morph, hat, costume, winEffect, minestrikeModifiers, survivalGamesModifiers, bridgeModifiers FROM gadgetPersistence WHERE gadgetPersistence.uuid = '" + uuid + "' LIMIT 1;"; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/LoadPersistence.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/LoadPersistence.java new file mode 100644 index 000000000..3f82dd6c0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/LoadPersistence.java @@ -0,0 +1,127 @@ +package mineplex.core.gadget.persistence; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import org.bukkit.entity.Player; + +/** + * Applies gadgets for players when they join + */ +public class LoadPersistence +{ + + private final GadgetManager _manager; + private final UserGadgetPersistence _userGadgetPersistence; + private final Player _player; + + public LoadPersistence(GadgetManager manager, Player player) + { + _manager = manager; + _userGadgetPersistence = manager.getUserGadgetPersistence(player); + _player = player; + } + + public void givePlayer() + { + // PARTICLE EFFECTS + if (!_userGadgetPersistence._particleEffect.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(_userGadgetPersistence._particleEffect, GadgetType.Particle); + if (gadget != null) + gadget.Enable(_player); + } + // ARROW EFFECTS + if (!_userGadgetPersistence._arrowEffect.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(_userGadgetPersistence._arrowEffect, GadgetType.ArrowTrail); + if (gadget != null) + gadget.Enable(_player); + } + // DOUBLE JUMPS + if (!_userGadgetPersistence._doubleJump.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(_userGadgetPersistence._doubleJump, GadgetType.DoubleJump); + if (gadget != null) + gadget.Enable(_player); + } + // DEATH ANIMATIONS + if (!_userGadgetPersistence._deathAnimation.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(_userGadgetPersistence._deathAnimation, GadgetType.Death); + if (gadget != null) + gadget.Enable(_player); + } + // ITEMS + if (!_userGadgetPersistence._gadgetItem.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(_userGadgetPersistence._gadgetItem, GadgetType.Item); + if (gadget != null) + gadget.Enable(_player); + } + // MORPHS + if (!_userGadgetPersistence._morph.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(_userGadgetPersistence._morph, GadgetType.Morph); + if (gadget != null) + gadget.Enable(_player); + } + // HATS + if (!_userGadgetPersistence._hat.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(_userGadgetPersistence._hat, GadgetType.Hat); + if (gadget != null) + gadget.Enable(_player); + } + // WIN EFFECTS + if (!_userGadgetPersistence._winEffect.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(_userGadgetPersistence._winEffect, GadgetType.WinEffect); + if (gadget != null) + gadget.Enable(_player); + } + // COSTUMES + String[] costumeSplit = _userGadgetPersistence._costume.split(","); + for (String costume : costumeSplit) + { + if (!costume.equalsIgnoreCase("NONE")) + { + Gadget gadget = _manager.getGadget(costume, GadgetType.Costume); + if (gadget != null) + gadget.Enable(_player); + } + } + // GAME MODIFIERS + if(!_userGadgetPersistence._minestrikeModifiers.equalsIgnoreCase("NONE")) + { + String[] minestrikeModifiersSplit = _userGadgetPersistence._minestrikeModifiers.split(","); + for (String modifier : minestrikeModifiersSplit) + { + Gadget gadget = _manager.getGadget(modifier, GadgetType.GameModifier); + if (gadget != null) + gadget.Enable(_player); + } + } + if(!_userGadgetPersistence._survivalGamesModifiers.equalsIgnoreCase("NONE")) + { + String[] survivalGamesModifiersSplit = _userGadgetPersistence._survivalGamesModifiers.split(","); + for (String modifier : survivalGamesModifiersSplit) + { + Gadget gadget = _manager.getGadget(modifier, GadgetType.GameModifier); + if (gadget != null) + gadget.Enable(_player); + } + } + if(!_userGadgetPersistence._bridgeModifiers.equalsIgnoreCase("NONE")) + { + String[] bridgeModifiersSplit = _userGadgetPersistence._bridgeModifiers.split(","); + for (String modifier : bridgeModifiersSplit) + { + Gadget gadget = _manager.getGadget(modifier, GadgetType.GameModifier); + if (gadget != null) + gadget.Enable(_player); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/PersistenceRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/PersistenceRepository.java new file mode 100644 index 000000000..a1e5f2c45 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/PersistenceRepository.java @@ -0,0 +1,112 @@ +package mineplex.core.gadget.persistence; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +import mineplex.core.database.MinecraftRepository; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.column.ColumnVarChar; +import org.bukkit.plugin.java.JavaPlugin; + +public class PersistenceRepository extends MinecraftRepository +{ + + private static String INSERT_ACCOUNT = "INSERT INTO gadgetPersistence (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;"; + private static String UPDATE_GADGET_PERSISTENCE = "UPDATE gadgetPersistence SET particleEffect = ?, arrowEffect = ?, doubleJump = ?, deathAnimation = ?, gadgetItem = ?, morph = ?, hat = ?, costume = ?, winEffect = ?, minestrikeModifiers = ?, survivalGamesModifiers = ?, bridgeModifiers = ? WHERE uuid=?;"; + + public PersistenceRepository(JavaPlugin plugin) + { + super(plugin, DBPool.getAccount()); + } + + @Override + protected void initialize() + { + } + + @Override + protected void update() + { + } + + public void savePersistence(Map persistence) + { + try (Connection connection = getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(UPDATE_GADGET_PERSISTENCE)) + { + for (Map.Entry entry : persistence.entrySet()) + { + preparedStatement.setString(1, entry.getValue()._particleEffect); + preparedStatement.setString(2, entry.getValue()._arrowEffect); + preparedStatement.setString(3, entry.getValue()._doubleJump); + preparedStatement.setString(4, entry.getValue()._deathAnimation); + preparedStatement.setString(5, entry.getValue()._gadgetItem); + preparedStatement.setString(6, entry.getValue()._morph); + preparedStatement.setString(7, entry.getValue()._hat); + preparedStatement.setString(8, entry.getValue()._costume); + preparedStatement.setString(9, entry.getValue()._winEffect); + preparedStatement.setString(10, entry.getValue()._minestrikeModifiers); + preparedStatement.setString(11, entry.getValue()._survivalGamesModifiers); + preparedStatement.setString(12, entry.getValue()._bridgeModifiers); + preparedStatement.setString(13, entry.getKey()); + preparedStatement.addBatch(); + } + + int[] rowsAffected = preparedStatement.executeBatch(); + int i = 0; + + for (Map.Entry entry : persistence.entrySet()) + { + if (rowsAffected[i] < 1) + { + executeUpdate(INSERT_ACCOUNT, new ColumnVarChar("uuid", 100, entry.getKey())); + + preparedStatement.setString(1, entry.getValue()._particleEffect); + preparedStatement.setString(2, entry.getValue()._arrowEffect); + preparedStatement.setString(3, entry.getValue()._doubleJump); + preparedStatement.setString(4, entry.getValue()._deathAnimation); + preparedStatement.setString(5, entry.getValue()._gadgetItem); + preparedStatement.setString(6, entry.getValue()._morph); + preparedStatement.setString(7, entry.getValue()._hat); + preparedStatement.setString(8, entry.getValue()._costume); + preparedStatement.setString(9, entry.getValue()._winEffect); + preparedStatement.setString(10, entry.getValue()._minestrikeModifiers); + preparedStatement.setString(11, entry.getValue()._survivalGamesModifiers); + preparedStatement.setString(12, entry.getValue()._bridgeModifiers); + preparedStatement.setString(13, entry.getKey()); + + preparedStatement.execute(); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + public UserGadgetPersistence loadClientPersistence(final ResultSet set) throws SQLException + { + final UserGadgetPersistence userGadgetPersistence = new UserGadgetPersistence(); + + if (set.next()) + { + userGadgetPersistence._particleEffect = set.getString(1); + userGadgetPersistence._arrowEffect = set.getString(2); + userGadgetPersistence._doubleJump = set.getString(3); + userGadgetPersistence._deathAnimation = set.getString(4); + userGadgetPersistence._gadgetItem = set.getString(5); + userGadgetPersistence._morph = set.getString(6); + userGadgetPersistence._hat = set.getString(7); + userGadgetPersistence._costume = set.getString(9); + userGadgetPersistence._winEffect = set.getString(9); + userGadgetPersistence._minestrikeModifiers = set.getString(10); + userGadgetPersistence._survivalGamesModifiers = set.getString(11); + userGadgetPersistence._bridgeModifiers = set.getString(12); + } + return userGadgetPersistence; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java new file mode 100644 index 000000000..fc204d8af --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java @@ -0,0 +1,58 @@ +package mineplex.core.gadget.persistence; + +import java.util.StringJoiner; + +public class UserGadgetPersistence +{ + + private StringJoiner _joiner; + public String _particleEffect = "NONE"; + public String _arrowEffect = "NONE"; + public String _doubleJump = "NONE"; + public String _deathAnimation = "NONE"; + public String _gadgetItem = "NONE"; + public String _morph = "NONE"; + public String _hat = "NONE"; + public String _costume = "NONE,NONE,NONE,NONE"; + public String _winEffect = "NONE"; + public String _minestrikeModifiers = "NONE"; + public String _survivalGamesModifiers = "NONE"; + public String _bridgeModifiers = "NONE"; + + public void addCostume(int part, String name) + { + String[] costumeParts = _costume.split(","); + costumeParts[part] = name; + _joiner = new StringJoiner(","); + _joiner.add(costumeParts[0]); + _joiner.add(costumeParts[1]); + _joiner.add(costumeParts[2]); + _joiner.add(costumeParts[3]); + _costume = _joiner.toString(); + } + + public String addGameModifier(String old, String add) + { + String[] oldSplit = old.split(","); + _joiner = new StringJoiner(","); + for (int i = 0; i < oldSplit.length - 1; i++) + { + _joiner.add(oldSplit[i]); + } + _joiner.add(add); + return _joiner.toString(); + } + + public String removeGameModifier(String old, String remove) + { + String[] oldSplit = old.split(","); + _joiner = new StringJoiner(","); + for (int i = 0; i < oldSplit.length - 1; i++) + { + if (!oldSplit[i].equalsIgnoreCase(remove)) + _joiner.add(oldSplit[i]); + } + return _joiner.toString(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java index bae19a6d2..a9a2bbe0c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCandyCane.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane; -import mineplex.core.gadget.gadgets.death.DeathCandyCane; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane; -import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; +import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; +import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; +import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; import mineplex.core.gadget.types.GadgetSet; public class SetCandyCane extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java index 938bf3104..7696abc25 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetCupidsLove.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid; -import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings; -import mineplex.core.gadget.gadgets.particle.ParticleHeart; +import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; +import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; +import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; +import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; import mineplex.core.gadget.types.GadgetSet; public class SetCupidsLove extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java index 1eec46356..60897253f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetEmerald.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald; -import mineplex.core.gadget.gadgets.death.DeathEmerald; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald; -import mineplex.core.gadget.gadgets.particle.ParticleEmerald; +import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; +import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; +import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; +import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; import mineplex.core.gadget.types.GadgetSet; public class SetEmerald extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java index 6907576db..0ced72181 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFrostLord.java @@ -1,13 +1,10 @@ package mineplex.core.gadget.set; -import org.bukkit.entity.Player; - -import mineplex.core.common.util.F; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord; -import mineplex.core.gadget.gadgets.death.DeathFrostLord; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord; -import mineplex.core.gadget.gadgets.particle.ParticleFrostLord; +import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord; +import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; import mineplex.core.gadget.types.GadgetSet; public class SetFrostLord extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java index 9af8fcec4..120a35c95 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetHowlingWinds.java @@ -1,11 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm; -import mineplex.core.gadget.gadgets.death.DeathStorm; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm; -import mineplex.core.gadget.gadgets.particle.ParticleRain; -import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; +import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; +import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; +import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; import mineplex.core.gadget.types.GadgetSet; public class SetHowlingWinds extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java deleted file mode 100644 index 12a6bf5e2..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetLove.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.set; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHearts; -import mineplex.core.gadget.gadgets.death.DeathHearts; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHearts; -import mineplex.core.gadget.gadgets.particle.ParticleHeart; -import mineplex.core.gadget.types.GadgetSet; - -public class SetLove extends GadgetSet -{ - /** - * Created by: Mysticate - * Timestamp: February 4, 2016 - */ - - public SetLove(GadgetManager manager) - { - super(manager, "Lovely!", "Coming soon...", - manager.getGadget(ArrowTrailHearts.class), - manager.getGadget(DeathHearts.class), - manager.getGadget(DoubleJumpHearts.class), - manager.getGadget(ParticleHeart.class)); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java index 268e16ee9..89022edb4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetMusic.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic; -import mineplex.core.gadget.gadgets.death.DeathMusic; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic; -import mineplex.core.gadget.gadgets.particle.ParticleMusic; +import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; +import mineplex.core.gadget.gadgets.death.music.DeathMusic; +import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; +import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; import mineplex.core.gadget.types.GadgetSet; public class SetMusic extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java index 86bb56d14..93370a41f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetParty.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti; -import mineplex.core.gadget.gadgets.death.DeathPinataBurst; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker; -import mineplex.core.gadget.gadgets.particle.ParticlePartyTime; +import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; +import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; +import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; +import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.types.GadgetSet; public class SetParty extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetShadow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetShadow.java index 80b751d7d..befc2e27c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetShadow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetShadow.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow; -import mineplex.core.gadget.gadgets.death.DeathShadow; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow; -import mineplex.core.gadget.gadgets.particle.ParticleFoot; +import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.types.GadgetSet; public class SetShadow extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java index 6a5225603..7c66a8f6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetTitan.java @@ -1,13 +1,10 @@ package mineplex.core.gadget.set; -import org.bukkit.entity.Player; - -import mineplex.core.common.util.F; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan; -import mineplex.core.gadget.gadgets.death.DeathTitan; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan; -import mineplex.core.gadget.gadgets.particle.ParticleTitan; +import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; +import mineplex.core.gadget.gadgets.death.titan.DeathTitan; +import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; +import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.types.GadgetSet; public class SetTitan extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java index 49e5c6f69..25842bb71 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetVampire.java @@ -1,11 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood; -import mineplex.core.gadget.gadgets.death.DeathBlood; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood; -import mineplex.core.gadget.gadgets.particle.ParticleBlood; -import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; +import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; +import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; +import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.types.GadgetSet; public class SetVampire extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java index a5f82a95e..06858d63f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetWisdom.java @@ -1,10 +1,10 @@ package mineplex.core.gadget.set; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant; -import mineplex.core.gadget.gadgets.death.DeathEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant; -import mineplex.core.gadget.gadgets.particle.ParticleEnchant; +import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; +import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.types.GadgetSet; public class SetWisdom extends GadgetSet diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java index cc9b7fd39..69a0bed33 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -12,10 +12,22 @@ public abstract class OutfitGadget extends Gadget { public enum ArmorSlot { - Helmet, - Chest, - Legs, - Boots + Helmet(0), + Chest(1), + Legs(2), + Boots(3); + + int _slot; + + ArmorSlot(int slot) + { + _slot = slot; + } + + public int getSlot() + { + return _slot; + } } protected ArmorSlot _slot; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index 18cef7df2..3ed550da9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.UUID; import mineplex.core.common.util.*; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -273,6 +274,7 @@ public abstract class WinEffectGadget extends Gadget for(Player p : UtilServer.getPlayers()) { lockPlayer(p); UtilPlayer.hideFromAll(p); + p.setGameMode(GameMode.ADVENTURE); p.getInventory().clear(); p.teleport(loc); p.setAllowFlight(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index d31575cb2..e3245d831 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -5,6 +5,17 @@ import java.util.EnumMap; import java.util.List; import java.util.Random; +import mineplex.core.gadget.gadgets.particle.*; +import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; +import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; +import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; +import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; +import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; +import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; +import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; +import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; +import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; +import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -13,34 +24,34 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm; -import mineplex.core.gadget.gadgets.death.DeathBlood; -import mineplex.core.gadget.gadgets.death.DeathCandyCane; -import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart; -import mineplex.core.gadget.gadgets.death.DeathEmerald; -import mineplex.core.gadget.gadgets.death.DeathEnchant; -import mineplex.core.gadget.gadgets.death.DeathFrostLord; -import mineplex.core.gadget.gadgets.death.DeathMusic; -import mineplex.core.gadget.gadgets.death.DeathPinataBurst; -import mineplex.core.gadget.gadgets.death.DeathShadow; -import mineplex.core.gadget.gadgets.death.DeathStorm; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm; +import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; +import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; +import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; +import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; +import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; +import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord; +import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; +import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; +import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; +import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane; +import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart; +import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald; +import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord; +import mineplex.core.gadget.gadgets.death.music.DeathMusic; +import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; +import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; +import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; +import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; +import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; +import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; +import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; +import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord; +import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; +import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; import mineplex.core.gadget.gadgets.hat.HatCompanionBlock; import mineplex.core.gadget.gadgets.hat.HatGrinch; @@ -78,23 +89,6 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; -import mineplex.core.gadget.gadgets.particle.ParticleBlood; -import mineplex.core.gadget.gadgets.particle.ParticleCandyCane; -import mineplex.core.gadget.gadgets.particle.ParticleEmerald; -import mineplex.core.gadget.gadgets.particle.ParticleEnchant; -import mineplex.core.gadget.gadgets.particle.ParticleFairy; -import mineplex.core.gadget.gadgets.particle.ParticleFireRings; -import mineplex.core.gadget.gadgets.particle.ParticleFoot; -import mineplex.core.gadget.gadgets.particle.ParticleFrostLord; -import mineplex.core.gadget.gadgets.particle.ParticleHeart; -import mineplex.core.gadget.gadgets.particle.ParticleMusic; -import mineplex.core.gadget.gadgets.particle.ParticlePartyTime; -import mineplex.core.gadget.gadgets.particle.ParticleRain; -import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; -import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; -import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; -import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; -import mineplex.core.gadget.gadgets.particle.ParticleYinYang; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index ba542f68a..b0341657b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -20,6 +20,7 @@ import mineplex.core.donation.DonationManager; import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.friend.FriendManager; +import mineplex.core.gadget.persistence.GadgetPersistenceManager; import mineplex.core.give.Give; import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index d97b30e75..6cfe3b731 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -9,6 +9,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Random; +import mineplex.core.gadget.persistence.GadgetPersistenceManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -222,7 +223,8 @@ public class HubManager extends MiniClientPlugin _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); _inventoryManager = inventoryManager; new BenefitManager(plugin, clientManager, _inventoryManager); - _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager); + GadgetPersistenceManager gadgetPersistenceManager = new GadgetPersistenceManager(plugin, clientManager); + _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager, gadgetPersistenceManager); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 2baa32897..eb0accd24 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -2,6 +2,7 @@ package nautilus.game.arcade; import java.io.File; +import mineplex.core.gadget.persistence.GadgetPersistenceManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -125,6 +126,7 @@ public class Arcade extends JavaPlugin incognito.setPreferencesManager(preferenceManager); + Creature creature = new Creature(this); ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager); @@ -159,10 +161,11 @@ public class Arcade extends JavaPlugin HologramManager hologramManager = new HologramManager(this, packetHandler); //Inventory + GadgetPersistenceManager gadgetPersistenceManager = new GadgetPersistenceManager(this, _clientManager); InventoryManager inventoryManager = new InventoryManager(this, _clientManager); PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); - GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager); + GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, gadgetPersistenceManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null); cosmeticManager.setInterfaceSlot(7); cosmeticManager.disableTeamArmor(); From 255191f01adb93f046481334af39bf83df88e916 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 26 May 2016 23:58:36 -0300 Subject: [PATCH 02/49] Changed gadget persistence to use Player Key/Value system (Thanks to Connor) Changed the method names for some classes --- .../core/cosmetic/CosmeticManager.java | 2 +- .../core/cosmetic/ui/button/MountButton.java | 2 +- .../cosmetic/ui/button/OpenPageButton.java | 2 +- .../core/cosmetic/ui/page/CostumePage.java | 18 +- .../core/cosmetic/ui/page/GadgetPage.java | 90 +++---- .../cosmetic/ui/page/GameModifierSubPage.java | 2 +- .../cosmetic/ui/page/KitGameModifierPage.java | 2 +- .../mineplex/core/cosmetic/ui/page/Menu.java | 6 +- .../core/cosmetic/ui/page/MountPage.java | 44 +-- .../core/cosmetic/ui/page/PetPage.java | 38 ++- .../core/cosmetic/ui/page/PetTagPage.java | 2 +- .../mineplex/core/gadget/GadgetManager.java | 252 ++++++++---------- .../core/gadget/commands/AmmoCommand.java | 8 +- .../gadget/commands/LockCosmeticsCommand.java | 2 +- .../commands/UnlockCosmeticsCommand.java | 2 +- .../core/gadget/event/GadgetAppliedEvent.java | 42 +++ .../mineplex/core/gadget/gadgets/Ammo.java | 2 +- .../arrowtrail/titan/ArrowTrailTitan.java | 2 +- .../gadgets/death/titan/DeathTitan.java | 2 +- .../doublejump/titan/DoubleJumpTitan.java | 3 +- .../gamemodifiers/kits/KitGameModifier.java | 6 +- .../GameModifierMineStrikeSkin.java | 6 +- .../core/gadget/gadgets/item/ItemBatGun.java | 6 +- .../core/gadget/gadgets/item/ItemCoal.java | 44 +-- .../gadget/gadgets/item/ItemCoinBomb.java | 2 +- .../gadgets/item/ItemEtherealPearl.java | 11 +- .../gadget/gadgets/item/ItemFirework.java | 4 +- .../gadget/gadgets/item/ItemFleshHook.java | 5 +- .../gadget/gadgets/item/ItemFlowerGift.java | 20 +- .../gadget/gadgets/item/ItemFootball.java | 9 +- .../gadget/gadgets/item/ItemFreezeCannon.java | 6 +- .../gadget/gadgets/item/ItemLovePotion.java | 34 +-- .../gadgets/item/ItemMelonLauncher.java | 2 +- .../gadget/gadgets/item/ItemPaintbrush.java | 25 +- .../core/gadget/gadgets/item/ItemTNT.java | 3 +- .../core/gadget/gadgets/morph/MorphBat.java | 20 +- .../core/gadget/gadgets/morph/MorphBlaze.java | 9 +- .../core/gadget/gadgets/morph/MorphBlock.java | 6 +- .../core/gadget/gadgets/morph/MorphBunny.java | 13 +- .../gadget/gadgets/morph/MorphChicken.java | 20 +- .../core/gadget/gadgets/morph/MorphCow.java | 8 +- .../gadget/gadgets/morph/MorphCreeper.java | 9 +- .../gadget/gadgets/morph/MorphEnderman.java | 12 +- .../core/gadget/gadgets/morph/MorphPig.java | 25 +- .../gadgets/morph/MorphPumpkinKing.java | 4 +- .../core/gadget/gadgets/morph/MorphSlime.java | 8 +- .../gadget/gadgets/morph/MorphSnowman.java | 10 +- .../core/gadget/gadgets/morph/MorphTitan.java | 14 +- .../gadget/gadgets/morph/MorphVillager.java | 14 +- .../gadget/gadgets/morph/MorphWither.java | 16 +- .../gadget/gadgets/outfit/OutfitTeam.java | 73 ++--- .../outfit/ravesuit/OutfitRaveSuit.java | 36 +-- .../outfit/spacesuit/OutfitSpaceSuit.java | 10 +- .../outfit/windupsuit/OutfitWindUpSuit.java | 24 +- .../gadgets/particle/ParticleFairy.java | 4 +- .../gadgets/particle/ParticleKronos.java | 6 +- .../gadgets/particle/ParticleLegend.java | 2 +- .../particle/cupidslove/ParticleHeart.java | 4 +- .../particle/frostlord/ParticleFrostLord.java | 2 +- .../gadgets/particle/titan/ParticleTitan.java | 2 +- .../wineffect/WinEffectDragonRider.java | 4 +- .../persistence/GadgetPersistenceManager.java | 77 ------ .../gadget/persistence/LoadPersistence.java | 127 --------- .../persistence/PersistenceRepository.java | 112 -------- .../persistence/UserGadgetPersistence.java | 106 +++++--- .../core/gadget/types/ArrowEffectGadget.java | 20 +- .../core/gadget/types/DeathEffectGadget.java | 22 +- .../gadget/types/DoubleJumpEffectGadget.java | 20 +- .../mineplex/core/gadget/types/Gadget.java | 57 ++-- .../core/gadget/types/GadgetGameModifier.java | 13 +- .../mineplex/core/gadget/types/GadgetSet.java | 2 +- .../core/gadget/types/GadgetType.java | 36 ++- .../mineplex/core/gadget/types/HatGadget.java | 20 +- .../core/gadget/types/ItemGadget.java | 42 +-- .../core/gadget/types/MorphGadget.java | 9 +- .../core/gadget/types/MusicGadget.java | 20 +- .../core/gadget/types/OutfitGadget.java | 58 ++-- .../core/gadget/types/ParticleGadget.java | 14 +- .../core/gadget/types/WinEffectGadget.java | 17 -- .../mineplex/core/inventory/GemBooster.java | 2 +- .../src/mineplex/core/mount/DragonMount.java | 4 +- .../src/mineplex/core/mount/HorseMount.java | 6 +- .../src/mineplex/core/mount/Mount.java | 4 +- .../mineplex/core/mount/types/MountCart.java | 14 +- .../core/mount/types/MountDragon.java | 2 +- .../mineplex/core/mount/types/MountFrost.java | 2 +- .../mineplex/core/mount/types/MountSheep.java | 3 +- .../mineplex/core/mount/types/MountSlime.java | 17 +- .../core/mount/types/MountSpider.java | 10 +- .../mineplex/core/mount/types/MountTitan.java | 10 +- .../src/mineplex/core/pet/Pet.java | 2 +- .../src/mineplex/core/pet/PetExtra.java | 4 +- .../mineplex/core/reward/RewardManager.java | 24 +- .../core/shop/item/ICurrencyPackage.java | 8 +- .../core/shop/item/IDisplayPackage.java | 8 +- .../core/shop/item/SalesPackageBase.java | 24 +- .../core/shop/page/ConfirmationPage.java | 14 +- .../mineplex/core/treasure/ChestPackage.java | 2 +- .../mineplex/core/treasure/TreasureKey.java | 2 +- .../game/clans/shop/energy/EnergyPackage.java | 2 +- .../Mineplex.Hub/src/mineplex/hub/Hub.java | 6 - .../src/mineplex/hub/HubManager.java | 4 +- .../hub/commands/DisguiseCommand.java | 8 +- .../src/mineplex/hub/modules/KothManager.java | 9 +- .../mineplex/hub/modules/ParkourManager.java | 2 +- .../mineplex/hub/modules/SoccerManager.java | 7 +- .../classcombat/Skill/Assassin/Illusion.java | 2 +- .../game/classcombat/Skill/Global/Pistol.java | 2 +- .../classcombat/Skill/Knight/BullsCharge.java | 2 +- .../Skill/Knight/DefensiveStance.java | 2 +- .../classcombat/Skill/Ranger/Fletcher.java | 2 +- .../Skill/Ranger/IncendiaryShot.java | 10 +- .../Skill/Ranger/Sharpshooter.java | 2 +- .../classcombat/item/Throwable/Pistol.java | 2 +- .../game/classcombat/shop/page/SkillPage.java | 10 +- .../shop/salespackage/ItemSalesPackage.java | 2 +- .../shop/salespackage/SkillSalesPackage.java | 2 +- .../src/nautilus/game/arcade/Arcade.java | 12 +- .../nautilus/game/arcade/ArcadeManager.java | 4 +- .../game/arcade/command/DisguiseCommand.java | 8 +- .../arcade/game/games/event/EventGame.java | 19 +- .../arcade/game/games/event/EventModule.java | 25 +- .../minecraftleague/data/TowerManager.java | 2 +- .../game/games/minestrike/MineStrike.java | 6 +- .../game/games/minestrike/items/guns/Gun.java | 2 +- .../kits/perks/PerkPaintballSniper.java | 4 +- .../searchanddestroy/SearchAndDestroy.java | 6 +- .../games/survivalgames/SurvivalGames.java | 6 +- .../survivalgames/SurvivalGamesTeams.java | 6 +- .../game/arcade/kit/perks/PerkFlameDash.java | 2 +- .../game/arcade/kit/perks/PerkSmokebomb.java | 4 +- .../arcade/scoreboard/GameScoreboard.java | 4 +- .../nautilus/game/arcade/shop/KitPackage.java | 2 +- .../game/arcade/stats/AssistsStatTracker.java | 2 +- .../arcade/stats/DamageDealtStatTracker.java | 2 +- .../arcade/stats/DamageTakenStatTracker.java | 4 +- .../game/arcade/stats/DeathsStatTracker.java | 2 +- .../game/arcade/stats/KillsStatTracker.java | 2 +- .../game/arcade/stats/LoseStatTracker.java | 2 +- .../game/arcade/stats/WinStatTracker.java | 2 +- .../arcade/wineffect/WinEffectManager.java | 2 +- 141 files changed, 884 insertions(+), 1317 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetAppliedEvent.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/GadgetPersistenceManager.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/LoadPersistence.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/PersistenceRepository.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index 3afb1ae7e..da45bcbcd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -175,7 +175,7 @@ public class CosmeticManager extends MiniPlugin public void disableItemsForGame() { - _gadgetManager.DisableAll(); + _gadgetManager.disableAll(); _mountManager.DisableAll(); _petManager.DisableAll(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java index 55d34af4b..7041e843d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/MountButton.java @@ -29,7 +29,7 @@ public class MountButton implements IButton { public void run() { - _page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.GetName(), 1); + _page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.getName(), 1); _page.refresh(); } }, _page, _mount, CurrencyType.Coins, player)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java index 7e0a4159a..350826677 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java @@ -28,7 +28,7 @@ public abstract class OpenPageButton implements IButton if (_active != null) { _menu.playAcceptSound(player); - _active.Disable(player); + _active.disable(player); _menu.refresh(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java index 9c8ca1850..badc1c0fa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java @@ -38,7 +38,7 @@ public class CostumePage extends GadgetPage for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) { - if (gadget.GetCost(CurrencyType.Coins) == -1) + if (gadget.getCost(CurrencyType.Coins) == -1) continue; OutfitGadget outfitGadget = ((OutfitGadget) gadget); @@ -51,16 +51,16 @@ public class CostumePage extends GadgetPage slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down - if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Chest) + if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Chest) slot += 9; - else if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Legs) + else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Legs) slot += 18; - else if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Boots) + else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Boots) slot += 27; addGadget(gadget, slot); - if (gadget.IsActive(getPlayer())) + if (gadget.isActive(getPlayer())) addGlow(slot); } @@ -71,10 +71,10 @@ public class CostumePage extends GadgetPage boolean gadgetDisabled = false; for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) { - if (gadget.IsActive(player)) + if (gadget.isActive(player)) { gadgetDisabled = true; - gadget.Disable(player); + gadget.disable(player); } } @@ -99,7 +99,7 @@ public class CostumePage extends GadgetPage { if (gadget instanceof ItemGadget) { - if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0) + if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.getName()) <= 0) { purchaseGadget(player, gadget); return; @@ -107,7 +107,7 @@ public class CostumePage extends GadgetPage } playAcceptSound(player); - gadget.Enable(player); + gadget.enable(player); buildPage(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index db83190df..2045d2c87 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -46,12 +46,12 @@ public class GadgetPage extends ShopPageBase for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item)) { - if (gadget.GetCost(CurrencyType.Coins) == -3) + if (gadget.getCost(CurrencyType.Coins) == -3) continue; addGadget(gadget, slot); - if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetDisplayName()) > 0) + if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getDisplayName()) > 0) addGlow(slot); slot++; @@ -80,7 +80,7 @@ public class GadgetPage extends ShopPageBase List itemLore = new ArrayList(); itemLore.add(C.cBlack); - itemLore.addAll(Arrays.asList(gadget.GetDescription())); + itemLore.addAll(Arrays.asList(gadget.getDescription())); if (gadget.getSet() != null) { @@ -89,7 +89,7 @@ public class GadgetPage extends ShopPageBase //Elements for (Gadget cur : gadget.getSet().getGadgets()) - itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "â–ª " + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName()); + itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "â–ª " + (cur.isActive(getPlayer()) ? C.cGreen : C.cGray) + cur.getName()); itemLore.add(C.cBlack); @@ -101,59 +101,59 @@ public class GadgetPage extends ShopPageBase if (!gadget.ownsGadget(getPlayer())) { - if (gadget.GetCost(CurrencyType.Coins) == -1) + if (gadget.getCost(CurrencyType.Coins) == -1) { //Nothing } //Chest Unlocks - else if (gadget.GetCost(CurrencyType.Coins) == -2 || gadget.GetCost(CurrencyType.Coins) > 0) + else if (gadget.getCost(CurrencyType.Coins) == -2 || gadget.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } - else if (gadget.GetCost(CurrencyType.Coins) == -3) + else if (gadget.getCost(CurrencyType.Coins) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } - else if (gadget.GetCost(CurrencyType.Coins) == -4) + else if (gadget.getCost(CurrencyType.Coins) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } - else if (gadget.GetCost(CurrencyType.Coins) == -5) + else if (gadget.getCost(CurrencyType.Coins) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } - else if (gadget.GetCost(CurrencyType.Coins) == -6) + else if (gadget.getCost(CurrencyType.Coins) == -6) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Valentines Gifts"); } - else if (gadget.GetCost(CurrencyType.Coins) == -7) + else if (gadget.getCost(CurrencyType.Coins) == -7) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Purchased from shop.mineplex.com"); } //Rank Unlocks - else if (gadget.GetCost(CurrencyType.Coins) == -10) + else if (gadget.getCost(CurrencyType.Coins) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } - else if (gadget.GetCost(CurrencyType.Coins) == -11) + else if (gadget.getCost(CurrencyType.Coins) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } - else if (gadget.GetCost(CurrencyType.Coins) == -12) + else if (gadget.getCost(CurrencyType.Coins) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } - else if (gadget.GetCost(CurrencyType.Coins) == -13) + else if (gadget.getCost(CurrencyType.Coins) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); @@ -166,15 +166,15 @@ public class GadgetPage extends ShopPageBase ItemGadget itemGadget = (ItemGadget)gadget; itemLore.add(C.cBlack); - itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName())); + itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getName())); // boolean canAffordAmmo = true; -// if (itemGadget.getAmmo().GetCost(CurrencyType.Coins) > 0) +// if (itemGadget.getAmmo().getCost(CurrencyType.Coins) > 0) // { // itemLore.add(C.cBlack); -// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins"); +// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().getDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().getCost(CurrencyType.Coins) + " Coins"); // -// if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().GetCost(CurrencyType.Coins)) +// if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().getCost(CurrencyType.Coins)) // { // itemLore.add(C.cGreen + "Right-Click To Purchase"); // } @@ -190,11 +190,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Left-Click to Enable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } else { - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } return; @@ -205,11 +205,11 @@ public class GadgetPage extends ShopPageBase ItemStack item = ((HatGadget)gadget).getHelmetItem(); ItemMeta im = item.getItemMeta(); - im.setDisplayName(C.cGreen + C.Bold + gadget.GetName()); + im.setDisplayName(C.cGreen + C.Bold + gadget.getName()); if (gadget.ownsGadget(getPlayer())) { - if (gadget.GetActive().contains(getPlayer())) + if (gadget.getActive().contains(getPlayer())) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); @@ -230,29 +230,29 @@ public class GadgetPage extends ShopPageBase } else { - if (gadget.GetCost(CurrencyType.Coins) > 0) + if (gadget.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.Coins) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.Coins) + " Treasure Shards"); } - if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins)) + if (gadget.getCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.getCost(CurrencyType.Coins)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); } - else if (gadget.GetCost(CurrencyType.Coins) > 0) + else if (gadget.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } } @@ -262,46 +262,46 @@ public class GadgetPage extends ShopPageBase //Standard if (gadget.ownsGadget(getPlayer())) { - if (gadget.GetActive().contains(getPlayer())) + if (gadget.getActive().contains(getPlayer())) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); } else { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); + addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } } else { - if (gadget.GetCost(CurrencyType.Coins) > 0) + if (gadget.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.Coins) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.Coins) + " Treasure Shards"); } - if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins)) + if (gadget.getCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.getCost(CurrencyType.Coins)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); } - else if (gadget.GetCost(CurrencyType.Coins) > 0) + else if (gadget.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); } } } @@ -313,7 +313,7 @@ public class GadgetPage extends ShopPageBase { ItemGadget itemGadget = (ItemGadget)gadget; - if (itemGadget.getAmmo().GetCost(CurrencyType.Coins) < 0) + if (itemGadget.getAmmo().getCost(CurrencyType.Coins) < 0) return; } @@ -326,7 +326,7 @@ public class GadgetPage extends ShopPageBase { public void run() { - getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); + getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); refresh(); } }, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), CurrencyType.Coins, getPlayer())); @@ -336,7 +336,7 @@ public class GadgetPage extends ShopPageBase { // if (gadget instanceof ItemGadget) // { - // if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0) + // if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.getName()) <= 0) // { // purchaseGadget(player, gadget); // return; @@ -344,7 +344,7 @@ public class GadgetPage extends ShopPageBase // } playAcceptSound(player); - gadget.Enable(player); + gadget.enable(player); getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); } @@ -360,7 +360,7 @@ public class GadgetPage extends ShopPageBase public void deactivateGadget(Player player, Gadget gadget) { playAcceptSound(player); - gadget.Disable(player); + gadget.disable(player); refresh(); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java index 887d71e18..4708af7a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java @@ -88,7 +88,7 @@ public class GameModifierSubPage extends GadgetPage addGadget(gadget, slot); - if (gadget.IsActive(getPlayer())) + if (gadget.isActive(getPlayer())) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java index a98c145dc..73fc6c92d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java @@ -46,7 +46,7 @@ public class KitGameModifierPage extends GadgetPage { addGadget(gadget, slot); - if (gadget.IsActive(getPlayer())) + if (gadget.isActive(getPlayer())) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 3429950c6..0e9be9ddf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -112,7 +112,7 @@ public class Menu extends ShopPageBase Mount mountActive = getPlugin().getMountManager().getActive(getPlayer()); for (Mount mount : getPlugin().getMountManager().getMounts()) { - if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.GetName()) || mount.HasMount(getPlayer())) + if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName()) || mount.HasMount(getPlayer())) { mountOwned++; } @@ -164,7 +164,7 @@ public class Menu extends ShopPageBase addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(morphSlot); - lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.GetName()); + lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.getName()); addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive)); if (mountActive != null) addGlow(mountSlot); @@ -211,7 +211,7 @@ public class Menu extends ShopPageBase private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled) { - return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.GetName()); + return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.getName()); } private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 599ab9339..f8c349237 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -58,105 +58,105 @@ public class MountPage extends ShopPageBase List itemLore = new ArrayList(); itemLore.add(C.cBlack); - itemLore.addAll(Arrays.asList(mount.GetDescription())); + itemLore.addAll(Arrays.asList(mount.getDescription())); - if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) + if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName())) { - if (mount.GetCost(CurrencyType.Coins) == -1) + if (mount.getCost(CurrencyType.Coins) == -1) { //Nothing } //Chest Unlocks - else if (mount.GetCost(CurrencyType.Coins) == -2 || mount.GetCost(CurrencyType.Coins) > 0) + else if (mount.getCost(CurrencyType.Coins) == -2 || mount.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } - else if (mount.GetCost(CurrencyType.Coins) == -3) + else if (mount.getCost(CurrencyType.Coins) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } - else if (mount.GetCost(CurrencyType.Coins) == -4) + else if (mount.getCost(CurrencyType.Coins) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } - else if (mount.GetCost(CurrencyType.Coins) == -5) + else if (mount.getCost(CurrencyType.Coins) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } - else if (mount.GetCost(CurrencyType.Coins) == -6) + else if (mount.getCost(CurrencyType.Coins) == -6) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure"); } //Rank Unlocks - else if (mount.GetCost(CurrencyType.Coins) == -10) + else if (mount.getCost(CurrencyType.Coins) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } - else if (mount.GetCost(CurrencyType.Coins) == -11) + else if (mount.getCost(CurrencyType.Coins) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } - else if (mount.GetCost(CurrencyType.Coins) == -12) + else if (mount.getCost(CurrencyType.Coins) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } - else if (mount.GetCost(CurrencyType.Coins) == -13) + else if (mount.getCost(CurrencyType.Coins) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); } } - if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) + if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName())) { if (mount.GetActive().containsKey(getPlayer())) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this)); + addButton(slot, new ShopItem(mount.getDisplayMaterial(), mount.getDisplayData(), mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this)); } else { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this)); + addButton(slot, new ShopItem(mount.getDisplayMaterial(), mount.getDisplayData(), mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this)); } } else { - if (mount.GetCost(CurrencyType.Coins) > 0) + if (mount.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.GetCost(CurrencyType.Coins) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.getCost(CurrencyType.Coins) + " Treasure Shards"); } - if (mount.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins)) + if (mount.getCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.getCost(CurrencyType.Coins)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); - addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); + addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); } - else if (mount.GetCost(CurrencyType.Coins) > 0) + else if (mount.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 114b700ce..785dbb527 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -7,12 +7,10 @@ import java.util.List; import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_8_R3.ChatMessage; import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.Items; import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow; import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; @@ -33,8 +31,6 @@ import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.donation.DonationManager; import mineplex.core.pet.Pet; import mineplex.core.pet.PetExtra; -import mineplex.core.pet.types.Elf; -import mineplex.core.pet.types.Pumpkin; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.AnvilContainer; @@ -62,54 +58,54 @@ public class PetPage extends ShopPageBase List itemLore = new ArrayList(); itemLore.add(C.cBlack); - itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!"); + itemLore.add(C.cGray + "Your very own " + pet.getName() + "!"); //Chest Unlocks if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) { - if (pet.GetCost(CurrencyType.Coins) == -1) + if (pet.getCost(CurrencyType.Coins) == -1) { //Nothing } - else if (pet.GetCost(CurrencyType.Coins) == -2 || pet.GetCost(CurrencyType.Coins) > 0) + else if (pet.getCost(CurrencyType.Coins) == -2 || pet.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } - else if (pet.GetCost(CurrencyType.Coins) == -3) + else if (pet.getCost(CurrencyType.Coins) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } - else if (pet.GetCost(CurrencyType.Coins) == -4) + else if (pet.getCost(CurrencyType.Coins) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } - else if (pet.GetCost(CurrencyType.Coins) == -5) + else if (pet.getCost(CurrencyType.Coins) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } //Rank Unlocks - else if (pet.GetCost(CurrencyType.Coins) == -10) + else if (pet.getCost(CurrencyType.Coins) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } - else if (pet.GetCost(CurrencyType.Coins) == -11) + else if (pet.getCost(CurrencyType.Coins) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } - else if (pet.GetCost(CurrencyType.Coins) == -12) + else if (pet.getCost(CurrencyType.Coins) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } - else if (pet.GetCost(CurrencyType.Coins) == -13) + else if (pet.getCost(CurrencyType.Coins) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); @@ -122,7 +118,7 @@ public class PetPage extends ShopPageBase String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType()); if (petName == null) { - petName = pet.GetName(); + petName = pet.getName(); } if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType()) @@ -149,20 +145,20 @@ public class PetPage extends ShopPageBase //Not Owned else { - if (pet.GetCost(CurrencyType.Coins) > 0) + if (pet.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.GetCost(CurrencyType.Coins) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.getCost(CurrencyType.Coins) + " Treasure Shards"); } - if (pet.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins)) + if (pet.getCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= pet.getCost(CurrencyType.Coins)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this)); } - else if (pet.GetCost(CurrencyType.Coins) > 0) + else if (pet.getCost(CurrencyType.Coins) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); @@ -189,11 +185,11 @@ public class PetPage extends ShopPageBase if (!getPlugin().getPetManager().hasActivePet(getPlayer().getName())) { itemLore.add(C.cWhite + "You must have an active pet to use this!"); - getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle()); + getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle()); } else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.WITHER) { - addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.Coins) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); + addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.getCost(CurrencyType.Coins) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); } slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index 9e222aeae..8eeb6c505 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -92,7 +92,7 @@ public class PetTagPage extends ShopPageBase return; } - PetExtra tag = new PetExtra("Rename " + _pet.GetName() + " to " + _tagName, Material.NAME_TAG, 100); + PetExtra tag = new PetExtra("Rename " + _pet.getName() + " to " + _tagName, Material.NAME_TAG, 100); _pet.setDisplayName(C.cGreen + "Purchase " + _tagName); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index b6041c9de..5d2c9fbe4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -4,11 +4,10 @@ import java.util.*; import java.util.function.Predicate; import mineplex.core.gadget.commands.LockCosmeticsCommand; -import mineplex.core.gadget.event.GadgetDisableEvent; +import mineplex.core.gadget.event.GadgetAppliedEvent; +import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; -import mineplex.core.gadget.persistence.GadgetPersistenceManager; -import mineplex.core.gadget.persistence.LoadPersistence; import mineplex.core.gadget.persistence.UserGadgetPersistence; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -37,7 +36,6 @@ import mineplex.core.donation.DonationManager; import mineplex.core.gadget.commands.AmmoCommand; import mineplex.core.gadget.commands.UnlockCosmeticsCommand; import mineplex.core.gadget.event.GadgetCollideEntityEvent; -import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; @@ -212,7 +210,7 @@ public class GadgetManager extends MiniPlugin private final HashSet _sets = new HashSet<>(); - private GadgetPersistenceManager _gadgetPetsistenceManager; + private UserGadgetPersistence _userGadgetPersistence; private boolean _hideParticles = false; private int _activeItemSlot = 3; @@ -221,7 +219,7 @@ public class GadgetManager extends MiniPlugin public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager, - PacketHandler packetHandler, HologramManager hologramManager, GadgetPersistenceManager persistenceManager) + PacketHandler packetHandler, HologramManager hologramManager) { super("Gadget Manager", plugin); @@ -237,10 +235,10 @@ public class GadgetManager extends MiniPlugin _packetManager = packetHandler; _mountManager = mountManager; _hologramManager = hologramManager; - _gadgetPetsistenceManager = persistenceManager; + _userGadgetPersistence = new UserGadgetPersistence(this); _boosterManager = new OutfitWindUpSuitBoosterManager(this); - CreateGadgets(); + createGadgets(); createSets(); } @@ -274,7 +272,7 @@ public class GadgetManager extends MiniPlugin addSet(new SetMusic(this)); } - private void CreateGadgets() + private void createGadgets() { _gadgets = new NautHashMap<>(); @@ -540,9 +538,8 @@ public class GadgetManager extends MiniPlugin // Fixes win room speed bug event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); - // Loads persistence gadgets for players - LoadPersistence loadPersistence = new LoadPersistence(this, event.getPlayer()); - loadPersistence.givePlayer(); + // Loads saved gadgets + _userGadgetPersistence.load(event.getPlayer()); } public List getGadgets(GadgetType gadgetType) @@ -550,12 +547,23 @@ public class GadgetManager extends MiniPlugin return _gadgets.get(gadgetType); } + public List getAllGadgets() + { + List gadgets = new ArrayList<>(); + for (GadgetType gadgetType : GadgetType.values()) + { + gadgets.addAll(getGadgets(gadgetType)); + } + return gadgets; + } + public Gadget getGadget(String name, GadgetType gadgetType) { List gadgets = getGadgets(gadgetType); for (Gadget gadget : gadgets) { - if (gadget.GetName().equalsIgnoreCase(name)) + if (gadget.getName().equalsIgnoreCase(name) + || Arrays.asList(gadget.getAlternativePackageNames()).contains(name)) return gadget; } return null; @@ -580,7 +588,7 @@ public class GadgetManager extends MiniPlugin for(GadgetGameModifier g : getGameModifiers(GameModifierType.MineStrike)) { GameModifierMineStrikeSkin gskin = (GameModifierMineStrikeSkin) g; - if(g.GetName().equals(skin.getSkinName())) return gskin; + if(g.getName().equals(skin.getSkinName())) return gskin; } return null; } @@ -605,7 +613,7 @@ public class GadgetManager extends MiniPlugin { for (GadgetGameModifier g : getGameModifiers(gameType)) { - if (!g.IsActive(player)) { continue; } + if (!g.isActive(player)) { continue; } if (!selector.test(g)) { continue; } return g; } @@ -617,7 +625,7 @@ public class GadgetManager extends MiniPlugin { for (GadgetGameModifier g : getGameModifiers(kitType)) { - if (!g.IsActive(player)) { continue; } + if (!g.isActive(player)) { continue; } if (!selector.test(g)) { continue; } if (!(g instanceof KitGameModifier)) { continue; } return (KitGameModifier) g; @@ -626,7 +634,7 @@ public class GadgetManager extends MiniPlugin } // Disallows two armor gadgets in same slot. - public void RemoveOutfit(Player player, ArmorSlot slot) + public void removeOutfit(Player player, ArmorSlot slot) { for (GadgetType gadgetType : _gadgets.keySet()) { @@ -636,9 +644,9 @@ public class GadgetManager extends MiniPlugin { OutfitGadget armor = (OutfitGadget) gadget; - if (armor.GetSlot() == slot) + if (armor.getSlot() == slot) { - armor.RemoveArmor(player); + armor.removeArmor(player); } } } @@ -651,11 +659,22 @@ public class GadgetManager extends MiniPlugin if(gadgets == null) return; for(Gadget g : gadgets) { - g.Disable(player); + g.disable(player); + } + } + + public void removeGadgetType(Player player, GadgetType type, Gadget enabled) + { + List gadgets = _gadgets.get(type); + if(gadgets == null) return; + for(Gadget g : gadgets) + { + if (g != enabled) + g.disable(player); } } - public void DisableAll() + public void disableAll() { for (GadgetType gadgetType : _gadgets.keySet()) { @@ -680,32 +699,43 @@ public class GadgetManager extends MiniPlugin continue; for (Player player : UtilServer.getPlayers()) - gadget.Disable(player); + gadget.disable(player); } } } - public void DisableAll(Player player) + public void disableAll(Player player) { for (GadgetType gadgetType : _gadgets.keySet()) { for (Gadget gadget : _gadgets.get(gadgetType)) { - gadget.Disable(player); + gadget.disable(player); } } } - - public void DisableAll(Player player, List dontDisable) + + public void disableAll(Player player, boolean callEvent) { for (GadgetType gadgetType : _gadgets.keySet()) { for (Gadget gadget : _gadgets.get(gadgetType)) { - if (dontDisable.contains(gadget.GetName())) + gadget.disable(player); + } + } + } + + public void disableAll(Player player, List dontDisable) + { + for (GadgetType gadgetType : _gadgets.keySet()) + { + for (Gadget gadget : _gadgets.get(gadgetType)) + { + if (dontDisable.contains(gadget.getName())) continue; - gadget.Disable(player); + gadget.disable(player); } } } @@ -801,7 +831,7 @@ public class GadgetManager extends MiniPlugin @EventHandler public void quit(PlayerQuitEvent event) { - DisableAll(event.getPlayer()); + disableAll(event.getPlayer(), false); _lastMove.remove(event.getPlayer()); _playerActiveGadgetMap.remove(event.getPlayer()); event.getPlayer().setWalkSpeed(0.2f); @@ -871,7 +901,7 @@ public class GadgetManager extends MiniPlugin { if (gadget instanceof ItemGadget) { - if (gadget.IsActive(player)) + if (gadget.isActive(player)) { ((ItemGadget)gadget).ApplyItem(player, false); } @@ -910,125 +940,13 @@ public class GadgetManager extends MiniPlugin if (_gadgetsEnabled != enabled) { _gadgetsEnabled = enabled; - DisableAll(); + disableAll(); _mountManager.DisableAll(); } } @EventHandler - public void onGadgetEnable(GadgetEnableEvent event) - { - System.out.print("GADGET ENABLED!"); - if (!_gadgetsEnabled) - event.setCancelled(true); - - UserGadgetPersistence userGadgetPersistence = _gadgetPetsistenceManager.Get(event.getPlayer()); - Gadget gadget = event.getGadget(); - String name = gadget.GetName(); - switch (event.getGadget().getGadgetType()) - { - case Item: - userGadgetPersistence._gadgetItem = name; - break; - case Morph: - userGadgetPersistence._morph = name; - break; - case Particle: - userGadgetPersistence._particleEffect = name; - break; - case Costume: - OutfitGadget outfitGadget = (OutfitGadget) gadget; - userGadgetPersistence.addCostume(outfitGadget.GetSlot().getSlot(), name); - break; - case DoubleJump: - userGadgetPersistence._doubleJump = name; - break; - case ArrowTrail: - userGadgetPersistence._arrowEffect = name; - break; - case Death: - userGadgetPersistence._deathAnimation = name; - break; - case Hat: - userGadgetPersistence._hat = name; - break; - case WinEffect: - userGadgetPersistence._winEffect = name; - break; - case GameModifier: - GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; - switch (gadgetGameModifier.getGameType()) - { - case MineStrike: - userGadgetPersistence._minestrikeModifiers = userGadgetPersistence.addGameModifier(userGadgetPersistence._minestrikeModifiers, name); - break; - case SurvivalGames: - userGadgetPersistence._survivalGamesModifiers = userGadgetPersistence.addGameModifier(userGadgetPersistence._survivalGamesModifiers, name); - break; - case Bridges: - userGadgetPersistence._bridgeModifiers = userGadgetPersistence.addGameModifier(userGadgetPersistence._bridgeModifiers, name); - break; - } - } - _gadgetPetsistenceManager.savePersistence(event.getPlayer()); - } - - @EventHandler - public void onGadgetDisable(GadgetDisableEvent event) - { - UserGadgetPersistence userGadgetPersistence = _gadgetPetsistenceManager.Get(event.getPlayer()); - Gadget gadget = event.getGadget(); - String name = gadget.GetName(); - switch (event.getGadget().getGadgetType()) - { - case Item: - userGadgetPersistence._gadgetItem = "NONE"; - break; - case Morph: - userGadgetPersistence._morph = "NONE"; - break; - case Particle: - userGadgetPersistence._particleEffect = "NONE"; - break; - case Costume: - OutfitGadget outfitGadget = (OutfitGadget) gadget; - userGadgetPersistence.addCostume(outfitGadget.GetSlot().getSlot(), "NONE"); - break; - case DoubleJump: - userGadgetPersistence._doubleJump = "NONE"; - break; - case ArrowTrail: - userGadgetPersistence._arrowEffect = "NONE"; - break; - case Death: - userGadgetPersistence._deathAnimation = "NONE"; - break; - case Hat: - userGadgetPersistence._hat = "NONE"; - break; - case WinEffect: - userGadgetPersistence._winEffect = "NONE"; - break; - case GameModifier: - GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; - switch (gadgetGameModifier.getGameType()) - { - case MineStrike: - userGadgetPersistence._minestrikeModifiers = userGadgetPersistence.removeGameModifier(userGadgetPersistence._minestrikeModifiers, name); - break; - case SurvivalGames: - userGadgetPersistence._survivalGamesModifiers = userGadgetPersistence.removeGameModifier(userGadgetPersistence._survivalGamesModifiers, name); - break; - case Bridges: - userGadgetPersistence._bridgeModifiers = userGadgetPersistence.removeGameModifier(userGadgetPersistence._bridgeModifiers, name); - break; - } - } - _gadgetPetsistenceManager.savePersistence(event.getPlayer()); - } - - @EventHandler - public void MountActivate(MountActivateEvent event) + public void onMountActivate(MountActivateEvent event) { if (!_gadgetsEnabled) event.setCancelled(true); @@ -1050,8 +968,50 @@ public class GadgetManager extends MiniPlugin event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.PIG_IDLE, 1f, 1f); } - public UserGadgetPersistence getUserGadgetPersistence(Player player) + @EventHandler + public void onGadgetEnable(GadgetEnableEvent event) { - return _gadgetPetsistenceManager.Get(player); + if (!_gadgetsEnabled) + event.setCancelled(true); + } + + @EventHandler + public void onGadgetApplied(GadgetAppliedEvent event) + { + Player player = event.getPlayer(); + Gadget gadget = event.getGadget(); + GadgetType gadgetType = gadget.getGadgetType(); + switch (gadgetType) + { + case MusicDisc: + case Item: + break; + case Costume: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + switch (outfitGadget.getSlot()) + { + case Helmet: + _userGadgetPersistence.save(player, "activeCostumeHelmet", outfitGadget.getName()); + break; + case Chest: + _userGadgetPersistence.save(player, "activeCostumeChestplate", outfitGadget.getName()); + break; + case Legs: + _userGadgetPersistence.save(player, "activeCostumeLeggings", outfitGadget.getName()); + break; + case Boots: + _userGadgetPersistence.save(player, "activeCostumeBoots", outfitGadget.getName()); + break; + } + break; + case GameModifier: + GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; + String key = "active" + gadget.getName().replace(" ", "") + gadgetGameModifier.getGameType().getName().replace(" ", ""); + _userGadgetPersistence.save(player, key, "enabled"); + break; + default: + _userGadgetPersistence.save(player, gadgetType.getDatabaseKey(), gadget.getName()); + break; + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java index e7d3bdeff..6b8969fed 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java @@ -89,11 +89,11 @@ public class AmmoCommand extends CommandBase try { int ammo = Integer.parseInt(amount); - _plugin.getInventoryManager().addItemToInventory(target, gadget.GetName(), ammo); - UtilPlayer.message(caller, F.main("Ammo", "You gave " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.GetName()) + " to " + F.name(target.getName()) + ".")); + _plugin.getInventoryManager().addItemToInventory(target, gadget.getName(), ammo); + UtilPlayer.message(caller, F.main("Ammo", "You gave " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.getName()) + " to " + F.name(target.getName()) + ".")); if (target != null) { - UtilPlayer.message(target, F.main("Ammo", F.name(caller.getName()) + " gave you " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.GetName()) + ".")); + UtilPlayer.message(target, F.main("Ammo", F.name(caller.getName()) + " gave you " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.getName()) + ".")); } } catch (Exception e) @@ -106,7 +106,7 @@ public class AmmoCommand extends CommandBase { for (Gadget gadget : _plugin.getGadgets(GadgetType.Item)) { - if (gadget.GetName().equalsIgnoreCase(gadgetName.replaceAll("_", " "))) + if (gadget.getName().equalsIgnoreCase(gadgetName.replaceAll("_", " "))) return gadget; } return null; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index 25f03de1d..82eede2df 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -64,7 +64,7 @@ public class LockCosmeticsCommand extends CommandBase } for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - _plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.GetName()); + _plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.getName()); } UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name() + " cosmetics!")); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java index 44a2a3643..53ec47121 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -64,7 +64,7 @@ public class UnlockCosmeticsCommand extends CommandBase } for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - _plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.GetName()); + _plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.getName()); } UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name() + " cosmetics!")); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetAppliedEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetAppliedEvent.java new file mode 100644 index 000000000..ca7c38f72 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetAppliedEvent.java @@ -0,0 +1,42 @@ +package mineplex.core.gadget.event; + +import mineplex.core.gadget.types.Gadget; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class GadgetAppliedEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private Gadget _gadget; + + public GadgetAppliedEvent(Player player, Gadget gadget) + { + _player = player; + _gadget = gadget; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Gadget getGadget() + { + return _gadget; + } + + public Player getPlayer() + { + return _player; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/Ammo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/Ammo.java index d8b7fc648..71d36ba62 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/Ammo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/Ammo.java @@ -18,7 +18,7 @@ public class Ammo extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java index d0b1fcf4c..57938844b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/titan/ArrowTrailTitan.java @@ -45,7 +45,7 @@ public class ArrowTrailTitan extends ArrowEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java index a10c9bd60..1d4fd7b3e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/titan/DeathTitan.java @@ -34,7 +34,7 @@ public class DeathTitan extends DeathEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java index 03423b740..2282001f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/titan/DoubleJumpTitan.java @@ -4,7 +4,6 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -40,7 +39,7 @@ public class DoubleJumpTitan extends DoubleJumpEffectGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java index 85dd1827e..13948042c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java @@ -46,11 +46,11 @@ public class KitGameModifier extends GadgetGameModifier } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kit)).forEach(g -> g.Disable(player)); + Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kit)).forEach(g -> g.disable(player)); - super.EnableCustom(player); + super.enableCustom(player); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java index 2b1734ef2..74c989f4f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java @@ -83,11 +83,11 @@ public class GameModifierMineStrikeSkin extends GadgetGameModifier } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.Disable(player)); + Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.disable(player)); - super.EnableCustom(player); + super.enableCustom(player); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java index ba436a8b2..a9add458a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemBatGun.java @@ -47,9 +47,9 @@ public class ItemBatGun extends ItemGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - super.DisableCustom(player); + super.disableCustom(player); Clear(player); } @@ -67,7 +67,7 @@ public class ItemBatGun extends ItemGadget _bats.get(player).add(player.getWorld().spawn(player.getEyeLocation(), Bat.class)); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java index 71544264e..be4f1d5ef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java @@ -84,10 +84,10 @@ public class ItemCoal extends ItemGadget { goal = _hat; - if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _hat) + if(Manager.getInventoryManager().Get(player).getItemCount(getName()) >= _hat) { - Recharge.Instance.recharge(player, GetName()); - Recharge.Instance.use(player, GetName(), 30000, true, true); + Recharge.Instance.recharge(player, getName()); + Recharge.Instance.use(player, getName(), 30000, true, true); Manager.getInventoryManager().addItemToInventory(new Callback() { @@ -101,8 +101,8 @@ public class ItemCoal extends ItemGadget UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 0.5f, 0.0f, 0.5f, 0, 100, ViewDist.LONG); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); - Manager.getInventoryManager().addItemToInventory(player, GetName(), -_hat); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + Manager.getInventoryManager().addItemToInventory(player, getName(), -_hat); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Lump of Coal Hat"); } @@ -121,10 +121,10 @@ public class ItemCoal extends ItemGadget { goal = _pet; - if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _pet) + if(Manager.getInventoryManager().Get(player).getItemCount(getName()) >= _pet) { - Recharge.Instance.recharge(player, GetName()); - Recharge.Instance.use(player, GetName(), 30000, true, true); + Recharge.Instance.recharge(player, getName()); + Recharge.Instance.use(player, getName(), 30000, true, true); PetReward reward = new PetReward( Manager.getPetManager(), @@ -143,8 +143,8 @@ public class ItemCoal extends ItemGadget UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1f, 0.0f, 1f, 0, 250, ViewDist.LONG); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); - Manager.getInventoryManager().addItemToInventory(player, GetName(), -_pet); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + Manager.getInventoryManager().addItemToInventory(player, getName(), -_pet); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Apparition"); } @@ -159,10 +159,10 @@ public class ItemCoal extends ItemGadget { goal = _particle; - if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) >= _particle) + if(Manager.getInventoryManager().Get(player).getItemCount(getName()) >= _particle) { - Recharge.Instance.recharge(player, GetName()); - Recharge.Instance.use(player, GetName(), 30000, true, true); + Recharge.Instance.recharge(player, getName()); + Recharge.Instance.use(player, getName(), 30000, true, true); Manager.getInventoryManager().addItemToInventory(new Callback() { @@ -176,8 +176,8 @@ public class ItemCoal extends ItemGadget UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 1.5f, 0.0f, 1.5f, 0, 500, ViewDist.LONG); player.getWorld().playSound(player.getLocation(), Sound.WITHER_DEATH, 0.8f, 0); - Manager.getInventoryManager().addItemToInventory(player, GetName(), -_particle); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + Manager.getInventoryManager().addItemToInventory(player, getName(), -_particle); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); Manager.getDonationManager().Get(player).AddUnknownSalesPackagesOwned("Coal Fumes"); } @@ -191,7 +191,7 @@ public class ItemCoal extends ItemGadget } } - goal -= Manager.getInventoryManager().Get(player).getItemCount(GetName()); + goal -= Manager.getInventoryManager().Get(player).getItemCount(getName()); if (goal > 0 && Math.random() > 0.95) { @@ -219,21 +219,21 @@ public class ItemCoal extends ItemGadget if (UtilBlock.usable(event.getClickedBlock())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial())) return; Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); //Stock - if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0) + if (Manager.getInventoryManager().Get(player).getItemCount(getName()) <= 0) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -242,13 +242,13 @@ public class ItemCoal extends ItemGadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; } - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); ActivateCustom(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java index 1f9f69217..7bebd373d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java @@ -109,7 +109,7 @@ public class ItemCoinBomb extends ItemGadget event.setCancelled(true); event.getItem().remove(); - Manager.getDonationManager().RewardCoinsLater(GetName() + " Pickup", event.getPlayer(), 4); + Manager.getDonationManager().RewardCoinsLater(getName() + " Pickup", event.getPlayer(), 4); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java index 7f0b83cba..973d2f55d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemEtherealPearl.java @@ -1,8 +1,6 @@ package mineplex.core.gadget.gadgets.item; -import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import org.bukkit.Color; import org.bukkit.FireworkEffect; @@ -10,7 +8,6 @@ import org.bukkit.Material; import org.bukkit.FireworkEffect.Type; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; @@ -45,9 +42,9 @@ public class ItemEtherealPearl extends ItemGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - super.DisableCustom(player); + super.disableCustom(player); } @Override @@ -60,7 +57,7 @@ public class ItemEtherealPearl extends ItemGadget pearl.setPassenger(player); //Inform - UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(getName()) + ".")); //Dont Collide ((CraftPlayer)player).getHandle().spectating = true; @@ -73,7 +70,7 @@ public class ItemEtherealPearl extends ItemGadget @EventHandler public void teleportCancel(PlayerTeleportEvent event) { - if (!IsActive(event.getPlayer())) + if (!isActive(event.getPlayer())) return; if (event.getCause() == TeleportCause.ENDER_PEARL) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java index 597dc0a2a..aaaa6aa50 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFirework.java @@ -41,13 +41,13 @@ public class ItemFirework extends ItemGadget { if (block.getTypeId() == 90) { - UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " near Portals.")); + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(getName()) + " near Portals.")); return; } } //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); double r = Math.random(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java index dfb2526eb..a22679254 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java @@ -7,7 +7,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -48,7 +47,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.5f); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); //Effect item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f); @@ -80,7 +79,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown target.playEffect(EntityEffect.HURT); //Inform - UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + ".")); + UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(getName()) + ".")); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java index 085a5a5cb..71f6dd3b3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFlowerGift.java @@ -5,7 +5,6 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.valentines.event.AttemptGiftEvent; import org.bukkit.Bukkit; @@ -15,7 +14,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractAtEntityEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; public class ItemFlowerGift extends ItemGadget @@ -43,15 +41,15 @@ public class ItemFlowerGift extends ItemGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; - if (!UtilGear.isMat(player.getItemInHand(), GetDisplayMaterial())) + if (!UtilGear.isMat(player.getItemInHand(), getDisplayMaterial())) return; if (!hasAmmo(player)) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -60,7 +58,7 @@ public class ItemFlowerGift extends ItemGadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; @@ -74,7 +72,7 @@ public class ItemFlowerGift extends ItemGadget } else { - UtilPlayer.message(player, F.main("Gadget", "You used " + F.elem(GetName()) + " on " + F.name(event.getRightClicked().getName()) + ". It's not very effective...")); + UtilPlayer.message(player, F.main("Gadget", "You used " + F.elem(getName()) + " on " + F.name(event.getRightClicked().getName()) + ". It's not very effective...")); } event.setCancelled(true); @@ -87,19 +85,19 @@ public class ItemFlowerGift extends ItemGadget if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return; - if (!IsActive(event.getPlayer())) + if (!isActive(event.getPlayer())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), getDisplayMaterial())) return; //Recharge - if (!Recharge.Instance.use(event.getPlayer(), GetName(), GetName(), _recharge, false, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(event.getPlayer(), getName(), getName(), _recharge, false, true, false, true, "Cosmetics")) return; if (!hasAmmo(event.getPlayer())) { - UtilPlayer.message(event.getPlayer(), F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(event.getPlayer(), F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java index b44dfd504..a405ea02c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFootball.java @@ -7,7 +7,6 @@ import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand; import org.bukkit.entity.Bat; import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; @@ -61,7 +60,7 @@ public class ItemFootball extends ItemGadget _active.add(bat); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); } @EventHandler @@ -83,7 +82,7 @@ public class ItemFootball extends ItemGadget if (UtilMath.offset(ball, other) > 1.5) continue; - if (!Recharge.Instance.use(other, GetName() + " Bump", 200, false, false)) + if (!Recharge.Instance.use(other, getName() + " Bump", 200, false, false)) continue; @@ -112,10 +111,10 @@ public class ItemFootball extends ItemGadget if (UtilMath.offset(ball, player) > 2) continue; - if (!Recharge.Instance.use(player, GetName() + " Kick", 1000, false, false)) + if (!Recharge.Instance.use(player, getName() + " Kick", 1000, false, false)) return; - Recharge.Instance.useForce(player, GetName() + " Bump", 1000); + Recharge.Instance.useForce(player, getName() + " Bump", 1000); //Velocity UtilAction.velocity(ball, UtilAlg.getTrajectory2d(player, ball), 2, false, 0, 0, 0, false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java index 79c8635ad..a993f9854 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.EntityEffect; import org.bukkit.Location; @@ -17,9 +16,6 @@ import org.bukkit.entity.Item; 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; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; @@ -69,7 +65,7 @@ public class ItemFreezeCannon extends ItemGadget implements IThrown null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); //Effect item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.5f, 0.5f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java index 1f3346e34..51ae35988 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemLovePotion.java @@ -75,14 +75,14 @@ public class ItemLovePotion extends ItemGadget _active.add(player); List itemLore = new ArrayList(); - itemLore.addAll(Arrays.asList(GetDescription())); + itemLore.addAll(Arrays.asList(getDescription())); itemLore.add(C.cBlack); - itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(GetName())); + itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(getName())); - player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(getDisplayMaterial(), getDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())).setHideInfo(true).build()); if (inform) - UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(getName()) + ".")); } @EventHandler @@ -90,10 +90,10 @@ public class ItemLovePotion extends ItemGadget { Player player = event.getPlayer(); - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), getDisplayMaterial())) return; - if (!IsActive(player)) + if (!isActive(player)) return; if (!Recharge.Instance.use(player, "Interact Love Potion", 1000, false, false)) @@ -104,7 +104,7 @@ public class ItemLovePotion extends ItemGadget //Stock if (!hasAmmo(player)) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -112,7 +112,7 @@ public class ItemLovePotion extends ItemGadget return; } - if (!Recharge.Instance.usable(player, GetName())) + if (!Recharge.Instance.usable(player, getName())) { UtilInv.Update(player); return; @@ -126,11 +126,11 @@ public class ItemLovePotion extends ItemGadget if (gadgetEvent.isCancelled()) return; - Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown + Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown - Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); + Manager.getInventoryManager().addItemToInventory(player, getName(), -1); - player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(getDisplayMaterial(), getDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())).setHideInfo(true).build()); } @EventHandler @@ -142,12 +142,12 @@ public class ItemLovePotion extends ItemGadget if (UtilBlock.usable(event.getClickedBlock())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial())) return; Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!Recharge.Instance.use(player, "Interact Love Potion", 500, false, false)) @@ -158,7 +158,7 @@ public class ItemLovePotion extends ItemGadget //Stock if (!hasAmmo(player)) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -167,7 +167,7 @@ public class ItemLovePotion extends ItemGadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; @@ -176,9 +176,9 @@ public class ItemLovePotion extends ItemGadget String message = UtilMath.randomElement(DRINK_MESSAGES); UtilPlayer.message(player, F.main("Potion", message)); - Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); + Manager.getInventoryManager().addItemToInventory(player, getName(), -1); - player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build()); + player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(getDisplayMaterial(), getDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())).setHideInfo(true).build()); ActivateCustom(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java index 78269f173..8f43f9876 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java @@ -60,7 +60,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + ".")); //Effect item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.5f, 0.5f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java index 790a66d44..d1aff120d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPaintbrush.java @@ -12,7 +12,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityInteractEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -21,13 +20,11 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; -import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.types.GadgetType; @@ -60,12 +57,12 @@ public class ItemPaintbrush extends ItemGadget _active.add(player); List itemLore = new ArrayList(); - itemLore.addAll(Arrays.asList(GetDescription())); + itemLore.addAll(Arrays.asList(getDescription())); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, GetName())); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, getName())); if (inform) - UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(getName()) + ".")); } @Override @@ -82,7 +79,7 @@ public class ItemPaintbrush extends ItemGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { ApplyItem(player, true); @@ -92,7 +89,7 @@ public class ItemPaintbrush extends ItemGadget @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { _brushColor.remove(player.getName()); _brushPrevious.remove(player.getName()); @@ -104,7 +101,7 @@ public class ItemPaintbrush extends ItemGadget @EventHandler public void colorSelect(PlayerInteractEvent event) { - if (!IsActive(event.getPlayer())) + if (!isActive(event.getPlayer())) return; Player player = event.getPlayer(); @@ -130,14 +127,14 @@ public class ItemPaintbrush extends ItemGadget for (Player player : UtilServer.getPlayers()) { - if (!GetActive().contains(player)) + if (!getActive().contains(player)) continue; Location loc = _playerLocation.get(player.getName()); if (loc == null || UtilMath.offset(player.getLocation(), loc) > 12) { - Disable(player); + disable(player); } } } @@ -148,7 +145,7 @@ public class ItemPaintbrush extends ItemGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD)) continue; @@ -192,7 +189,7 @@ public class ItemPaintbrush extends ItemGadget @EventHandler public void enableInteract(PlayerInteractEntityEvent event) { - if (IsActive(event.getPlayer())) + if (isActive(event.getPlayer())) return; if (!(event.getRightClicked() instanceof Villager)) @@ -202,7 +199,7 @@ public class ItemPaintbrush extends ItemGadget if (villager.getCustomName() != null && villager.getCustomName().contains("Bob Ross")) { - Enable(event.getPlayer()); + enable(event.getPlayer()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java index 6584046e5..eecba68e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemTNT.java @@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.item; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -49,7 +48,7 @@ public class ItemTNT extends ItemGadget _tnt.put(tnt, player); //Inform - UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(GetName()) + ".")); + UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(getName()) + ".")); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java index c6a61b789..2304a7475 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java @@ -13,7 +13,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -21,7 +20,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; @@ -56,7 +54,7 @@ public class MorphBat extends MorphGadget implements IThrown } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -67,7 +65,7 @@ public class MorphBat extends MorphGadget implements IThrown } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -81,13 +79,13 @@ public class MorphBat extends MorphGadget implements IThrown { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 100, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 100, false, false, "Cosmetics")) return; //Effect @@ -105,7 +103,7 @@ public class MorphBat extends MorphGadget implements IThrown if (player.getGameMode() == GameMode.CREATIVE) return; - if (!IsActive(player)) + if (!isActive(player)) return; if (!Recharge.Instance.use(player, "Poop", 4000, true, false, "Cosmetics")) @@ -164,7 +162,7 @@ public class MorphBat extends MorphGadget implements IThrown if (player.getGameMode() == GameMode.CREATIVE) return; - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); @@ -180,7 +178,7 @@ public class MorphBat extends MorphGadget implements IThrown player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+0.5)); //Set Recharge - Recharge.Instance.use(player, GetName(), 40, false, false); + Recharge.Instance.use(player, getName(), 40, false, false); } @EventHandler @@ -189,7 +187,7 @@ public class MorphBat extends MorphGadget implements IThrown if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.getGameMode() == GameMode.CREATIVE) continue; @@ -198,7 +196,7 @@ public class MorphBat extends MorphGadget implements IThrown { player.setAllowFlight(true); } - else if (Recharge.Instance.usable(player, GetName())) + else if (Recharge.Instance.usable(player, getName())) { player.setAllowFlight(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java index 1ea72b7e4..9fd7c7b72 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -38,7 +37,7 @@ public class MorphBlaze extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -49,7 +48,7 @@ public class MorphBlaze extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -60,7 +59,7 @@ public class MorphBlaze extends MorphGadget { if (event.getType() == UpdateType.TICK) { - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.isSneaking()) { @@ -85,7 +84,7 @@ public class MorphBlaze extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java index dea95636a..71f3040be 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlock.java @@ -46,7 +46,7 @@ public class MorphBlock extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -54,7 +54,7 @@ public class MorphBlock extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); @@ -91,7 +91,7 @@ public class MorphBlock extends MorphGadget if (!UtilBlock.solid(event.getClickedBlock())) return; - if (!Recharge.Instance.use(event.getPlayer(), GetName(), 500, false, false)) + if (!Recharge.Instance.use(event.getPlayer(), getName(), 500, false, false)) return; BlockForm form = _active.get(event.getPlayer()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java index 50d789985..9e09961f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java @@ -29,7 +29,6 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -66,7 +65,7 @@ public class MorphBunny extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -80,7 +79,7 @@ public class MorphBunny extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { _jumpCharge.remove(player); this.RemoveArmor(player); @@ -96,7 +95,7 @@ public class MorphBunny extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; //Start @@ -146,7 +145,7 @@ public class MorphBunny extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -172,7 +171,7 @@ public class MorphBunny extends MorphGadget UtilAction.velocity(egg, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false); - Manager.getDonationManager().RewardCoinsLater(this.GetName() + " Egg Hide", player, -500); + Manager.getDonationManager().RewardCoinsLater(this.getName() + " Egg Hide", player, -500); egg.setPickupDelay(40); @@ -199,7 +198,7 @@ public class MorphBunny extends MorphGadget event.setCancelled(true); event.getItem().remove(); - Manager.getDonationManager().RewardCoinsLater(GetName() + " Egg Pickup", event.getPlayer(), 450); + Manager.getDonationManager().RewardCoinsLater(getName() + " Egg Pickup", event.getPlayer(), 450); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 0.75f); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 1.25f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java index 5d989f5e0..9ff4d5e56 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java @@ -1,7 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import org.bukkit.ChatColor; -import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; @@ -11,11 +9,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.util.Vector; -import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; @@ -47,7 +43,7 @@ public class MorphChicken extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -58,7 +54,7 @@ public class MorphChicken extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -72,13 +68,13 @@ public class MorphChicken extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 100, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 100, false, false, "Cosmetics")) return; Vector offset = player.getLocation().getDirection(); @@ -101,7 +97,7 @@ public class MorphChicken extends MorphGadget if (player.getGameMode() == GameMode.CREATIVE) return; - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); @@ -119,7 +115,7 @@ public class MorphChicken extends MorphGadget player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+1)); //Set Recharge - Recharge.Instance.use(player, GetName(), 80, false, false); + Recharge.Instance.use(player, getName(), 80, false, false); //Energy player.setExp(Math.max(0f, player.getExp() - (1f/9f))); @@ -131,7 +127,7 @@ public class MorphChicken extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.getGameMode() == GameMode.CREATIVE) continue; @@ -141,7 +137,7 @@ public class MorphChicken extends MorphGadget player.setExp(0.999f); player.setAllowFlight(true); } - else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0) + else if (Recharge.Instance.usable(player, getName()) && player.getExp() > 0) { player.setAllowFlight(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java index 95ce07b35..2b6694280 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java @@ -31,7 +31,7 @@ public class MorphCow extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -42,7 +42,7 @@ public class MorphCow extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -53,13 +53,13 @@ public class MorphCow extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 2500, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 2500, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 1f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java index 90478d1eb..1d5126468 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java @@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; -import org.bukkit.ChatColor; import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; @@ -46,7 +45,7 @@ public class MorphCreeper extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -57,7 +56,7 @@ public class MorphCreeper extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -68,7 +67,7 @@ public class MorphCreeper extends MorphGadget { if (event.getType() == UpdateType.TICK) { - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.isSneaking()) { @@ -172,7 +171,7 @@ public class MorphCreeper extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java index b833b52bb..2ad50feb3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java @@ -42,7 +42,7 @@ public class MorphEnderman extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -53,7 +53,7 @@ public class MorphEnderman extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -70,7 +70,7 @@ public class MorphEnderman extends MorphGadget if (player.getGameMode() == GameMode.CREATIVE) return; - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); @@ -80,7 +80,7 @@ public class MorphEnderman extends MorphGadget player.setAllowFlight(false); //Set Recharge - Recharge.Instance.use(player, GetName(), 2000, false, false, "Cosmetics"); + Recharge.Instance.use(player, getName(), 2000, false, false, "Cosmetics"); //Smoke Trail Block lastSmoke = player.getLocation().getBlock(); @@ -153,12 +153,12 @@ public class MorphEnderman extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (player.getGameMode() == GameMode.CREATIVE) continue; - if (Recharge.Instance.usable(player, GetName())) + if (Recharge.Instance.usable(player, getName())) { player.setAllowFlight(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java index 04fa7c32e..2ce744cb0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java @@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashSet; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -45,7 +44,7 @@ public class MorphPig extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -56,7 +55,7 @@ public class MorphPig extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -67,13 +66,13 @@ public class MorphPig extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 400, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 400, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(0.75 + Math.random() * 0.5)); @@ -85,7 +84,7 @@ public class MorphPig extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.ULTRA)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } @@ -93,7 +92,7 @@ public class MorphPig extends MorphGadget public void Collide(PlayerToggleFlightEvent event) { _double.add(event.getPlayer()); - Recharge.Instance.useForce(event.getPlayer(), GetName() + " Double Jump", 200); + Recharge.Instance.useForce(event.getPlayer(), getName() + " Double Jump", 200); } @EventHandler @@ -102,12 +101,12 @@ public class MorphPig extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { //Grounded if (_double.contains(player)) if (UtilEnt.isGrounded(player)) - if (Recharge.Instance.usable(player, GetName() + " Double Jump")) + if (Recharge.Instance.usable(player, getName() + " Double Jump")) _double.remove(player); double range = 1; @@ -118,7 +117,7 @@ public class MorphPig extends MorphGadget if (player.getVehicle() != null) continue; - if (!Recharge.Instance.usable(player, GetName() + " Collide")) + if (!Recharge.Instance.usable(player, getName() + " Collide")) continue; for (Player other : UtilServer.getPlayers()) @@ -129,7 +128,7 @@ public class MorphPig extends MorphGadget if (other.getVehicle() != null) continue; - if (!Recharge.Instance.usable(other, GetName() + " Collide")) + if (!Recharge.Instance.usable(other, getName() + " Collide")) continue; if (UtilMath.offset(player, other) > range) @@ -139,8 +138,8 @@ public class MorphPig extends MorphGadget continue; //Cooldown - Recharge.Instance.useForce(other, GetName() + " Collide", 200); - Recharge.Instance.useForce(player, GetName() + " Collide", 200); + Recharge.Instance.useForce(other, getName() + " Collide", 200); + Recharge.Instance.useForce(player, getName() + " Collide", 200); double power = 0.4; double height = 0.1; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java index ed425a5de..622a4c042 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java @@ -29,7 +29,7 @@ public class MorphPumpkinKing extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -47,7 +47,7 @@ public class MorphPumpkinKing extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java index 7e539bf90..51db16da6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java @@ -43,7 +43,7 @@ public class MorphSlime extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -65,7 +65,7 @@ public class MorphSlime extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -76,7 +76,7 @@ public class MorphSlime extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -85,7 +85,7 @@ public class MorphSlime extends MorphGadget if (!UtilEnt.isGrounded(player)) return; - if (!Recharge.Instance.use(player, GetName(), 1000, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 1000, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.SLIME_ATTACK, 1f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java index 8834023e1..7e31855f3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java @@ -55,7 +55,7 @@ public class MorphSnowman extends MorphGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { this.ApplyArmor(player); @@ -66,7 +66,7 @@ public class MorphSnowman extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -75,7 +75,7 @@ public class MorphSnowman extends MorphGadget @EventHandler public void onInteract(PlayerInteractEvent event) { - if(!IsActive(event.getPlayer())) return; + if(!isActive(event.getPlayer())) return; if(!UtilEvent.isAction(event, ActionType.L)) return; @@ -93,7 +93,7 @@ public class MorphSnowman extends MorphGadget if (event.getType() == UpdateType.FASTEST) { - for (Player player : GetActive()) + for (Player player : getActive()) { NautHashMap map = Recharge.Instance.Get(player); if(map == null) continue; @@ -120,7 +120,7 @@ public class MorphSnowman extends MorphGadget if(event.getType() == UpdateType.TICK) { - for (Player player : GetActive()) + for (Player player : getActive()) { if(player.isSneaking() && UtilEnt.isGrounded(player)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index aaed71945..0c3d7a65a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -55,7 +55,7 @@ public class MorphTitan extends MorphGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { this.ApplyArmor(player); @@ -67,7 +67,7 @@ public class MorphTitan extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -85,7 +85,7 @@ public class MorphTitan extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -119,13 +119,13 @@ public class MorphTitan extends MorphGadget //Fake Head UtilEnt.setFakeHead(player, true); - Recharge.Instance.useForce(player, GetName() + " FakeHead", 2000); + Recharge.Instance.useForce(player, getName() + " FakeHead", 2000); } @EventHandler public void lazerEnd(RechargedEvent event) { - if (event.GetAbility().equals(GetName() + " FakeHead")) + if (event.GetAbility().equals(getName() + " FakeHead")) { UtilEnt.setFakeHead(event.GetPlayer(), false); @@ -194,7 +194,7 @@ public class MorphTitan extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (UtilPlayer.isSpectator(player)) continue; @@ -212,7 +212,7 @@ public class MorphTitan extends MorphGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index d2e9f9bad..1fdc71369 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -14,7 +14,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.*; import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; @@ -26,7 +25,6 @@ import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -55,7 +53,7 @@ public class MorphVillager extends MorphGadget implements IThrown } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -66,7 +64,7 @@ public class MorphVillager extends MorphGadget implements IThrown } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -77,7 +75,7 @@ public class MorphVillager extends MorphGadget implements IThrown { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) @@ -89,7 +87,7 @@ public class MorphVillager extends MorphGadget implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), 800, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 800, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_IDLE, 1f, 1f); @@ -102,7 +100,7 @@ public class MorphVillager extends MorphGadget implements IThrown Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, true, null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f); - Manager.getDonationManager().RewardGems(null, this.GetName() + " Throw", player.getName(), player.getUniqueId(), -20); + Manager.getDonationManager().RewardGems(null, this.getName() + " Throw", player.getName(), player.getUniqueId(), -20); gem.setPickupDelay(40); @@ -152,7 +150,7 @@ public class MorphVillager extends MorphGadget implements IThrown event.setCancelled(true); event.getItem().remove(); - Manager.getDonationManager().RewardGemsLater(GetName() + " Pickup", event.getPlayer(), 16); + Manager.getDonationManager().RewardGemsLater(getName() + " Pickup", event.getPlayer(), 16); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java index f5029d34b..d2cccc413 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java @@ -56,7 +56,7 @@ public class MorphWither extends MorphGadget } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { this.ApplyArmor(player); @@ -73,7 +73,7 @@ public class MorphWither extends MorphGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { this.RemoveArmor(player); Manager.getDisguiseManager().undisguise(player); @@ -90,13 +90,13 @@ public class MorphWither extends MorphGadget { Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 2500, false, false, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), 2500, false, false, "Cosmetics")) return; Vector offset = player.getLocation().getDirection(); @@ -165,7 +165,7 @@ public class MorphWither extends MorphGadget if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive()) + for (Player player : getActive()) { if (UtilPlayer.isSpectator(player)) continue; @@ -184,13 +184,13 @@ public class MorphWither extends MorphGadget // TODO HARDCODED Wither Morph Database Item Id - 550 if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND)) { - Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(550, GetName()), 1)); + Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(550, getName()), 1)); } } public void setWitherData(String text, double healthPercent) { - Iterator activeIterator = GetActive().iterator(); + Iterator activeIterator = getActive().iterator(); while (activeIterator.hasNext()) { @@ -200,7 +200,7 @@ public class MorphWither extends MorphGadget if (disguise == null || !(disguise instanceof DisguiseWither)) { - DisableCustom(player); + disableCustom(player); activeIterator.remove(); continue; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java index 8abec4a35..778d5b9a3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/OutfitTeam.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.outfit; import java.util.HashMap; +import mineplex.core.gadget.event.GadgetAppliedEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; @@ -22,7 +23,6 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.OutfitGadget; -import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; @@ -39,44 +39,45 @@ public class OutfitTeam extends OutfitGadget } @Override - public void Enable(Player player) + public void enable(Player player) { - GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); + GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); - + if (gadgetEvent.isCancelled()) { return; } - EnableCustom(player); + enableCustom(player); Manager.setActive(player, this); + Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); } @Override - public void ApplyArmor(Player player) + public void applyArmor(Player player) { Manager.removeGadgetType(player, GadgetType.Morph); - Manager.RemoveOutfit(player, _slot); + Manager.removeOutfit(player, _slot); _active.add(player); if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); } @Override - public void RemoveArmor(Player player) + public void removeArmor(Player player) { if (!_active.remove(player)) return; @@ -88,16 +89,16 @@ public class OutfitTeam extends OutfitGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - ApplyArmor(player); + applyArmor(player); colorArmor(player); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); } @EventHandler(priority=EventPriority.LOWEST) @@ -117,20 +118,20 @@ public class OutfitTeam extends OutfitGadget if (args.length < 2) { - Disable(player); + disable(player); return; } //Will only display the message once - if (GetSlot() == ArmorSlot.Legs) + if (getSlot() == ArmorSlot.Legs) { if (!Recharge.Instance.use(player, "Set Team Color", 20000, true, false)) return; } else { - if (!Recharge.Instance.use(player, "Set Team Color " + GetSlot(), 20000, false, false)) + if (!Recharge.Instance.use(player, "Set Team Color " + getSlot(), 20000, false, false)) return; } @@ -139,28 +140,28 @@ public class OutfitTeam extends OutfitGadget { _colorSetting.put(player.getName(), Color.RED); - if (GetSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.Legs) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cRed + "Red Team Outfit") + "!")); } else if (args[1].equals("yellow")) { _colorSetting.put(player.getName(), Color.YELLOW); - if (GetSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.Legs) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cYellow + "Yellow Team Outfit") + "!")); } else if (args[1].equals("green")) { _colorSetting.put(player.getName(), Color.LIME); - if (GetSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.Legs) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cGreen + "Green Team Outfit") + "!")); } else if (args[1].equals("blue")) { _colorSetting.put(player.getName(), Color.AQUA); - if (GetSlot() == ArmorSlot.Legs) //Only Display Once + if (getSlot() == ArmorSlot.Legs) //Only Display Once UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cAqua + "Blue Team Outfit") + "!")); } else @@ -168,7 +169,7 @@ public class OutfitTeam extends OutfitGadget colorArmor(player); - Enable(player); + enable(player); } private void colorArmor(Player player) @@ -179,43 +180,43 @@ public class OutfitTeam extends OutfitGadget //Get Item ItemStack stack; - if (GetSlot() == ArmorSlot.Helmet) + if (getSlot() == ArmorSlot.Helmet) { stack = player.getInventory().getHelmet(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } } - else if (GetSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.Chest) { stack = player.getInventory().getChestplate(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } } - else if (GetSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.Legs) { stack = player.getInventory().getLeggings(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } } - else if (GetSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.Boots) { stack = player.getInventory().getBoots(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java index be7e1cc32..64a0b6a90 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/ravesuit/OutfitRaveSuit.java @@ -36,16 +36,16 @@ public class OutfitRaveSuit extends OutfitGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - ApplyArmor(player); + applyArmor(player); _colorPhase.put(player.getName(), -1); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); _colorPhase.remove(player.getName()); } @@ -57,49 +57,49 @@ public class OutfitRaveSuit extends OutfitGadget for (Player player : UtilServer.getPlayers()) { - if (!IsActive(player)) + if (!isActive(player)) continue; //Get Item ItemStack stack; - if (GetSlot() == ArmorSlot.Helmet) + if (getSlot() == ArmorSlot.Helmet) { stack = player.getInventory().getHelmet(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); continue; } } - else if (GetSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.Chest) { stack = player.getInventory().getChestplate(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); continue; } } - else if (GetSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.Legs) { stack = player.getInventory().getLeggings(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); continue; } } - else if (GetSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.Boots) { stack = player.getInventory().getBoots(); - if (!UtilGear.isMat(stack, GetDisplayMaterial())) + if (!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); continue; } } @@ -167,7 +167,7 @@ public class OutfitRaveSuit extends OutfitGadget if (event.getType() != UpdateType.FAST) return; - if (GetSlot() != ArmorSlot.Helmet) + if (getSlot() != ArmorSlot.Helmet) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java index 2fa6d8dfa..acf7e9e32 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/spacesuit/OutfitSpaceSuit.java @@ -26,15 +26,15 @@ public class OutfitSpaceSuit extends OutfitGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - ApplyArmor(player); + applyArmor(player); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); } @EventHandler @@ -43,7 +43,7 @@ public class OutfitSpaceSuit extends OutfitGadget if (event.getType() != UpdateType.FAST) return; - if (GetSlot() != ArmorSlot.Helmet) + if (getSlot() != ArmorSlot.Helmet) return; for (Player player : UtilServer.getPlayers()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java index 47ec2f651..dcd3620ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuit.java @@ -33,17 +33,17 @@ public class OutfitWindUpSuit extends OutfitGadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - ApplyArmor(player); + applyArmor(player); _colorPhase.put(player, 0); _percentage.put(player, 0); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); _colorPhase.remove(player); _percentage.remove(player); @@ -68,7 +68,7 @@ public class OutfitWindUpSuit extends OutfitGadget Player player = event.getPlayer(); // Checks if player is wearing suit - if (!IsActive(player)) + if (!isActive(player)) return; if (!getSet().isActive(player)) @@ -123,7 +123,7 @@ public class OutfitWindUpSuit extends OutfitGadget Player player = event.getPlayer(); // Checks if effect is active - if (!IsActive(player)) + if (!isActive(player)) return; int phase = _colorPhase.get(player); @@ -192,9 +192,9 @@ public class OutfitWindUpSuit extends OutfitGadget return; // Checks if material is the same - if(!UtilGear.isMat(stack, GetDisplayMaterial())) + if(!UtilGear.isMat(stack, getDisplayMaterial())) { - Disable(player); + disable(player); return; } @@ -216,19 +216,19 @@ public class OutfitWindUpSuit extends OutfitGadget { ItemStack stack; - if(GetSlot() == ArmorSlot.Helmet) + if(getSlot() == ArmorSlot.Helmet) { stack = player.getInventory().getHelmet(); } - else if (GetSlot() == ArmorSlot.Chest) + else if (getSlot() == ArmorSlot.Chest) { stack = player.getInventory().getChestplate(); } - else if (GetSlot() == ArmorSlot.Legs) + else if (getSlot() == ArmorSlot.Legs) { stack = player.getInventory().getLeggings(); } - else if (GetSlot() == ArmorSlot.Boots) + else if (getSlot() == ArmorSlot.Boots) { stack = player.getInventory().getBoots(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java index a941e7113..a72364d41 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFairy.java @@ -36,9 +36,9 @@ public class ParticleFairy extends ParticleGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); clean(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java index 7cbbed5b5..da57bfcb6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleKronos.java @@ -56,15 +56,15 @@ public class ParticleKronos extends ParticleGadget /*Until it becomes purchasable*/if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.TITAN)) //if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); clean(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java index b52c19002..e1f76d435 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleLegend.java @@ -42,7 +42,7 @@ public class ParticleLegend extends ParticleGadget // TODO HARDCODED Legendary Aura Database Item Id - 552 if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND)) { - Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(552, GetName()), 1)); + Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(552, getName()), 1)); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java index 669ea32f0..b10b946f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/cupidslove/ParticleHeart.java @@ -46,9 +46,9 @@ public class ParticleHeart extends ParticleGadget } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java index 39127dd15..62c1388b3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/frostlord/ParticleFrostLord.java @@ -57,7 +57,7 @@ public class ParticleFrostLord extends ParticleGadget UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(x, scale * 3, z), 0f, 0f, 0f, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); - if (scale > 0.95 && Recharge.Instance.use(player, GetName(), 1000, false, false)) + if (scale > 0.95 && Recharge.Instance.use(player, getName(), 1000, false, false)) { UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, scale * 3.5, 0), 0f, 0f, 0f, 0.2f, 60, ViewDist.NORMAL, UtilServer.getPlayers()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java index 5cd6b70d2..f2df819c8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/titan/ParticleTitan.java @@ -96,7 +96,7 @@ public class ParticleTitan extends ParticleGadget { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectDragonRider.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectDragonRider.java index 7813fbbb1..2f630647c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectDragonRider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectDragonRider.java @@ -21,13 +21,13 @@ public class WinEffectDragonRider extends WinEffectGadget @Override public void play() { - Bukkit.broadcastMessage("Playing effect win effect: " + GetName()); + Bukkit.broadcastMessage("Playing effect win effect: " + getName()); } @Override public void finish() { - Bukkit.broadcastMessage("Playing effect win effect: " + GetName()); + Bukkit.broadcastMessage("Playing effect win effect: " + getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/GadgetPersistenceManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/GadgetPersistenceManager.java deleted file mode 100644 index 703d7cfed..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/GadgetPersistenceManager.java +++ /dev/null @@ -1,77 +0,0 @@ -package mineplex.core.gadget.persistence; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; - -import mineplex.core.MiniDbClientPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.java.JavaPlugin; - -public class GadgetPersistenceManager extends MiniDbClientPlugin -{ - - private final PersistenceRepository _persistenceRepository; - - private Map _saveBuffer = new HashMap<>(); - - public GadgetPersistenceManager(JavaPlugin plugin, CoreClientManager manager) - { - super("GadgetPersistence", plugin, manager); - _persistenceRepository = new PersistenceRepository(plugin); - } - - public void savePersistence(Player caller) - { - _saveBuffer.put(caller.getUniqueId().toString(), Get(caller)); - } - - @EventHandler - public void storeBuffer(UpdateEvent event) - { - if (event.getType() != UpdateType.SLOW) - return; - - Map bufferCopy = new HashMap<>(); - - for (Map.Entry entry : _saveBuffer.entrySet()) - { - bufferCopy.put(entry.getKey(), entry.getValue()); - } - - _saveBuffer.clear(); - - getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() - { - @Override - public void run() - { - _persistenceRepository.savePersistence(bufferCopy); - } - }); - } - - @Override - public UserGadgetPersistence AddPlayer(String player) - { - return new UserGadgetPersistence(); - } - - @Override - public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException - { - Set(playerName, _persistenceRepository.loadClientPersistence(resultSet)); - } - - @Override - public String getQuery(int accountId, String uuid, String name) - { - return "SELECT particleEffect, arrowEffect, doubleJump, deathAnimation, gadgetItem, morph, hat, costume, winEffect, minestrikeModifiers, survivalGamesModifiers, bridgeModifiers FROM gadgetPersistence WHERE gadgetPersistence.uuid = '" + uuid + "' LIMIT 1;"; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/LoadPersistence.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/LoadPersistence.java deleted file mode 100644 index 3f82dd6c0..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/LoadPersistence.java +++ /dev/null @@ -1,127 +0,0 @@ -package mineplex.core.gadget.persistence; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.Gadget; -import mineplex.core.gadget.types.GadgetType; -import org.bukkit.entity.Player; - -/** - * Applies gadgets for players when they join - */ -public class LoadPersistence -{ - - private final GadgetManager _manager; - private final UserGadgetPersistence _userGadgetPersistence; - private final Player _player; - - public LoadPersistence(GadgetManager manager, Player player) - { - _manager = manager; - _userGadgetPersistence = manager.getUserGadgetPersistence(player); - _player = player; - } - - public void givePlayer() - { - // PARTICLE EFFECTS - if (!_userGadgetPersistence._particleEffect.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(_userGadgetPersistence._particleEffect, GadgetType.Particle); - if (gadget != null) - gadget.Enable(_player); - } - // ARROW EFFECTS - if (!_userGadgetPersistence._arrowEffect.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(_userGadgetPersistence._arrowEffect, GadgetType.ArrowTrail); - if (gadget != null) - gadget.Enable(_player); - } - // DOUBLE JUMPS - if (!_userGadgetPersistence._doubleJump.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(_userGadgetPersistence._doubleJump, GadgetType.DoubleJump); - if (gadget != null) - gadget.Enable(_player); - } - // DEATH ANIMATIONS - if (!_userGadgetPersistence._deathAnimation.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(_userGadgetPersistence._deathAnimation, GadgetType.Death); - if (gadget != null) - gadget.Enable(_player); - } - // ITEMS - if (!_userGadgetPersistence._gadgetItem.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(_userGadgetPersistence._gadgetItem, GadgetType.Item); - if (gadget != null) - gadget.Enable(_player); - } - // MORPHS - if (!_userGadgetPersistence._morph.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(_userGadgetPersistence._morph, GadgetType.Morph); - if (gadget != null) - gadget.Enable(_player); - } - // HATS - if (!_userGadgetPersistence._hat.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(_userGadgetPersistence._hat, GadgetType.Hat); - if (gadget != null) - gadget.Enable(_player); - } - // WIN EFFECTS - if (!_userGadgetPersistence._winEffect.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(_userGadgetPersistence._winEffect, GadgetType.WinEffect); - if (gadget != null) - gadget.Enable(_player); - } - // COSTUMES - String[] costumeSplit = _userGadgetPersistence._costume.split(","); - for (String costume : costumeSplit) - { - if (!costume.equalsIgnoreCase("NONE")) - { - Gadget gadget = _manager.getGadget(costume, GadgetType.Costume); - if (gadget != null) - gadget.Enable(_player); - } - } - // GAME MODIFIERS - if(!_userGadgetPersistence._minestrikeModifiers.equalsIgnoreCase("NONE")) - { - String[] minestrikeModifiersSplit = _userGadgetPersistence._minestrikeModifiers.split(","); - for (String modifier : minestrikeModifiersSplit) - { - Gadget gadget = _manager.getGadget(modifier, GadgetType.GameModifier); - if (gadget != null) - gadget.Enable(_player); - } - } - if(!_userGadgetPersistence._survivalGamesModifiers.equalsIgnoreCase("NONE")) - { - String[] survivalGamesModifiersSplit = _userGadgetPersistence._survivalGamesModifiers.split(","); - for (String modifier : survivalGamesModifiersSplit) - { - Gadget gadget = _manager.getGadget(modifier, GadgetType.GameModifier); - if (gadget != null) - gadget.Enable(_player); - } - } - if(!_userGadgetPersistence._bridgeModifiers.equalsIgnoreCase("NONE")) - { - String[] bridgeModifiersSplit = _userGadgetPersistence._bridgeModifiers.split(","); - for (String modifier : bridgeModifiersSplit) - { - Gadget gadget = _manager.getGadget(modifier, GadgetType.GameModifier); - if (gadget != null) - gadget.Enable(_player); - } - } - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/PersistenceRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/PersistenceRepository.java deleted file mode 100644 index a1e5f2c45..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/PersistenceRepository.java +++ /dev/null @@ -1,112 +0,0 @@ -package mineplex.core.gadget.persistence; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Map; - -import mineplex.core.database.MinecraftRepository; -import mineplex.serverdata.database.DBPool; -import mineplex.serverdata.database.column.ColumnVarChar; -import org.bukkit.plugin.java.JavaPlugin; - -public class PersistenceRepository extends MinecraftRepository -{ - - private static String INSERT_ACCOUNT = "INSERT INTO gadgetPersistence (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;"; - private static String UPDATE_GADGET_PERSISTENCE = "UPDATE gadgetPersistence SET particleEffect = ?, arrowEffect = ?, doubleJump = ?, deathAnimation = ?, gadgetItem = ?, morph = ?, hat = ?, costume = ?, winEffect = ?, minestrikeModifiers = ?, survivalGamesModifiers = ?, bridgeModifiers = ? WHERE uuid=?;"; - - public PersistenceRepository(JavaPlugin plugin) - { - super(plugin, DBPool.getAccount()); - } - - @Override - protected void initialize() - { - } - - @Override - protected void update() - { - } - - public void savePersistence(Map persistence) - { - try (Connection connection = getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(UPDATE_GADGET_PERSISTENCE)) - { - for (Map.Entry entry : persistence.entrySet()) - { - preparedStatement.setString(1, entry.getValue()._particleEffect); - preparedStatement.setString(2, entry.getValue()._arrowEffect); - preparedStatement.setString(3, entry.getValue()._doubleJump); - preparedStatement.setString(4, entry.getValue()._deathAnimation); - preparedStatement.setString(5, entry.getValue()._gadgetItem); - preparedStatement.setString(6, entry.getValue()._morph); - preparedStatement.setString(7, entry.getValue()._hat); - preparedStatement.setString(8, entry.getValue()._costume); - preparedStatement.setString(9, entry.getValue()._winEffect); - preparedStatement.setString(10, entry.getValue()._minestrikeModifiers); - preparedStatement.setString(11, entry.getValue()._survivalGamesModifiers); - preparedStatement.setString(12, entry.getValue()._bridgeModifiers); - preparedStatement.setString(13, entry.getKey()); - preparedStatement.addBatch(); - } - - int[] rowsAffected = preparedStatement.executeBatch(); - int i = 0; - - for (Map.Entry entry : persistence.entrySet()) - { - if (rowsAffected[i] < 1) - { - executeUpdate(INSERT_ACCOUNT, new ColumnVarChar("uuid", 100, entry.getKey())); - - preparedStatement.setString(1, entry.getValue()._particleEffect); - preparedStatement.setString(2, entry.getValue()._arrowEffect); - preparedStatement.setString(3, entry.getValue()._doubleJump); - preparedStatement.setString(4, entry.getValue()._deathAnimation); - preparedStatement.setString(5, entry.getValue()._gadgetItem); - preparedStatement.setString(6, entry.getValue()._morph); - preparedStatement.setString(7, entry.getValue()._hat); - preparedStatement.setString(8, entry.getValue()._costume); - preparedStatement.setString(9, entry.getValue()._winEffect); - preparedStatement.setString(10, entry.getValue()._minestrikeModifiers); - preparedStatement.setString(11, entry.getValue()._survivalGamesModifiers); - preparedStatement.setString(12, entry.getValue()._bridgeModifiers); - preparedStatement.setString(13, entry.getKey()); - - preparedStatement.execute(); - } - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - public UserGadgetPersistence loadClientPersistence(final ResultSet set) throws SQLException - { - final UserGadgetPersistence userGadgetPersistence = new UserGadgetPersistence(); - - if (set.next()) - { - userGadgetPersistence._particleEffect = set.getString(1); - userGadgetPersistence._arrowEffect = set.getString(2); - userGadgetPersistence._doubleJump = set.getString(3); - userGadgetPersistence._deathAnimation = set.getString(4); - userGadgetPersistence._gadgetItem = set.getString(5); - userGadgetPersistence._morph = set.getString(6); - userGadgetPersistence._hat = set.getString(7); - userGadgetPersistence._costume = set.getString(9); - userGadgetPersistence._winEffect = set.getString(9); - userGadgetPersistence._minestrikeModifiers = set.getString(10); - userGadgetPersistence._survivalGamesModifiers = set.getString(11); - userGadgetPersistence._bridgeModifiers = set.getString(12); - } - return userGadgetPersistence; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java index fc204d8af..ae8918ff5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java @@ -1,58 +1,82 @@ package mineplex.core.gadget.persistence; -import java.util.StringJoiner; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.*; + +import mineplex.core.common.util.BukkitFuture; +import mineplex.core.database.PlayerKeyValueRepository; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GadgetType; +import org.bukkit.entity.Player; public class UserGadgetPersistence { - private StringJoiner _joiner; - public String _particleEffect = "NONE"; - public String _arrowEffect = "NONE"; - public String _doubleJump = "NONE"; - public String _deathAnimation = "NONE"; - public String _gadgetItem = "NONE"; - public String _morph = "NONE"; - public String _hat = "NONE"; - public String _costume = "NONE,NONE,NONE,NONE"; - public String _winEffect = "NONE"; - public String _minestrikeModifiers = "NONE"; - public String _survivalGamesModifiers = "NONE"; - public String _bridgeModifiers = "NONE"; + private final GadgetManager _manager; + private final PlayerKeyValueRepository _repository; - public void addCostume(int part, String name) + public UserGadgetPersistence(GadgetManager manager) { - String[] costumeParts = _costume.split(","); - costumeParts[part] = name; - _joiner = new StringJoiner(","); - _joiner.add(costumeParts[0]); - _joiner.add(costumeParts[1]); - _joiner.add(costumeParts[2]); - _joiner.add(costumeParts[3]); - _costume = _joiner.toString(); + _manager = manager; + _repository = new PlayerKeyValueRepository<>("gadgets", PreparedStatement::setString, ResultSet::getString, "VARCHAR(255)"); } - public String addGameModifier(String old, String add) + public void load(Player player) { - String[] oldSplit = old.split(","); - _joiner = new StringJoiner(","); - for (int i = 0; i < oldSplit.length - 1; i++) - { - _joiner.add(oldSplit[i]); - } - _joiner.add(add); - return _joiner.toString(); + _repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values -> { + if (player.isOnline()) + { + for (GadgetType gadgetType : GadgetType.values()) + { + switch (gadgetType) + { + case MusicDisc: + case Item: + break; + case Costume: + String[] costumeParts = new String[] {"activeCostumeHelmet", "activeCostumeChestplate", + "activeCostumeLeggings", "activeCostumeBoots"}; + for (String costumePart : costumeParts) + { + Gadget costumeGadget = _manager.getGadget(values.get(costumePart), gadgetType); + if (costumeGadget != null) + costumeGadget.enable(player); + } + break; + case GameModifier: + List gameModifiers = _manager.getGadgets(gadgetType); + for (Gadget gadget : gameModifiers) + { + GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; + String key = "active" + gadget.getName().replace(" ", "") + + gadgetGameModifier.getGameType().getName().replace(" ", ""); + if (values.get(key) != null) + if (values.get(key).equalsIgnoreCase("enabled")) + gadget.enable(player); + } + break; + default: + Gadget gadget = _manager.getGadget(values.get(gadgetType.getDatabaseKey()), gadgetType); + if (gadget != null) + gadget.enable(player); + break; + } + } + } + })); } - public String removeGameModifier(String old, String remove) + public void save(Player player, Map values) { - String[] oldSplit = old.split(","); - _joiner = new StringJoiner(","); - for (int i = 0; i < oldSplit.length - 1; i++) - { - if (!oldSplit[i].equalsIgnoreCase(remove)) - _joiner.add(oldSplit[i]); - } - return _joiner.toString(); + _repository.putAll(player.getUniqueId(), values); + } + + public void save(Player player, String key, String value) + { + _repository.put(player.getUniqueId(), key, value); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java index a32e05163..24cb0f684 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java @@ -10,7 +10,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.updater.UpdateType; @@ -23,23 +22,6 @@ public abstract class ArrowEffectGadget extends Gadget public ArrowEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) { super(manager, GadgetType.ArrowTrail, name, desc, cost, mat, data, 1, altNames); - } - - @Override - public void EnableCustom(Player player) - { - Manager.removeGadgetType(player, GadgetType.ArrowTrail); - - _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); } public boolean shouldDisplay(Player player) @@ -63,7 +45,7 @@ public abstract class ArrowEffectGadget extends Gadget { if (event.getEntity().getShooter() != null) { - if (GetActive().contains(event.getEntity().getShooter())) + if (getActive().contains(event.getEntity().getShooter())) { _arrows.add((Arrow)event.getEntity()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java index 0a8979f9a..ff6ddcbe7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.blood.BloodEvent; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; @@ -14,25 +13,8 @@ public abstract class DeathEffectGadget extends Gadget public DeathEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String... altNames) { super(manager, GadgetType.Death, name, desc, cost, mat, data, 1, altNames); - } + } - @Override - public void EnableCustom(Player player) - { - Manager.removeGadgetType(player, GadgetType.Death); - - _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); - } - public boolean shouldDisplay(Player player) { if (UtilPlayer.isSpectator(player)) @@ -50,7 +32,7 @@ public abstract class DeathEffectGadget extends Gadget if (event.getPlayer() == null) return; - if (!IsActive(event.getPlayer())) + if (!isActive(event.getPlayer())) return; if (!shouldDisplay(event.getPlayer())) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java index cfbc93f40..baf23b1fb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerToggleFlightEvent; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; @@ -14,23 +13,6 @@ public abstract class DoubleJumpEffectGadget extends Gadget public DoubleJumpEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String... altNames) { super(manager, GadgetType.DoubleJump, name, desc, cost, mat, data, 1, altNames); - } - - @Override - public void EnableCustom(Player player) - { - Manager.removeGadgetType(player, GadgetType.DoubleJump); - - _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); } public boolean shouldDisplay(Player player) @@ -51,7 +33,7 @@ public abstract class DoubleJumpEffectGadget extends Gadget return; if (!event.getPlayer().isFlying()) - if (IsActive(event.getPlayer())) + if (isActive(event.getPlayer())) { doEffect(event.getPlayer()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index 11835f1ca..05c4c501a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -7,6 +7,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetAppliedEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetDisableEvent; import mineplex.core.shop.item.SalesPackageBase; @@ -74,70 +75,81 @@ public abstract class Gadget extends SalesPackageBase implements Listener return _gadgetType; } - public HashSet GetActive() + public HashSet getActive() { return _active; } - public boolean IsActive(Player player) + public boolean isActive(Player player) { return _active.contains(player); } @EventHandler - public void PlayerQuit(PlayerQuitEvent event) + public void onPlayerQuit(PlayerQuitEvent event) { - Disable(event.getPlayer()); + disable(event.getPlayer()); } - public void Enable(Player player) + public void enable(Player player) { GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); if (gadgetEvent.isCancelled()) { - UtilPlayer.message(player, F.main("Inventory", GetName() + " is not enabled.")); + UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); return; } System.out.println(player.getName() + " has activated " + Name); - - EnableCustom(player); + Manager.setActive(player, this); + enableCustom(player); + Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); } - public void DisableForAll() + public void disableForAll() { for (Player player : UtilServer.getPlayers()) - Disable(player); + disable(player); } - - public void Disable(Player player) + + public void disable(Player player) { - if (IsActive(player)) + if (isActive(player)) { Manager.removeActive(player, this); GadgetDisableEvent event = new GadgetDisableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(event); - DisableCustom(player); + disableCustom(player); } } - public abstract void EnableCustom(Player player); - public abstract void DisableCustom(Player player); + public void enableCustom(Player player) + { + Manager.removeGadgetType(player, _gadgetType, this); + _active.add(player); + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + ".")); + } + + public void disableCustom(Player player) + { + if (_active.remove(player)) + UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(getName()) + ".")); + } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } public boolean ownsGadget(Player player) { - if(IsFree() || _free) return true; - if(Manager.getDonationManager().Get(player.getName()).OwnsUnknownPackage(GetName())) { return true; } - if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) > 0) { return true; } + if(isFree() || _free) return true; + if(Manager.getDonationManager().Get(player.getName()).OwnsUnknownPackage(getName())) { return true; } + if(Manager.getInventoryManager().Get(player).getItemCount(getName()) > 0) { return true; } for(String alt : _alternativePackageNames) { @@ -157,4 +169,9 @@ public abstract class Gadget extends SalesPackageBase implements Listener { return _set; } + + public String[] getAlternativePackageNames() + { + return _alternativePackageNames; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java index c7674700d..916dbefa4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java @@ -37,19 +37,10 @@ public abstract class GadgetGameModifier extends Gadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { _active.add(player); - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - { - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); - } + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + ".")); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java index 234bbc2dd..e985fce7f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java @@ -47,7 +47,7 @@ public abstract class GadgetSet implements Listener for(Gadget g : _gadgets) { - if(!g.IsActive(player) || g.equals(gadget)) + if(!g.isActive(player) || g.equals(gadget)) { if(enable && g.equals(gadget)) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java index 577d0833e..3ad4cb0e9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java @@ -5,24 +5,26 @@ package mineplex.core.gadget.types; */ public enum GadgetType { - Item("Items"), - Morph("Morphs"), - Particle("Particles"), - MusicDisc("Music Discs"), - Costume("Costumes"), - DoubleJump("Double Jump Effects"), - ArrowTrail("Arrow Trails"), - Death("Death Effects"), - Hat("Hats"), - Taunt("Taunts"), - WinEffect("Win Effects"), - GameModifier("Game Modifiers"); + Item("Items", "activeItem"), + Morph("Morphs", "activeMorph"), + Particle("Particles", "activeParticle"), + MusicDisc("Music Discs", ""), + Costume("Costumes", ""), + DoubleJump("Double Jump Effects", "activeDoubleJump"), + ArrowTrail("Arrow Trails", "activeArrowTrail"), + Death("Death Effects", "activeDeathEffect"), + Hat("Hats", "activeHat"), + Taunt("Taunts", "activeTaunt"), + WinEffect("Win Effects", "activeWinEffect"), + GameModifier("Game Modifiers", ""); private String _name; + private String _databaseKey; - GadgetType(String name) + GadgetType(String name, String databaseKey) { _name = name; + _databaseKey = databaseKey; } /** @@ -32,4 +34,12 @@ public enum GadgetType { return _name; } + + /** + * Returns the name of the database key used to store the active gadgets + */ + public String getDatabaseKey() + { + return _databaseKey; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java index d61339bf8..0f6ff3dfb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java @@ -37,25 +37,25 @@ public abstract class HatGadget extends OutfitGadget return _hat.clone(); } - public void ApplyArmor(Player player) + public void applyArmor(Player player) { - Manager.removeGadgetType(player, GadgetType.Morph); + Manager.removeGadgetType(player, GadgetType.Morph, this); - Manager.RemoveOutfit(player, _slot); + Manager.removeOutfit(player, _slot); _active.add(player); - UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); player.getInventory().setHelmet(getHelmetItem()); } - public void RemoveArmor(Player player) + public void removeArmor(Player player) { if (!_active.remove(player)) return; - UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + ".")); player.getInventory().setHelmet(null); } @@ -81,15 +81,15 @@ public abstract class HatGadget extends OutfitGadget @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - ApplyArmor(player); + applyArmor(player); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { - RemoveArmor(player); + removeArmor(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java index 9dfa14563..178fcfbb6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java @@ -50,48 +50,48 @@ public abstract class ItemGadget extends Gadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { ApplyItem(player, true); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { RemoveItem(player); } - public HashSet GetActive() + public HashSet getActive() { return _active; } - public boolean IsActive(Player player) + public boolean isActive(Player player) { return _active.contains(player); } public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item); + Manager.removeGadgetType(player, GadgetType.Item, this); _active.add(player); List itemLore = new ArrayList(); - itemLore.addAll(Arrays.asList(GetDescription())); + itemLore.addAll(Arrays.asList(getDescription())); itemLore.add(C.cBlack); - itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(GetName())); + itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(getName())); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); if (inform) - UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(getName()) + ".")); } @EventHandler public void orderThatChest(PlayerDropItemEvent event) { - if (IsActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == GetDisplayMaterial()) + if (isActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == getDisplayMaterial()) { if (_preserveStaticItem) return; @@ -104,8 +104,8 @@ public abstract class ItemGadget extends Gadget { if (player.isOnline()) { - player.getInventory().remove(GetDisplayMaterial()); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + player.getInventory().remove(getDisplayMaterial()); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); UtilInv.Update(player); } } @@ -119,7 +119,7 @@ public abstract class ItemGadget extends Gadget { player.getInventory().setItem(Manager.getActiveItemSlot(), null); - UtilPlayer.message(player, F.main("Gadget", "You unequipped " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You unequipped " + F.elem(getName()) + ".")); } } @@ -130,7 +130,7 @@ public abstract class ItemGadget extends Gadget public boolean IsItem(Player player) { - return UtilInv.IsItem(player.getItemInHand(), GetDisplayMaterial(), GetDisplayData()); + return UtilInv.IsItem(player.getItemInHand(), getDisplayMaterial(), getDisplayData()); } @EventHandler @@ -142,12 +142,12 @@ public abstract class ItemGadget extends Gadget if (UtilBlock.usable(event.getClickedBlock())) return; - if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial())) + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial())) return; Player player = event.getPlayer(); - if (!IsActive(player)) + if (!isActive(player)) return; event.setCancelled(true); @@ -156,7 +156,7 @@ public abstract class ItemGadget extends Gadget if (!hasAmmo(player)) { - UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have any " + getName() + " left.")); ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this); Bukkit.getServer().getPluginManager().callEvent(ammoEvent); @@ -165,22 +165,22 @@ public abstract class ItemGadget extends Gadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) + if (!Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; } - Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); + Manager.getInventoryManager().addItemToInventory(player, getName(), -1); - player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName()))); ActivateCustom(event.getPlayer()); } public boolean hasAmmo(Player player) { - return Manager.getInventoryManager().Get(player).getItemCount(GetName()) > 0; + return Manager.getInventoryManager().Get(player).getItemCount(getName()) > 0; } public abstract void ActivateCustom(Player player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java index 96c19d0ad..a9c0de2f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java @@ -8,7 +8,6 @@ import org.bukkit.event.entity.PlayerDeathEvent; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; -import mineplex.core.itemstack.ItemStackFactory; public abstract class MorphGadget extends Gadget { @@ -19,22 +18,22 @@ public abstract class MorphGadget extends Gadget public void ApplyArmor(Player player) { - Manager.removeGadgetType(player, GadgetType.Morph); + Manager.removeGadgetType(player, GadgetType.Morph, this); _active.add(player); - UtilPlayer.message(player, F.main("Gadget", "You morphed into " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You morphed into " + F.elem(getName()) + ".")); } public void RemoveArmor(Player player) { if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You unmorphed from " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You unmorphed from " + F.elem(getName()) + ".")); } @EventHandler public void playerDeath(PlayerDeathEvent event) { - Disable(event.getEntity()); + disable(event.getEntity()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java index c139e85c8..d0955ebbb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java @@ -5,13 +5,12 @@ import java.util.Iterator; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetAppliedEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.gadgets.SongData; -import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -39,14 +38,14 @@ public class MusicGadget extends Gadget } @Override - public void Enable(Player player) + public void enable(Player player) { GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); if (gadgetEvent.isCancelled()) { - UtilPlayer.message(player, F.main("Inventory", GetName() + " is not enabled.")); + UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); return; } @@ -91,18 +90,7 @@ public class MusicGadget extends Gadget player.getWorld().playEffect(player.getLocation(), Effect.RECORD_PLAY, _id); _songs.add(new SongData(player.getLocation().getBlock(), _duration)); - } - - @Override - public void EnableCustom(Player player) - { - - } - - @Override - public void DisableCustom(Player player) - { - + Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java index 69a0bed33..c8aabba05 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -12,22 +12,10 @@ public abstract class OutfitGadget extends Gadget { public enum ArmorSlot { - Helmet(0), - Chest(1), - Legs(2), - Boots(3); - - int _slot; - - ArmorSlot(int slot) - { - _slot = slot; - } - - public int getSlot() - { - return _slot; - } + Helmet, + Chest, + Legs, + Boots } protected ArmorSlot _slot; @@ -39,44 +27,60 @@ public abstract class OutfitGadget extends Gadget _slot = slot; } - public ArmorSlot GetSlot() + public ArmorSlot getSlot() { return _slot; } - public void ApplyArmor(Player player) + public void applyArmor(Player player) { - Manager.removeGadgetType(player, GadgetType.Morph); + Manager.removeGadgetType(player, GadgetType.Morph, this); - Manager.RemoveOutfit(player, _slot); + Manager.removeOutfit(player, _slot); _active.add(player); - UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots( - ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName())); + ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName())); } - public void RemoveArmor(Player player) + public void removeArmor(Player player) { if (!_active.remove(player)) return; - UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + ".")); if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(null); else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(null); else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(null); else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(null); } + + public String getDatabaseKey() + { + switch (_slot) + { + case Helmet: + return "activeCostumeHelmet"; + case Chest: + return "activeCostumeChestplate"; + case Legs: + return "activeCostumeLeggings"; + case Boots: + return "activeCostumeBoots"; + } + return ""; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java index 10766d395..c46423965 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java @@ -31,20 +31,18 @@ public abstract class ParticleGadget extends Gadget } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - Manager.removeGadgetType(player, GadgetType.Particle); - + Manager.removeGadgetType(player, GadgetType.Particle, this); _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(getName()) + ".")); } @Override - public void DisableCustom(Player player) + public void disableCustom(Player player) { if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); } public boolean shouldDisplay(Player player) @@ -61,7 +59,7 @@ public abstract class ParticleGadget extends Gadget @EventHandler public void Caller(UpdateEvent event) { - for (Player player : GetActive()) + for (Player player : getActive()) { if (!shouldDisplay(player)) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index 3ed550da9..a576bf586 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -86,23 +86,6 @@ public abstract class WinEffectGadget extends Gadget { super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, free, alternativesalepackageNames); } - - @Override - public void EnableCustom(Player player) - { - Manager.removeGadgetType(player, GadgetType.WinEffect); - - _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(GetName()) + ".")); - } - - @Override - public void DisableCustom(Player player) - { - if (_active.remove(player)) - UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(GetName()) + ".")); - } public void runPlay() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java index 2431b67c4..acdfffe07 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java @@ -32,7 +32,7 @@ public class GemBooster extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java index 9cf933aac..c25b3e2ad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java @@ -25,7 +25,7 @@ public class DragonMount extends Mount Manager.DeregisterAll(player); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store DragonData dragonData = new DragonData(this, player); @@ -45,7 +45,7 @@ public class DragonMount extends Mount data.Chicken.remove(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java index d4267beec..0e0b801ac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java @@ -107,10 +107,10 @@ public class HorseMount extends Mount> if (_armor != null) horse.getInventory().setArmor(new ItemStack(_armor)); - horse.setCustomName(player.getName() + "'s " + GetName()); + horse.setCustomName(player.getName() + "'s " + getName()); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store SingleEntityMountData mount = new SingleEntityMountData(player, horse); @@ -125,7 +125,7 @@ public class HorseMount extends Mount> mount.remove(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java index ad18c3cc8..5192598fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java @@ -36,7 +36,7 @@ public abstract class Mount extends SalesPackageBase implem } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } @@ -48,7 +48,7 @@ public abstract class Mount extends SalesPackageBase implem if (gadgetEvent.isCancelled()) { - UtilPlayer.message(player, F.main("Inventory", GetName() + " is not enabled.")); + UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java index 3af133864..7bf339bc8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java @@ -1,7 +1,5 @@ package mineplex.core.mount.types; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Minecart; @@ -49,7 +47,7 @@ public class MountCart extends Mount> SingleEntityMountData mount = new SingleEntityMountData(player, player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class)); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store _active.put(player, mount); @@ -63,7 +61,7 @@ public class MountCart extends Mount> mount.remove(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } @@ -138,7 +136,7 @@ public class MountCart extends Mount> Player player = (Player)cart.getPassenger(); - if (!Recharge.Instance.usable(player, GetName() + " Collide")) + if (!Recharge.Instance.usable(player, getName() + " Collide")) continue; for (SingleEntityMountData otherData : GetActive().values()) @@ -155,15 +153,15 @@ public class MountCart extends Mount> Player otherPlayer = (Player)other.getPassenger(); - if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide")) + if (!Recharge.Instance.usable(otherPlayer, getName() + " Collide")) continue; //Collide if (UtilMath.offset(cart, other) > 2) continue; - Recharge.Instance.useForce(player, GetName() + " Collide", 500); - Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500); + Recharge.Instance.useForce(player, getName() + " Collide", 500); + Recharge.Instance.useForce(otherPlayer, getName() + " Collide", 500); UtilAction.velocity(cart, UtilAlg.getTrajectory(other, cart), 1.2, false, 0, 0.8, 10, true); UtilAction.velocity(other, UtilAlg.getTrajectory(cart, other), 1.2, false, 0, 0.8, 10, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java index 918585528..2830acfa4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java @@ -108,7 +108,7 @@ public class MountDragon extends DragonMount { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.HERO)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java index 5a8617699..e836ad324 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java @@ -50,7 +50,7 @@ public class MountFrost extends HorseMount // if (event.getType() != UpdateType.TICK) // return; // -// for (Horse horse : GetActive().values()) +// for (Horse horse : getActive().values()) // { // //Blocks // double duration = 2000; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java index 7cecd08b0..89ba01f96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java @@ -1,6 +1,5 @@ package mineplex.core.mount.types; -import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.Horse; @@ -58,7 +57,7 @@ public class MountSheep extends HorseMount Manager.getDisguiseManager().disguise(disguise); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store _active.put(player, mount); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java index 92e90a12b..3932c55aa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java @@ -1,6 +1,5 @@ package mineplex.core.mount.types; -import org.bukkit.ChatColor; import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; @@ -49,10 +48,10 @@ public class MountSlime extends Mount> SingleEntityMountData mount = new SingleEntityMountData(player, player.getWorld().spawn(player.getLocation(), Slime.class)); mount.getEntity().setSize(2); - mount.getEntity().setCustomName(player.getName() + "'s " + GetName()); + mount.getEntity().setCustomName(player.getName() + "'s " + getName()); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store _active.put(player, mount); @@ -66,7 +65,7 @@ public class MountSlime extends Mount> mount.remove(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } @@ -127,7 +126,7 @@ public class MountSlime extends Mount> Player player = (Player)slime.getPassenger(); - if (!Recharge.Instance.use(player, GetName(), 200, false, false)) + if (!Recharge.Instance.use(player, getName(), 200, false, false)) continue; Vector dir = slime.getPassenger().getLocation().getDirection(); @@ -151,7 +150,7 @@ public class MountSlime extends Mount> Player player = (Player)slime.getPassenger(); - if (!Recharge.Instance.usable(player, GetName() + " Collide")) + if (!Recharge.Instance.usable(player, getName() + " Collide")) continue; for (SingleEntityMountData otherSlime : GetActive().values()) @@ -169,15 +168,15 @@ public class MountSlime extends Mount> Player otherPlayer = (Player)other.getPassenger(); - if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide")) + if (!Recharge.Instance.usable(otherPlayer, getName() + " Collide")) continue; //Collide if (UtilMath.offset(slime, other) > 2) continue; - Recharge.Instance.useForce(player, GetName() + " Collide", 500); - Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500); + Recharge.Instance.useForce(player, getName() + " Collide", 500); + Recharge.Instance.useForce(otherPlayer, getName() + " Collide", 500); UtilAction.velocity(slime, UtilAlg.getTrajectory(other, slime), 1.2, false, 0, 0.8, 10, true); UtilAction.velocity(other, UtilAlg.getTrajectory(slime, other), 1.2, false, 0, 0.8, 10, true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 25884d4b2..995fc38a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -82,10 +82,10 @@ public class MountSpider extends HorseMount if (_armor != null) horse.getInventory().setArmor(new ItemStack(_armor)); - horse.setCustomName(player.getName() + "'s " + GetName()); + horse.setCustomName(player.getName() + "'s " + getName()); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store SingleEntityMountData mount = new SingleEntityMountData(player, horse); @@ -159,10 +159,10 @@ public class MountSpider extends HorseMount // if (player.getGameMode() == GameMode.CREATIVE) // return; // -// if (!GetActive().containsKey(player)) +// if (!getActive().containsKey(player)) // return; // -// if (GetActive().get(player).getPassenger() != event.getPlayer()) +// if (getActive().get(player).getPassenger() != event.getPlayer()) // return; // // //Chicken Cancel @@ -170,7 +170,7 @@ public class MountSpider extends HorseMount // if (disguise != null && ((disguise instanceof DisguiseChicken && !((DisguiseChicken)disguise).isBaby()) || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman || disguise instanceof DisguiseWither)) // return; // -// Horse horse = GetActive().get(event.getPlayer()); +// Horse horse = getActive().get(event.getPlayer()); // // if (!UtilEnt.isGrounded(horse)) // return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java index 5e9747e8d..36b09d6af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java @@ -35,7 +35,7 @@ public class MountTitan extends Mount { if(GetActive().size() >= 3) { - UtilPlayer.message(player, F.main("Mount", "The maximum amount of simultaneous " + F.elem(GetName()) + " in this lobby has been reached.")); + UtilPlayer.message(player, F.main("Mount", "The maximum amount of simultaneous " + F.elem(getName()) + " in this lobby has been reached.")); return; } @@ -46,10 +46,10 @@ public class MountTitan extends Mount Manager.DeregisterAll(player); //Inform - UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + ".")); //Store - _active.put(player, new MountTitanData(player, GetName())); + _active.put(player, new MountTitanData(player, getName())); } @Override @@ -61,7 +61,7 @@ public class MountTitan extends Mount data.clean(); //Inform - UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); + UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(getName()) + ".")); Manager.removeActive(player); } @@ -137,7 +137,7 @@ public class MountTitan extends Mount { if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN)) { - Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(getName()); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java index 4bc68c8dc..69b274015 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java @@ -40,7 +40,7 @@ public class Pet extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java index 8cc4d8bff..3350f29c7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetExtra.java @@ -29,7 +29,7 @@ public class PetExtra extends SalesPackageBase } - public String GetName() + public String getName() { return _name; } @@ -40,7 +40,7 @@ public class PetExtra extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index e3245d831..5e2b4edbb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -822,8 +822,8 @@ public class RewardManager public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight, int shards) { - UnknownPackageReward reward = new UnknownPackageReward(_donationManager, "Mount", mount.GetDisplayName(), mount.GetName(), - new ItemStack(mount.GetDisplayMaterial(), 1, (short) 0, (byte) mount.GetDisplayData()), rarity, weight, shards); + UnknownPackageReward reward = new UnknownPackageReward(_donationManager, "Mount", mount.getDisplayName(), mount.getName(), + new ItemStack(mount.getDisplayMaterial(), 1, (short) 0, (byte) mount.getDisplayData()), rarity, weight, shards); addReward(type, reward); return reward; } @@ -837,7 +837,7 @@ public class RewardManager { for(Gadget gadget : _gadgetManager.getGadgets(GadgetType.MusicDisc)) { - if(gadget.GetName().equals(musicDisk) || gadget.GetName().equals(musicDisk + " Disk")) + if(gadget.getName().equals(musicDisk) || gadget.getName().equals(musicDisk + " Disk")) { return addGadget(type, gadget, rarity, weight, shards); } @@ -848,8 +848,8 @@ public class RewardManager public UnknownPackageReward addHatReward(RewardPool.Type type, HatGadget gadget, RewardRarity rarity, int weight) { UnknownPackageReward reward = - new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), gadget.GetDisplayName(), - gadget.GetName(), gadget.getHelmetItem(), rarity, weight, getShards(rarity)); + new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), gadget.getDisplayName(), + gadget.getName(), gadget.getHelmetItem(), rarity, weight, getShards(rarity)); addReward(type, reward); return reward; } @@ -864,7 +864,7 @@ public class RewardManager { UnknownPackageReward reward = new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), displayName, - gadget.GetName(), new ItemStack(gadget.GetDisplayMaterial(), 1, (short) 0, gadget.GetDisplayData()), rarity, + gadget.getName(), new ItemStack(gadget.getDisplayMaterial(), 1, (short) 0, gadget.getDisplayData()), rarity, weight, shards); addReward(type, reward); return reward; @@ -872,7 +872,7 @@ public class RewardManager public UnknownPackageReward addGadget(RewardPool.Type type, Gadget gadget, RewardRarity rarity, int weight, int shards) { - return addGadget(type, gadget, gadget.GetDisplayName(), rarity, weight, shards); + return addGadget(type, gadget, gadget.getDisplayName(), rarity, weight, shards); } public UnknownPackageReward addMineStrikeSkin(Type type, MineStrikeSkin skin, RewardRarity rarity, int weight) @@ -883,7 +883,7 @@ public class RewardManager public UnknownPackageReward addMineStrikeSkin(Type type, MineStrikeSkin skin, RewardRarity rarity, int weight, int shards) { Gadget gadget = _gadgetManager.getGameModifier(skin); - return addGadget(type, gadget, gadget.GetDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards); + return addGadget(type, gadget, gadget.getDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards); } public InventoryReward addInventoryReward(RewardPool.Type type, ItemGadget gadget, RewardRarity rarity, int weight) @@ -899,9 +899,9 @@ public class RewardManager public InventoryReward addInventoryReward(RewardPool.Type type, ItemGadget gadget, RewardRarity rarity, int weight, int shards, int minAmmo, int maxAmmo) { - InventoryReward reward = new InventoryReward(_inventoryManager, gadget.GetDisplayName(), - gadget.GetName(), minAmmo, maxAmmo, - new ItemStack(gadget.GetDisplayMaterial(), 1, (short) 0, gadget.GetDisplayData()), rarity, weight, shards); + InventoryReward reward = new InventoryReward(_inventoryManager, gadget.getDisplayName(), + gadget.getName(), minAmmo, maxAmmo, + new ItemStack(gadget.getDisplayMaterial(), 1, (short) 0, gadget.getDisplayData()), rarity, weight, shards); addReward(type, reward); return reward; } @@ -915,7 +915,7 @@ public class RewardManager { Pet pet = _petManager.GetFactory().getPet(entityType); PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, - pet.GetName() + " Pet", pet.GetName(), entityType, rarity, weight, shards); + pet.getName() + " Pet", pet.getName(), entityType, rarity, weight, shards); addReward(type, reward); return reward; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java index 4dc987a37..3cd7b949f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ICurrencyPackage.java @@ -5,8 +5,8 @@ import mineplex.core.donation.repository.GameSalesPackageToken; public interface ICurrencyPackage { - int GetSalesPackageId(); - int GetCost(CurrencyType currencytype); - boolean IsFree(); - void Update(GameSalesPackageToken token); + int getSalesPackageId(); + int getCost(CurrencyType currencytype); + boolean isFree(); + void update(GameSalesPackageToken token); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java index 48e1a5f0a..da067afbf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/IDisplayPackage.java @@ -4,8 +4,8 @@ import org.bukkit.Material; public interface IDisplayPackage { - String GetName(); - String[] GetDescription(); - Material GetDisplayMaterial(); - byte GetDisplayData(); + String getName(); + String[] getDescription(); + Material getDisplayMaterial(); + byte getDisplayData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java index bc42c6a50..698430fef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java @@ -53,52 +53,52 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack Quantity = quantity; } - public abstract void Sold(Player player, CurrencyType currencyType); + public abstract void sold(Player player, CurrencyType currencyType); @Override - public String GetName() + public String getName() { return Name; } @Override - public String[] GetDescription() + public String[] getDescription() { return Description; } @Override - public int GetCost(CurrencyType currencyType) + public int getCost(CurrencyType currencyType) { return CurrencyCostMap.containsKey(currencyType) ? CurrencyCostMap.get(currencyType) : 0; } @Override - public int GetSalesPackageId() + public int getSalesPackageId() { return SalesPackageId; } @Override - public boolean IsFree() + public boolean isFree() { return Free; } @Override - public Material GetDisplayMaterial() + public Material getDisplayMaterial() { return _displayMaterial; } @Override - public byte GetDisplayData() + public byte getDisplayData() { return _displayData; } @Override - public void Update(GameSalesPackageToken token) + public void update(GameSalesPackageToken token) { SalesPackageId = token.GameSalesPackageId; Free = token.Free; @@ -114,17 +114,17 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack return Quantity; } - public boolean IsKnown() + public boolean isKnown() { return KnownPackage; } - public boolean OneTimePurchase() + public boolean oneTimePurchase() { return OneTimePurchaseOnly; } - public String GetDisplayName() + public String getDisplayName() { return DisplayName; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java index c52c84e2b..0a23e6b0d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java @@ -56,7 +56,7 @@ public class ConfirmationPage goldCount) showResultsPage(TransactionResponse.InsufficientFunds); @@ -160,7 +160,7 @@ public class ConfirmationPage() { @@ -168,7 +168,7 @@ public class ConfirmationPage _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); _inventoryManager = inventoryManager; new BenefitManager(plugin, clientManager, _inventoryManager); - GadgetPersistenceManager gadgetPersistenceManager = new GadgetPersistenceManager(plugin, clientManager); - _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager, gadgetPersistenceManager); + _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java index fa0c65c2b..75c929335 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java @@ -1,7 +1,6 @@ package mineplex.hub.commands; import java.lang.reflect.Field; -import java.util.List; import java.util.UUID; import mineplex.core.account.CoreClient; @@ -18,9 +17,7 @@ import mineplex.core.disguise.PlayerUndisguiseEvent; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.punish.Category; import mineplex.core.punish.PunishClient; -import mineplex.core.punish.Punishment; import mineplex.core.treasure.event.TreasureStartEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -28,15 +25,12 @@ import mineplex.hub.HubManager; import net.minecraft.server.v1_8_R3.ChatComponentText; import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.EnumDifficulty; import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData; -import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode; -import net.minecraft.server.v1_8_R3.WorldType; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -405,7 +399,7 @@ public class DisguiseCommand extends CommandBase implements Listener @EventHandler public void gadget(GadgetEnableEvent event) { - if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph) + if(!event.getGadget().getName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph) return; if(_disguisedPlayers.containsKey(event.getPlayer())) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java index 4aec41006..801b7a228 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java @@ -12,7 +12,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerVelocityEvent; import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; @@ -100,7 +99,7 @@ public class KothManager extends MiniPlugin //All peices are always same color! for (OutfitTeam outfit : _teamArmor) { - if (outfit.IsActive(player)) + if (outfit.isActive(player)) return outfit.getTeamColor(player); } @@ -174,7 +173,7 @@ public class KothManager extends MiniPlugin { if (enabled) { - _kothSword.Enable(player); + _kothSword.enable(player); _active.add(player); @@ -196,13 +195,13 @@ public class KothManager extends MiniPlugin outfit.add("Team Boots"); outfit.add("PvP Sword"); - Manager.GetGadget().DisableAll(player, outfit); + Manager.GetGadget().disableAll(player, outfit); Manager.GetMount().DisableAll(player); Manager.getPetManager().DisableAll(player); } else { - _kothSword.Disable(player); + _kothSword.disable(player); _active.remove(player); UtilPlayer.message(player, F.main("KOTH", "You have exited " + F.elem("KOTH Mode") + ".")); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java index b5d86f0d6..b357aee34 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java @@ -119,7 +119,7 @@ public class ParkourManager extends MiniPlugin _active.add(player); UtilPlayer.message(player, F.main("Parkour", "You have entered " + F.elem("Parkour Mode") + ".")); - Manager.GetGadget().DisableAll(player); + Manager.GetGadget().disableAll(player); player.setVelocity(new Vector(0,-1,0)); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index 9a05b6047..8a116b0d4 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -11,7 +11,6 @@ import org.bukkit.Sound; import org.bukkit.entity.Bat; import org.bukkit.entity.Entity; import org.bukkit.entity.Firework; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.entity.TNTPrimed; @@ -19,10 +18,8 @@ import org.bukkit.entity.WitherSkull; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.util.Vector; import mineplex.core.MiniPlugin; @@ -343,7 +340,7 @@ public class SoccerManager extends MiniPlugin //All peices are always same color! for (OutfitTeam outfit : _teamArmor) { - if (outfit.IsActive(player)) + if (outfit.isActive(player)) return outfit.getTeamColor(player); } @@ -473,7 +470,7 @@ public class SoccerManager extends MiniPlugin outfit.add("Team Pants"); outfit.add("Team Boots"); - Manager.GetGadget().DisableAll(player, outfit); + Manager.GetGadget().disableAll(player, outfit); Manager.GetMount().DisableAll(player); Manager.getPetManager().DisableAll(player); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java index 82cd557fd..a87c6fc53 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java @@ -143,7 +143,7 @@ public class Illusion extends SkillActive if (Factory.Condition().GetActiveCondition(cur, ConditionType.CLOAK) == null || !UtilPlayer.isBlocking(cur) || - //!Factory.Energy().Use(cur, GetName(), 0.625 - (getLevel(cur) * 0.025), true, true) || + //!Factory.Energy().Use(cur, getName(), 0.625 - (getLevel(cur) * 0.025), true, true) || skel == null || !skel.isValid()) { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java index 28d3b0f24..f9a230fd9 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Global/Pistol.java @@ -191,7 +191,7 @@ public class Pistol extends SkillActive if (damage > 0) return; - //UtilPlayer.Damage(hit, attacker, damage, GetName(), true, true, false); + //UtilPlayer.Damage(hit, attacker, damage, getName(), true, true, false); */ } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java index 80d60b3ca..db14f198a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/BullsCharge.java @@ -105,7 +105,7 @@ public class BullsCharge extends SkillActive Factory.Condition().EndCondition(damager, ConditionType.SPEED, GetName()); //Damage - //event.AddMod(damager.getName(), GetName(), level, true); + //event.AddMod(damager.getName(), getName(), level, true); event.SetKnockback(false); //Effect diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java index d77e626db..9d9bbb165 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java @@ -111,7 +111,7 @@ public class DefensiveStance extends SkillActive if (damagee.getLocation().getDirection().subtract(from).length() > 1.4) { - //event.AddMod(damagee.getName(), GetName(), -0.5 - (0.5 * level), true); + //event.AddMod(damagee.getName(), getName(), -0.5 - (0.5 * level), true); return; } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java index 90f2d9519..468e6f58e 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Fletcher.java @@ -107,7 +107,7 @@ public class Fletcher extends Skill cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, "Fletched Arrow")); //Inform - //UtilPlayer.message(cur, F.main(GetName(), "You crafted a " + F.item("Fletched Arrow") + ".")); + //UtilPlayer.message(cur, F.main(getName(), "You crafted a " + F.item("Fletched Arrow") + ".")); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java index c8a3503bb..bfa6fcadf 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java @@ -61,7 +61,7 @@ // { // if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) // { -// UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); +// UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(getName()) + " in water.")); // return false; // } // @@ -75,7 +75,7 @@ // _active.add(player); // // //Inform -// UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); +// UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(getName(level)) + ".")); // // //Effect // player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); @@ -96,7 +96,7 @@ // return; // // //Inform -// UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + ".")); +// UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(getName(getLevel(player))) + ".")); // // _arrows.add(event.getProjectile()); // event.getProjectile().setFireTicks(200); @@ -128,10 +128,10 @@ // if (level == 0) return; // // //Ignite -// Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true); +// Factory.Condition().Factory().Ignite(getName(), damagee, damager, 2 + level, true, true); // // //Damage -// event.AddMod(damager.getName(), GetName(), 0, true); +// event.AddMod(damager.getName(), getName(), 0, true); // // //Effect // damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java index 363173009..77218628b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java @@ -140,7 +140,7 @@ public class Sharpshooter extends Skill // // if (player != null) // if (_hitCount.remove(player) != null) -// UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits"))); +// UtilPlayer.message(player, F.main(GetClassType().name(), getName() + ": " + F.elem("0 Consecutive Hits"))); // } // } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java index a28023c2b..adead9093 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Pistol.java @@ -168,7 +168,7 @@ public class Pistol extends ItemUsable if (damage > 1) return; - //UtilPlayer.Damage(hit, attacker, damage, GetName(), true, true, false); + //UtilPlayer.Damage(hit, attacker, damage, getName(), true, true, false); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java index 176cfb332..3f7d54821 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/SkillPage.java @@ -434,28 +434,28 @@ public class SkillPage extends ShopPageBase ClientClass clientClass = getPlugin().GetClassManager().Get(player); /* - if (item.GetName().contains("Sword") || item.GetName().contains("Axe") || item.GetName().contains("Bow")) + if (item.getName().contains("Sword") || item.getName().contains("Axe") || item.getName().contains("Bow")) { - if (clientClass.GetSavingCustomBuild().hasItem(item.GetType(), item.GetName())) + if (clientClass.GetSavingCustomBuild().hasItem(item.GetType(), item.getName())) { PlayDenySound(player); System.out.println("Denying because of matching material and name."); return; } - if (item.GetName().contains("Sword")) + if (item.getName().contains("Sword")) { System.out.println("Sword"); if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Sword")) index = clientClass.GetSavingCustomBuild().getItemIndexWithNameLike("Sword"); } - else if (item.GetName().contains("Axe")) + else if (item.getName().contains("Axe")) { System.out.println("Axe"); if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Axe")) index = clientClass.GetSavingCustomBuild().getItemIndexWithNameLike("Axe"); } - else if (item.GetName().contains("Bow")) + else if (item.getName().contains("Bow")) { System.out.println("Bow"); if (clientClass.GetSavingCustomBuild().hasItemWithNameLike("Bow")) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/ItemSalesPackage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/ItemSalesPackage.java index 625920e4b..9e16dc454 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/ItemSalesPackage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/ItemSalesPackage.java @@ -18,7 +18,7 @@ public class ItemSalesPackage extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java index 436d82b17..173cbf216 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/salespackage/SkillSalesPackage.java @@ -18,7 +18,7 @@ public class SkillSalesPackage extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index eb0accd24..bb4a765b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -2,7 +2,6 @@ package nautilus.game.arcade; import java.io.File; -import mineplex.core.gadget.persistence.GadgetPersistenceManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -10,11 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.CustomTagFix; import mineplex.core.FoodDupeFix; import mineplex.core.PacketsInteractionFix; -import mineplex.core.chatsnap.publishing.SnapshotPublisher; import mineplex.core.customdata.CustomDataManager; -import mineplex.core.chatsnap.SnapshotManager; -import mineplex.core.chatsnap.SnapshotPlugin; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.GlobalPacketManager; import net.minecraft.server.v1_8_R3.BiomeBase; import net.minecraft.server.v1_8_R3.MinecraftServer; @@ -36,7 +31,6 @@ import mineplex.core.elo.EloManager; import mineplex.core.friend.FriendManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.give.Give; -import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; import mineplex.core.incognito.IncognitoManager; @@ -57,8 +51,6 @@ import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; import mineplex.core.recharge.Recharge; -import mineplex.core.report.ReportManager; -import mineplex.core.report.ReportPlugin; import mineplex.core.serverConfig.ServerConfiguration; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; @@ -69,7 +61,6 @@ import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; -import nautilus.game.arcade.broadcast.BroadcastManager; import nautilus.game.arcade.game.GameServerConfig; public class Arcade extends JavaPlugin @@ -161,11 +152,10 @@ public class Arcade extends JavaPlugin HologramManager hologramManager = new HologramManager(this, packetHandler); //Inventory - GadgetPersistenceManager gadgetPersistenceManager = new GadgetPersistenceManager(this, _clientManager); InventoryManager inventoryManager = new InventoryManager(this, _clientManager); PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); - GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, gadgetPersistenceManager); + GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null); cosmeticManager.setInterfaceSlot(7); cosmeticManager.disableTeamArmor(); 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 f3bd4a08d..ee542b663 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1013,8 +1013,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation GetDisguise().undisguise(player); Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph); - if (morph != null && morph.IsActive(player)) - morph.Disable(player); + if (morph != null && morph.isActive(player)) + morph.disable(player); } public ArrayList LoadFiles(String gameName) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java index 632317ab5..37e77a858 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.command; import java.lang.reflect.Field; -import java.util.List; import java.util.UUID; import mineplex.core.account.CoreClient; @@ -18,9 +17,7 @@ import mineplex.core.disguise.PlayerUndisguiseEvent; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.punish.Category; import mineplex.core.punish.PunishClient; -import mineplex.core.punish.Punishment; import mineplex.core.treasure.event.TreasureStartEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -29,15 +26,12 @@ import nautilus.game.arcade.game.Game.GameState; import net.minecraft.server.v1_8_R3.ChatComponentText; import net.minecraft.server.v1_8_R3.EntityHuman; import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.EnumDifficulty; import net.minecraft.server.v1_8_R3.IChatBaseComponent; import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData; -import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode; -import net.minecraft.server.v1_8_R3.WorldType; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -431,7 +425,7 @@ public class DisguiseCommand extends CommandBase implements Liste @EventHandler public void gadget(GadgetEnableEvent event) { - if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph) + if(!event.getGadget().getName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph) return; if(_disguisedPlayers.containsKey(event.getPlayer())) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index f90b48ed1..9543fa0b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -14,7 +14,6 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -28,7 +27,6 @@ import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.give.Give; import mineplex.core.mount.Mount; import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.recharge.Recharge; @@ -42,7 +40,6 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.event.kits.KitPlayer; -import nautilus.game.arcade.game.games.sheep.kits.KitBrute; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.GameHostManager; @@ -61,7 +58,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; @@ -69,7 +65,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; @@ -1060,7 +1055,7 @@ public class EventGame extends Game UtilPlayer.message(player, F.main("Event", "Gadgets for area " + area.ID)); for(SalesPackageBase gadget : area.GadgetsEnabled) - UtilPlayer.message(player, F.oo(gadget.GetName(), true)); + UtilPlayer.message(player, F.oo(gadget.getName(), true)); } } @@ -1132,15 +1127,15 @@ public class EventGame extends Game { for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type)) { - if (gadget.GetName().replaceAll(" ", "").equalsIgnoreCase(args[3])) + if (gadget.getName().replaceAll(" ", "").equalsIgnoreCase(args[3])) { if (_customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.remove(gadget)) { - Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget for area " + args[1], F.ed(false)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.getName() + " Gadget for area " + args[1], F.ed(false)))); } else { - Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget for area " + args[1], F.ed(true)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.getName() + " Gadget for area " + args[1], F.ed(true)))); _customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.add(gadget); } @@ -1152,15 +1147,15 @@ public class EventGame extends Game //Mounts for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts()) { - if (mount.GetName().replaceAll(" ", "").equalsIgnoreCase(args[3])) + if (mount.getName().replaceAll(" ", "").equalsIgnoreCase(args[3])) { if (_customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.remove(mount)) { - Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget for area " + args[1], F.ed(false)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget for area " + args[1], F.ed(false)))); } else { - Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget for area " + args[1], F.ed(true)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget for area " + args[1], F.ed(true)))); _customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.add(mount); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 379833f82..236d441d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -15,7 +15,6 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilSystem; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilEvent.ActionType; @@ -29,16 +28,13 @@ import mineplex.core.give.Give; import mineplex.core.mount.Mount; 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.events.PlayerDeathOutEvent; import nautilus.game.arcade.game.games.bridge.Bridge; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.GameMode; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.Sound; @@ -61,7 +57,6 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; @@ -878,7 +873,7 @@ public class EventModule extends MiniPlugin if (!((EventGame) Manager.GetGame()).isAllowGadget()) { Manager.getCosmeticManager().getMountManager().DisableAll(); - Manager.getCosmeticManager().getGadgetManager().DisableAll(); + Manager.getCosmeticManager().getGadgetManager().disableAll(); } Manager.GetGame().Announce(F.main("Inventory", F.value("Allow All Gadgets", F.ed(((EventGame) Manager.GetGame()).isAllowGadget())))); @@ -903,7 +898,7 @@ public class EventModule extends MiniPlugin for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type)) { - items += color + gadget.GetName().replaceAll(" ", "") + " "; + items += color + gadget.getName().replaceAll(" ", "") + " "; color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA); } @@ -914,7 +909,7 @@ public class EventModule extends MiniPlugin String mounts = C.Bold + "Mount Gadgets> "; for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts()) { - mounts += color + mount.GetName().replaceAll(" ", "") + " "; + mounts += color + mount.getName().replaceAll(" ", "") + " "; color = (color == ChatColor.AQUA ? ChatColor.DARK_AQUA : ChatColor.AQUA); } UtilPlayer.message(player, mounts); @@ -929,16 +924,16 @@ public class EventModule extends MiniPlugin { for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type)) { - if (gadget.GetName().replaceAll(" ", "").equalsIgnoreCase(args[1])) + if (gadget.getName().replaceAll(" ", "").equalsIgnoreCase(args[1])) { if (((EventGame) Manager.GetGame()).getGadgetWhitelist().remove(gadget)) { - Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(false)))); - gadget.DisableForAll(); + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.getName() + " Gadget", F.ed(false)))); + gadget.disableForAll(); } else { - Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget", F.ed(true)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.getName() + " Gadget", F.ed(true)))); ((EventGame) Manager.GetGame()).getGadgetWhitelist().add(gadget); } @@ -950,16 +945,16 @@ public class EventModule extends MiniPlugin //Mounts for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts()) { - if (mount.GetName().replaceAll(" ", "").equalsIgnoreCase(args[1])) + if (mount.getName().replaceAll(" ", "").equalsIgnoreCase(args[1])) { if (((EventGame) Manager.GetGame()).getGadgetWhitelist().remove(mount)) { - Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(false)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget", F.ed(false)))); mount.DisableForAll(); } else { - Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget", F.ed(true)))); + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget", F.ed(true)))); ((EventGame) Manager.GetGame()).getGadgetWhitelist().add(mount); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java index 4ab0a41fa..c1e1264e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java @@ -217,7 +217,7 @@ public class TowerManager implements Listener { public void run() { - UtilTextMiddle.display("", towerBase.getTeam().GetColor() + towerBase.getTeam().GetName() + " Team ores have been replenished!", UtilServer.getPlayers()); + UtilTextMiddle.display("", towerBase.getTeam().GetColor() + towerBase.getTeam().getName() + " Team ores have been replenished!", UtilServer.getPlayers()); } }, 20 * 5);*/ //_mapZone.get(towerBase).setValid(false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index d71cbd39e..efd4eaabc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -431,7 +431,7 @@ public class MineStrike extends TeamGame { mat = knifeSkin.getSkinMaterial(); data = knifeSkin.getSkinData(); - name = knifeSkin.GetName(); + name = knifeSkin.getName(); } ItemStack knife = ItemStackFactory.Instance.CreateStack(mat, data, 1, name); @@ -1552,9 +1552,9 @@ public class MineStrike extends TeamGame int kills = GetStats().get(killer).get("") ItemStack item = killer.getInventory().getItem(2); ItemMeta im = item.getItemMeta(); - im.setDisplayName(C.cYellow + C.Bold + knifeSkin.GetName() + " - Kills: " + kills); + im.setDisplayName(C.cYellow + C.Bold + knifeSkin.getName() + " - Kills: " + kills); - AddStat(killer, "Knife." + knifeSkin.GetName() + ".Kills", 1, false, false); + AddStat(killer, "Knife." + knifeSkin.getName() + ".Kills", 1, false, false); } } */ diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index 3a9cfc761..cabfdcf94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -453,7 +453,7 @@ public class Gun extends StrikeItem if(skin == null) return; setSkin(skin.getSkinMaterial(), skin.getSkinData()); - _activeSkinName = skin.GetName(); + _activeSkinName = skin.getName(); owner.getInventory().setItem(_slot, getStack()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index f863678e3..672a55872 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -312,8 +312,8 @@ public class PerkPaintballSniper extends Perk implements IPacketHandler if (Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) Manager.GetCondition().EndCondition(player, ConditionType.SLOW, GetName()); -// if (Manager.GetCondition().HasCondition(player, ConditionType.JUMP, GetName())) -// Manager.GetCondition().EndCondition(player, ConditionType.JUMP, GetName()); +// if (Manager.GetCondition().HasCondition(player, ConditionType.JUMP, getName())) +// Manager.GetCondition().EndCondition(player, ConditionType.JUMP, getName()); } private void addEffects(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java index ebb419815..5fc2ba8df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/searchanddestroy/SearchAndDestroy.java @@ -214,13 +214,13 @@ public class SearchAndDestroy extends TeamGame /* if (getBombs().size() == 1) { GameTeam winning = getBombs().get(0).getTeam(); - Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.GetName() + " Team's" + ChatColor.RESET - + ChatColor.GOLD + " bomb exploded! " + winning.GetColor() + winning.GetName() + Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.getName() + " Team's" + ChatColor.RESET + + ChatColor.GOLD + " bomb exploded! " + winning.GetColor() + winning.getName() + ChatColor.RESET + ChatColor.GOLD + " wins!"); } else { - Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.GetName() + " Team was defeated!"); + Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.getName() + " Team was defeated!"); }*/ } if (timeLeft > 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index b39c25164..8617b762f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -239,7 +239,7 @@ public abstract class SurvivalGames extends Game BlockBreakAllow.add(Material.VINE.getId()); BlockBreakAllow.add(Material.WATER_LILY.getId()); - // Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", + // Manager.GetStatsManager().addTable(getName(), "kills", "deaths", // "chestsOpened"); setupLoot(); @@ -1905,7 +1905,7 @@ public abstract class SurvivalGames extends Game if (killer != null && !killer.equals(killed)) { - // Manager.GetStatsManager().addStat(killer, GetName(), "kills", + // Manager.GetStatsManager().addStat(killer, getName(), "kills", // 1); } } @@ -1914,7 +1914,7 @@ public abstract class SurvivalGames extends Game { if (killed != null) { - // Manager.GetStatsManager().addStat(killed, GetName(), + // Manager.GetStatsManager().addStat(killed, getName(), // "deaths", 1); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java index 9222cd907..f9ce3f31e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGamesTeams.java @@ -251,7 +251,7 @@ public class SurvivalGamesTeams extends TeamGame System.out.println("==================="); System.out.println("CREEP TYPE: " + _spreadName); System.out.println("==================="); - //Manager.GetStatsManager().addTable(GetName(), "kills", "deaths", "chestsOpened"); + //Manager.GetStatsManager().addTable(getName(), "kills", "deaths", "chestsOpened"); //Tournament if (Manager.IsTournamentServer()) @@ -1554,7 +1554,7 @@ public class SurvivalGamesTeams extends TeamGame if (killer != null && !killer.equals(killed)) { - //Manager.GetStatsManager().addStat(killer, GetName(), "kills", 1); + //Manager.GetStatsManager().addStat(killer, getName(), "kills", 1); } } @@ -1562,7 +1562,7 @@ public class SurvivalGamesTeams extends TeamGame { if (killed != null) { - //Manager.GetStatsManager().addStat(killed, GetName(), "deaths", 1); + //Manager.GetStatsManager().addStat(killed, getName(), "deaths", 1); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java index 94b7376bd..969e5120b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFlameDash.java @@ -94,7 +94,7 @@ public class PerkFlameDash extends Perk _data.add(new FireflyData(player)); Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false); - //Manager.GetCondition().Factory().Invisible(GetName(), player, player, 2.5, 0, false, false, true); + //Manager.GetCondition().Factory().Invisible(getName(), player, player, 2.5, 0, false, false, true); UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java index cabf76c7d..0364e5719 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java @@ -95,7 +95,7 @@ public class PerkSmokebomb extends Perk //Action Manager.GetCondition().Factory().Cloak(GetName(), player, player, 1.2, false, false); - //Manager.GetCondition().Factory().Vulnerable(GetName(), player, player, 6, 3, false, false, true); + //Manager.GetCondition().Factory().Vulnerable(getName(), player, player, 6, 3, false, false, true); //Blind for (Entity other : player.getNearbyEntities(5, 5, 5)) @@ -110,7 +110,7 @@ public class PerkSmokebomb extends Perk LivingEntity living = (LivingEntity) other; Manager.GetCondition().Factory().Blind(GetName() + " Effect", living, player, getEffectDuration(), 0, false, false, true); - //Manager.GetCondition().Factory().Slow(GetName() + " Effect", living, player, getEffectDuration(), 0, false, false, true, false); + //Manager.GetCondition().Factory().Slow(getName() + " Effect", living, player, getEffectDuration(), 0, false, false, true, false); } //Effects diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java index c9ae60414..ce8c403eb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/scoreboard/GameScoreboard.java @@ -146,11 +146,11 @@ public class GameScoreboard //Team Groups for (GameTeam team : Game.GetTeamList()) { - System.out.println("Scoreboard Team: " + team.GetName().toUpperCase()); + System.out.println("Scoreboard Team: " + team.getName().toUpperCase()); for (Rank rank : Rank.values()) { - _scoreboard.registerNewTeam(ParseTeamName(rank.Name + team.GetName().toUpperCase())).setPrefix(team.GetColor() + ""); + _scoreboard.registerNewTeam(ParseTeamName(rank.Name + team.getName().toUpperCase())).setPrefix(team.GetColor() + ""); } } */ diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java index 03da0da69..19020b59b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/shop/KitPackage.java @@ -16,7 +16,7 @@ public class KitPackage extends SalesPackageBase } @Override - public void Sold(Player player, CurrencyType currencyType) + public void sold(Player player, CurrencyType currencyType) { } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java index 3180ab90c..c042363d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/AssistsStatTracker.java @@ -34,7 +34,7 @@ public class AssistsStatTracker extends StatTracker addStat(player, "Assists", 1, false, false); // if (getGame().GetKit(player) != null) -// addStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false); +// addStat(player, getGame().GetKit(player).getName() + " Assists", 1, false, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageDealtStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageDealtStatTracker.java index 6dc38aaa7..37865c91b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageDealtStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageDealtStatTracker.java @@ -25,6 +25,6 @@ public class DamageDealtStatTracker extends StatTracker addStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false); // if (getGame().GetKit(damager) != null) -// addStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false); +// addStat(damager, getGame().GetKit(damager).getName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageTakenStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageTakenStatTracker.java index ae6a9650f..32f278f72 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageTakenStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DamageTakenStatTracker.java @@ -28,10 +28,10 @@ public class DamageTakenStatTracker extends StatTracker // if (getGame().GetKit(damagee) != null) // { -// addStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false); +// addStat(damagee, getGame().GetKit(damagee).getName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false); // // if (event.GetDamagerPlayer(true) != null) -// addStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken PvP ", (int) Math.round(event.GetDamage()), false, false); +// addStat(damagee, getGame().GetKit(damagee).getName() + " Damage Taken PvP ", (int) Math.round(event.GetDamage()), false, false); // } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathsStatTracker.java index eb12b09fc..739a4e618 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/DeathsStatTracker.java @@ -34,6 +34,6 @@ public class DeathsStatTracker extends StatTracker addStat(player, "Deaths", 1, false, false); // if (getGame().GetKit(player) != null) -// addStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false); +// addStat(player, getGame().GetKit(player).getName() + " Deaths", 1, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java index d0fa7196a..a384daf3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillsStatTracker.java @@ -34,6 +34,6 @@ public class KillsStatTracker extends StatTracker addStat(player, "Kills", 1, false, false); // if (getGame().GetKit(player) != null) -// addStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false); +// addStat(player, getGame().GetKit(player).getName() + " Kills", 1, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java index 6fa5033f7..5f12714ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LoseStatTracker.java @@ -39,7 +39,7 @@ public class LoseStatTracker extends StatTracker addStat(loser, "Losses", 1, false, false); // if (getGame().GetKit(loser) != null) -// addStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false); +// addStat(loser, getGame().GetKit(loser).getName() + " Losses", 1, false, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java index 382b6bbd0..345539360 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinStatTracker.java @@ -33,7 +33,7 @@ public class WinStatTracker extends StatTracker addStat(winner, "Wins", 1, false, false); // if (getGame().GetKit(winner) != null) -// addStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false); +// addStat(winner, getGame().GetKit(winner).getName() + " Wins", 1, false, false); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java index bb64219f1..ad1c23631 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java @@ -38,7 +38,7 @@ public class WinEffectManager for(Player p : UtilServer.getPlayers()) { Gadget g = _game.getArcadeManager().getCosmeticManager().getGadgetManager().getActive(p, GadgetType.Item); - if(g != null) g.Disable(p); + if(g != null) g.disable(p); } playEffect(); } From b3291476cb83b39b5b1d827f53660c10c0adba8c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 2 Jun 2016 18:25:16 -0300 Subject: [PATCH 03/49] Changed method names Changed kit modifiers to be in an enum instead of creating a new class for each modifier Implemented kit modifiers in the games Removed renaming from Widder, Christmas Elf and Pumpling Changed the persistence to have the system that Connor added --- .../disguises/DisguiseAnimalBase.java | 5 ++++ .../gamemodifiers/kits/KitModifier.java | 22 +++++++++++++++ .../kits/bridges/PotatoKitGameModifier.java | 26 ----------------- .../beastmaster/ChickenKitGameModifier.java | 28 ------------------- .../MiniGuardianKitGameModifier.java | 28 ------------------- .../beastmaster/PigKitGameModifier.java | 28 ------------------- .../beastmaster/SquidKitGameModifier.java | 28 ------------------- .../horseman/MuleKitGameModifier.java | 26 ----------------- .../SkeletonHorseKitGameModifier.java | 26 ----------------- .../WitherSkeletonKitGameModifier.java | 26 ----------------- 10 files changed, 27 insertions(+), 216 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/bridges/PotatoKitGameModifier.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/ChickenKitGameModifier.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/MiniGuardianKitGameModifier.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/PigKitGameModifier.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/SquidKitGameModifier.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/MuleKitGameModifier.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/SkeletonHorseKitGameModifier.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/necromancer/WitherSkeletonKitGameModifier.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java new file mode 100644 index 000000000..c41d03dd4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java @@ -0,0 +1,5 @@ +package mineplex.core.disguise.disguises; + +public class DisguiseAnimalBase +{ +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java new file mode 100644 index 000000000..1c507c30d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java @@ -0,0 +1,22 @@ +package mineplex.core.gadget.gadgets.gamemodifiers.kits; + +public enum KitModifier +{ + + // Bridges + Bridges_Apple_Potato, + + // Survival Games + Survival_Games_Beastmaster_Chicken, + Survival_Games_Beastmaster_Mini_Guardian, + Survival_Games_Beastmaster_Pig, + Survival_Games_Beastmaster_Squid, + Survival_Games_Horseman_Mule, + Survival_Games_Horseman_Skeleton_Horse, + Survival_Games_Horseman_Zombie_Horse, + Survival_Games_Necromancer_Wither_Skeleton, + Survival_Games_Necromancer_Zombie + + KitModifier + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/bridges/PotatoKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/bridges/PotatoKitGameModifier.java deleted file mode 100644 index 5f70403bf..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/bridges/PotatoKitGameModifier.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.bridges; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; - -public class PotatoKitGameModifier extends KitGameModifier -{ - - /** - * Game: Bridges - * Kit: Apple - * Changes: Change Apples to Potatoes - * @param manager - */ - - public PotatoKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.Bridges, KitModifierType.Bridges_AppleKit, "Potatoes", new String[]{"Placeholder"}, 0, Material.POTATO_ITEM, - (byte) 0, "Apple", "apple_potato"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/ChickenKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/ChickenKitGameModifier.java deleted file mode 100644 index 6667c14b3..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/ChickenKitGameModifier.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; - -public class ChickenKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Beastmaster - * Changes: Change Wolves to Chickens - * @param manager - */ - - public ChickenKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Chicken", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG, - UtilEnt.getEntityEggData(EntityType.CHICKEN), "Beastmaster", "beastmaster_chicken"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/MiniGuardianKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/MiniGuardianKitGameModifier.java deleted file mode 100644 index f95a1fe6c..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/MiniGuardianKitGameModifier.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; - -public class MiniGuardianKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Beastmaster - * Changes: Change Wolves to Mini Guardians - * @param manager - */ - - public MiniGuardianKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Mini Guardian", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG, - UtilEnt.getEntityEggData(EntityType.GUARDIAN), "Beastmaster", "beastmaster_mini_guardian"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/PigKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/PigKitGameModifier.java deleted file mode 100644 index 37f0142a3..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/PigKitGameModifier.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; - -public class PigKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Beastmaster - * Changes: Change Wolves to Pigs - * @param manager - */ - - public PigKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Pig", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG, - UtilEnt.getEntityEggData(EntityType.PIG), "Beastmaster", "beastmaster_pig"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/SquidKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/SquidKitGameModifier.java deleted file mode 100644 index 201a38a4b..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/beastmaster/SquidKitGameModifier.java +++ /dev/null @@ -1,28 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster; - -import mineplex.core.common.util.UtilEnt; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; - -public class SquidKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Beastmaster - * Changes: Change Wolves to Squids - * @param manager - */ - - public SquidKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Squid", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG, - UtilEnt.getEntityEggData(EntityType.SQUID), "Beastmaster", "beastmaster_squid"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/MuleKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/MuleKitGameModifier.java deleted file mode 100644 index 856dee70e..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/MuleKitGameModifier.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.horseman; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; - -public class MuleKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Horseman - * Changes: Change Horses to Mules - * @param manager - */ - - public MuleKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_HorsemanKit, "Mule", new String[]{"Placeholder"}, 0, Material.CHEST, - (byte) 0, "Horseman", "horseman_mule"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/SkeletonHorseKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/SkeletonHorseKitGameModifier.java deleted file mode 100644 index d2a2ffc19..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/horseman/SkeletonHorseKitGameModifier.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.horseman; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; - -public class SkeletonHorseKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Horseman - * Changes: Change Horses to Skeleton Horses - * @param manager - */ - - public SkeletonHorseKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_HorsemanKit, "Skeleton Horse", new String[]{"Placeholder"}, 0, Material.BONE, - (byte) 0, "Horseman", "horseman_skeleton_horse"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/necromancer/WitherSkeletonKitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/necromancer/WitherSkeletonKitGameModifier.java deleted file mode 100644 index a029aa2f8..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/survivalgames/necromancer/WitherSkeletonKitGameModifier.java +++ /dev/null @@ -1,26 +0,0 @@ -package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.necromancer; - -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; -import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; - -import org.bukkit.Material; - -public class WitherSkeletonKitGameModifier extends KitGameModifier -{ - - /** - * Game: Survival Games - * Kit: Necromancer - * Changes: Change Skeletons to Wither Skeletons - * @param manager - */ - - public WitherSkeletonKitGameModifier(GadgetManager manager) - { - super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_NecromancerKit, "Wither Skeleton", new String[]{"Placeholder"}, 0, Material.SKULL_ITEM, - (byte) 1, "Necromancer", "necromancer_wither_skeleton"); - } - -} From cb71bf4ba5c55b6220637daec251d934343a667f Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 5 Jun 2016 17:44:34 -0300 Subject: [PATCH 04/49] Removes morphs from gadget persistence (PC-429) --- .../mineplex/core/common/util/UtilPlayer.java | 6 + .../mineplex/core/bonuses/BonusManager.java | 2 + .../cosmetic/ui/page/KitGameModifierPage.java | 5 +- .../mineplex/core/cosmetic/ui/page/Menu.java | 2 +- .../core/cosmetic/ui/page/PetPage.java | 7 +- .../disguises/DisguiseAnimalBase.java | 10 +- .../mineplex/core/gadget/GadgetManager.java | 143 ++++++++++-------- .../gamemodifiers/kits/KitGameModifier.java | 39 ++--- .../gamemodifiers/kits/KitModifier.java | 77 ++++++++-- .../GameModifierMineStrikeSkin.java | 2 +- .../gadget/gadgets/item/ItemFleshHook.java | 10 +- .../gadget/gadgets/item/ItemFreezeCannon.java | 6 +- .../gadgets/item/ItemMelonLauncher.java | 8 +- .../gadget/gadgets/item/ItemPartyPopper.java | 14 +- .../core/gadget/gadgets/morph/MorphBat.java | 10 +- .../gadget/gadgets/morph/MorphVillager.java | 8 +- .../persistence/UserGadgetPersistence.java | 48 +++--- .../core/gadget/types/GadgetGameModifier.java | 9 +- .../core/gadget/types/OutfitGadget.java | 20 ++- .../core/projectile/ProjectileManager.java | 9 +- .../core/projectile/ProjectileUser.java | 10 +- .../clans/clans/potato/PotatoManager.java | 4 +- .../mineplex/hub/modules/StackerManager.java | 6 +- .../classcombat/Skill/Brute/BlockToss.java | 19 ++- .../classcombat/Skill/Brute/FleshHook.java | 13 +- .../classcombat/Skill/Knight/AxeThrow.java | 14 +- .../classcombat/Skill/Mage/FreezingBlast.java | 12 +- .../classcombat/Skill/Mage/GlacialBlade.java | 19 +-- .../classcombat/Skill/Mage/IcePrison.java | 10 +- .../classcombat/Skill/Mage/LightningOrb.java | 8 +- .../game/classcombat/item/Consume/Apple.java | 12 +- .../item/Throwable/PoisonBall.java | 8 +- .../item/Throwable/ProximityExplosive.java | 19 ++- .../item/Throwable/ProximityZapper.java | 20 ++- .../item/Throwable/WaterBottle.java | 12 +- .../game/classcombat/item/Throwable/Web.java | 11 +- .../boss/slimeking/ability/RocketAbility.java | 8 +- .../boss/spider/attacks/SpiderPoison.java | 6 +- .../mobs/perks/PerkBlockTossEVO.java | 16 +- .../mobs/perks/PerkSulphurBombEVO.java | 10 +- .../evolution/mobs/perks/PerkWebEVO.java | 6 +- .../game/games/lobbers/BombLobbers.java | 14 +- .../game/arcade/game/games/runner/Runner.java | 6 +- .../games/smash/perks/PerkFishFlurry.java | 10 +- .../arcade/game/games/stacker/Stacker.java | 10 +- .../survivalgames/kit/KitBeastmaster.java | 2 +- .../games/survivalgames/kit/KitHorseman.java | 2 +- .../survivalgames/kit/KitNecromancer.java | 2 +- .../games/wizards/spells/SpellIcePrison.java | 8 +- .../games/wizards/spells/SpellIceShards.java | 8 +- .../games/wizards/spells/SpellWebShot.java | 13 +- .../game/arcade/kit/perks/PerkApple.java | 51 +++++-- .../game/arcade/kit/perks/PerkAxeThrower.java | 12 +- .../game/arcade/kit/perks/PerkBaconBlast.java | 10 +- .../arcade/kit/perks/PerkBlockRestorer.java | 6 +- .../game/arcade/kit/perks/PerkBlockToss.java | 16 +- .../game/arcade/kit/perks/PerkBoneRush.java | 14 +- .../game/arcade/kit/perks/PerkCowBomb.java | 12 +- .../kit/perks/PerkCreeperSulphurBomb.java | 11 +- .../arcade/kit/perks/PerkHammerThrow.java | 10 +- .../game/arcade/kit/perks/PerkHorsePet.java | 43 +++++- .../game/arcade/kit/perks/PerkInkBlast.java | 9 +- .../game/arcade/kit/perks/PerkIronHook.java | 12 +- .../arcade/kit/perks/PerkMadScientist.java | 36 ++--- .../arcade/kit/perks/PerkPigBaconBounce.java | 12 +- .../game/arcade/kit/perks/PerkRevealer.java | 12 +- .../game/arcade/kit/perks/PerkSkeletons.java | 42 ++++- .../arcade/kit/perks/PerkSlimeRocket.java | 8 +- .../game/arcade/kit/perks/PerkSquidRifle.java | 10 +- .../arcade/kit/perks/PerkSquidShotgun.java | 14 +- .../arcade/kit/perks/PerkSquidSniper.java | 14 +- .../game/arcade/kit/perks/PerkThrower.java | 12 +- .../game/arcade/kit/perks/PerkWeb.java | 4 +- .../game/arcade/kit/perks/PerkWebShot.java | 12 +- .../game/arcade/kit/perks/PerkWitherWeb.java | 6 +- .../game/arcade/kit/perks/PerkWolfPet.java | 132 ++++++++++------ .../game/arcade/kit/perks/PerkWoolBomb.java | 10 +- .../game/arcade/kit/perks/PerkZombieBile.java | 12 +- .../arcade/managers/chat/GameChatManager.java | 2 +- 79 files changed, 757 insertions(+), 540 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index db3fb1cea..9f5f14739 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -937,4 +937,10 @@ public class UtilPlayer return false; return true; } + + public static void removeAllowedCommands(Player player) + { + if (ALLOWED_COMMANDS.containsKey(player.getUniqueId())) + ALLOWED_COMMANDS.remove(player.getUniqueId()); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index e956e3afd..bb52b991d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -1067,6 +1067,8 @@ public class BonusManager extends MiniClientPlugin implements I public void Quit(PlayerQuitEvent event) { _showCarl.remove(event.getPlayer().getName()); + // Removes from allow command map + UtilPlayer.removeAllowedCommands(event.getPlayer()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java index 73fc6c92d..6dfa6cf0a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java @@ -2,6 +2,7 @@ package mineplex.core.cosmetic.ui.page; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; @@ -53,11 +54,7 @@ public class KitGameModifierPage extends GadgetPage if(slot%9 == 8) slot += 2; } - else - continue; } - else - continue; } addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 0e9be9ddf..10835827f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -198,7 +198,7 @@ public class Menu extends ShopPageBase }); type = GadgetType.WinEffect; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awsome effects is even more fun!", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awesome effects is even more fun!", "Usable in Lobbies", enabled.get(type)); addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), new OpenWinEffect(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(winEffectSlot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 785dbb527..7e97f02fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -187,7 +187,12 @@ public class PetPage extends ShopPageBase itemLore.add(C.cWhite + "You must have an active pet to use this!"); getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle()); } - else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.WITHER) + // Silverfish = Wither disguised + // Villager = Elf + // Zombie = Pumpkin + else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.SILVERFISH + || getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.VILLAGER + || getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.ZOMBIE) { addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.getCost(CurrencyType.Coins) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java index c41d03dd4..f47327a24 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseAnimalBase.java @@ -1,5 +1,13 @@ package mineplex.core.disguise.disguises; -public class DisguiseAnimalBase +import org.bukkit.entity.EntityType; + +public class DisguiseAnimalBase extends DisguiseAnimal { + + public DisguiseAnimalBase(EntityType entityType, org.bukkit.entity.Entity entity) + { + super(entityType, entity); + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 5d2c9fbe4..6bb1e5c66 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -4,11 +4,12 @@ import java.util.*; import java.util.function.Predicate; import mineplex.core.gadget.commands.LockCosmeticsCommand; -import mineplex.core.gadget.event.GadgetAppliedEvent; import mineplex.core.gadget.event.GadgetEnableEvent; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.outfit.windupsuit.*; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; import mineplex.core.gadget.persistence.UserGadgetPersistence; +import mineplex.core.gadget.set.suits.SetWindUpSuit; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -260,8 +261,7 @@ public class GadgetManager extends MiniPlugin //Costumes addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); - //Removes WindUp suit for now, as it's not going to be released - //addSet(new SetWindUpSuit(this)); + addSet(new SetWindUpSuit(this)); addSet(new SetParty(this)); addSet(new SetCupidsLove(this)); addSet(new SetEmerald(this)); @@ -306,10 +306,10 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitSpaceSuitLeggings(this)); addGadget(new OutfitSpaceSuitBoots(this)); - //addGadget(new OutfitWindUpSuitHelmet(this)); - //addGadget(new OutfitWindUpSuitChestplate(this)); - //addGadget(new OutfitWindUpSuitLeggings(this)); - //addGadget(new OutfitWindUpSuitBoots(this)); + addGadget(new OutfitWindUpSuitHelmet(this)); + addGadget(new OutfitWindUpSuitChestplate(this)); + addGadget(new OutfitWindUpSuitLeggings(this)); + addGadget(new OutfitWindUpSuitBoots(this)); addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); @@ -461,29 +461,16 @@ public class GadgetManager extends MiniPlugin // Survival Games - // Also not being released in this update - // Beastmaster - //addGadget(new ChickenKitGameModifier(this)); - //addGadget(new MiniGuardianKitGameModifier(this)); - //addGadget(new PigKitGameModifier(this)); - //addGadget(new SquidKitGameModifier(this)); - - // Horseman - //addGadget(new MuleKitGameModifier(this)); - //addGadget(new SkeletonHorseKitGameModifier(this)); - - // Necromancer - //addGadget(new WitherSkeletonKitGameModifier(this)); - - - // Bridges - //addGadget(new PotatoKitGameModifier(this)); + for (KitModifier kitModifier : KitModifier.values()) + { + addGadget(new KitGameModifier(this, kitModifier)); + } for(GadgetType type : GadgetType.values()) { if(!_gadgets.containsKey(type)) { - _gadgets.put(type, new ArrayList()); + _gadgets.put(type, new ArrayList<>()); } } } @@ -829,21 +816,15 @@ public class GadgetManager extends MiniPlugin } @EventHandler - public void quit(PlayerQuitEvent event) + public void onPlayerQuit(PlayerQuitEvent event) { + saveGadgets(event.getPlayer()); disableAll(event.getPlayer(), false); _lastMove.remove(event.getPlayer()); _playerActiveGadgetMap.remove(event.getPlayer()); event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); } - - @EventHandler - public void join(PlayerJoinEvent event) - { - event.getPlayer().setWalkSpeed(0.2f); - event.getPlayer().setFlySpeed(0.1f); - } @EventHandler public void death(PlayerDeathEvent event) @@ -975,43 +956,79 @@ public class GadgetManager extends MiniPlugin event.setCancelled(true); } - @EventHandler - public void onGadgetApplied(GadgetAppliedEvent event) + private void saveGadgets(Player player) { - Player player = event.getPlayer(); - Gadget gadget = event.getGadget(); - GadgetType gadgetType = gadget.getGadgetType(); - switch (gadgetType) + Map cache = new HashMap<>(); + for (Gadget gadget : getAllGadgets()) { - case MusicDisc: - case Item: - break; - case Costume: - OutfitGadget outfitGadget = (OutfitGadget) gadget; - switch (outfitGadget.getSlot()) + if (gadget.ownsGadget(player)) + { + GadgetType gadgetType = gadget.getGadgetType(); + switch (gadgetType) { - case Helmet: - _userGadgetPersistence.save(player, "activeCostumeHelmet", outfitGadget.getName()); + case MusicDisc: + case Item: + case Morph: break; - case Chest: - _userGadgetPersistence.save(player, "activeCostumeChestplate", outfitGadget.getName()); + case Costume: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); + if (cache.containsKey(key)) + continue; + if (outfitGadget.isActive(player)) + cache.put(key, outfitGadget.getName()); break; - case Legs: - _userGadgetPersistence.save(player, "activeCostumeLeggings", outfitGadget.getName()); + case GameModifier: + GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; + if (gadgetGameModifier.canAllowMultiple()) + { + if (cache.containsKey(gadget.getName())) + continue; + cache.put(gadget.getName(), (gadget.isActive(player)) ? "enabled" : "disabled"); + } + else + { + String dataKey = "activeModifier" + gadgetGameModifier.getGameType().getName().replace(" ", ""); + if (cache.containsKey(dataKey)) + continue; + if (gadget.isActive(player)) + cache.put(dataKey, gadget.getName()); + } break; - case Boots: - _userGadgetPersistence.save(player, "activeCostumeBoots", outfitGadget.getName()); + default: + if (cache.containsKey(gadgetType.getDatabaseKey())) + continue; + if (gadget.isActive(player)) + cache.put(gadgetType.getDatabaseKey(), gadget.getName()); break; } - break; - case GameModifier: - GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; - String key = "active" + gadget.getName().replace(" ", "") + gadgetGameModifier.getGameType().getName().replace(" ", ""); - _userGadgetPersistence.save(player, key, "enabled"); - break; - default: - _userGadgetPersistence.save(player, gadgetType.getDatabaseKey(), gadget.getName()); - break; + } } + _userGadgetPersistence.save(player, cache); + } + + public boolean isKitModifierActive(KitModifier kitModifier, Player player) + { + for (Gadget gadget : getGadgets(GadgetType.GameModifier)) + { + if (gadget instanceof KitGameModifier) + { + KitGameModifier kitGameModifier = (KitGameModifier) gadget; + if (kitGameModifier.getKitModifier().equals(kitModifier)) + return kitGameModifier.isActive(player); + } + } + return false; + } + + public KitModifier getActiveKitModifier(KitModifierType kitModifierType, Player player) + { + for (KitModifier kitModifier : KitModifier.values()) + { + if (kitModifier.getKitModifierType().equals(kitModifierType)) + if (isKitModifierActive(kitModifier, player)) + return kitModifier; + } + return null; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java index 13948042c..666db3575 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java @@ -17,17 +17,15 @@ import java.util.function.Predicate; public class KitGameModifier extends GadgetGameModifier { - private KitModifierType _kitType; - private String _kit; - private String _id; + private KitModifier _kitModifier; + private KitModifierType _kitType; - public KitGameModifier(GadgetManager manager, GameModifierType gameType, KitModifierType kitType, String name, String[] desc, - int cost, Material material, byte data, String kit, String id) + public KitGameModifier(GadgetManager manager, KitModifier kitModifier) { - super(manager, gameType, name, desc, cost, material, data); - _kitType = kitType; - _kit = kit; - _id = id; + super(manager, kitModifier.getKitModifierType().getGameModifierType(), kitModifier.getName(), kitModifier.getLore(), kitModifier.getCost(), + kitModifier.getMaterial(), kitModifier.getData(), false); + _kitModifier = kitModifier; + _kitType = kitModifier.getKitModifierType(); } public KitModifierType getKitType() @@ -35,36 +33,31 @@ public class KitGameModifier extends GadgetGameModifier return _kitType; } - public String getKit() - { - return _kit; - } - - public String getId() - { - return _id; - } + public KitModifier getKitModifier() + { + return _kitModifier; + } @Override public void enableCustom(Player player) { - Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kit)).forEach(g -> g.disable(player)); + Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kitType)).forEach(g -> g.disable(player)); super.enableCustom(player); } /** - * Filters kit based on name - * @param kitName + * Filters kit based on type + * @param kitModifierType * @return */ - public static Predicate getKitFilter(String kitName) + public static Predicate getKitFilter(KitModifierType kitModifierType) { return new Predicate() { @Override public boolean test(GadgetGameModifier g) { if (!(g instanceof KitGameModifier)) { return false; } - return ((KitGameModifier)g).getKit().equalsIgnoreCase(kitName); + return ((KitGameModifier)g).getKitType().equals(kitModifierType); } }; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java index 1c507c30d..750b36583 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitModifier.java @@ -1,22 +1,77 @@ package mineplex.core.gadget.gadgets.gamemodifiers.kits; +import mineplex.core.common.util.UtilEnt; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; + public enum KitModifier { // Bridges - Bridges_Apple_Potato, + Bridges_Apple_Potato(KitModifierType.Bridges_AppleKit, "Potato", new String[] {"Placeholder"}, Material.POTATO_ITEM, 0), // Survival Games - Survival_Games_Beastmaster_Chicken, - Survival_Games_Beastmaster_Mini_Guardian, - Survival_Games_Beastmaster_Pig, - Survival_Games_Beastmaster_Squid, - Survival_Games_Horseman_Mule, - Survival_Games_Horseman_Skeleton_Horse, - Survival_Games_Horseman_Zombie_Horse, - Survival_Games_Necromancer_Wither_Skeleton, - Survival_Games_Necromancer_Zombie + Survival_Games_Beastmaster_Chicken(KitModifierType.SurvivalGames_BeastmasterKit, "Chicken", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.CHICKEN), 0), + Survival_Games_Beastmaster_Mini_Guardian(KitModifierType.SurvivalGames_BeastmasterKit, "Mini Guardian", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.GUARDIAN), 0), + Survival_Games_Beastmaster_Pig(KitModifierType.SurvivalGames_BeastmasterKit, "Pig", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.PIG), 0), + Survival_Games_Beastmaster_Squid(KitModifierType.SurvivalGames_BeastmasterKit, "Squid", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.SQUID), 0), + Survival_Games_Horseman_Mule(KitModifierType.SurvivalGames_HorsemanKit, "Mule", new String[] {"Placeholder"}, Material.CHEST, 0), + Survival_Games_Horseman_Skeleton_Horse(KitModifierType.SurvivalGames_HorsemanKit, "Skeleton Horse", new String[] {"Placeholder"}, Material.BONE, 0), + Survival_Games_Horseman_Zombie_Horse(KitModifierType.SurvivalGames_HorsemanKit, "Zombie Horse", new String[] {"Placeholder"}, Material.ROTTEN_FLESH, 0), + Survival_Games_Horseman_Donkey(KitModifierType.SurvivalGames_HorsemanKit, "Donkey", new String[] {"Placeholder"}, Material.CHEST, 0), + Survival_Games_Necromancer_Wither_Skeleton(KitModifierType.SurvivalGames_NecromancerKit, "Wither Skeleton", new String[] {"Placeholder"}, Material.SKULL_ITEM, (byte) 1, 0), + Survival_Games_Necromancer_Zombie(KitModifierType.SurvivalGames_NecromancerKit, "Zombie", new String[] {"Placeholder"}, Material.SKULL_ITEM, (byte) 2, 0); - KitModifier + private final KitModifierType _kitModifierType; + private final String _name; + private final String[] _lore; + private final Material _material; + private final byte _data; + private final int _cost; + + KitModifier(KitModifierType kitModifierType, String name, String[] lore, Material material, int cost) + { + this(kitModifierType, name, lore, material, (byte) 0, cost); + } + + KitModifier(KitModifierType kitModifierType, String name, String[] lore, Material material, byte data, int cost) + { + _kitModifierType = kitModifierType; + _name = name; + _lore = lore; + _material = material; + _data = data; + _cost = cost; + } + + public KitModifierType getKitModifierType() + { + return _kitModifierType; + } + + public String getName() + { + return _name; + } + + public String[] getLore() + { + return _lore; + } + + public Material getMaterial() + { + return _material; + } + + public byte getData() + { + return _data; + } + + public int getCost() + { + return _cost; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java index 74c989f4f..eb9efdfb9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java @@ -37,7 +37,7 @@ public class GameModifierMineStrikeSkin extends GadgetGameModifier int cost, Material displayMat, int displayData) { super(manager, GameModifierType.MineStrike, name, - UtilText.splitLinesToArray(lore, LineFormat.LORE), cost, displayMat, (byte) displayData); + UtilText.splitLinesToArray(lore, LineFormat.LORE), cost, displayMat, (byte) displayData, true); _weapon = weaponName; _skinMat = newSkin; _skinData = newSkinData; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java index a22679254..4f53d1384 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFleshHook.java @@ -56,12 +56,12 @@ public class ItemFleshHook extends ItemGadget implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); if (target == null) return; @@ -85,12 +85,12 @@ public class ItemFleshHook extends ItemGadget implements IThrown @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java index a993f9854..ce3e899d1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemFreezeCannon.java @@ -100,7 +100,7 @@ public class ItemFreezeCannon extends ItemGadget implements IThrown target.playEffect(EntityEffect.HURT); } - smash(data.GetThrown()); + smash(data.getThrown()); } @EventHandler @@ -173,13 +173,13 @@ public class ItemFreezeCannon extends ItemGadget implements IThrown @Override public void Idle(ProjectileUser data) { - smash(data.GetThrown()); + smash(data.getThrown()); } @Override public void Expire(ProjectileUser data) { - smash(data.GetThrown()); + smash(data.getThrown()); } public void smash(Entity ent) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java index 8f43f9876..ee0eea7f3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemMelonLauncher.java @@ -73,26 +73,26 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown { //Push UtilAction.velocity(target, - UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), + UtilAlg.getTrajectory2d(data.getThrown().getLocation(), target.getLocation()), 1.4, false, 0, 0.8, 1.5, true); //Effect target.playEffect(EntityEffect.HURT); } - smash(data.GetThrown()); + smash(data.getThrown()); } @Override public void Idle(ProjectileUser data) { - smash(data.GetThrown()); + smash(data.getThrown()); } @Override public void Expire(ProjectileUser data) { - smash(data.GetThrown()); + smash(data.getThrown()); } public void smash(Entity ent) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java index c3ea07224..0554acfe2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java @@ -124,20 +124,20 @@ public class ItemPartyPopper extends ItemGadget implements IThrown { for(int type : new int[]{1,2,4,5,6,9,10,11,12,13,14,15}) { - UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, type), data.GetThrown().getLocation(), null, 0.4f, 50, ViewDist.LONG); + UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, type), data.getThrown().getLocation(), null, 0.4f, 50, ViewDist.LONG); } - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); + data.getThrown().remove(); /* - if (data.GetThrown() instanceof Item) + if (data.getThrown() instanceof Item) { - Item item = (Item) data.GetThrown(); + Item item = (Item) data.getThrown(); byte b = item.getItemStack().getData().getData(); UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, b), item.getLocation(), 0, 0, 0, 0.2f, 80, ViewDist.LONG); _items.remove(item); } - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.LAVA_POP, 0.75f, 1.25f); + data.getThrown().remove(); */ } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java index 2304a7475..7b3e0902c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java @@ -134,24 +134,24 @@ public class MorphBat extends MorphGadget implements IThrown target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 80, 1), true); //Inform - UtilPlayer.message(target, F.main("Skill", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.skill("Bat Poop") + ".")); + UtilPlayer.message(target, F.main("Skill", F.name(UtilEnt.getName(data.getThrower())) + " hit you with " + F.skill("Bat Poop") + ".")); - UtilPlayer.message(data.GetThrower(), F.main("Skill", "You hit " + F.name(UtilEnt.getName(target)) + " with " + F.skill("Bat Poop") + ".")); + UtilPlayer.message(data.getThrower(), F.main("Skill", "You hit " + F.name(UtilEnt.getName(target)) + " with " + F.skill("Bat Poop") + ".")); } - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index 1fdc71369..b386a6ef5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -114,16 +114,16 @@ public class MorphVillager extends MorphGadget implements IThrown return; if (target instanceof Player) - if (Manager.collideEvent((Player) data.GetThrower(), this, (Player) target)) + if (Manager.collideEvent((Player) data.getThrower(), this, (Player) target)) return; //Pull UtilAction.velocity(target, - UtilAlg.getTrajectory(data.GetThrown().getLocation(), target.getEyeLocation()), + UtilAlg.getTrajectory(data.getThrown().getLocation(), target.getEyeLocation()), 1, false, 0, 0.2, 0.8, true); - UtilAction.velocity(data.GetThrown(), - UtilAlg.getTrajectory(target, data.GetThrown()), + UtilAction.velocity(data.getThrown(), + UtilAlg.getTrajectory(target, data.getThrown()), 0.5, false, 0, 0, 0.8, true); //Effect diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java index ae8918ff5..d2f8f9b67 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java @@ -10,6 +10,7 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetGameModifier; import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.OutfitGadget; import org.bukkit.entity.Player; public class UserGadgetPersistence @@ -21,7 +22,7 @@ public class UserGadgetPersistence public UserGadgetPersistence(GadgetManager manager) { _manager = manager; - _repository = new PlayerKeyValueRepository<>("gadgets", PreparedStatement::setString, ResultSet::getString, "VARCHAR(255)"); + _repository = new PlayerKeyValueRepository<>("gadgets", PreparedStatement::setString, ResultSet::getString); } public void load(Player player) @@ -29,38 +30,45 @@ public class UserGadgetPersistence _repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values -> { if (player.isOnline()) { - for (GadgetType gadgetType : GadgetType.values()) + for (Gadget gadget : _manager.getAllGadgets()) { + GadgetType gadgetType = gadget.getGadgetType(); switch (gadgetType) { case MusicDisc: case Item: + case Morph: break; case Costume: - String[] costumeParts = new String[] {"activeCostumeHelmet", "activeCostumeChestplate", - "activeCostumeLeggings", "activeCostumeBoots"}; - for (String costumePart : costumeParts) - { - Gadget costumeGadget = _manager.getGadget(values.get(costumePart), gadgetType); - if (costumeGadget != null) - costumeGadget.enable(player); - } + OutfitGadget outfitGadget = (OutfitGadget) gadget; + String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); + if (!values.containsKey(key)) + continue; + if (values.get(key).equals(gadget.getName())) + gadget.enable(player); break; case GameModifier: - List gameModifiers = _manager.getGadgets(gadgetType); - for (Gadget gadget : gameModifiers) + GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; + if (gadgetGameModifier.canAllowMultiple()) { - GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; - String key = "active" + gadget.getName().replace(" ", "") + - gadgetGameModifier.getGameType().getName().replace(" ", ""); - if (values.get(key) != null) - if (values.get(key).equalsIgnoreCase("enabled")) - gadget.enable(player); + if (!values.containsKey(gadget.getName())) + continue; + if (values.get(gadget.getName()).equals("enabled")) + gadget.enable(player); + } + else + { + String dataKey = "activeModifier" + gadgetGameModifier.getGameType().getName().replace(" ", ""); + if (!values.containsKey(dataKey)) + continue; + if (values.get(dataKey).equals(gadget.getName())) + gadget.enable(player); } break; default: - Gadget gadget = _manager.getGadget(values.get(gadgetType.getDatabaseKey()), gadgetType); - if (gadget != null) + if (!values.containsKey(gadgetType.getDatabaseKey())) + continue; + if (values.get(gadgetType.getDatabaseKey()).equals(gadget.getName())) gadget.enable(player); break; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java index 916dbefa4..03d060e85 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java @@ -15,6 +15,7 @@ public abstract class GadgetGameModifier extends Gadget { protected final GameModifierType _type; + private final boolean _allowMultiple; /** * @param manager Normal GadgetManager @@ -25,16 +26,22 @@ public abstract class GadgetGameModifier extends Gadget * @param mat The display material used in GUIs * @param data The display data used in GUIs */ - public GadgetGameModifier(GadgetManager manager, GameModifierType type, String name, String[] desc, int cost, Material mat, byte data) + public GadgetGameModifier(GadgetManager manager, GameModifierType type, String name, String[] desc, int cost, Material mat, byte data, boolean allowMultiple) { super(manager, GadgetType.GameModifier, name, desc, cost, mat, data); _type = type; + _allowMultiple = allowMultiple; } public GameModifierType getGameType() { return _type; } + + public boolean canAllowMultiple() + { + return _allowMultiple; + } @Override public void enableCustom(Player player) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java index c8aabba05..77d46f7f1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -12,10 +12,22 @@ public abstract class OutfitGadget extends Gadget { public enum ArmorSlot { - Helmet, - Chest, - Legs, - Boots + Helmet ("Helmet"), + Chest ("Chestplate"), + Legs ("Leggings"), + Boots ("Boots"); + + private String _databaseKey; + + ArmorSlot(String databaseKey) + { + _databaseKey = databaseKey; + } + + public String getDatabaseKey() + { + return _databaseKey; + } } protected ArmorSlot _slot; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java index ceb014de4..12dbee6b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java @@ -10,7 +10,6 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Sound; import org.bukkit.entity.Entity; @@ -40,7 +39,7 @@ public class ProjectileManager extends MiniPlugin { if (_thrown.containsKey(thrown)) { - return _thrown.get(thrown).GetThrower(); + return _thrown.get(thrown).getThrower(); } return null; @@ -174,14 +173,14 @@ public class ProjectileManager extends MiniPlugin iterator.remove(); continue; } - else if (_thrown.get(cur).Collision()) + else if (_thrown.get(cur).collision()) iterator.remove(); } } //Effects for (ProjectileUser cur : _thrown.values()) - cur.Effect(event); + cur.effect(event); } @EventHandler(priority=EventPriority.LOW) @@ -191,7 +190,7 @@ public class ProjectileManager extends MiniPlugin return; if (_thrown.containsKey(event.getItem())) - if (!_thrown.get(event.getItem()).CanPickup(event.getPlayer())) + if (!_thrown.get(event.getItem()).canPickup(event.getPlayer())) event.setCancelled(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index 8a17080cd..31aee43b1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -143,7 +143,7 @@ public class ProjectileUser _canHit = canHit; } - public void Effect(UpdateEvent event) + public void effect(UpdateEvent event) { if (event.getType() != _effectRate) return; @@ -160,7 +160,7 @@ public class ProjectileUser } - public boolean Collision() + public boolean collision() { if (_expireTime != -1 && System.currentTimeMillis() > (_startTime + _expireTime)) { @@ -317,17 +317,17 @@ public class ProjectileUser return _callback; } - public LivingEntity GetThrower() + public LivingEntity getThrower() { return _thrower; } - public Entity GetThrown() + public Entity getThrown() { return _thrown; } - public boolean CanPickup(LivingEntity thrower) + public boolean canPickup(LivingEntity thrower) { if (!thrower.equals(_thrower)) return false; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/potato/PotatoManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/potato/PotatoManager.java index fe8880d24..bc9be3fff 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/potato/PotatoManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/potato/PotatoManager.java @@ -119,9 +119,9 @@ public class PotatoManager extends MiniPlugin implements IThrown give(player, 1); } - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); - data.GetThrown().remove(); + data.getThrown().remove(); } @Override diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 532058fa2..7684044f2 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -302,7 +302,7 @@ public class StackerManager extends MiniPlugin implements IThrown System.out.println("Stacker collide."); //Velocity - UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true); + UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.getThrown(), target), 1, true, 0.8, 0, 10, true); Entity rider = target.getPassenger(); while (rider != null) @@ -315,10 +315,10 @@ public class StackerManager extends MiniPlugin implements IThrown rider = rider.getPassenger(); } - UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown())))); + UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.getThrower())) + " hit you with " + F.name(UtilEnt.getName(data.getThrown())))); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); //Portal Delay Manager.SetPortalDelay(target); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java index c25d056b8..800547f8b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -37,7 +37,6 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.classcombat.Skill.SkillCharge; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; -import mineplex.minecraft.game.classcombat.Skill.event.BlockTossEvent; import mineplex.minecraft.game.classcombat.Skill.event.BlockTossExpireEvent; import mineplex.minecraft.game.classcombat.Skill.event.BlockTossLandEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; @@ -281,19 +280,19 @@ public class BlockToss extends SkillCharge implements IThrown if (target == null) return; - int level = getLevel(data.GetThrower()); + int level = getLevel(data.getThrower()); //Damage Event - Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.CUSTOM, data.GetThrown().getVelocity().length() * (3 + 0.6 * level), true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + Factory.Damage().NewDamageEvent(target, data.getThrower(), null, + DamageCause.CUSTOM, data.getThrown().getVelocity().length() * (3 + 0.6 * level), true, true, false, + UtilEnt.getName(data.getThrower()), GetName()); //Block to Item - if (data.GetThrown() instanceof FallingBlock) + if (data.getThrown() instanceof FallingBlock) { - FallingBlock thrown = (FallingBlock) data.GetThrown(); + FallingBlock thrown = (FallingBlock) data.getThrown(); - FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData()); + FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData()); newThrown.setDropItem(false); //Remove Old @@ -301,8 +300,8 @@ public class BlockToss extends SkillCharge implements IThrown thrown.remove(); //Add New - if (data.GetThrower() instanceof Player) - _falling.put(newThrown, (Player)data.GetThrower()); + if (data.getThrower() instanceof Player) + _falling.put(newThrown, (Player)data.getThrower()); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java index ca77c5908..373caea1f 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java @@ -3,7 +3,6 @@ package mineplex.minecraft.game.classcombat.Skill.Brute; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -126,13 +125,13 @@ public class FleshHook extends SkillActiveCharge implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Remove - double velocity = data.GetThrown().getVelocity().length(); - data.GetThrown().remove(); + double velocity = data.getThrown().getVelocity().length(); + data.getThrown().remove(); - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); //Level int level = getLevel(player); @@ -172,13 +171,13 @@ public class FleshHook extends SkillActiveCharge implements IThrown public void Idle(ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java index 957f53cb0..bf2d6aa75 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java @@ -3,7 +3,6 @@ package mineplex.minecraft.game.classcombat.Skill.Knight; import java.util.HashMap; import java.util.Iterator; -import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -27,7 +26,6 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; 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 mineplex.minecraft.game.classcombat.Skill.SkillActive; @@ -100,33 +98,33 @@ public class AxeThrow extends SkillActive implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); if (target == null) return; - int level = getLevel(data.GetThrower()); + int level = getLevel(data.getThrower()); if (level <= 0) return; double damage = 5.5 + 0.5 * level; //Damage Event - Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + Factory.Damage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, damage, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override public void Idle(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } @Override public void Expire(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } public void Rebound(LivingEntity player, Entity ent) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java index b78b0c96e..ba21f4252 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java @@ -100,23 +100,23 @@ public class FreezingBlast extends SkillActive implements IThrown public void Action(LivingEntity target, ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 79); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 79); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); //Thrower - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); //Level int level = getLevel(player); if (level == 0) return; //Snow Spread - HashMap blocks = UtilBlock.getInRadius(data.GetThrown().getLocation(), 4d); + HashMap blocks = UtilBlock.getInRadius(data.getThrown().getLocation(), 4d); for (Block cur : blocks.keySet()) { if (UtilBlock.airFoliage(cur) && UtilBlock.solid(cur.getRelative(BlockFace.DOWN))) @@ -127,7 +127,7 @@ public class FreezingBlast extends SkillActive implements IThrown } //Slow Players - for (Player curPlayer : UtilPlayer.getNearby(data.GetThrown().getLocation(), 4)) + for (Player curPlayer : UtilPlayer.getNearby(data.getThrown().getLocation(), 4)) Factory.Condition().Factory().Slow(GetName(), curPlayer, player, 2.9, 0, false, true, true, true); if (target == null) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java index 9a8450374..7f9f0b6a7 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java @@ -7,17 +7,14 @@ import org.bukkit.block.Block; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.updater.UpdateType; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; @@ -83,38 +80,38 @@ public class GlacialBlade extends SkillActive implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); if (target == null) return; //Damage - Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + Factory.Damage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3.5, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override public void Idle(ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java index f2201330b..2c2c0f118 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java @@ -101,22 +101,22 @@ public class IcePrison extends SkillActive implements IThrown public void Action(LivingEntity target, ProjectileUser data) { //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 79); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 79); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); //Thrower - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); //Level int level = getLevel(player); if (level == 0) return; - Block block = data.GetThrown().getLocation().getBlock(); + Block block = data.getThrown().getLocation().getBlock(); //Sphere HashMap blocks = UtilBlock.getInRadius(block, 3.8d); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java index 17cea9ff8..027fee62a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java @@ -132,20 +132,20 @@ public class LightningOrb extends SkillActive implements IThrown public void Strike(LivingEntity target, ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); //Thrower - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); //Level int level = getLevel(player); if (level == 0) return; - HashMap hit = UtilEnt.getInRadius(data.GetThrown().getLocation(), 3 + 0.5 * level); + HashMap hit = UtilEnt.getInRadius(data.getThrown().getLocation(), 3 + 0.5 * level); List struck = new ArrayList<>(); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java index de226ba57..08d800a16 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Consume/Apple.java @@ -56,18 +56,18 @@ public class Apple extends ItemUsable return; //Damage Event - Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + Factory.Damage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 2, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); //Re-Drop - if (data.GetThrown() instanceof Item) - data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(((Item)data.GetThrown()).getItemStack().getType())).setPickupDelay(60); + if (data.getThrown() instanceof Item) + data.getThrown().getWorld().dropItem(data.getThrown().getLocation(), ItemStackFactory.Instance.CreateStack(((Item)data.getThrown()).getItemStack().getType())).setPickupDelay(60); - data.GetThrown().remove(); + data.getThrown().remove(); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java index 111d15db7..08293d5a7 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/PoisonBall.java @@ -39,24 +39,24 @@ public class PoisonBall extends ItemUsable @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); if (target == null) return; - Factory.Condition().Factory().Poison(GetName(), target, data.GetThrower(), 6, 0, false, true, true); + Factory.Condition().Factory().Poison(GetName(), target, data.getThrower(), 6, 0, false, true, true); } @Override public void Idle(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } @Override public void Expire(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } public void Rebound(LivingEntity player, Entity ent) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java index a6895deda..017f6c5fe 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java @@ -1,7 +1,6 @@ package mineplex.minecraft.game.classcombat.item.Throwable; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import org.bukkit.Bukkit; @@ -79,33 +78,33 @@ public class ProximityExplosive extends ItemUsable public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Idle(ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Expire(ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @EventHandler(priority = EventPriority.LOW) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java index 3a3c22886..3076b403b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java @@ -1,12 +1,10 @@ package mineplex.minecraft.game.classcombat.item.Throwable; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import org.bukkit.Bukkit; import org.bukkit.Effect; -import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -77,33 +75,33 @@ public class ProximityZapper extends ItemUsable public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Idle(ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Expire(ProjectileUser data) { //Arm - _armed.put(data.GetThrown(), data.GetThrower()); + _armed.put(data.getThrown(), data.getThrower()); //Effect - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 7); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @EventHandler(priority = EventPriority.LOW) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java index 347755706..99361e426 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java @@ -80,17 +80,17 @@ public class WaterBottle extends ItemUsable public void Break(ProjectileUser data) { //Splash - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 20); - data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 8); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.SPLASH, 1f, 1.4f); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 20); + data.getThrown().getWorld().playEffect(data.getThrown().getLocation(), Effect.STEP_SOUND, 8); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.SPLASH, 1f, 1.4f); //Extinguish - Factory.Fire().RemoveNear(data.GetThrown().getLocation(), 3); + Factory.Fire().RemoveNear(data.getThrown().getLocation(), 3); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); - for (Player player : UtilPlayer.getNearby(data.GetThrown().getLocation(), 3)) + for (Player player : UtilPlayer.getNearby(data.getThrown().getLocation(), 3)) { //Extinguish player.setFireTicks(-20); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java index a765748d7..023afeb5c 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/Web.java @@ -7,7 +7,6 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -47,27 +46,27 @@ public class Web extends ItemUsable { if (target != null) { - double distance = UtilMath.offset(target.getLocation(), data.GetThrown().getLocation()); + double distance = UtilMath.offset(target.getLocation(), data.getThrown().getLocation()); if (distance > .75) { - data.GetThrown().teleport(data.GetThrown().getLocation().add(new Vector(0, -distance / 2, 0))); + data.getThrown().teleport(data.getThrown().getLocation().add(new Vector(0, -distance / 2, 0))); } } - CreateWeb(data.GetThrown()); + CreateWeb(data.getThrown()); } @Override public void Idle(ProjectileUser data) { - CreateWeb(data.GetThrown()); + CreateWeb(data.getThrown()); } @Override public void Expire(ProjectileUser data) { - CreateWeb(data.GetThrown()); + CreateWeb(data.getThrown()); } public void CreateWeb(Entity ent) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/slimeking/ability/RocketAbility.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/slimeking/ability/RocketAbility.java index 2675c0530..d77b039ef 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/slimeking/ability/RocketAbility.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/slimeking/ability/RocketAbility.java @@ -109,27 +109,27 @@ public class RocketAbility extends SlimeAbility implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { // Bukkit.broadcastMessage("COLLIDE " + target); - UtilParticle.PlayParticle(UtilParticle.ParticleType.LARGE_EXPLODE, data.GetThrown().getLocation(), 0, 0, 0, 0, 1, UtilParticle.ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(UtilParticle.ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, UtilParticle.ViewDist.LONG, UtilServer.getPlayers()); target.getLocation().getWorld().playSound(target.getLocation(), Sound.SPLASH, 1, 2); getSlime().getEvent().getDamageManager().NewDamageEvent(target, getSlime().getEntity(), null, EntityDamageEvent.DamageCause.PROJECTILE, 3 + getSlime().getSize() * 3, true, true, false, getSlime().getName(), "Slime Rocket"); - data.GetThrown().remove(); + data.getThrown().remove(); _rocketsHit++; } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); _rocketsHit++; } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); _rocketsHit++; } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/attacks/SpiderPoison.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/attacks/SpiderPoison.java index ec57283bb..3135945b0 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/attacks/SpiderPoison.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/spider/attacks/SpiderPoison.java @@ -3,7 +3,6 @@ package mineplex.minecraft.game.core.boss.spider.attacks; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -12,7 +11,6 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.minecraft.game.core.boss.EventCreature; @@ -53,9 +51,9 @@ public class SpiderPoison implements IThrown private void burst(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); - UtilParticle.PlayParticle(ParticleType.ICON_CRACK.getParticle(Material.SLIME_BALL, 0), data.GetThrown().getLocation(), + UtilParticle.PlayParticle(ParticleType.ICON_CRACK.getParticle(Material.SLIME_BALL, 0), data.getThrown().getLocation(), 0.3F, 0.3F, 0.3F, 0, 30, ViewDist.NORMAL, UtilServer.getPlayers()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java index e1d90d398..1ed85835a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -175,24 +175,24 @@ public class PerkBlockTossEVO extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.PROJECTILE, data.GetThrown().getVelocity().length() * 4, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, + DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * 4, true, true, false, + UtilEnt.getName(data.getThrower()), GetName()); //Block to Item - if (data.GetThrown() instanceof FallingBlock) + if (data.getThrown() instanceof FallingBlock) { - FallingBlock thrown = (FallingBlock) data.GetThrown(); + FallingBlock thrown = (FallingBlock) data.getThrown(); - FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0); + FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte)0); //Remove Old _falling.remove(thrown); thrown.remove(); //Add New - if (data.GetThrower() instanceof Player) - _falling.put(newThrown, (Player)data.GetThrower()); + if (data.getThrower() instanceof Player) + _falling.put(newThrown, (Player)data.getThrower()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index 504ee6d9a..4baac10db 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -103,9 +103,9 @@ public class PerkSulphurBombEVO extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 5, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -122,10 +122,10 @@ public class PerkSulphurBombEVO extends Perk implements IThrown public void Explode(ProjectileUser data) { - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.GetThrown().getLocation(), 0, 0, 0, 0, 1, + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index a1ef621a3..a23144570 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -85,7 +85,7 @@ public class PerkWebEVO extends Perk implements IThrown { if (Manager.GetGame().IsAlive((Player)target)) { - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.CUSTOM, 8, false, false, false, "Web Shot", "Webbed Net"); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 8, false, false, false, "Web Shot", "Webbed Net"); target.playEffect(EntityEffect.HURT); } else @@ -112,9 +112,9 @@ public class PerkWebEVO extends Perk implements IThrown public void Web(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); + Location loc = data.getThrown().getLocation(); - data.GetThrown().remove(); + data.getThrown().remove(); if (loc.getBlock().getType() != Material.AIR) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 93d9bb2bd..10b5abe6a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -566,26 +566,26 @@ public class BombLobbers extends TeamGame implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - if (!(data.GetThrown() instanceof TNTPrimed)) + if (!(data.getThrown() instanceof TNTPrimed)) return; - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; if (!(target instanceof Player)) return; - if (GetTeam((Player) target) == GetTeam((Player) data.GetThrower())) + if (GetTeam((Player) target) == GetTeam((Player) data.getThrower())) return; - data.GetThrown().setVelocity(new Vector()); + data.getThrown().setVelocity(new Vector()); if (target != null) - UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true); + UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.getThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true); - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 10.0, false, false, false, "Throwing TNT", "Throwing TNT Direct Hit"); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 10.0, false, false, false, "Throwing TNT", "Throwing TNT Direct Hit"); - AddGems((Player) data.GetThrower(), 4.0, "Direct Hit", true, true); + AddGems((Player) data.getThrower(), 4.0, "Direct Hit", true, true); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index 10f901cd1..a8ecdc232 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -310,18 +310,18 @@ public class Runner extends SoloGame implements IThrown return; } - if (target.getLocation().getY() > data.GetThrown().getLocation().getY() + 0.5) + if (target.getLocation().getY() > data.getThrown().getLocation().getY() + 0.5) { return; } } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.ENTITY_ATTACK, 6, true, true, false, "Falling Block", "Falling Block"); - BlockSmash(data.GetThrown()); + BlockSmash(data.getThrown()); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java index 29fd02576..6ca0a54e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java @@ -173,26 +173,26 @@ public class PerkFishFlurry extends SmashPerk implements IThrown if (target != null) { //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java index 93fd43c1e..99bd044f1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java @@ -170,14 +170,14 @@ public class Stacker extends SoloGame implements IThrown hit = hit.getVehicle(); //Hit Own Stack > Rethrow - if (hit.equals(data.GetThrower())) + if (hit.equals(data.getThrower())) { - Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this, -1, true, false, true, false, 1f); + Manager.GetProjectile().AddThrow(data.getThrown(), data.getThrower(), this, -1, true, false, true, false, 1f); return; } //Velocity on base component - UtilAction.velocity(hit, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true); + UtilAction.velocity(hit, UtilAlg.getTrajectory2d(data.getThrown(), target), 1, true, 0.8, 0, 10, true); //Shuffle Up Entity top = target; @@ -192,10 +192,10 @@ public class Stacker extends SoloGame implements IThrown rider = rider.getPassenger(); } - UtilPlayer.message(target, F.main("Game", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown())))); + UtilPlayer.message(target, F.main("Game", F.name(UtilEnt.getName(data.getThrower())) + " hit you with " + F.name(UtilEnt.getName(data.getThrown())))); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); } @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 586bd9167..55b003818 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 @@ -24,7 +24,7 @@ public class KitBeastmaster extends Kit new Perk[] { - new PerkWolfPet(30, 1, false, true) + new PerkWolfPet(manager, 30, 1, false, true) }, EntityType.ZOMBIE, new ItemStack(Material.BONE)); 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 dbf7f7638..4cc345f76 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 @@ -25,7 +25,7 @@ public class KitHorseman extends Kit new Perk[] { - new PerkHorsePet() + new PerkHorsePet(manager) }, EntityType.HORSE, new ItemStack(Material.DIAMOND_BARDING)); 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..c34dd187b 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 @@ -24,7 +24,7 @@ public class KitNecromancer extends Kit new Perk[] { - new PerkSkeletons(true) + new PerkSkeletons(manager, true) }, EntityType.ZOMBIE, new ItemStack(Material.SKULL_ITEM)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIcePrison.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIcePrison.java index baabb5ae0..8fdab34d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIcePrison.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIcePrison.java @@ -67,7 +67,7 @@ public class SpellIcePrison extends Spell implements SpellClick, IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - if (target != data.GetThrower()) + if (target != data.getThrower()) { IcePrison(data); } @@ -81,11 +81,11 @@ public class SpellIcePrison extends Spell implements SpellClick, IThrown public void IcePrison(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); HashMap blocks = UtilBlock.getInRadius(loc.getBlock(), - data.GetThrown().getMetadata("PrisonStrength").get(0).asDouble(), true); + data.getThrown().getMetadata("PrisonStrength").get(0).asDouble(), true); for (Block block : blocks.keySet()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIceShards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIceShards.java index 94181f076..aad833881 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIceShards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellIceShards.java @@ -85,7 +85,7 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown // Damage Event Wizards.getArcadeManager() .GetDamage() - .NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 4 /*+ (timesHit * 2)*/, true, true, + .NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 4 /*+ (timesHit * 2)*/, true, true, false, "Ice Shard", "Ice Shard"); } @@ -95,8 +95,8 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown private void handleShard(ProjectileUser data) { - data.GetThrown().remove(); - Location loc = data.GetThrown().getLocation(); + data.getThrown().remove(); + Location loc = data.getThrown().getLocation(); UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(Material.PACKED_ICE, 0), loc, 0.3F, 0.3F, 0.3F, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); @@ -118,7 +118,7 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown } } - _lastParticles.remove(data.GetThrown()); + _lastParticles.remove(data.getThrown()); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellWebShot.java index 73e1f544b..567078d29 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellWebShot.java @@ -19,7 +19,6 @@ import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; public class SpellWebShot extends Spell implements SpellClick, IThrown { @@ -67,9 +66,9 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - if (target != data.GetThrower()) + if (target != data.getThrower()) { - Location loc = data.GetThrown().getLocation(); + Location loc = data.getThrown().getLocation(); if (target != null) { @@ -94,7 +93,7 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown // Damage Event /* Wizards.getArcadeManager() .GetDamage() - .NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2, false, false, false, + .NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 2, false, false, false, "Web Shot", "Web Shot");*/ } @@ -149,18 +148,18 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown @Override public void Idle(ProjectileUser data) { - Web(data, data.GetThrown().getLocation()); + Web(data, data.getThrown().getLocation()); } @Override public void Expire(ProjectileUser data) { - Web(data, data.GetThrown().getLocation()); + Web(data, data.getThrown().getLocation()); } public void Web(ProjectileUser data, Location loc) { - data.GetThrown().remove(); + data.getThrown().remove(); Block block = getValidLocation(loc); 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..559fb6040 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,8 @@ package nautilus.game.arcade.kit.perks; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; +import nautilus.game.arcade.ArcadeManager; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -21,19 +24,21 @@ 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) + private final ArcadeManager _manager; + + public PerkApple(ArcadeManager manager) { super("Apple Thrower", new String[] { C.cGray + "Receive 1 Apple every 10 seconds", C.cYellow + "Left-Click" + C.cGray + " with Apple to " + C.cGreen + "Throw Apple", }); + _manager = manager; } @EventHandler @@ -53,10 +58,10 @@ public class PerkApple extends Perk implements IThrown if (!Manager.GetGame().IsAlive(player)) continue; - if (!Recharge.Instance.use(player, "Apple Spawn", 10000, false, false)) + if (!Recharge.Instance.use(player, getMessage(player), 10000, false, false)) continue; - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(260)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(getMaterial(player))); player.playSound(player.getLocation(), Sound.ITEM_PICKUP, 2f, 1f); } } @@ -70,7 +75,7 @@ public class PerkApple extends Perk implements IThrown if (event.getPlayer().getItemInHand() == null) return; - if (event.getPlayer().getItemInHand().getType() != Material.APPLE) + if (event.getPlayer().getItemInHand().getType() != getMaterial(event.getPlayer())) return; Player player = event.getPlayer(); @@ -80,10 +85,10 @@ public class PerkApple extends Perk implements IThrown event.setCancelled(true); - UtilInv.remove(player, Material.APPLE, (byte)0, 1); + UtilInv.remove(player, getMaterial(player), (byte)0, 1); UtilInv.Update(player); - org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE)); + org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(getMaterial(player))); UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f); } @@ -96,25 +101,25 @@ public class PerkApple extends Perk implements IThrown if (target instanceof Player) { - if (!Manager.GetGame().IsAlive((Player)target)) + if (!Manager.GetGame().IsAlive(target)) { return; } } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3, true, false, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1.6f); //Re-Drop - if (data.GetThrown() instanceof Item) - data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE)).setPickupDelay(60); + if (data.getThrown() instanceof Item && data.getThrown() instanceof Player) + data.getThrown().getWorld().dropItem(data.getThrown().getLocation(), ItemStackFactory.Instance.CreateStack(getMaterial((Player) data.getThrower()))).setPickupDelay(60); - data.GetThrown().remove(); + data.getThrown().remove(); } @Override @@ -128,4 +133,22 @@ public class PerkApple extends Perk implements IThrown { } + + private Material getMaterial(Player player) + { + if (_manager.getCosmeticManager().getGadgetManager().isKitModifierActive(KitModifier.Bridges_Apple_Potato, player)) + { + return Material.POTATO_ITEM; + } + return Material.APPLE; + } + + private String getMessage(Player player) + { + if (_manager.getCosmeticManager().getGadgetManager().isKitModifierActive(KitModifier.Bridges_Apple_Potato, player)) + { + return "Potato Spawn"; + } + return "Apple Spawn"; + } } 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..552e5c6ad 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 @@ -74,7 +74,7 @@ public class PerkAxeThrower extends Perk implements IThrown if (!Manager.GetGame().IsAlive((Player)target)) return; - Item item = (Item)data.GetThrown(); + Item item = (Item)data.getThrown(); int damage = 4; if (item.getItemStack().getType() == Material.STONE_AXE) damage = 5; @@ -82,18 +82,18 @@ public class PerkAxeThrower extends Perk implements IThrown else if (item.getItemStack().getType() == Material.DIAMOND_AXE) damage = 7; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, damage, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.ZOMBIE_WOOD, 1f, 1.6f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.ZOMBIE_WOOD, 1f, 1.6f); //Re-Drop - data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(item.getItemStack().getType())).setPickupDelay(60); + data.getThrown().getWorld().dropItem(data.getThrown().getLocation(), ItemStackFactory.Instance.CreateStack(item.getItemStack().getType())).setPickupDelay(60); //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java index 89ff68f52..a24bec73d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java @@ -89,9 +89,9 @@ public class PerkBaconBlast extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 6, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -109,8 +109,8 @@ public class PerkBaconBlast extends Perk implements IThrown public void Explode(ProjectileUser data) { // for whatever reason, you can't put a location in createExplosion if you don't want it to break blocks >.> - Location loc = data.GetThrown().getLocation(); - data.GetThrown().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 0.5f, false, false); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 0.5f, false, false); + data.getThrown().remove(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockRestorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockRestorer.java index 16e17e38d..c4c754d8f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockRestorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockRestorer.java @@ -66,19 +66,19 @@ public class PerkBlockRestorer extends Perk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - restore(data.GetThrown()); + restore(data.getThrown()); } @Override public void Idle(ProjectileUser data) { - restore(data.GetThrown()); + restore(data.getThrown()); } @Override public void Expire(ProjectileUser data) { - restore(data.GetThrown()); + restore(data.getThrown()); } public void restore(Entity entity) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java index f74e03053..83870c9d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlockToss.java @@ -166,24 +166,24 @@ public class PerkBlockToss extends SmashPerk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.PROJECTILE, data.GetThrown().getVelocity().length() * 10, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, + DamageCause.PROJECTILE, data.getThrown().getVelocity().length() * 10, true, true, false, + UtilEnt.getName(data.getThrower()), GetName()); //Block to Item - if (data.GetThrown() instanceof FallingBlock) + if (data.getThrown() instanceof FallingBlock) { - FallingBlock thrown = (FallingBlock) data.GetThrown(); + FallingBlock thrown = (FallingBlock) data.getThrown(); - FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0); + FallingBlock newThrown = data.getThrown().getWorld().spawnFallingBlock(data.getThrown().getLocation(), thrown.getMaterial(), (byte)0); //Remove Old _falling.remove(thrown); thrown.remove(); //Add New - if (data.GetThrower() instanceof Player) - _falling.put(newThrown, (Player)data.GetThrower()); + if (data.getThrower() instanceof Player) + _falling.put(newThrown, (Player)data.getThrower()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java index 3bee3341d..4a5790f73 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBoneRush.java @@ -141,12 +141,12 @@ public class PerkBoneRush extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); if (target == null) return; - Player damager = (Player)data.GetThrower(); + Player damager = (Player)data.getThrower(); double damage = 0.7; String reason = GetName(); @@ -158,23 +158,23 @@ public class PerkBoneRush extends SmashPerk implements IThrown } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, damage, false, true, false, - UtilEnt.getName(data.GetThrower()), reason); + UtilEnt.getName(data.getThrower()), reason); - UtilAction.velocity(target, data.GetThrown().getVelocity()); + UtilAction.velocity(target, data.getThrown().getVelocity()); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java index e3461cd2f..535dc0ca5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCowBomb.java @@ -96,9 +96,9 @@ public class PerkCowBomb extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 4, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -116,11 +116,11 @@ public class PerkCowBomb extends Perk implements IThrown public void Explode(ProjectileUser data) { //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.COW_HURT, 2f, 1.2f); - data.GetThrown().getWorld().createExplosion(data.GetThrown().getLocation(), 0.5f); - data.GetThrown().remove(); + data.getThrown().getWorld().createExplosion(data.getThrown().getLocation(), 0.5f); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java index e9759b073..c1d93f7b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperSulphurBomb.java @@ -27,7 +27,6 @@ import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashPerk; public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown @@ -99,9 +98,9 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 7, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -118,10 +117,10 @@ public class PerkCreeperSulphurBomb extends SmashPerk implements IThrown public void Explode(ProjectileUser data) { - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.GetThrown().getLocation(), 0, 0, 0, 0, 1, + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.getThrown().getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java index 6abfaf5d1..10c87bc33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHammerThrow.java @@ -130,7 +130,7 @@ public class PerkHammerThrow extends Perk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); if (target == null) return; @@ -140,21 +140,21 @@ public class PerkHammerThrow extends Perk implements IThrown damage = 8; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.LIGHTNING, damage, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override public void Idle(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } @Override public void Expire(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } public void Rebound(LivingEntity player, Entity ent) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java index 19133d9b3..fde17d8b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkHorsePet.java @@ -3,7 +3,10 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; -import org.bukkit.Bukkit; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; +import nautilus.game.arcade.ArcadeManager; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Entity; @@ -31,16 +34,17 @@ import nautilus.game.arcade.kit.Perk; public class PerkHorsePet extends Perk { + private ArcadeManager _manager; private HashMap _horseMap = new HashMap(); private HashMap _deathTime = new HashMap(); - public PerkHorsePet() + public PerkHorsePet(ArcadeManager manager) { super("Horse Master", new String[] { C.cGray + "You have a loyal horse companion.", }); - + _manager = manager; //Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin()); } @@ -63,7 +67,32 @@ public class PerkHorsePet extends Perk horse.setAgeLock(true); horse.setColor(Color.BROWN); horse.setStyle(Style.NONE); - horse.setVariant(Variant.HORSE); + KitModifier kitModifier = getHorseType(player); + if (kitModifier != null) + { + switch (getHorseType(player)) + { + case Survival_Games_Horseman_Mule: + horse.setVariant(Variant.MULE); + break; + case Survival_Games_Horseman_Skeleton_Horse: + horse.setVariant(Variant.SKELETON_HORSE); + break; + case Survival_Games_Horseman_Zombie_Horse: + horse.setVariant(Variant.UNDEAD_HORSE); + break; + case Survival_Games_Horseman_Donkey: + horse.setVariant(Variant.DONKEY); + break; + default: + horse.setVariant(Variant.HORSE); + break; + } + } + else + { + horse.setVariant(Variant.HORSE); + } horse.setOwner(player); horse.setMaxDomestication(1); horse.setJumpStrength(1); @@ -228,4 +257,10 @@ public class PerkHorsePet extends Perk return; } } + + private KitModifier getHorseType(Player player) + { + GadgetManager gadgetManager = _manager.getCosmeticManager().getGadgetManager(); + return gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_HorsemanKit, player); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java index fee34747e..bc40a81ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.kit.perks; -import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -118,9 +117,9 @@ public class PerkInkBlast extends SmashPerk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, _damagePerBullet, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers()); } @@ -139,8 +138,8 @@ public class PerkInkBlast extends SmashPerk implements IThrown public void Explode(ProjectileUser data) { - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 0.75f, 1.25f); - data.GetThrown().remove(); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.EXPLODE, 0.75f, 1.25f); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java index e629b7d8d..d938dd3d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkIronHook.java @@ -77,13 +77,13 @@ public class PerkIronHook extends Perk implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { //Remove - double velocity = data.GetThrown().getVelocity().length(); - data.GetThrown().remove(); + double velocity = data.getThrown().getVelocity().length(); + data.getThrown().remove(); - if (!(data.GetThrower() instanceof Player)) + if (!(data.getThrower() instanceof Player)) return; - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); if (target == null) return; @@ -109,14 +109,14 @@ public class PerkIronHook extends Perk implements IThrown public void Idle(ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { //Remove - data.GetThrown().remove(); + data.getThrown().remove(); } } 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..d94f27e2d 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 @@ -7,22 +7,11 @@ 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.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; @@ -36,7 +25,6 @@ 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; @@ -185,9 +173,9 @@ public class PerkMadScientist extends Perk implements IThrown if (target != null) { - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 1.5D, true, false, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @@ -210,28 +198,28 @@ public class PerkMadScientist extends Perk implements IThrown public void spawnMobs(ProjectileUser data) { - data.GetThrown() + data.getThrown() .getWorld() - .playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 1f, + .playSound(data.getThrown().getLocation(), Sound.EXPLODE, 1f, 1.6f); - UtilParticle.PlayParticle(ParticleType.EXPLODE, data.GetThrown() + UtilParticle.PlayParticle(ParticleType.EXPLODE, data.getThrown() .getLocation(), 0F, 0F, 0F, 1F, 5, ViewDist.SHORT, UtilServer .getPlayers()); - data.GetThrown().remove(); + data.getThrown().remove(); Manager.GetGame().CreatureAllowOverride = true; - Zombie zombie = (Zombie) data.GetThrown().getWorld() - .spawn(data.GetThrown().getLocation(), Zombie.class); + Zombie zombie = (Zombie) data.getThrown().getWorld() + .spawn(data.getThrown().getLocation(), Zombie.class); zombie.setRemoveWhenFarAway(false); zombie.setMaxHealth(10.0D); zombie.setHealth(10.0D); UtilEnt.silence(zombie, true); //Name - zombie.setCustomName(C.cAqua + UtilEnt.getName(data.GetThrower()) + "'s Minion"); + zombie.setCustomName(C.cAqua + UtilEnt.getName(data.getThrower()) + "'s Minion"); zombie.setCustomNameVisible(true); // double r = Math.random(); @@ -261,13 +249,13 @@ public class PerkMadScientist extends Perk implements IThrown // // if (disguise instanceof DisguiseInsentient) // { -// if (((Player) data.GetThrower()).getName().toLowerCase().endsWith("s")) +// if (((Player) data.getThrower()).getName().toLowerCase().endsWith("s")) // { -// ((DisguiseInsentient)disguise).setName(C.cAqua + UtilEnt.getName(data.GetThrower()) + "' Minion"); +// ((DisguiseInsentient)disguise).setName(C.cAqua + UtilEnt.getName(data.getThrower()) + "' Minion"); // } // else // { -// ((DisguiseInsentient)disguise).setName(C.cAqua + UtilEnt.getName(data.GetThrower()) + "' Minion"); +// ((DisguiseInsentient)disguise).setName(C.cAqua + UtilEnt.getName(data.getThrower()) + "' Minion"); // } // // ((DisguiseInsentient)disguise).setCustomNameVisible(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java index cff63ed81..b458b763d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java @@ -104,30 +104,30 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); if (target == null) return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 4, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); - Item item = (Item)data.GetThrown(); + Item item = (Item)data.getThrown(); item.setItemStack(new ItemStack(Material.GRILLED_PORK)); } @Override public void Idle(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } @Override public void Expire(ProjectileUser data) { - Rebound(data.GetThrower(), data.GetThrown()); + Rebound(data.getThrower(), data.getThrown()); } public void Rebound(LivingEntity player, Entity ent) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java index 022e13315..37dabb0f8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java @@ -147,22 +147,22 @@ public class PerkRevealer extends Perk implements IThrown { // Workaround to make firework effect always visible for (int i = 0; i < 3; i++) - UtilFirework.playFirework(data.GetThrown().getLocation(), REVEALER_FIREWORK_EFFECT); + UtilFirework.playFirework(data.getThrown().getLocation(), REVEALER_FIREWORK_EFFECT); - data.GetThrown().getLocation().getWorld().playSound(data.GetThrown().getLocation(), Sound.ZOMBIE_UNFECT, 2f, 0.5f); + data.getThrown().getLocation().getWorld().playSound(data.getThrown().getLocation(), Sound.ZOMBIE_UNFECT, 2f, 0.5f); for (Player player : Manager.GetGame().GetPlayers(true)) { - if (player == data.GetThrower()) + if (player == data.getThrower()) continue; - if (player.getLocation().getWorld() == data.GetThrown().getWorld() && player.getLocation().distanceSquared(data.GetThrown().getLocation()) <= 12 * 12) + if (player.getLocation().getWorld() == data.getThrown().getWorld() && player.getLocation().distanceSquared(data.getThrown().getLocation()) <= 12 * 12) { RevealedPlayerInfo info = getRevealedPlayers().get(player); if (info == null) { - Bukkit.getPluginManager().callEvent(new PlayerRevealEvent(player, data.GetThrower())); + Bukkit.getPluginManager().callEvent(new PlayerRevealEvent(player, data.getThrower())); info = new RevealedPlayerInfo(Manager.GetDisguise().getDisguise(player)); getRevealedPlayers().put(player, info); @@ -175,7 +175,7 @@ public class PerkRevealer extends Perk implements IThrown } } - data.GetThrown().remove(); + data.getThrown().remove(); } public Map getRevealedPlayers() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index 3533cc8be..6cff0cdb4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -1,10 +1,15 @@ package nautilus.game.arcade.kit.perks; import mineplex.core.common.util.*; +import mineplex.core.disguise.disguises.DisguiseZombie; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; import mineplex.core.updater.*; import mineplex.core.updater.event.*; import mineplex.minecraft.game.core.combat.event.*; import mineplex.minecraft.game.core.damage.*; +import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.*; import net.minecraft.server.v1_8_R3.*; @@ -52,18 +57,20 @@ public class PerkSkeletons extends Perk } } + private ArcadeManager _manager; + private HashMap> _minions = new HashMap>(); private boolean _name; private int _maxDist = 8; - public PerkSkeletons(boolean name) + public PerkSkeletons(ArcadeManager manager, boolean name) { super("Skeleton Minons", new String[] { C.cGray + "Killing an opponent summons a skeletal minion." }); - + _manager = manager; _name = name; } @@ -112,6 +119,29 @@ public class PerkSkeletons extends Perk skel.getEquipment().setLeggingsDropChance(1f); skel.getEquipment().setBootsDropChance(1f); + KitModifier kitModifier = getSkeletonType(killer); + if (kitModifier != null) + { + switch (kitModifier) + { + case Survival_Games_Necromancer_Wither_Skeleton: + skel.setSkeletonType(Skeleton.SkeletonType.WITHER); + break; + case Survival_Games_Necromancer_Zombie: + skel.setSkeletonType(Skeleton.SkeletonType.NORMAL); + DisguiseZombie disguiseZombie = new DisguiseZombie(skel); + _manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseZombie); + break; + default: + skel.setSkeletonType(Skeleton.SkeletonType.NORMAL); + break; + } + } + else + { + skel.setSkeletonType(Skeleton.SkeletonType.NORMAL); + } + if (_name) { skel.setCustomName("Skeletal " + UtilEnt.getName(event.GetEvent().getEntity())); @@ -119,7 +149,7 @@ public class PerkSkeletons extends Perk } if (!_minions.containsKey(killer)) - _minions.put(killer, new ArrayList()); + _minions.put(killer, new ArrayList<>()); _minions.get(killer).add(skel); @@ -292,4 +322,10 @@ public class PerkSkeletons extends Perk { return _minions.get(player); } + + private KitModifier getSkeletonType(Player player) + { + GadgetManager gadgetManager = _manager.getCosmeticManager().getGadgetManager(); + return gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_NecromancerKit, player); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java index 1b16508b9..4a433a9d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java @@ -220,15 +220,15 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown if (target == null) return; - if (!(data.GetThrown() instanceof Slime)) + if (!(data.getThrown() instanceof Slime)) return; - Slime slime = (Slime)data.GetThrown(); + Slime slime = (Slime)data.getThrown(); //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java index 7beb2494c..0157bf271 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidRifle.java @@ -136,9 +136,9 @@ public class PerkSquidRifle extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 50, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override @@ -155,13 +155,13 @@ public class PerkSquidRifle extends Perk implements IThrown public void Explode(ProjectileUser data) { - if (!(data.GetThrown() instanceof Firework)) + if (!(data.getThrown() instanceof Firework)) { - data.GetThrown().remove(); + data.getThrown().remove(); return; } - Firework fw = (Firework)data.GetThrown(); + Firework fw = (Firework)data.getThrown(); try { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java index cb51926b9..797468967 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidShotgun.java @@ -145,14 +145,14 @@ public class PerkSquidShotgun extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 12, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Recharge - if (data.GetThrower() instanceof Player) + if (data.getThrower() instanceof Player) { - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); Recharge.Instance.recharge(player, GetName()); player.playSound(player.getLocation(), Sound.NOTE_STICKS, 3f, 1f); } @@ -172,13 +172,13 @@ public class PerkSquidShotgun extends Perk implements IThrown public void Explode(ProjectileUser data) { - if (!(data.GetThrown() instanceof Firework)) + if (!(data.getThrown() instanceof Firework)) { - data.GetThrown().remove(); + data.getThrown().remove(); return; } - Firework fw = (Firework)data.GetThrown(); + Firework fw = (Firework)data.getThrown(); try { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java index 687869ecc..96b38e418 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSquidSniper.java @@ -136,14 +136,14 @@ public class PerkSquidSniper extends Perk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 50, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Recharge - if (data.GetThrower() instanceof Player) + if (data.getThrower() instanceof Player) { - Player player = (Player)data.GetThrower(); + Player player = (Player)data.getThrower(); Recharge.Instance.recharge(player, GetName()); player.playSound(player.getLocation(), Sound.NOTE_STICKS, 3f, 1f); } @@ -163,13 +163,13 @@ public class PerkSquidSniper extends Perk implements IThrown public void Explode(ProjectileUser data) { - if (!(data.GetThrown() instanceof Firework)) + if (!(data.getThrown() instanceof Firework)) { - data.GetThrown().remove(); + data.getThrown().remove(); return; } - Firework fw = (Firework)data.GetThrown(); + Firework fw = (Firework)data.getThrown(); try { 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..acce5d08c 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 @@ -97,21 +97,21 @@ public class PerkThrower extends Perk implements IThrown } //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 6, false, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); //Bounce - Vector dir = UtilAlg.getTrajectory(data.GetThrown(), target); + Vector dir = UtilAlg.getTrajectory(data.getThrown(), target); if (dir.getY() < 0) dir.setY(0); UtilAction.velocity(target, dir, 1.2, false, 0, 0.4, 1, true); - dir = UtilAlg.getTrajectory(target, data.GetThrown()); + dir = UtilAlg.getTrajectory(target, data.getThrown()); if (dir.getY() < 0) dir.setY(0); - UtilAction.velocity(data.GetThrown(), dir, 0.2, false, 0, 0.2, 1, true); + UtilAction.velocity(data.getThrown(), dir, 0.2, false, 0, 0.2, 1, true); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.SHEEP_IDLE, 3f, 5f); + data.getThrown().getWorld().playSound(data.getThrown().getLocation(), Sound.SHEEP_IDLE, 3f, 5f); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java index 2e40fe70d..dcaa8df8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWeb.java @@ -131,8 +131,8 @@ public class PerkWeb extends Perk implements IThrown public void Web(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 4000); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java index cbe999d59..7103f5ca7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWebShot.java @@ -91,14 +91,14 @@ public class PerkWebShot extends SmashPerk implements IThrown { if (target != null) { - data.GetThrown().remove(); + data.getThrown().remove(); Manager.GetBlockRestore().add(target.getLocation().getBlock(), 30, (byte) 0, 3000); //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 6, false, false, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); UtilAction.zeroVelocity(target); @@ -122,10 +122,10 @@ public class PerkWebShot extends SmashPerk implements IThrown public void Web(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); - if (data.GetThrown().getTicksLived() > 3) + if (data.getThrown().getTicksLived() > 3) Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 2000); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherWeb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherWeb.java index 9e270d6f5..d643727a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherWeb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherWeb.java @@ -98,10 +98,10 @@ public class PerkWitherWeb extends Perk implements IThrown public void Web(ProjectileUser data) { - Location loc = data.GetThrown().getLocation(); - data.GetThrown().remove(); + Location loc = data.getThrown().getLocation(); + data.getThrown().remove(); - if (data.GetThrown().getTicksLived() > 3) + if (data.getThrown().getTicksLived() > 3) Manager.GetBlockRestore().add(loc.getBlock(), 30, (byte) 0, 3000); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index 1c0dda66b..c9cbb4f20 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -4,18 +4,19 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import mineplex.core.disguise.disguises.*; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; +import nautilus.game.arcade.ArcadeManager; import org.bukkit.DyeColor; import org.bukkit.EntityEffect; -import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWolf; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Wolf; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityTargetEvent; @@ -30,28 +31,28 @@ import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.Navigation; import net.minecraft.server.v1_8_R3.NavigationAbstract; public class PerkWolfPet extends Perk { - private HashMap> _wolfMap = new HashMap>(); + private HashMap> _petMap = new HashMap<>(); - private HashMap _tackle = new HashMap(); + private HashMap _tackle = new HashMap<>(); + private ArcadeManager _manager; private int _spawnRate; private int _max; private boolean _baby; private boolean _name; - public PerkWolfPet(int spawnRate, int max, boolean baby, boolean name) + public PerkWolfPet(ArcadeManager manager, int spawnRate, int max, boolean baby, boolean name) { super("Wolf Master", new String[] { C.cGray + "Spawn 1 Wolf every " + spawnRate + " seconds. Maximum of " + max + ".", C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to use " + C.cGreen + "Wolf Tackle", }); - + _manager = manager; _spawnRate = spawnRate; _max = max; _baby = baby; @@ -65,7 +66,7 @@ public class PerkWolfPet extends Perk } @EventHandler - public void CubSpawn(UpdateEvent event) + public void cubSpawn(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; @@ -81,16 +82,14 @@ public class PerkWolfPet extends Perk if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false, false)) continue; - if (!_wolfMap.containsKey(cur)) - _wolfMap.put(cur, new ArrayList()); + if (!_petMap.containsKey(cur)) + _petMap.put(cur, new ArrayList<>()); - if (_wolfMap.get(cur).size() >= _max) + if (_petMap.get(cur).size() >= _max) continue; Manager.GetGame().CreatureAllowOverride = true; Wolf wolf = cur.getWorld().spawn(cur.getLocation(), Wolf.class); - Manager.GetGame().CreatureAllowOverride = false; - SpigotUtil.setOldOwner_RemoveMeWhenSpigotFixesThis(wolf, cur); wolf.setOwner(cur); wolf.setCollarColor(DyeColor.GREEN); @@ -106,33 +105,33 @@ public class PerkWolfPet extends Perk { wolf.setCustomName(cur.getName() + "'s Wolf"); } - - - _wolfMap.get(cur).add(wolf); - + _petMap.get(cur).add(wolf); + Manager.GetGame().CreatureAllowOverride = false; cur.playSound(cur.getLocation(), Sound.WOLF_HOWL, 1f, 1f); + disguise(wolf, cur); } } @EventHandler - public void CubTargetCancel(EntityTargetEvent event) + public void cubTargetCancel(EntityTargetEvent event) { - if (!_wolfMap.containsKey(event.getTarget())) + if (!_petMap.containsKey(event.getTarget())) return; - if (_wolfMap.get(event.getTarget()).contains(event.getEntity())) + if (_petMap.get(event.getTarget()).contains(event.getEntity())) event.setCancelled(true); } + // Note: Why are there 4 different update event handlers? @EventHandler - public void CubUpdate(UpdateEvent event) + public void cubUpdate(UpdateEvent event) { if (event.getType() != UpdateType.FAST) return; - for (Player player : _wolfMap.keySet()) + for (Player player : _petMap.keySet()) { - Iterator wolfIterator = _wolfMap.get(player).iterator(); + Iterator wolfIterator = _petMap.get(player).iterator(); while (wolfIterator.hasNext()) { @@ -149,7 +148,7 @@ public class PerkWolfPet extends Perk if (player.isSneaking()) { - ((CraftWolf)wolf).getHandle().setGoalTarget(null); + ((CraftWolf) wolf).getHandle().setGoalTarget(null); } //Return to Owner @@ -167,7 +166,7 @@ public class PerkWolfPet extends Perk speed = 1.4f; //Move - EntityCreature ec = ((CraftCreature)wolf).getHandle(); + EntityCreature ec = ((CraftCreature) wolf).getHandle(); NavigationAbstract nav = ec.getNavigation(); nav.a(target.getX(), target.getY(), target.getZ(), speed); @@ -178,7 +177,7 @@ public class PerkWolfPet extends Perk } @EventHandler - public void CubStrikeTrigger(PlayerInteractEvent event) + public void cubStrikeTrigger(PlayerInteractEvent event) { if (event.isCancelled()) return; @@ -200,7 +199,7 @@ public class PerkWolfPet extends Perk if (!Kit.HasKit(player)) return; - if (!_wolfMap.containsKey(player) || _wolfMap.get(player).isEmpty()) + if (!_petMap.containsKey(player) || _petMap.get(player).isEmpty()) { UtilPlayer.message(player, F.main("Game", "You have no Wolf Cubs.")); return; @@ -209,7 +208,7 @@ public class PerkWolfPet extends Perk if (!Recharge.Instance.use(player, "Cub Strike", 4000, true, true)) return; - Wolf wolf = _wolfMap.get(player).get(UtilMath.r(_wolfMap.get(player).size())); + Wolf wolf = _petMap.get(player).get(UtilMath.r(_petMap.get(player).size())); UtilAction.velocity(wolf, player.getLocation().getDirection(), 1.4, false, 0, 0.2, 1.2, true); @@ -225,7 +224,7 @@ public class PerkWolfPet extends Perk } @EventHandler - public void CubStrikeEnd(UpdateEvent event) + public void cubStrikeEnd(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; @@ -244,7 +243,7 @@ public class PerkWolfPet extends Perk if (other.equals(wolf.getOwner())) continue; - CubStrikeHit((Player)wolf.getOwner(), other, wolf); + cubStrikeHit((Player)wolf.getOwner(), other, wolf); wolfIterator.remove(); return; } @@ -259,11 +258,11 @@ public class PerkWolfPet extends Perk } } - public void CubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf) + public void cubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf) { //Damage Event ((CraftWolf)wolf).getHandle().setGoalTarget(((CraftLivingEntity)damagee).getHandle(), EntityTargetEvent.TargetReason.CUSTOM, false); - + //Sound damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1.5f); @@ -276,12 +275,12 @@ public class PerkWolfPet extends Perk } @EventHandler - public void CubHeal(UpdateEvent event) + public void cubHeal(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; - for (ArrayList wolves : _wolfMap.values()) + for (ArrayList wolves : _petMap.values()) { for (Wolf wolf : wolves) { @@ -292,9 +291,9 @@ public class PerkWolfPet extends Perk } @EventHandler - public void PlayerDeath(PlayerDeathEvent event) + public void playerDeath(PlayerDeathEvent event) { - ArrayList wolves = _wolfMap.remove(event.getEntity()); + ArrayList wolves = _petMap.remove(event.getEntity()); if (wolves == null) return; @@ -306,9 +305,9 @@ public class PerkWolfPet extends Perk } @EventHandler - public void PlayerQuit(PlayerQuitEvent event) + public void playerQuit(PlayerQuitEvent event) { - ArrayList wolves = _wolfMap.remove(event.getPlayer()); + ArrayList wolves = _petMap.remove(event.getPlayer()); if (wolves == null) return; @@ -319,9 +318,9 @@ public class PerkWolfPet extends Perk wolves.clear(); } - public boolean IsMinion(Entity ent) + public boolean isMinion(Entity ent) { - for (ArrayList minions : _wolfMap.values()) + for (ArrayList minions : _petMap.values()) { for (Wolf minion : minions) { @@ -336,12 +335,12 @@ public class PerkWolfPet extends Perk } @EventHandler - public void Damage(CustomDamageEvent event) + public void damage(CustomDamageEvent event) { if (event.GetDamagerEntity(true) == null) return; - if (!IsMinion(event.GetDamagerEntity(true))) + if (!isMinion(event.GetDamagerEntity(true))) return; double damage = 3; @@ -349,4 +348,47 @@ public class PerkWolfPet extends Perk event.AddMod("Wolf Minion", "Negate", -event.GetDamageInitial(), false); event.AddMod("Wolf Minion", "Damage", damage, false); } + + private void disguise(Entity wolf, Player player) + { + EntityType entityType = getDisguiseType(player); + if (entityType != null) + { + if (entityType.equals(EntityType.GUARDIAN)) + { + DisguiseGuardian disguiseGuardian = new DisguiseGuardian(wolf); + _manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseGuardian); + return; + } + else if (entityType.equals(EntityType.SQUID)) + { + DisguiseSquid disguiseSquid = new DisguiseSquid(wolf); + _manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseSquid); + return; + } + DisguiseAnimalBase disguiseAnimal = new DisguiseAnimalBase(entityType, wolf); + _manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseAnimal); + } + } + + private EntityType getDisguiseType(Player player) + { + GadgetManager gadgetManager = _manager.getCosmeticManager().getGadgetManager(); + KitModifier kitModifier = gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_BeastmasterKit, player); + if (kitModifier != null) + { + switch (kitModifier) + { + case Survival_Games_Beastmaster_Chicken: + return EntityType.CHICKEN; + case Survival_Games_Beastmaster_Mini_Guardian: + return EntityType.GUARDIAN; + case Survival_Games_Beastmaster_Pig: + return EntityType.PIG; + case Survival_Games_Beastmaster_Squid: + return EntityType.SQUID; + } + } + return null; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 5f692fb5d..436db672e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -241,27 +241,27 @@ public class PerkWoolBomb extends Perk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - solidify(data.GetThrower(), false); + solidify(data.getThrower(), false); if (target == null) return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.PROJECTILE, 4, true, true, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); } @Override public void Idle(ProjectileUser data) { - solidify(data.GetThrower(), false); + solidify(data.getThrower(), false); } @Override public void Expire(ProjectileUser data) { - solidify(data.GetThrower(), false); + solidify(data.getThrower(), false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java index 116cd0add..adb0f1455 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java @@ -133,7 +133,7 @@ public class PerkZombieBile extends SmashPerk implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); if (target == null) return; @@ -143,23 +143,23 @@ public class PerkZombieBile extends SmashPerk implements IThrown return; //Damage Event - Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + Manager.GetDamage().NewDamageEvent(target, data.getThrower(), null, DamageCause.CUSTOM, 3, true, false, false, - UtilEnt.getName(data.GetThrower()), GetName()); + UtilEnt.getName(data.getThrower()), GetName()); - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Idle(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @Override public void Expire(ProjectileUser data) { - data.GetThrown().remove(); + data.getThrown().remove(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java index 347730a4d..2bb9542fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java @@ -310,7 +310,7 @@ public class GameChatManager implements Listener { if (!_manager.GetGame().GetStats().containsKey(player)) { - temp.add(new AbstractMap.SimpleEntry(C.cGray + "Retrieving stats..", "")); + temp.add(new AbstractMap.SimpleEntry(C.cGray + "Retrieving stats...", "")); break; } From 8bf26dbc1101f575b242e912ae703f283ab2d5fe Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 9 Jun 2016 18:57:48 -0500 Subject: [PATCH 05/49] Use a better podium for NPC, reenable boosters --- .../mineplex/core/common/api/ApiEndpoint.java | 5 +- .../src/nautilus/game/arcade/Arcade.java | 2 +- .../nautilus/game/arcade/ArcadeManager.java | 13 +-- .../game/arcade/booster/BoosterPodium.java | 83 +++++++++++++++---- 4 files changed, 80 insertions(+), 23 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java index 7bf091d36..40684023c 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java @@ -7,8 +7,9 @@ import com.google.gson.Gson; */ public class ApiEndpoint { - private static final String API_HOST = "10.33.53.12"; - private static final int API_PORT = 7979; +// private static final String API_HOST = "10.33.53.12"; + private static final String API_HOST = "localhost"; + private static final int API_PORT = 3000; private ApiWebCall _webCall; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 290aa9c95..746876508 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -174,7 +174,7 @@ public class Arcade extends JavaPlugin //Arcade Manager PollManager pollManager = new PollManager(this, _clientManager, _donationManager); - _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish, eloManager); + _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish, eloManager, boosterManager); new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager, petManager, statsManager, _gameManager.getBonusManager().getRewardManager()); 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..55095432c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -10,6 +10,7 @@ import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blood.Blood; import mineplex.core.bonuses.BonusManager; +import mineplex.core.boosters.BoosterManager; import mineplex.core.chat.Chat; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -73,6 +74,7 @@ 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.booster.GameBoosterManager; import nautilus.game.arcade.command.DisguiseCommand; import nautilus.game.arcade.command.GameCmdModeCommand; import nautilus.game.arcade.command.GameCommand; @@ -219,11 +221,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation private boolean _gameCommandMode; public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, - CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, - StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, - Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, - CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, - NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager) + CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, + StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, + Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, + CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, + NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, BoosterManager boosterManager) { super("Game Manager", plugin); @@ -317,6 +319,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); new PlayerDisguiseManager(plugin, _clientManager); + new GameBoosterManager(plugin, boosterManager, disguiseManager, hologramManager, serverConfig); // Game Addons new CompassAddon(plugin, this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index ef66228fe..b5d8010d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -16,6 +16,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -24,6 +25,8 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; +import java.util.HashSet; + /** * @author Shaun Bennett */ @@ -47,22 +50,10 @@ public class BoosterPodium extends MiniPlugin _hologramManager = hologramManager; _podiumLocation = podiumLocation; - addPodium(); + setPodium(_podiumLocation, Material.EMERALD_BLOCK.getId(), (byte) 0); updateNpcs(); } - public void addPodium() - { - for(int x = 0; x < 2; x++) - { - for (int z = 0; z < 2; z++) - { - Location location = _podiumLocation.clone().add(x - 0.5, 0, z - 0.5); - location.getBlock().setType(Material.STEP); - } - } - } - public void updateNpcs() { System.out.println("Updating Npcs."); @@ -75,7 +66,7 @@ public class BoosterPodium extends MiniPlugin _activeArmorStand.remove(); } - Location armorStandLocation = _podiumLocation.clone(); + Location armorStandLocation = _podiumLocation.clone().add(0, 1.5, 0); ArmorStand armorStand = _podiumLocation.getWorld().spawn(armorStandLocation, ArmorStand.class); armorStand.setVisible(true); armorStand.setCustomNameVisible(false); @@ -94,7 +85,7 @@ public class BoosterPodium extends MiniPlugin if (_hologram == null) { - _hologram = new Hologram(_hologramManager, armorStandLocation.clone().add(0, 2, 0), getHologramText(activeBooster)); + _hologram = new Hologram(_hologramManager, armorStandLocation.clone().add(0, 1.75, 0), getHologramText(activeBooster)); _hologram.start(); } @@ -207,4 +198,66 @@ public class BoosterPodium extends MiniPlugin event.setCancelled(true); } } + + public void setPodium(Location loc, int id, byte data) + { + HashSet blockSet = new HashSet<>(); + //Coloring + Block block = loc.clone().add( 0.5, 0, 0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add(-0.5, 0, 0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add( 0.5, 0, -0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + block = loc.clone().add(-0.5, 0, -0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + + //Top + block = loc.clone().add( 0.5, 1, 0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add(-0.5, 1, 0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add( 0.5, 1, -0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + block = loc.clone().add(-0.5, 1, -0.5).getBlock(); + blockSet.add(block); + MapUtil.QuickChangeBlockAt(block.getLocation(), 44, (byte)5); + + //Floor + for (int x=-2 ; x<2 ; x++) + { + for (int z=-2 ; z<2 ; z++) + { + block = loc.clone().add(x + 0.5, -1, z + 0.5).getBlock(); + blockSet.add(block); + + MapUtil.QuickChangeBlockAt(block.getLocation(), id, data); + } + } + + //Outline + for (int x=-3 ; x<3 ; x++) + { + for (int z=-3 ; z<3 ; z++) + { + block = loc.clone().add(x + 0.5, -1, z + 0.5).getBlock(); + if (blockSet.contains(block)) continue; + + MapUtil.QuickChangeBlockAt(block.getLocation(), 35, (byte)15); + } + } + } } From 08e47b4b1b69d7eebcb4ec252a9e8cb23929a183 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 9 Jun 2016 22:41:41 -0500 Subject: [PATCH 06/49] Enable tips in bonus gui --- .../src/mineplex/core/bonuses/BonusManager.java | 16 +++++++++++----- .../core/bonuses/commands/GuiCommand.java | 2 +- .../src/mineplex/core/bonuses/gui/BonusGui.java | 14 +++++++------- .../src/mineplex/hub/HubManager.java | 2 +- .../src/nautilus/game/arcade/ArcadeManager.java | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 4c9081b52..8373ae4a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -122,7 +122,7 @@ public class BonusManager extends MiniClientPlugin implements I private RewardManager _rewardManager; private StatsManager _statsManager; private FacebookManager _facebookManager; -// private BoosterManager _boosterManager; + private BoosterManager _boosterManager; public boolean _enabled; private Npc _carlNpc; private AnimationCarl _animation; @@ -161,7 +161,7 @@ public class BonusManager extends MiniClientPlugin implements I updateOffSet(); } - public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, GadgetManager gadgetManager) + public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, GadgetManager gadgetManager, BoosterManager boosterManager) { super("Bonus", plugin); _repository = new BonusRepository(plugin, this, donationManager); @@ -170,6 +170,7 @@ public class BonusManager extends MiniClientPlugin implements I _npcManager = npcManager; _hologramManager = hologramManager; _inventoryManager = inventoryManager; + _boosterManager = boosterManager; _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager); @@ -823,7 +824,7 @@ public class BonusManager extends MiniClientPlugin implements I if (entity.equals(_carlNpc.getEntity())) { updateDailyStreak(event.getPlayer()); - new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager).openInventory(); + new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager, _boosterManager).openInventory(); } } @@ -839,7 +840,7 @@ public class BonusManager extends MiniClientPlugin implements I if (event.getEntity().equals(_carlNpc.getEntity())) { updateDailyStreak(player); - new BonusGui(_plugin, player, this, _rewardManager, _facebookManager).openInventory(); + new BonusGui(_plugin, player, this, _rewardManager, _facebookManager, _boosterManager).openInventory(); } } } @@ -905,7 +906,7 @@ public class BonusManager extends MiniClientPlugin implements I if (canDaily(player)) availableRewards++; if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++; if (!_facebookManager.hasRedeemed(player)) availableRewards++; -// if (_boosterManager.getTipManager().Get(player).getTips() > 0) availableRewards++; + if (_boosterManager.getTipManager().Get(player).getTips() > 0) availableRewards++; Hologram hologram; @@ -1183,4 +1184,9 @@ public class BonusManager extends MiniClientPlugin implements I { return "SELECT * FROM bonus WHERE accountId = '" + accountId + "';"; } + + public BoosterManager getBoosterManager() + { + return _boosterManager; + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java index 7758c377a..b4b98c360 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java @@ -18,7 +18,7 @@ public class GuiCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager()).openInventory(); + new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager(), Plugin.getBoosterManager()).openInventory(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index 2392914e4..7c3de784a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -15,23 +15,23 @@ public class BonusGui extends SimpleGui private BonusManager manager; - public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager) + public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager, BoosterManager boosterManager) { super(plugin, player, player.getName() + "'s Bonuses", 5 * 9); this.manager = manager; - setItem(9, new VoteButton(plugin, player, this, manager)); + setItem(10, new VoteButton(plugin, player, this, manager)); - setItem(11, new RankBonusButton(getPlugin(), player, this, manager)); + setItem(12, new RankBonusButton(getPlugin(), player, this, manager)); - setItem(13, new DailyBonusButton(getPlugin(), player, this, manager)); + setItem(14, new DailyBonusButton(getPlugin(), player, this, manager)); - setItem(15, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager)); + setItem(16, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager)); - setItem(17, new FacebookButton(player, facebookManager)); + setItem(20, new FacebookButton(player, facebookManager)); -// setItem(19, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); + setItem(24, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index bb9d446c1..485f3ea80 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -227,7 +227,7 @@ public class HubManager extends MiniClientPlugin _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager); + _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager, boosterManager); _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager); 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 55095432c..f642914ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -307,7 +307,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _gameTournamentManager = new GameTournamentManager(this); new GameStatManager(this); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _cosmeticManager.getGadgetManager()); + _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _cosmeticManager.getGadgetManager(), boosterManager); new GameLootManager(this, petManager, _bonusManager.getRewardManager()); new GameSpectatorManager(this); _gameWorldManager = new GameWorldManager(this); From 0a204a3b908f9ea29d94843d2fece80d19778629 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 10 Jun 2016 12:44:27 -0500 Subject: [PATCH 07/49] Use redis pub/sub to send booster updates --- .../src/mineplex/core/boosters/Booster.java | 14 +-- .../core/boosters/BoosterManager.java | 94 +++++++++++++------ .../boosters/event/BoosterUpdateEvent.java | 39 ++++++++ .../boosters/redis/BoosterUpdateListener.java | 44 +++++++++ .../redis/BoosterUpdateRepository.java | 39 ++++++++ .../core/boosters/tips/BoosterTipManager.java | 2 +- 6 files changed, 197 insertions(+), 35 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateListener.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java index 143b6d837..2aaf4302b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java @@ -10,7 +10,7 @@ import java.util.UUID; */ public class Booster { - private int _boosterId; + private int _id; private String _playerName; private UUID _uuid; private int _accountId; @@ -24,9 +24,9 @@ public class Booster { } - public int getBoosterId() + public int getId() { - return _boosterId; + return _id; } public String getPlayerName() @@ -66,7 +66,7 @@ public class Booster public boolean isActive() { - return getEndTime().before(new Date()); + return getEndTime().after(new Date()); } public long getTimeRemaining() @@ -92,14 +92,14 @@ public class Booster Booster booster = (Booster) o; - if (_boosterId != booster._boosterId) return false; + if (_id != booster._id) return false; return _accountId == booster._accountId; } @Override public int hashCode() { - int result = _boosterId; + int result = _id; result = 31 * result + _accountId; return result; } @@ -108,7 +108,7 @@ public class Booster public String toString() { return "Booster{" + - "_boosterId=" + _boosterId + + "_id=" + _id + ", _playerName='" + _playerName + '\'' + ", _uuid=" + _uuid + ", _accountId=" + _accountId + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index ae1937537..769531765 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -5,13 +5,16 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.boosters.command.BoosterCommand; import mineplex.core.boosters.event.BoosterActivateEvent; import mineplex.core.boosters.event.BoosterDeactivateEvent; +import mineplex.core.boosters.event.BoosterUpdateEvent; import mineplex.core.boosters.gui.BoosterShop; +import mineplex.core.boosters.redis.BoosterUpdateRepository; import mineplex.core.boosters.tips.BoosterTipManager; import mineplex.core.common.util.Callback; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; @@ -58,6 +61,8 @@ public class BoosterManager extends MiniPlugin System.out.println("Failed to load boosters on server start."); e.printStackTrace(); } + + new BoosterUpdateRepository(plugin); } @Override @@ -76,28 +81,7 @@ public class BoosterManager extends MiniPlugin long timeTaken = System.currentTimeMillis() - time; runSync(() -> { - _boosterCache.entrySet().stream() - .filter(entry -> entry.getValue().size() > 0) - .filter(entry -> boosters.get(entry.getKey()) == null) - .forEach(entry -> callNextTick(new BoosterDeactivateEvent(entry.getValue().get(0)))); - - for (Map.Entry> entry : boosters.entrySet()) - { - List current = _boosterCache.get(entry.getKey()); - if (current == null || current.get(0) == null) - { - callNextTick(new BoosterActivateEvent(entry.getValue().get(0))); - } - else if (!current.get(0).equals(entry.getValue().get(0))) - { - callNextTick(new BoosterDeactivateEvent(current.get(0))); - callNextTick(new BoosterActivateEvent(entry.getValue().get(0))); - } - - } - - _cacheLastUpdated = System.currentTimeMillis(); - _boosterCache = boosters; + handleBoosterUpdate(boosters); if (callback != null) callback.run(boosters); }); } @@ -109,6 +93,65 @@ public class BoosterManager extends MiniPlugin }); } + private void handleBoosterUpdate(Map> boosterMap) + { + _boosterCache.entrySet().stream() + .filter(entry -> entry.getValue().size() > 0) + .filter(entry -> boosterMap.get(entry.getKey()) == null) + .forEach(entry -> callNextTick(new BoosterDeactivateEvent(entry.getValue().get(0)))); + + for (Map.Entry> entry : boosterMap.entrySet()) + { + List current = _boosterCache.get(entry.getKey()); + if (current == null || current.get(0) == null) + { + callNextTick(new BoosterActivateEvent(entry.getValue().get(0))); + } + else if (!current.get(0).equals(entry.getValue().get(0))) + { + callNextTick(new BoosterDeactivateEvent(current.get(0))); + callNextTick(new BoosterActivateEvent(entry.getValue().get(0))); + } + } + + _cacheLastUpdated = System.currentTimeMillis(); + _boosterCache = boosterMap; + } + + private void tickBoosterCache() + { + for (List boosters : _boosterCache.values()) + { + Iterator iterator = boosters.iterator(); + boolean removedOne = false; + while (iterator.hasNext()) + { + Booster booster = iterator.next(); + if (!booster.isActive()) + { + iterator.remove(); + removedOne = true; + System.out.println("booster removed from tick"); + Bukkit.getPluginManager().callEvent(new BoosterDeactivateEvent(booster)); + } + else + { + if (removedOne) Bukkit.getPluginManager().callEvent(new BoosterActivateEvent(booster)); + break; + } + } + } + } + + @EventHandler + public void tickBoosters(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + tickBoosterCache(); + } + public Booster getActiveBoosterFromCache(String serverGroup) { List boosters = _boosterCache.get(serverGroup); @@ -158,12 +201,9 @@ public class BoosterManager extends MiniPlugin } @EventHandler - public void updateCache(UpdateEvent event) + public void onBoosterUpdate(BoosterUpdateEvent event) { - if (event.getType() == UpdateType.SEC_30) - { - getBoostersAsync(null); - } + handleBoosterUpdate(event.getBoosterMap()); } public BoosterTipManager getTipManager() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java new file mode 100644 index 000000000..f17b259fd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java @@ -0,0 +1,39 @@ +package mineplex.core.boosters.event; + +import mineplex.core.boosters.Booster; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import java.util.List; +import java.util.Map; + +/** + * @author Shaun Bennett + */ +public class BoosterUpdateEvent extends Event +{ + private Map> _boosterMap; + + public BoosterUpdateEvent(Map> boosterMap) + { + _boosterMap = boosterMap; + } + + public Map> getBoosterMap() + { + return _boosterMap; + } + + private static final HandlerList _handlers = new HandlerList(); + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateListener.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateListener.java new file mode 100644 index 000000000..0e85b5ee6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateListener.java @@ -0,0 +1,44 @@ +package mineplex.core.boosters.redis; + +import com.google.common.reflect.TypeToken; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import mineplex.core.boosters.Booster; +import mineplex.core.boosters.event.BoosterUpdateEvent; +import mineplex.core.common.api.ApiFieldNamingStrategy; +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; +import redis.clients.jedis.JedisPubSub; + +import java.util.List; +import java.util.Map; + +/** + * @author Shaun Bennett + */ +public class BoosterUpdateListener extends JedisPubSub +{ + private Gson _gson = new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy()) + .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create(); + private JavaPlugin _plugin; + + public BoosterUpdateListener(JavaPlugin plugin) + { + _plugin = plugin; + } + + @Override + public void onMessage(String channel, String message) + { + try + { + Map> boosterMap = _gson.fromJson(message, new TypeToken>>() {}.getType()); + _plugin.getServer().getScheduler().runTask(_plugin, () -> Bukkit.getPluginManager().callEvent(new BoosterUpdateEvent(boosterMap))); + } + catch (Exception e) + { + System.out.println("Failed to load booster update"); + e.printStackTrace(); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java new file mode 100644 index 000000000..5721fd736 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java @@ -0,0 +1,39 @@ +package mineplex.core.boosters.redis; + +import mineplex.serverdata.Region; +import mineplex.serverdata.redis.RedisRepository; +import org.bukkit.plugin.java.JavaPlugin; +import redis.clients.jedis.Jedis; + +/** + * @author Shaun Bennett + */ +public class BoosterUpdateRepository extends RedisRepository +{ + private JavaPlugin _plugin; + + public BoosterUpdateRepository(JavaPlugin plugin) + { + super(Region.ALL); + + _plugin = plugin; + init(); + } + + private void init() + { + Thread thread = new Thread("Booster Subscriber") + { + @Override + public void run() + { + try (Jedis jedis = new Jedis()) + { + jedis.subscribe(new BoosterUpdateListener(_plugin), "minecraft.boosters"); + } + } + }; + + thread.start(); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java index d12827300..c8012b7fb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java @@ -57,7 +57,7 @@ public class BoosterTipManager extends MiniDbClientPlugin runAsync(() -> { TipAddResult result; - if (_repository.addTip(accountId, booster.getAccountId(), booster.getBoosterId(), TIP_FOR_SPONSOR)) + if (_repository.addTip(accountId, booster.getAccountId(), booster.getId(), TIP_FOR_SPONSOR)) { _donationManager.rewardCoinsUntilSuccess(null, "Tips", player.getName(), accountId, TIP_FOR_TIPPER); result = TipAddResult.SUCCESS; From ceb4de8b35aff250c7395b99decf61e1469fa733 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 10 Jun 2016 16:33:53 -0500 Subject: [PATCH 08/49] Load booster groups for arcade --- .../core/boosters/BoosterManager.java | 20 ++++++++-------- .../boosters/event/BoosterActivateEvent.java | 9 +++++++- .../event/BoosterDeactivateEvent.java | 9 +++++++- .../personalServer/PersonalServerManager.java | 2 +- .../mineplex/serverdata/data/ServerGroup.java | 7 +++++- .../src/nautilus/game/arcade/Arcade.java | 1 + .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../game/arcade/booster/BoosterPodium.java | 2 -- .../arcade/booster/GameBoosterManager.java | 23 +++++++++++++------ .../game/arcade/game/GameServerConfig.java | 1 + 10 files changed, 52 insertions(+), 24 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index 769531765..a7732dfe5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -98,19 +98,19 @@ public class BoosterManager extends MiniPlugin _boosterCache.entrySet().stream() .filter(entry -> entry.getValue().size() > 0) .filter(entry -> boosterMap.get(entry.getKey()) == null) - .forEach(entry -> callNextTick(new BoosterDeactivateEvent(entry.getValue().get(0)))); + .forEach(entry -> callNextTick(new BoosterDeactivateEvent(entry.getKey(), entry.getValue().get(0)))); for (Map.Entry> entry : boosterMap.entrySet()) { List current = _boosterCache.get(entry.getKey()); if (current == null || current.get(0) == null) { - callNextTick(new BoosterActivateEvent(entry.getValue().get(0))); + callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0))); } else if (!current.get(0).equals(entry.getValue().get(0))) { - callNextTick(new BoosterDeactivateEvent(current.get(0))); - callNextTick(new BoosterActivateEvent(entry.getValue().get(0))); + callNextTick(new BoosterDeactivateEvent(entry.getKey(), current.get(0))); + callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0))); } } @@ -120,9 +120,9 @@ public class BoosterManager extends MiniPlugin private void tickBoosterCache() { - for (List boosters : _boosterCache.values()) + for (Map.Entry> entry : _boosterCache.entrySet()) { - Iterator iterator = boosters.iterator(); + Iterator iterator = entry.getValue().iterator(); boolean removedOne = false; while (iterator.hasNext()) { @@ -132,11 +132,11 @@ public class BoosterManager extends MiniPlugin iterator.remove(); removedOne = true; System.out.println("booster removed from tick"); - Bukkit.getPluginManager().callEvent(new BoosterDeactivateEvent(booster)); + Bukkit.getPluginManager().callEvent(new BoosterDeactivateEvent(entry.getKey(), booster)); } else { - if (removedOne) Bukkit.getPluginManager().callEvent(new BoosterActivateEvent(booster)); + if (removedOne) Bukkit.getPluginManager().callEvent(new BoosterActivateEvent(entry.getKey(), booster)); break; } } @@ -152,9 +152,9 @@ public class BoosterManager extends MiniPlugin tickBoosterCache(); } - public Booster getActiveBoosterFromCache(String serverGroup) + public Booster getActiveBoosterFromCache(String boosterGroup) { - List boosters = _boosterCache.get(serverGroup); + List boosters = _boosterCache.get(boosterGroup); if (boosters != null) { for (Booster booster : boosters) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java index f3592a96a..6cb1d0ea6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java @@ -9,13 +9,20 @@ import org.bukkit.event.HandlerList; */ public class BoosterActivateEvent extends Event { + private String _boosterGroup; private Booster _booster; - public BoosterActivateEvent(Booster booster) + public BoosterActivateEvent(String boosterGroup, Booster booster) { + _boosterGroup = boosterGroup; _booster = booster; } + public String getBoosterGroup() + { + return _boosterGroup; + } + public Booster getBooster() { return _booster; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java index c211274fe..3336912ee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java @@ -9,13 +9,20 @@ import org.bukkit.event.HandlerList; */ public class BoosterDeactivateEvent extends Event { + private String _boosterGroup; private Booster _booster; - public BoosterDeactivateEvent(Booster booster) + public BoosterDeactivateEvent(String boosterGroup, Booster booster) { + _boosterGroup = boosterGroup; _booster = booster; } + public String getBoosterGroup() + { + return _boosterGroup; + } + public Booster getBooster() { return _booster; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java index 551a82d76..93db55bf3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java @@ -160,7 +160,7 @@ public class PersonalServerManager extends MiniPlugin } final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers, - true, false, false, games, "", "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", ""); + true, false, false, games, "", "", "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", ""); getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java index fd4c81dc0..1a6cc85e7 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java @@ -51,6 +51,7 @@ public class ServerGroup private String _games; private String _modes; + private String _boosterGroup; private String _serverType; private boolean _addNoCheat; private boolean _addWorldEdit; @@ -89,6 +90,7 @@ public class ServerGroup _generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions")); _games = data.get("games"); _modes = data.get("modes"); + _boosterGroup = data.get("boosterGroup"); _serverType = data.get("serverType"); _addNoCheat = Boolean.valueOf(data.get("addNoCheat")); _addWorldEdit = Boolean.valueOf(data.get("addWorldEdit")); @@ -119,7 +121,7 @@ public class ServerGroup } public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath - , int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String modes, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin + , int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String modes, String boosterGroup, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin , boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats , boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region , String teamServerKey, String portalBottomCornerLocation, String portalTopCornerLocation, String npcName) @@ -143,6 +145,7 @@ public class ServerGroup _tournamentPoints = tournamentPoints; _games = games; _modes = modes; + _boosterGroup = boosterGroup; _serverType = serverType; _addNoCheat = noCheat; _addWorldEdit = worldEdit; @@ -214,6 +217,8 @@ public class ServerGroup public String getGames() { return _games; } public String getModes() { return _modes; } + public String getBoosterGroup() { return _boosterGroup; } + public String getServerType() { return _serverType; } public boolean getAddNoCheat() { return _addNoCheat; } public boolean getAddWorldEdit() { return _addWorldEdit; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 746876508..0e6dd7108 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -219,6 +219,7 @@ public class Arcade extends JavaPlugin try { config.ServerGroup = _serverConfiguration.getServerGroup().getName(); + config.BoosterGroup = _serverConfiguration.getServerGroup().getBoosterGroup(); config.HostName = _serverConfiguration.getServerGroup().getHost(); config.ServerType = _serverConfiguration.getServerGroup().getServerType(); config.MinPlayers = _serverConfiguration.getServerGroup().getMinPlayers(); 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 f642914ec..c6023c6bb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -319,7 +319,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); new PlayerDisguiseManager(plugin, _clientManager); - new GameBoosterManager(plugin, boosterManager, disguiseManager, hologramManager, serverConfig); + new GameBoosterManager(plugin, boosterManager, disguiseManager, hologramManager, serverConfig.BoosterGroup); // Game Addons new CompassAddon(plugin, this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index b5d8010d1..35097f260 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -56,9 +56,7 @@ public class BoosterPodium extends MiniPlugin public void updateNpcs() { - System.out.println("Updating Npcs."); Booster activeBooster = _gameBoosterManager.getActiveBooster(); - System.out.println("Active booster: " + activeBooster); if (activeBooster != null) { if (_activeArmorStand != null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index 55c9c67aa..f359f1305 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -27,24 +27,27 @@ import java.util.List; */ public class GameBoosterManager extends MiniPlugin { - private GameServerConfig _gameServerConfig; + private String _boosterGroup; private BoosterManager _boosterManager; private BoosterPodium _boosterPodium; - public GameBoosterManager(JavaPlugin plugin, BoosterManager boosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, GameServerConfig gameServerConfig) + public GameBoosterManager(JavaPlugin plugin, BoosterManager boosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, String boosterGroup) { super("Arcade Boosters", plugin); - _gameServerConfig = gameServerConfig; + _boosterGroup = boosterGroup; _boosterManager = boosterManager; - _boosterPodium = new BoosterPodium(plugin, this, disguiseManager, hologramManager, new Location(UtilWorld.getWorld("world"), 0, 101.5, -12)); + if (boosterGroup != null && boosterGroup.length() > 0) + { + _boosterPodium = new BoosterPodium(plugin, this, disguiseManager, hologramManager, new Location(UtilWorld.getWorld("world"), 0, 101.5, -12)); + } } public Booster getActiveBooster() { - return _boosterManager.getActiveBoosterFromCache(_gameServerConfig.ServerGroup); + return _boosterManager.getActiveBoosterFromCache(_boosterGroup); } public void attemptTip(Player player) @@ -76,9 +79,15 @@ public class GameBoosterManager extends MiniPlugin @EventHandler public void onActivate(BoosterActivateEvent event) { - System.out.println("booster activate: " + event.getBooster()); Booster booster = event.getBooster(); - Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster for " + booster.getMultiplier() + "x Gems!" )); + if (event.getBoosterGroup().equals(_boosterGroup)) + { + Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster for " + booster.getMultiplier() + "x Gems!" )); + } + else + { + Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster on " + F.elem(event.getBoosterGroup()))); + } } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java index d2fa87db2..f2b60267d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java @@ -9,6 +9,7 @@ public class GameServerConfig { public String ServerGroup = null; public String ServerType = null; + public String BoosterGroup = null; public int MinPlayers = -1; public int MaxPlayers = -1; public ArrayList GameList = new ArrayList(); From e6920b45496364e6f00136aedaf06e791042745f Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 10 Jun 2016 17:17:43 -0500 Subject: [PATCH 09/49] Work on booster gui, display wait time --- .../src/mineplex/core/boosters/Booster.java | 16 ++++++- .../core/boosters/BoosterCategory.java | 12 ------ .../core/boosters/BoosterManager.java | 39 ++++++++++++++--- .../core/boosters/gui/BoosterPage.java | 19 ++++++-- .../core/boosters/gui/BoosterShop.java | 4 +- .../mineplex/core/boosters/gui/MenuPage.java | 37 ---------------- .../Mineplex.Hub/src/mineplex/hub/Hub.java | 6 ++- .../mineplex/serverdata/data/ServerGroup.java | 2 + .../src/nautilus/game/arcade/Arcade.java | 2 +- .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../game/arcade/booster/BoosterPodium.java | 43 +++++++++++++++++-- .../arcade/booster/GameBoosterManager.java | 5 ++- 12 files changed, 115 insertions(+), 72 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterCategory.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/MenuPage.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java index 2aaf4302b..c9b4d8554 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java @@ -66,12 +66,24 @@ public class Booster public boolean isActive() { - return getEndTime().after(new Date()); + Date now = new Date(); + return getStartTime().before(now) && getEndTime().after(now); } public long getTimeRemaining() { - return Math.max(0, getEndTime().getTime() - System.currentTimeMillis()); + if (isActive()) + { + return Math.max(0, getEndTime().getTime() - System.currentTimeMillis()); + } + else if (getEndTime().after(new Date())) + { + return _duration * 1000L; + } + else + { + return 0; + } } public String getTimeRemainingString() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterCategory.java deleted file mode 100644 index ffe7b8a3b..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterCategory.java +++ /dev/null @@ -1,12 +0,0 @@ -package mineplex.core.boosters; - -import mineplex.core.game.GameDisplay; - -/** - * @author Shaun Bennett - */ -public enum BoosterCategory -{ - - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index a7732dfe5..a29a07973 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -36,15 +36,17 @@ public class BoosterManager extends MiniPlugin private BoosterTipManager _tipManager; private BoosterShop _shop; + private String _boosterGroup; private long _cacheLastUpdated; private Map> _boosterCache = new HashMap<>(); - public BoosterManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) + public BoosterManager(JavaPlugin plugin, String boosterGroup, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) { super("Booster Manager", plugin); _repository = new BoosterRepository(); + _boosterGroup = boosterGroup; _clientManager = clientManager; _donationManager = donationManager; _inventoryManager = inventoryManager; @@ -120,6 +122,7 @@ public class BoosterManager extends MiniPlugin private void tickBoosterCache() { + List events = new ArrayList<>(3); for (Map.Entry> entry : _boosterCache.entrySet()) { Iterator iterator = entry.getValue().iterator(); @@ -131,16 +134,17 @@ public class BoosterManager extends MiniPlugin { iterator.remove(); removedOne = true; - System.out.println("booster removed from tick"); - Bukkit.getPluginManager().callEvent(new BoosterDeactivateEvent(entry.getKey(), booster)); + events.add(new BoosterDeactivateEvent(entry.getKey(), booster)); } else { - if (removedOne) Bukkit.getPluginManager().callEvent(new BoosterActivateEvent(entry.getKey(), booster)); + if (removedOne) events.add(new BoosterActivateEvent(entry.getKey(), booster)); break; } } } + + events.forEach(Bukkit.getPluginManager()::callEvent); } @EventHandler @@ -152,6 +156,31 @@ public class BoosterManager extends MiniPlugin tickBoosterCache(); } + public List getBoosters() + { + return _boosterCache.get(_boosterGroup); + } + + public long getBoostTime() + { + return getBoostTime(_boosterGroup); + } + + public long getBoostTime(String boosterGroup) + { + long time = 0; + List boosters = _boosterCache.get(boosterGroup); + if (boosters != null && boosters.size() > 0) + { + for (Booster booster : boosters) + { + time += booster.getTimeRemaining(); + } + } + + return time; + } + public Booster getActiveBoosterFromCache(String boosterGroup) { List boosters = _boosterCache.get(boosterGroup); @@ -227,7 +256,7 @@ public class BoosterManager extends MiniPlugin */ public boolean canActivateBoosters() { - return true; + return _boosterGroup != null && _boosterGroup.length() > 0; } public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index bbfefa532..cb7135c53 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -1,9 +1,9 @@ package mineplex.core.boosters.gui; import mineplex.core.account.CoreClientManager; -import mineplex.core.boosters.BoosterCategory; import mineplex.core.boosters.BoosterManager; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; @@ -17,9 +17,9 @@ import java.util.ArrayList; */ public class BoosterPage extends ShopPageBase { - public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, BoosterCategory category) + public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Booster", player); + super(plugin, shop, clientManager, donationManager, "Boosters", player, 9); buildPage(); } @@ -29,12 +29,23 @@ public class BoosterPage extends ShopPageBase { ArrayList lore = new ArrayList<>(); + int count = getPlugin().getAvailableBoosterCount(getPlayer()); lore.add(" "); lore.add(C.cWhite + "You Own: " + getPlugin().getAvailableBoosterCount(getPlayer())); - if (getPlugin().canActivateBoosters()) + if (getPlugin().canActivateBoosters() && count > 0) { lore.add(" "); lore.add(C.cWhite + "Click to Activate"); + + long waitTime = getPlugin().getBoostTime(); + if (waitTime == 0) + { + lore.add(C.cWhite + "Booster would activate " + C.cGreen + "now"); + } + else + { + lore.add(C.cWhite + "Booster would activate in " + C.cGreen + UtilTime.convertString(waitTime, 1, UtilTime.TimeUnit.FIT)); + } } ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java index d8552b315..09787ecb7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java @@ -14,12 +14,12 @@ public class BoosterShop extends ShopBase { public BoosterShop(BoosterManager plugin, CoreClientManager clientManager, DonationManager donationManager) { - super(plugin, clientManager, donationManager, "Boosters"); + super(plugin, clientManager, donationManager, "Booster Keeper"); } @Override protected ShopPageBase> buildPagesFor(Player player) { - return new MenuPage(getPlugin(), this, getClientManager(), getDonationManager(), player); + return new BoosterPage(getPlugin(), this, getClientManager(), getDonationManager(), player); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/MenuPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/MenuPage.java deleted file mode 100644 index 6686168ef..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/MenuPage.java +++ /dev/null @@ -1,37 +0,0 @@ -package mineplex.core.boosters.gui; - -import mineplex.core.account.CoreClientManager; -import mineplex.core.boosters.Booster; -import mineplex.core.boosters.BoosterManager; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.UtilSkull; -import mineplex.core.common.util.UtilTime; -import mineplex.core.donation.DonationManager; -import mineplex.core.shop.item.ShopItem; -import mineplex.core.shop.page.ShopPageBase; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Shaun Bennett - */ -public class MenuPage extends ShopPageBase -{ - public MenuPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) - { - super(plugin, shop, clientManager, donationManager, "Boosters", player); - - buildPage(); - } - - @Override - protected void buildPage() - { - - } -} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 91e936319..f90c29391 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -1,5 +1,6 @@ package mineplex.hub; +import com.avaje.ebean.config.ServerConfig; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -113,7 +114,7 @@ public class Hub extends JavaPlugin implements IRelation BlockRestore blockRestore = new BlockRestore(this); DonationManager donationManager = new DonationManager(this, clientManager, webServerAddress); - new ServerConfiguration(this, clientManager); + ServerConfiguration serverConfiguration = new ServerConfiguration(this, clientManager); //Other Modules PacketHandler packetHandler = new PacketHandler(this); @@ -154,7 +155,8 @@ public class Hub extends JavaPlugin implements IRelation CustomDataManager customDataManager = new CustomDataManager(this, clientManager); PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager); - BoosterManager boosterManager = new BoosterManager(this, clientManager, donationManager, inventoryManager); + String boosterGroup = serverConfiguration.getServerGroup().getBoosterGroup(); + BoosterManager boosterManager = new BoosterManager(this, boosterGroup, clientManager, donationManager, inventoryManager); HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, boosterManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java index 1a6cc85e7..7e40bed4c 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/data/ServerGroup.java @@ -388,6 +388,8 @@ public class ServerGroup _dataMap.put("host", _host); _dataMap.put("region", _region.name()); _dataMap.put("teamServerKey", _teamServerKey); + _dataMap.put("modes", _modes); + _dataMap.put("boosterGroup", _boosterGroup); _dataMap.put("portalBottomCornerLocation", _portalBottomCornerLocation); _dataMap.put("portalTopCornerLocation", _portalTopCornerLocation); _dataMap.put("npcName", _npcName); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 0e6dd7108..35bdb94e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -165,7 +165,7 @@ public class Arcade extends JavaPlugin PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager); - BoosterManager boosterManager = new BoosterManager(this, _clientManager, _donationManager, inventoryManager); + BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null, boosterManager); cosmeticManager.setInterfaceSlot(7); cosmeticManager.disableTeamArmor(); 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 c6023c6bb..dc96d4551 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -319,7 +319,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); new PlayerDisguiseManager(plugin, _clientManager); - new GameBoosterManager(plugin, boosterManager, disguiseManager, hologramManager, serverConfig.BoosterGroup); + new GameBoosterManager(plugin, boosterManager, disguiseManager, hologramManager, npcManager, serverConfig.BoosterGroup); // Game Addons new CompassAddon(plugin, this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index 35097f260..5f89afd64 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -11,13 +11,17 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; +import mineplex.core.npc.Npc; +import mineplex.core.npc.NpcManager; import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.database.tables.records.NpcsRecord; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageByEntityEvent; @@ -35,20 +39,39 @@ public class BoosterPodium extends MiniPlugin private GameBoosterManager _gameBoosterManager; private DisguiseManager _disguiseManager; private HologramManager _hologramManager; + private NpcManager _npcManager; private Location _podiumLocation; private Booster _activeBooster; + private Npc _npc; + private boolean _npcAlive; + private Location _npcLocation; private ArmorStand _activeArmorStand; private Hologram _hologram; - public BoosterPodium(JavaPlugin plugin, GameBoosterManager gameBoosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, Location podiumLocation) + public BoosterPodium(JavaPlugin plugin, GameBoosterManager gameBoosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, NpcManager npcManager, Location podiumLocation) { super("Booster Podium - " + podiumLocation.toString(), plugin); _gameBoosterManager = gameBoosterManager; _disguiseManager = disguiseManager; _hologramManager = hologramManager; + _npcManager = npcManager; _podiumLocation = podiumLocation; + _npcLocation = podiumLocation.clone().add(0, 1, 0); + + NpcsRecord npcsRecord = new NpcsRecord(); + npcsRecord.setServer(_npcManager.getServerName()); + npcsRecord.setName(C.cGreen + "Booster Keeper"); + npcsRecord.setWorld(_npcLocation.getWorld().getName()); + npcsRecord.setX(_npcLocation.getX()); + npcsRecord.setY(_npcLocation.getY()); + npcsRecord.setZ(_npcLocation.getZ()); + npcsRecord.setRadius(0D); + npcsRecord.setEntityType(EntityType.VILLAGER.name()); + npcsRecord.setAdult(true); + _npcAlive = false; + _npc = new Npc(npcManager, npcsRecord); setPodium(_podiumLocation, Material.EMERALD_BLOCK.getId(), (byte) 0); updateNpcs(); @@ -59,13 +82,18 @@ public class BoosterPodium extends MiniPlugin Booster activeBooster = _gameBoosterManager.getActiveBooster(); if (activeBooster != null) { + if (_npcAlive) + { + _npcManager.removeFakeNpc(_npc); + _npcAlive = false; + } + if (_activeArmorStand != null) { _activeArmorStand.remove(); } - Location armorStandLocation = _podiumLocation.clone().add(0, 1.5, 0); - ArmorStand armorStand = _podiumLocation.getWorld().spawn(armorStandLocation, ArmorStand.class); + ArmorStand armorStand = _podiumLocation.getWorld().spawn(_npcLocation, ArmorStand.class); armorStand.setVisible(true); armorStand.setCustomNameVisible(false); armorStand.setCustomName(""); @@ -83,7 +111,7 @@ public class BoosterPodium extends MiniPlugin if (_hologram == null) { - _hologram = new Hologram(_hologramManager, armorStandLocation.clone().add(0, 1.75, 0), getHologramText(activeBooster)); + _hologram = new Hologram(_hologramManager, _npcLocation.clone().add(0, 2, 0), getHologramText(activeBooster)); _hologram.start(); } @@ -124,6 +152,13 @@ public class BoosterPodium extends MiniPlugin _hologram.stop(); _hologram = null; } + + if (!_npcAlive) + { + _npcManager.spawnNpc(_npc); + _npcManager.addFakeNpc(_npc); + _npcAlive = true; + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index f359f1305..68a2168e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilWorld; import mineplex.core.disguise.DisguiseManager; import mineplex.core.hologram.HologramManager; +import mineplex.core.npc.NpcManager; import nautilus.game.arcade.game.GameServerConfig; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -32,7 +33,7 @@ public class GameBoosterManager extends MiniPlugin private BoosterManager _boosterManager; private BoosterPodium _boosterPodium; - public GameBoosterManager(JavaPlugin plugin, BoosterManager boosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, String boosterGroup) + public GameBoosterManager(JavaPlugin plugin, BoosterManager boosterManager, DisguiseManager disguiseManager, HologramManager hologramManager, NpcManager npcManager, String boosterGroup) { super("Arcade Boosters", plugin); @@ -41,7 +42,7 @@ public class GameBoosterManager extends MiniPlugin if (boosterGroup != null && boosterGroup.length() > 0) { - _boosterPodium = new BoosterPodium(plugin, this, disguiseManager, hologramManager, new Location(UtilWorld.getWorld("world"), 0, 101.5, -12)); + _boosterPodium = new BoosterPodium(plugin, this, disguiseManager, hologramManager, npcManager, new Location(UtilWorld.getWorld("world"), 0, 101.5, -12)); } } From 6964b1f26680e4132fa5bcc0c646f52fddba6289 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 10 Jun 2016 17:20:23 -0500 Subject: [PATCH 10/49] Booster gui command --- .../core/boosters/command/BoosterCommand.java | 4 +++- .../core/boosters/command/GuiCommand.java | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/command/GuiCommand.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java index 95d6cd706..bc33d884f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java @@ -18,11 +18,13 @@ public class BoosterCommand extends MultiCommandBase super(plugin, Rank.DEVELOPER, "booster"); AddCommand(new AddCommand(plugin)); + AddCommand(new GuiCommand(plugin)); } @Override protected void Help(Player caller, String[] args) { - UtilPlayer.message(caller, F.help("booster add ", "Add a booster to that server group", Rank.DEVELOPER)); + UtilPlayer.message(caller, F.help("booster add ", "Add a booster to that booster group", Rank.DEVELOPER)); + UtilPlayer.message(caller, F.help("booster gui", "Open Booster GUI", Rank.DEVELOPER)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/GuiCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/GuiCommand.java new file mode 100644 index 000000000..762565ce0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/GuiCommand.java @@ -0,0 +1,23 @@ +package mineplex.core.boosters.command; + +import mineplex.core.boosters.BoosterManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import org.bukkit.entity.Player; + +/** + * @author Shaun Bennett + */ +public class GuiCommand extends CommandBase +{ + public GuiCommand(BoosterManager plugin) + { + super(plugin, Rank.DEVELOPER, "gui"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.openShop(caller); + } +} From 42c35063b3393a3fae07f3d5ed72c4e7a0b677d7 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 10 Jun 2016 17:40:59 -0500 Subject: [PATCH 11/49] Display all the boosters you have activated --- .../core/boosters/gui/BoosterPage.java | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index cb7135c53..952ff1cff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -1,6 +1,7 @@ package mineplex.core.boosters.gui; import mineplex.core.account.CoreClientManager; +import mineplex.core.boosters.Booster; import mineplex.core.boosters.BoosterManager; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilTime; @@ -11,6 +12,8 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; /** * @author Shaun Bennett @@ -19,7 +22,7 @@ public class BoosterPage extends ShopPageBase { public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Boosters", player, 9); + super(plugin, shop, clientManager, donationManager, "Boosters", player, 27); buildPage(); } @@ -50,5 +53,41 @@ public class BoosterPage extends ShopPageBase ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); setItem(4, booster); + + addActiveBoosters(); + } + + private void addActiveBoosters() + { + List boosters = getPlugin().getBoosters().stream() + .filter(booster -> booster.getUuid().equals(getPlayer().getUniqueId())).collect(Collectors.toList()); + + int startIndex = Math.max(0, (9 - boosters.size()) / 2); + for (int i = 0; i < 9 && i < boosters.size(); i++) + { + Booster booster = boosters.get(i); + boolean active = booster.isActive(); + + int index = 18 + startIndex + i; + long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); + + List lore = new ArrayList(); + lore.add(" "); + if (active) + { + lore.add(C.cGreen + "Active"); + } + else + { + long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); + lore.add(C.cWhite + "Activates in " + C.cGreen + UtilTime.convertString(timeToActive, 2, UtilTime.TimeUnit.FIT)); + } + + String activationTime = UtilTime.convertString(timeActivatedDif, 2, UtilTime.TimeUnit.FIT); + ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, + "Added " + activationTime + " ago", lore.toArray(new String[0]), 1, false, false); + setItem(index, shopItem); + } + } } From 2421fd1cfed2cb1b07890ed994506511768d8e27 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 10 Jun 2016 19:40:27 -0500 Subject: [PATCH 12/49] Update booster page, proper booster rewards --- .../core/boosters/BoosterManager.java | 59 ++++++++++++++++++- .../boosters/gui/ActivateBoosterButton.java | 34 ++++++----- .../core/boosters/gui/BoosterPage.java | 39 ++++++++---- .../core/boosters/gui/BoosterShop.java | 12 ++++ .../nautilus/game/arcade/ArcadeManager.java | 8 +++ .../game/arcade/managers/GameGemManager.java | 22 +++---- .../arcade/managers/GameLobbyManager.java | 3 +- 7 files changed, 138 insertions(+), 39 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index a29a07973..4a8b1128c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -9,15 +9,24 @@ import mineplex.core.boosters.event.BoosterUpdateEvent; import mineplex.core.boosters.gui.BoosterShop; import mineplex.core.boosters.redis.BoosterUpdateRepository; import mineplex.core.boosters.tips.BoosterTipManager; +import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import java.io.IOException; @@ -29,6 +38,10 @@ import java.util.*; */ public class BoosterManager extends MiniPlugin { + public static final String BOOSTER_ITEM = "Game Booster"; + public static final ItemStack INTERFACE_ITEM = ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, ChatColor.RESET + C.cGreen + "Booster Menu"); + public static final int INTERFACE_SLOT = 6; + private BoosterRepository _repository; private CoreClientManager _clientManager; private DonationManager _donationManager; @@ -38,6 +51,8 @@ public class BoosterManager extends MiniPlugin private BoosterShop _shop; private String _boosterGroup; + private boolean _giveInterfaceItem; + private long _cacheLastUpdated; private Map> _boosterCache = new HashMap<>(); @@ -64,6 +79,8 @@ public class BoosterManager extends MiniPlugin e.printStackTrace(); } + _giveInterfaceItem = canActivateBoosters(); + new BoosterUpdateRepository(plugin); } @@ -181,6 +198,11 @@ public class BoosterManager extends MiniPlugin return time; } + public Booster getActiveBooster() + { + return getActiveBoosterFromCache(_boosterGroup); + } + public Booster getActiveBoosterFromCache(String boosterGroup) { List boosters = _boosterCache.get(boosterGroup); @@ -212,6 +234,11 @@ public class BoosterManager extends MiniPlugin }); } + public void activateBooster(Player player, Callback callback) + { + activateBooster(_boosterGroup, player, callback); + } + public void activateBooster(String serverGroup, Player player, Callback callback) { String playerName = player.getName(); @@ -224,6 +251,11 @@ public class BoosterManager extends MiniPlugin }); } + public void chargeBooster(Player player, Callback callback) + { + _inventoryManager.addItemToInventory(callback, player, BOOSTER_ITEM, -1); + } + public void openShop(Player player) { _shop.attemptShopOpen(player); @@ -247,7 +279,7 @@ public class BoosterManager extends MiniPlugin */ public int getAvailableBoosterCount(Player player) { - return _inventoryManager.Get(player).getItemCount("Game Booster"); + return _inventoryManager.Get(player).getItemCount(BOOSTER_ITEM); } /** @@ -259,6 +291,31 @@ public class BoosterManager extends MiniPlugin return _boosterGroup != null && _boosterGroup.length() > 0; } + public void giveInterfaceItem(Player player) + { + if (_giveInterfaceItem && !UtilGear.isMat(player.getInventory().getItem(INTERFACE_SLOT), Material.EMERALD)) + { + player.getInventory().setItem(INTERFACE_SLOT, INTERFACE_ITEM); + + UtilInv.Update(player); + } + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + giveInterfaceItem(event.getPlayer()); + } + + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (INTERFACE_ITEM.equals(event.getPlayer().getItemInHand())) + { + openShop(event.getPlayer()); + } + } + public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException { BoosterRepository repository = new BoosterRepository(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java index 9aa9a054a..a872b6ca0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java @@ -4,6 +4,7 @@ import mineplex.core.boosters.BoosterApiResponse; import mineplex.core.boosters.BoosterManager; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilTime; import mineplex.core.shop.item.IButton; import org.bukkit.entity.Player; @@ -27,21 +28,26 @@ public class ActivateBoosterButton implements IButton public void onClick(Player player, ClickType clickType) { player.closeInventory(); - _boosterManager.activateBooster("Testing", player, new Callback() - { - @Override - public void run(BoosterApiResponse response) + + _boosterManager.chargeBooster(player, data -> { + if (data) { - if (response.isSuccess()) - { - long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); - if (timeToStart <= 0) player.sendMessage(C.cGreen + "Booster activated and enabled now!"); - else player.sendMessage(C.cGreen + "Booster activated. Enabled in " + UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)); - } - else - { - player.sendMessage(C.cRed + "There was an error trying to enable your booster :("); - } + _boosterManager.activateBooster(player, response -> { + if (response.isSuccess()) + { + long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); + if (timeToStart <= 0) player.sendMessage(F.main("Booster", "Booster Activated!")); + else player.sendMessage(F.main("Booster", "Booster Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)))); + } + else + { + player.sendMessage(C.cRed + "There was an error trying to enable your booster :("); + } + }); + } + else + { + player.sendMessage(F.main("Booster", "There was an error charging your account. Try again later!")); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index 952ff1cff..4fe09ba97 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -34,25 +34,41 @@ public class BoosterPage extends ShopPageBase int count = getPlugin().getAvailableBoosterCount(getPlayer()); lore.add(" "); - lore.add(C.cWhite + "You Own: " + getPlugin().getAvailableBoosterCount(getPlayer())); + lore.add(C.cWhite + "You Own " + C.cGreen + getPlugin().getAvailableBoosterCount(getPlayer())); if (getPlugin().canActivateBoosters() && count > 0) { + List boosters = getPlugin().getBoosters(); lore.add(" "); - lore.add(C.cWhite + "Click to Activate"); long waitTime = getPlugin().getBoostTime(); if (waitTime == 0) { - lore.add(C.cWhite + "Booster would activate " + C.cGreen + "now"); + lore.add(C.cGray + "Booster would activate " + C.cGreen + "now"); + lore.add(" "); + lore.add(C.cWhite + "Click to Activate Booster"); } else { - lore.add(C.cWhite + "Booster would activate in " + C.cGreen + UtilTime.convertString(waitTime, 1, UtilTime.TimeUnit.FIT)); + if (boosters.size() > 1) + { + lore.add(C.cGray + "There are " + C.cGreen + (boosters.size() - 1) + C.cGray + " boosters in queue"); + } + + lore.add(C.cGray + "Activation Time: " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + lore.add(" "); + lore.add(C.cWhite + "Click to Queue Booster"); } } ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); - setItem(4, booster); + if (getPlugin().canActivateBoosters()) + { + addButton(4, booster, new ActivateBoosterButton(getShop(), getPlugin())); + } + else + { + setItem(4, booster); + } addActiveBoosters(); } @@ -70,24 +86,25 @@ public class BoosterPage extends ShopPageBase int index = 18 + startIndex + i; long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); + String activationTime = UtilTime.convertString(timeActivatedDif, 2, UtilTime.TimeUnit.FIT); List lore = new ArrayList(); - lore.add(" "); if (active) { - lore.add(C.cGreen + "Active"); + lore.add(C.cWhite + "Active"); } else { long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); - lore.add(C.cWhite + "Activates in " + C.cGreen + UtilTime.convertString(timeToActive, 2, UtilTime.TimeUnit.FIT)); + lore.add(C.cWhite + "Starts in " + C.cGreen + UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); } - String activationTime = UtilTime.convertString(timeActivatedDif, 2, UtilTime.TimeUnit.FIT); + lore.add(" "); + lore.add(C.cGray + "Added " + activationTime + " ago"); + ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, - "Added " + activationTime + " ago", lore.toArray(new String[0]), 1, false, false); + "Game Booster", lore.toArray(new String[0]), 1, !active, false); setItem(index, shopItem); } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java index 09787ecb7..92a515587 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java @@ -5,7 +5,10 @@ import mineplex.core.boosters.BoosterManager; import mineplex.core.donation.DonationManager; import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; /** * @author Shaun Bennett @@ -22,4 +25,13 @@ public class BoosterShop extends ShopBase { return new BoosterPage(getPlugin(), this, getClientManager(), getDonationManager(), player); } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + getPlayerPageMap().values().forEach(ShopPageBase::refresh); + } } 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 dc96d4551..c47d59f8b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -194,6 +194,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private Punish _punishmentManager; private BrandingManager _brandingManager; private BonusManager _bonusManager; + private BoosterManager _boosterManager; private IncognitoManager _incognitoManager; @@ -246,6 +247,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation _brandingManager = new BrandingManager(plugin); + _boosterManager = boosterManager; + //Dont see a reason to ever just use the normal one // if (serverConfig.GameList.contains(GameType.ChampionsDominate) // || serverConfig.GameList.contains(GameType.ChampionsTDM) @@ -1452,6 +1455,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _youtube.contains(player); } + public BoosterManager getBoosterManager() + { + return _boosterManager; + } + public void toggleUnlockKits(Player caller) { if (_youtube.remove(caller)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index ef80000d0..b225577dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -180,10 +180,11 @@ public class GameGemManager implements Listener } //Gem Boooster - /* - if (game.GemBoosterEnabled && game.getGemBooster() != null) - total += (int)(earned * game.getGemBooster().getMultiplier()); - */ + Booster booster = Manager.getBoosterManager().getActiveBooster(); + if (game.GemBoosterEnabled && booster != null) + { + total *= booster.getMultiplier(); + } int shards = total; @@ -309,16 +310,15 @@ public class GameGemManager implements Listener int totalGems = earnedGems; //Gem Booster - /* - Booster gemBooster = game.getGemBooster(); - if (game.GemBoosterEnabled && gemBooster != null) + Booster booster = Manager.getBoosterManager().getActiveBooster(); + if (game.GemBoosterEnabled && booster != null) { - UtilPlayer.message(player, F.elem(C.cGreen + "+" + (int) (earnedGems * gemBooster.getMultiplier()) + " Gems") + " for gem booster from " - + F.name(gemBooster.getPlayerName())); + int addedGems = (int) (earnedGems * booster.getMultiplier()) - earnedGems; + UtilPlayer.message(player, F.elem(C.cGreen + "+" + addedGems + " Gems") + " for gem booster from " + + F.name(booster.getPlayerName())); - totalGems += earnedGems * gemBooster.getMultiplier(); + totalGems *= booster.getMultiplier(); } - */ int shards = totalGems; 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..4e73bd40b 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 @@ -86,8 +86,6 @@ public class GameLobbyManager implements Listener private Location spawn; - private Location _boosterLocation; - private NautHashMap _kits = new NautHashMap(); private NautHashMap _kitBlocks = new NautHashMap(); @@ -1337,6 +1335,7 @@ public class GameLobbyManager implements Listener //Cosmetic Menu Manager.getCosmeticManager().giveInterfaceItem(player); + Manager.getBoosterManager().giveInterfaceItem(player); } } From cf874694009487e5f212448a2fd166ffeb184399 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 10 Jun 2016 20:24:22 -0500 Subject: [PATCH 13/49] Fix a possible NPE, use proper IP and port for api --- .../src/mineplex/core/common/api/ApiEndpoint.java | 6 +++--- .../src/mineplex/core/boosters/BoosterManager.java | 3 ++- .../src/mineplex/core/boosters/gui/BoosterPage.java | 3 +++ .../core/boosters/redis/BoosterUpdateRepository.java | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java index 40684023c..7dafb9ec2 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java @@ -7,9 +7,9 @@ import com.google.gson.Gson; */ public class ApiEndpoint { -// private static final String API_HOST = "10.33.53.12"; - private static final String API_HOST = "localhost"; - private static final int API_PORT = 3000; + private static final String API_HOST = "10.33.53.12"; +// private static final String API_HOST = "localhost"; + private static final int API_PORT = 7979; private ApiWebCall _webCall; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index 4a8b1128c..9a55b5b74 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -71,7 +71,8 @@ public class BoosterManager extends MiniPlugin try { - _boosterCache = _repository.getBoosters(); + Map> boosters = _repository.getBoosters(); + if (boosters != null) _boosterCache = boosters; } catch (Exception e) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index 4fe09ba97..f0b21a823 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -75,6 +75,9 @@ public class BoosterPage extends ShopPageBase private void addActiveBoosters() { + if (getPlugin().getBoosters() == null) + return; + List boosters = getPlugin().getBoosters().stream() .filter(booster -> booster.getUuid().equals(getPlayer().getUniqueId())).collect(Collectors.toList()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java index 5721fd736..702f55a07 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/redis/BoosterUpdateRepository.java @@ -27,7 +27,7 @@ public class BoosterUpdateRepository extends RedisRepository @Override public void run() { - try (Jedis jedis = new Jedis()) + try (Jedis jedis = getResource(false)) { jedis.subscribe(new BoosterUpdateListener(_plugin), "minecraft.boosters"); } From aa785ed3d579e1da2d5298de217ba412dd4c160d Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 12 Jun 2016 21:18:11 -0500 Subject: [PATCH 14/49] Code clean-up and documentation --- .../core/boosters/BoosterManager.java | 97 +++++++++++++------ .../mineplex/core/boosters/BoosterMap.java | 8 -- .../core/boosters/BoosterRepository.java | 2 + .../boosters/event/BoosterActivateEvent.java | 3 + .../event/BoosterDeactivateEvent.java | 2 + .../boosters/event/BoosterUpdateEvent.java | 2 + .../hub/server/ui/ServerGameMenu.java | 2 +- .../arcade/booster/GameBoosterManager.java | 5 +- 8 files changed, 76 insertions(+), 45 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterMap.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index 9a55b5b74..29632eee7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -29,17 +29,31 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; -import java.io.IOException; -import java.net.URISyntaxException; import java.util.*; /** + * BoosterManager handles the majority of logic for creating and getting Boosters. Every BoosterManager stores a cache + * for all boosters across all servers. We pull all boosters from the API when the server boots up. To keep them in sync, + * instead of consistently polling the API I have decided to go with a redis pub/sub solution to ensuring all boosters + * across all servers are up to date. Whenever the Booster API receives a call to add or modify boosters, it will publish + * an updated version of all boosters over redis. + * + * Boosters are enabled on live servers using "Booster Groups". A {@link mineplex.serverdata.data.ServerGroup} can specify + * which BoosterGroup applies to it. If there is no BoosterGroup, then it means the server does not use boosters. To add + * a BoosterGroup, you must add to the "boostergroups" set on redis (the same way the servergroups set works), otherwise + * the API will return an error saying that BoosterGroup does not exist. Currently BoosterGroups are no more than a String + * key for Boosters. In the future we may want to look into implementing BoosterGroup specific data such as default + * booster length and multiplier. + * * @author Shaun Bennett */ public class BoosterManager extends MiniPlugin { + // The InventoryManager item name for boosters. This is required to activate a booster on servers public static final String BOOSTER_ITEM = "Game Booster"; + // Item in arcade lobbies that opens the booster gui public static final ItemStack INTERFACE_ITEM = ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, ChatColor.RESET + C.cGreen + "Booster Menu"); + // Slot for the booster gui item public static final int INTERFACE_SLOT = 6; private BoosterRepository _repository; @@ -91,6 +105,10 @@ public class BoosterManager extends MiniPlugin addCommand(new BoosterCommand(this)); } + /** + * Make an API call to grab all Boosters + */ + @Deprecated public void getBoostersAsync(Callback>> callback) { runAsync(() -> { @@ -113,6 +131,33 @@ public class BoosterManager extends MiniPlugin }); } + /** + * Make an API call to grab all boosters for a specific booster group + * @param boosterGroup + * @param callback + */ + @Deprecated + public void getBoostersAsync(String boosterGroup, Callback> callback) + { + runAsync(() -> { + try + { + List boosters = _repository.getBoosters(boosterGroup); + if (callback != null) runSync(() -> callback.run(boosters)); + } + catch (Exception e) + { + System.err.println("Failed to grab boosters for boostergroup: " + boosterGroup); + e.printStackTrace(); + } + }); + } + + /** + * Process the new boosterMap whenever a BoosterUpdateEvent is sent. This will compare itself to the current + * cached BoosterMap and call events when it finds a booster was activated or deactivated + * @param boosterMap The new booster map + */ private void handleBoosterUpdate(Map> boosterMap) { _boosterCache.entrySet().stream() @@ -174,9 +219,21 @@ public class BoosterManager extends MiniPlugin tickBoosterCache(); } + /** + * Return all boosters for the active booster group + * @return list of boosters, or null if there is no active booster group + */ public List getBoosters() { - return _boosterCache.get(_boosterGroup); + if (_boosterGroup == null || _boosterGroup.length() == 0) + { + return null; + } + else + { + List boosters = _boosterCache.get(_boosterGroup); + return boosters == null ? Collections.emptyList() : boosters; + } } public long getBoostTime() @@ -201,10 +258,10 @@ public class BoosterManager extends MiniPlugin public Booster getActiveBooster() { - return getActiveBoosterFromCache(_boosterGroup); + return getActiveBooster(_boosterGroup); } - public Booster getActiveBoosterFromCache(String boosterGroup) + public Booster getActiveBooster(String boosterGroup) { List boosters = _boosterCache.get(boosterGroup); if (boosters != null) @@ -219,22 +276,6 @@ public class BoosterManager extends MiniPlugin return null; } - public void getBoostersAsync(String serverGroup, Callback> callback) - { - runAsync(() -> { - try - { - List boosters = _repository.getBoosters(serverGroup); - if (callback != null) runSync(() -> callback.run(boosters)); - } - catch (Exception e) - { - System.err.println("Failed to grab boosters for servergroup: " + serverGroup); - e.printStackTrace(); - } - }); - } - public void activateBooster(Player player, Callback callback) { activateBooster(_boosterGroup, player, callback); @@ -262,6 +303,9 @@ public class BoosterManager extends MiniPlugin _shop.attemptShopOpen(player); } + /** + * Booster updates are sent from {@link mineplex.core.boosters.redis.BoosterUpdateListener} + */ @EventHandler public void onBoosterUpdate(BoosterUpdateEvent event) { @@ -317,17 +361,6 @@ public class BoosterManager extends MiniPlugin } } - public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException - { - BoosterRepository repository = new BoosterRepository(); - Map> boosters = repository.getBoosters(); - boosters.entrySet().forEach((entry) -> { - System.out.println("Booster Entry: " + entry.getKey()); - System.out.println("Booster Size: " + entry.getValue().size()); - entry.getValue().forEach(System.out::println); - }); - } - private void callNextTick(Event event) { runSync(() -> getPluginManager().callEvent(event)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterMap.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterMap.java deleted file mode 100644 index 09786ce8f..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterMap.java +++ /dev/null @@ -1,8 +0,0 @@ -package mineplex.core.boosters; - -/** - * @author Shaun Bennett - */ -public class BoosterMap -{ -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java index fbe355e28..ec8a3733c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java @@ -14,6 +14,8 @@ import java.util.Map; import java.util.UUID; /** + * Boosters interaction is handled through a web API. All data is represented as JSON and then parsed using gson. + * * @author Shaun Bennett */ public class BoosterRepository extends ApiEndpoint diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java index 6cb1d0ea6..2972d2c30 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterActivateEvent.java @@ -5,6 +5,9 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; /** + * Called when a Booster is activated. This will be called regardless of which "BoosterGroup" the current server is set + * to, so if you only want Boosters on the current BoosterGroup, you will need to verify it. + * * @author Shaun Bennett */ public class BoosterActivateEvent extends Event diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java index 3336912ee..ab080c967 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java @@ -5,6 +5,8 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; /** + * Called when a Booster is finished. + * * @author Shaun Bennett */ public class BoosterDeactivateEvent extends Event diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java index f17b259fd..8dae38567 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterUpdateEvent.java @@ -8,6 +8,8 @@ import java.util.List; import java.util.Map; /** + * Called when {@link mineplex.core.boosters.redis.BoosterUpdateListener} receives updated Boosters over redis pubsub. + * * @author Shaun Bennett */ public class BoosterUpdateEvent extends Event diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index f279bb288..a432533bd 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -215,7 +215,7 @@ public class ServerGameMenu extends ShopPageBase // Boosters if (serverGroup != null) { - Booster booster = getPlugin().getBoosterManager().getActiveBoosterFromCache(serverGroup); + Booster booster = getPlugin().getBoosterManager().getActiveBooster(serverGroup); if (booster != null) { // append to start of lore diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index 68a2168e8..6c2169593 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -14,15 +14,12 @@ import mineplex.core.common.util.UtilWorld; import mineplex.core.disguise.DisguiseManager; import mineplex.core.hologram.HologramManager; import mineplex.core.npc.NpcManager; -import nautilus.game.arcade.game.GameServerConfig; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; -import java.util.List; - /** * @author Shaun Bennett */ @@ -48,7 +45,7 @@ public class GameBoosterManager extends MiniPlugin public Booster getActiveBooster() { - return _boosterManager.getActiveBoosterFromCache(_boosterGroup); + return _boosterManager.getActiveBooster(_boosterGroup); } public void attemptTip(Player player) From cbfbd6fe1c205d74a891e4f41b8e2cc920dcf640 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 15 Jun 2016 17:40:20 -0500 Subject: [PATCH 15/49] Booster GUI update --- .../mineplex/core/common/api/ApiEndpoint.java | 8 ++ .../src/mineplex/core/boosters/Booster.java | 7 ++ .../core/boosters/BoosterManager.java | 37 ++++++-- .../core/boosters/BoosterRepository.java | 3 + ...vateEvent.java => BoosterExpireEvent.java} | 4 +- .../core/boosters/gui/BoosterPage.java | 92 +++++++++++++++++-- .../Mineplex.Hub/src/mineplex/hub/Hub.java | 3 +- .../src/nautilus/game/arcade/Arcade.java | 3 +- .../game/arcade/booster/BoosterPodium.java | 8 +- .../arcade/booster/GameBoosterManager.java | 4 +- 10 files changed, 137 insertions(+), 32 deletions(-) rename Plugins/Mineplex.Core/src/mineplex/core/boosters/event/{BoosterDeactivateEvent.java => BoosterExpireEvent.java} (85%) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java index 7dafb9ec2..06fdc0896 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiEndpoint.java @@ -9,18 +9,26 @@ public class ApiEndpoint { private static final String API_HOST = "10.33.53.12"; // private static final String API_HOST = "localhost"; +// private static final int API_PORT = 3000; private static final int API_PORT = 7979; + private Gson _gson; private ApiWebCall _webCall; public ApiEndpoint(String path, Gson gson) { String url = "http://" + API_HOST + ":" + API_PORT + path; _webCall = new ApiWebCall(url, gson); + _gson = gson; } protected ApiWebCall getWebCall() { return _webCall; } + + public Gson getGson() + { + return _gson; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java index c9b4d8554..62a713513 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java @@ -1,5 +1,6 @@ package mineplex.core.boosters; +import com.mojang.authlib.properties.PropertyMap; import mineplex.core.common.util.UtilTime; import java.util.Date; @@ -19,6 +20,7 @@ public class Booster private Date _startTime; private Date _endTime; private Date _activationTime; +// private PropertyMap _propertyMap; public Booster() { @@ -96,6 +98,11 @@ public class Booster return _multiplier; } +// public PropertyMap getPropertyMap() +// { +// return _propertyMap; +// } + @Override public boolean equals(Object o) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index 29632eee7..10b57d1b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -1,10 +1,11 @@ package mineplex.core.boosters; +import com.mojang.authlib.properties.PropertyMap; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.boosters.command.BoosterCommand; import mineplex.core.boosters.event.BoosterActivateEvent; -import mineplex.core.boosters.event.BoosterDeactivateEvent; +import mineplex.core.boosters.event.BoosterExpireEvent; import mineplex.core.boosters.event.BoosterUpdateEvent; import mineplex.core.boosters.gui.BoosterShop; import mineplex.core.boosters.redis.BoosterUpdateRepository; @@ -21,6 +22,7 @@ import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; @@ -163,19 +165,23 @@ public class BoosterManager extends MiniPlugin _boosterCache.entrySet().stream() .filter(entry -> entry.getValue().size() > 0) .filter(entry -> boosterMap.get(entry.getKey()) == null) - .forEach(entry -> callNextTick(new BoosterDeactivateEvent(entry.getKey(), entry.getValue().get(0)))); + .forEach(entry -> callNextTick(new BoosterExpireEvent(entry.getKey(), entry.getValue().get(0)))); for (Map.Entry> entry : boosterMap.entrySet()) { List current = _boosterCache.get(entry.getKey()); - if (current == null || current.get(0) == null) + if (entry.getValue() != null && !entry.getValue().isEmpty()) { - callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0))); - } - else if (!current.get(0).equals(entry.getValue().get(0))) - { - callNextTick(new BoosterDeactivateEvent(entry.getKey(), current.get(0))); - callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0))); + if (current == null || current.isEmpty()) + { + // New booster was added + callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0))); + } else if (!current.get(0).equals(entry.getValue().get(0))) + { + // First booster was deactivated, new booster replaced it + callNextTick(new BoosterExpireEvent(entry.getKey(), current.get(0))); + callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0))); + } } } @@ -197,7 +203,7 @@ public class BoosterManager extends MiniPlugin { iterator.remove(); removedOne = true; - events.add(new BoosterDeactivateEvent(entry.getKey(), booster)); + events.add(new BoosterExpireEvent(entry.getKey(), booster)); } else { @@ -236,6 +242,11 @@ public class BoosterManager extends MiniPlugin } } + public String getBoosterGroup() + { + return _boosterGroup; + } + public long getBoostTime() { return getBoostTime(_boosterGroup); @@ -286,6 +297,7 @@ public class BoosterManager extends MiniPlugin String playerName = player.getName(); UUID uuid = player.getUniqueId(); int accountId = _clientManager.getAccountId(player); +// PropertyMap propertyMap = ((CraftPlayer) player).getHandle().getProfile().getProperties(); runAsync(() -> { BoosterApiResponse response = _repository.addBooster(serverGroup, playerName, uuid, accountId, 3600); @@ -361,6 +373,11 @@ public class BoosterManager extends MiniPlugin } } + public Map> getBoosterCache() + { + return _boosterCache; + } + private void callNextTick(Event event) { runSync(() -> getPluginManager().callEvent(event)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java index ec8a3733c..a057c4071 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterRepository.java @@ -4,6 +4,7 @@ import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; +import com.mojang.authlib.properties.PropertyMap; import mineplex.core.common.api.ApiEndpoint; import mineplex.core.common.api.ApiFieldNamingStrategy; import mineplex.core.common.api.ApiResponse; @@ -23,6 +24,7 @@ public class BoosterRepository extends ApiEndpoint public BoosterRepository() { super("/booster", new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy()) +// .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()) .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create()); } @@ -43,6 +45,7 @@ public class BoosterRepository extends ApiEndpoint body.addProperty("uuid", uuid.toString()); body.addProperty("accountId", accountId); body.addProperty("duration", duration); +// body.add("propertyMap", getGson().toJsonTree(propertyMap)); return getWebCall().post("/" + serverGroup, BoosterApiResponse.class, body); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterExpireEvent.java similarity index 85% rename from Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java rename to Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterExpireEvent.java index ab080c967..2f527ebac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterDeactivateEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterExpireEvent.java @@ -9,12 +9,12 @@ import org.bukkit.event.HandlerList; * * @author Shaun Bennett */ -public class BoosterDeactivateEvent extends Event +public class BoosterExpireEvent extends Event { private String _boosterGroup; private Booster _booster; - public BoosterDeactivateEvent(String boosterGroup, Booster booster) + public BoosterExpireEvent(String boosterGroup, Booster booster) { _boosterGroup = boosterGroup; _booster = booster; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index f0b21a823..2167892b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -3,17 +3,19 @@ package mineplex.core.boosters.gui; import mineplex.core.account.CoreClientManager; import mineplex.core.boosters.Booster; import mineplex.core.boosters.BoosterManager; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; +import org.apache.commons.lang3.tuple.Triple; import org.bukkit.Material; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; +import java.util.Map; /** * @author Shaun Bennett @@ -22,7 +24,7 @@ public class BoosterPage extends ShopPageBase { public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Boosters", player, 27); + super(plugin, shop, clientManager, donationManager, "Boosters", player, 54); buildPage(); } @@ -71,6 +73,7 @@ public class BoosterPage extends ShopPageBase } addActiveBoosters(); + addOtherBoosters(); } private void addActiveBoosters() @@ -78,23 +81,92 @@ public class BoosterPage extends ShopPageBase if (getPlugin().getBoosters() == null) return; - List boosters = getPlugin().getBoosters().stream() - .filter(booster -> booster.getUuid().equals(getPlayer().getUniqueId())).collect(Collectors.toList()); + List current = getPlugin().getBoosters(); + List> boosters = new ArrayList<>(); + for (int i = 0; i < current.size(); i++) + { + Booster b = current.get(i); + if (b.getUuid().equals(getPlayer().getUniqueId())) + { + boosters.add(Pair.create(i, b)); + } + } int startIndex = Math.max(0, (9 - boosters.size()) / 2); for (int i = 0; i < 9 && i < boosters.size(); i++) { - Booster booster = boosters.get(i); + int queueIndex = boosters.get(i).getLeft(); + int deliveryAmount = 1; + Booster booster = boosters.get(i).getRight(); boolean active = booster.isActive(); int index = 18 + startIndex + i; long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); - String activationTime = UtilTime.convertString(timeActivatedDif, 2, UtilTime.TimeUnit.FIT); + String activationTime = UtilTime.convertString(timeActivatedDif, 0, UtilTime.TimeUnit.FIT); List lore = new ArrayList(); + lore.add(" "); if (active) { lore.add(C.cWhite + "Active"); + lore.add(C.cWhite + "Expires in " + C.cGreen + UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS)); + } + else + { + deliveryAmount = Math.max(1, queueIndex); + long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); + lore.add(C.cWhite + "Starts in " + C.cGreen + UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + lore.add(C.cWhite + "Position " + C.cGreen + deliveryAmount + C.cWhite + " in queue"); + } + + lore.add(" "); + lore.add(C.cGray + "Added " + activationTime + " ago"); + + ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, + "Game Booster", lore.toArray(new String[0]), deliveryAmount, !active, false); + setItem(index, shopItem); + } + } + + private void addOtherBoosters() + { + Map> boosterMap = getPlugin().getBoosterCache(); + List> tripleList = new ArrayList<>(); + for (Map.Entry> entry : boosterMap.entrySet()) + { + String boosterGroup = entry.getKey(); + // dont display boosters for the current booster group + if (boosterGroup.equals(getPlugin().getBoosterGroup())) + continue; + + List boosters = entry.getValue(); + for (int i = 0; i < boosters.size(); i++) + { + Booster booster = boosters.get(i); + if (booster.getUuid().equals(getPlayer().getUniqueId())) + { + tripleList.add(Triple.of(i, boosterGroup, booster)); + } + } + } + + + int startIndex = Math.max(0, (9 - tripleList.size()) / 2); + for (int i = 0; i < 9 && i < tripleList.size(); i++) + { + Triple triple = tripleList.get(i); + int deliveryAmount = Math.max(1, triple.getLeft()); + String boosterGroup = triple.getMiddle(); + Booster booster = triple.getRight(); + long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); + String activationTime = UtilTime.convertString(timeActivatedDif, 2, UtilTime.TimeUnit.FIT); + + List lore = new ArrayList(); + lore.add(" "); + lore.add(C.cWhite + "Server: " + C.cGreen + boosterGroup); + if (booster.isActive()) + { + lore.add(C.cWhite + "Expires in " + C.cGreen + UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS)); } else { @@ -105,9 +177,11 @@ public class BoosterPage extends ShopPageBase lore.add(" "); lore.add(C.cGray + "Added " + activationTime + " ago"); - ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, - "Game Booster", lore.toArray(new String[0]), 1, !active, false); - setItem(index, shopItem); + ShopItem shopItem = new ShopItem(Material.GOLD_BLOCK, + "Game Booster", lore.toArray(new String[0]), 1, false, false); + setItem(startIndex + i, shopItem); } + + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index f90c29391..fec8e52be 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -102,6 +102,7 @@ public class Hub extends JavaPlugin implements IRelation new VelocityFix(this); //Static Modules + new ProfileCacheManager(this); CommandCenter.Initialize(this); CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); CommandCenter.Instance.setClientManager(clientManager); @@ -199,8 +200,6 @@ public class Hub extends JavaPlugin implements IRelation new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true); - new ProfileCacheManager(this); - //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 35bdb94e7..ef2e1411a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -106,6 +106,7 @@ public class Arcade extends JavaPlugin CommandCenter.Initialize(this); _clientManager = new CoreClientManager(this, webServerAddress); CommandCenter.Instance.setClientManager(_clientManager); + new ProfileCacheManager(this); ItemStackFactory.Initialize(this, false); @@ -185,8 +186,6 @@ public class Arcade extends JavaPlugin new PacketsInteractionFix(this, packetHandler); new FoodDupeFix(this); - new ProfileCacheManager(this); - //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index 5f89afd64..96b17381d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -4,16 +4,14 @@ import com.mojang.authlib.GameProfile; import mineplex.core.MiniPlugin; import mineplex.core.boosters.Booster; import mineplex.core.boosters.event.BoosterActivateEvent; -import mineplex.core.boosters.event.BoosterDeactivateEvent; +import mineplex.core.boosters.event.BoosterExpireEvent; import mineplex.core.boosters.tips.BoosterTipManager; import mineplex.core.common.util.*; import mineplex.core.disguise.DisguiseManager; -import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; import mineplex.core.npc.Npc; import mineplex.core.npc.NpcManager; -import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.database.tables.records.NpcsRecord; @@ -180,7 +178,7 @@ public class BoosterPodium extends MiniPlugin return new String[] { C.cGreen + "Boosted by " + C.cWhite + booster.getPlayerName(), C.cWhite + booster.getTimeRemainingString() + " Remaining", - C.cAqua + "Right Click to Tip. You get " + BoosterTipManager.TIP_FOR_TIPPER + " Treasure Shards" + C.cAqua + "Click to Tip. You get " + BoosterTipManager.TIP_FOR_TIPPER + " Treasure Shards" }; } @@ -207,7 +205,7 @@ public class BoosterPodium extends MiniPlugin } @EventHandler - public void onBoosterDisable(BoosterDeactivateEvent event) + public void onBoosterDisable(BoosterExpireEvent event) { updateNpcs(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index 6c2169593..1a52cf716 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -4,7 +4,7 @@ import mineplex.core.MiniPlugin; import mineplex.core.boosters.Booster; import mineplex.core.boosters.BoosterManager; import mineplex.core.boosters.event.BoosterActivateEvent; -import mineplex.core.boosters.event.BoosterDeactivateEvent; +import mineplex.core.boosters.event.BoosterExpireEvent; import mineplex.core.boosters.tips.BoosterTipManager; import mineplex.core.boosters.tips.TipAddResult; import mineplex.core.common.CurrencyType; @@ -89,7 +89,7 @@ public class GameBoosterManager extends MiniPlugin } @EventHandler - public void onDeactivate(BoosterDeactivateEvent event) + public void onDeactivate(BoosterExpireEvent event) { System.out.println("booster deactivate: " + event.getBooster()); } From 2f1954e41c80b21bd6f9328fe8d5c6f70cd7b3d5 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 15 Jun 2016 18:18:09 -0500 Subject: [PATCH 16/49] Rename to booster group --- .../src/mineplex/hub/server/ui/ServerGameMenu.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index a432533bd..38a176d85 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -210,12 +210,12 @@ public class ServerGameMenu extends ShopPageBase add(slot, new ItemBuilder(material, 1, data), title, lore, serverTags, serverGroup, button); } - private void add(int slot, ItemBuilder builder, String title, String[] lore, String[] serverTags, String serverGroup, IButton button) + private void add(int slot, ItemBuilder builder, String title, String[] lore, String[] serverTags, String boosterGroup, IButton button) { // Boosters - if (serverGroup != null) + if (boosterGroup != null) { - Booster booster = getPlugin().getBoosterManager().getActiveBooster(serverGroup); + Booster booster = getPlugin().getBoosterManager().getActiveBooster(boosterGroup); if (booster != null) { // append to start of lore From ea551182b6b52c726c084672c0711a1a03a0ce9d Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 16 Jun 2016 15:29:05 -0500 Subject: [PATCH 17/49] Make booster gui smaller --- .../core/boosters/gui/BoosterPage.java | 77 +++++++++++-------- .../nautilus/game/arcade/ArcadeManager.java | 23 ++++-- 2 files changed, 60 insertions(+), 40 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index 2167892b5..fa1b308ce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -24,7 +24,7 @@ public class BoosterPage extends ShopPageBase { public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Boosters", player, 54); + super(plugin, shop, clientManager, donationManager, "Boosters", player, 45); buildPage(); } @@ -48,6 +48,11 @@ public class BoosterPage extends ShopPageBase lore.add(C.cGray + "Booster would activate " + C.cGreen + "now"); lore.add(" "); lore.add(C.cWhite + "Click to Activate Booster"); + lore.add(" "); + lore.add(C.cGray + C.Italics + "Once a booster is activated"); + lore.add(C.cGray + C.Italics + "or queued, you are not able to"); + lore.add(C.cGray + C.Italics + "cancel it. You will still get"); + lore.add(C.cGray + C.Italics + "tips if you are offline."); } else { @@ -65,11 +70,11 @@ public class BoosterPage extends ShopPageBase ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); if (getPlugin().canActivateBoosters()) { - addButton(4, booster, new ActivateBoosterButton(getShop(), getPlugin())); + addButton(13, booster, new ActivateBoosterButton(getShop(), getPlugin())); } else { - setItem(4, booster); + setItem(13, booster); } addActiveBoosters(); @@ -93,38 +98,46 @@ public class BoosterPage extends ShopPageBase } int startIndex = Math.max(0, (9 - boosters.size()) / 2); - for (int i = 0; i < 9 && i < boosters.size(); i++) + if (boosters.size() > 0) { - int queueIndex = boosters.get(i).getLeft(); - int deliveryAmount = 1; - Booster booster = boosters.get(i).getRight(); - boolean active = booster.isActive(); - - int index = 18 + startIndex + i; - long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); - String activationTime = UtilTime.convertString(timeActivatedDif, 0, UtilTime.TimeUnit.FIT); - - List lore = new ArrayList(); - lore.add(" "); - if (active) + for (int i = 0; i < 9 && i < boosters.size(); i++) { - lore.add(C.cWhite + "Active"); - lore.add(C.cWhite + "Expires in " + C.cGreen + UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS)); - } - else - { - deliveryAmount = Math.max(1, queueIndex); - long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); - lore.add(C.cWhite + "Starts in " + C.cGreen + UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); - lore.add(C.cWhite + "Position " + C.cGreen + deliveryAmount + C.cWhite + " in queue"); - } + int queueIndex = boosters.get(i).getLeft(); + int deliveryAmount = 1; + Booster booster = boosters.get(i).getRight(); + boolean active = booster.isActive(); - lore.add(" "); - lore.add(C.cGray + "Added " + activationTime + " ago"); + int index = 27 + startIndex + i; + long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); + String activationTime = UtilTime.convertString(timeActivatedDif, 0, UtilTime.TimeUnit.FIT); - ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, - "Game Booster", lore.toArray(new String[0]), deliveryAmount, !active, false); - setItem(index, shopItem); + List lore = new ArrayList(); + lore.add(" "); + if (active) + { + lore.add(C.cWhite + "Active"); + lore.add(C.cWhite + "Expires in " + C.cGreen + UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS)); + } else + { + deliveryAmount = Math.max(1, queueIndex); + long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); + lore.add(C.cWhite + "Starts in " + C.cGreen + UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + lore.add(C.cWhite + "Position " + C.cGreen + deliveryAmount + C.cWhite + " in queue"); + } + + lore.add(" "); + lore.add(C.cGray + "Added " + activationTime + " ago"); + + ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, + "Game Booster", lore.toArray(new String[0]), deliveryAmount, !active, false); + setItem(index, shopItem); + } + } + else + { + String[] lore = new String[] { " ", C.cGray + "Your active Boosters will show here", C.cGray + "Use the sugar above to activate boosters" }; + ShopItem shopItem = new ShopItem(Material.BEDROCK, "No Active Boosters", lore, 1, false, false); + setItem(27 + 4, shopItem); } } @@ -179,7 +192,7 @@ public class BoosterPage extends ShopPageBase ShopItem shopItem = new ShopItem(Material.GOLD_BLOCK, "Game Booster", lore.toArray(new String[0]), 1, false, false); - setItem(startIndex + i, shopItem); + setItem(startIndex + i + 27, shopItem); } 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 c47d59f8b..f6f97a3a0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -115,6 +115,7 @@ import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.OfflinePlayer; +import org.bukkit.block.Chest; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; @@ -123,17 +124,11 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.block.*; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.*; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; @@ -619,6 +614,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation return true; } + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.CHEST) + { + Chest chest = ((Chest) event.getClickedBlock().getState()); + event.getPlayer().openInventory(chest.getBlockInventory()); + Bukkit.broadcastMessage("cancelled and fired!"); + event.setCancelled(true); + } + } + @Override public boolean isSafe(Player player) { From 0873ee011630c4f58e646afce1809533c43dec17 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 16 Jun 2016 16:54:54 -0500 Subject: [PATCH 18/49] Show entire booster queue in booster gui --- .../mineplex/core/common/util/UtilTime.java | 2 +- .../core/boosters/gui/BoosterPage.java | 116 ++++++++---------- 2 files changed, 55 insertions(+), 63 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java index db7d0ccc0..72c1aa5db 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTime.java @@ -180,7 +180,7 @@ public class UtilTime { if (type == TimeUnit.DAYS) text = (num = UtilMath.trim(trim, time / 86400000d)) + " Day"; else if (type == TimeUnit.HOURS) text = (num = UtilMath.trim(trim, time / 3600000d)) + " Hour"; - else if (type == TimeUnit.MINUTES) text = (num = UtilMath.trim(trim, time / 60000d)) + " Minute"; + else if (type == TimeUnit.MINUTES) text = (int) (num = (int) UtilMath.trim(trim, time / 60000d)) + " Minute"; else if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(trim, time / 1000d)) + " Second"; else text = (int) (num = (int) UtilMath.trim(trim, time)) + " Millisecond"; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index fa1b308ce..13db7cf48 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -36,32 +36,33 @@ public class BoosterPage extends ShopPageBase int count = getPlugin().getAvailableBoosterCount(getPlayer()); lore.add(" "); - lore.add(C.cWhite + "You Own " + C.cGreen + getPlugin().getAvailableBoosterCount(getPlayer())); + lore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getAvailableBoosterCount(getPlayer()) + C.cWhite + " Game Boosters"); if (getPlugin().canActivateBoosters() && count > 0) { List boosters = getPlugin().getBoosters(); - lore.add(" "); long waitTime = getPlugin().getBoostTime(); if (waitTime == 0) { - lore.add(C.cGray + "Booster would activate " + C.cGreen + "now"); - lore.add(" "); - lore.add(C.cWhite + "Click to Activate Booster"); + lore.add(C.cWhite + "Booster would activate " + C.cGreen + "now"); lore.add(" "); lore.add(C.cGray + C.Italics + "Once a booster is activated"); lore.add(C.cGray + C.Italics + "or queued, you are not able to"); lore.add(C.cGray + C.Italics + "cancel it. You will still get"); lore.add(C.cGray + C.Italics + "tips if you are offline."); + lore.add(" "); + lore.add(C.cWhite + "Click to Activate Booster"); } else { - if (boosters.size() > 1) - { - lore.add(C.cGray + "There are " + C.cGreen + (boosters.size() - 1) + C.cGray + " boosters in queue"); - } - - lore.add(C.cGray + "Activation Time: " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + lore.add(" "); + lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Boosters in queue"); + lore.add(C.cWhite + "Booster would activate in " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + lore.add(" "); + lore.add(C.cGray + C.Italics + "Once a booster is activated"); + lore.add(C.cGray + C.Italics + "or queued you are not able to"); + lore.add(C.cGray + C.Italics + "cancel it. You will still get"); + lore.add(C.cGray + C.Italics + "tips if you are offline."); lore.add(" "); lore.add(C.cWhite + "Click to Queue Booster"); } @@ -77,67 +78,60 @@ public class BoosterPage extends ShopPageBase setItem(13, booster); } - addActiveBoosters(); + addBoosterQueue(); addOtherBoosters(); } - private void addActiveBoosters() + private void addBoosterQueue() { if (getPlugin().getBoosters() == null) return; - List current = getPlugin().getBoosters(); - List> boosters = new ArrayList<>(); - for (int i = 0; i < current.size(); i++) - { - Booster b = current.get(i); - if (b.getUuid().equals(getPlayer().getUniqueId())) - { - boosters.add(Pair.create(i, b)); - } - } - + List boosters = getPlugin().getBoosters(); int startIndex = Math.max(0, (9 - boosters.size()) / 2); - if (boosters.size() > 0) + for (int i = 0; i < boosters.size() && i < 18; i++) { - for (int i = 0; i < 9 && i < boosters.size(); i++) + int slot = startIndex + 27 + i; + Booster booster = boosters.get(i); + boolean active = booster.isActive(); + int queueIndex = Math.max(1, i); + boolean owns = getPlayer().getUniqueId().equals(booster.getUuid()); + + long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); + String activationTime = UtilTime.convertString(timeActivatedDif, 0, UtilTime.TimeUnit.FIT); + + List lore = new ArrayList<>(); + if (active) { - int queueIndex = boosters.get(i).getLeft(); - int deliveryAmount = 1; - Booster booster = boosters.get(i).getRight(); - boolean active = booster.isActive(); - - int index = 27 + startIndex + i; - long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime(); - String activationTime = UtilTime.convertString(timeActivatedDif, 0, UtilTime.TimeUnit.FIT); - - List lore = new ArrayList(); + lore.add(C.cWhite + "Active"); lore.add(" "); - if (active) - { - lore.add(C.cWhite + "Active"); - lore.add(C.cWhite + "Expires in " + C.cGreen + UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS)); - } else - { - deliveryAmount = Math.max(1, queueIndex); - long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); - lore.add(C.cWhite + "Starts in " + C.cGreen + UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); - lore.add(C.cWhite + "Position " + C.cGreen + deliveryAmount + C.cWhite + " in queue"); - } - - lore.add(" "); - lore.add(C.cGray + "Added " + activationTime + " ago"); - - ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, - "Game Booster", lore.toArray(new String[0]), deliveryAmount, !active, false); - setItem(index, shopItem); + String expireTime = UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS); + lore.add(C.cWhite + "Added by " + C.cGreen + booster.getPlayerName()); + lore.add(C.cWhite + "Expires in " + C.cGreen + expireTime); + } + else + { + long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis(); + String activeString = UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS); + + lore.add(" "); + lore.add(C.cWhite + "Added by " + C.cGreen + booster.getPlayerName()); + lore.add(C.cWhite + "Starts in " + C.cGreen + activeString); +// lore.add(C.cWhite + "Position " + C.cGreen + queueIndex + C.cWhite + " in queue"); + } + + lore.add(" "); + lore.add(C.cGray + "Added " + activationTime + " ago"); + + ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, + "Game Booster", lore.toArray(new String[0]), queueIndex, !active, false); + setItem(slot, shopItem); + + // Add glow if the booster belongs to you + if (owns) + { + addGlow(slot); } - } - else - { - String[] lore = new String[] { " ", C.cGray + "Your active Boosters will show here", C.cGray + "Use the sugar above to activate boosters" }; - ShopItem shopItem = new ShopItem(Material.BEDROCK, "No Active Boosters", lore, 1, false, false); - setItem(27 + 4, shopItem); } } @@ -194,7 +188,5 @@ public class BoosterPage extends ShopPageBase "Game Booster", lore.toArray(new String[0]), 1, false, false); setItem(startIndex + i + 27, shopItem); } - - } } From 4e3062f41360dde3392a1b16b5c08f6adcb02f33 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 17 Jun 2016 15:23:53 -0500 Subject: [PATCH 19/49] Swap Cosmetic and Booster interface slot --- .../src/mineplex/core/boosters/BoosterManager.java | 2 +- .../Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index 10b57d1b5..146ef9e7b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -56,7 +56,7 @@ public class BoosterManager extends MiniPlugin // Item in arcade lobbies that opens the booster gui public static final ItemStack INTERFACE_ITEM = ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, ChatColor.RESET + C.cGreen + "Booster Menu"); // Slot for the booster gui item - public static final int INTERFACE_SLOT = 6; + public static final int INTERFACE_SLOT = 7; private BoosterRepository _repository; private CoreClientManager _clientManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index ef2e1411a..3e5f6a886 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -168,7 +168,7 @@ public class Arcade extends JavaPlugin GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager); BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null, boosterManager); - cosmeticManager.setInterfaceSlot(7); + cosmeticManager.setInterfaceSlot(6); cosmeticManager.disableTeamArmor(); CustomDataManager customDataManager = new CustomDataManager(this, _clientManager); From 5f9a57b7e2bed6a017fc68c07c8c50837a45f8f0 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 17 Jun 2016 16:10:01 -0500 Subject: [PATCH 20/49] Lower booster tip cooldown to 1 minute --- .../src/mineplex/core/boosters/tips/BoosterTipManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java index c8012b7fb..98a61f0f7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java @@ -33,7 +33,7 @@ public class BoosterTipManager extends MiniDbClientPlugin public void addTip(Player player, Booster booster, Callback callback) { - if (!Recharge.Instance.use(player, "Booster Tip", 1000 * 60 * 10, true, false)) + if (!Recharge.Instance.use(player, "Booster Tip", 1000 * 60, true, false)) { callback.run(TipAddResult.ON_COOLDOWN); return; From 690c6160b9259801610ea073383f2d4951b3e3be Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 18 Jun 2016 14:27:53 -0500 Subject: [PATCH 21/49] Green Armor --- .../nautilus/game/arcade/booster/BoosterPodium.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index 96b17381d..3417d38aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -10,11 +10,13 @@ import mineplex.core.common.util.*; import mineplex.core.disguise.DisguiseManager; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.npc.Npc; import mineplex.core.npc.NpcManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.database.tables.records.NpcsRecord; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -102,10 +104,10 @@ public class BoosterPodium extends MiniPlugin armorStand.setHelmet(UtilSkull.getPlayerHead(activeBooster.getPlayerName(), activeBooster.getPlayerName(), null)); - armorStand.setChestplate(new ItemStack(Material.GOLD_CHESTPLATE)); - armorStand.setLeggings(new ItemStack(Material.GOLD_LEGGINGS)); - armorStand.setBoots(new ItemStack(Material.GOLD_BOOTS)); - armorStand.setItemInHand(new ItemStack(Material.EMERALD)); + armorStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.GREEN).build()); + armorStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.GREEN).build()); + armorStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.GREEN).build()); +// armorStand.setItemInHand(); if (_hologram == null) { From 2f0a55944191a6717ad6b9a353ef87463b3c038f Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 18 Jun 2016 14:41:32 -0500 Subject: [PATCH 22/49] Add reload command, change podium to lime dye, change tip message --- .../core/boosters/command/BoosterCommand.java | 1 + .../core/boosters/command/ReloadCommand.java | 35 +++++++++++++++++++ .../game/arcade/booster/BoosterPodium.java | 6 ++-- .../arcade/booster/GameBoosterManager.java | 20 ++++------- 4 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java index bc33d884f..a7f2cd3e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java @@ -19,6 +19,7 @@ public class BoosterCommand extends MultiCommandBase AddCommand(new AddCommand(plugin)); AddCommand(new GuiCommand(plugin)); + AddCommand(new ReloadCommand(plugin)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java new file mode 100644 index 000000000..dfedbd809 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java @@ -0,0 +1,35 @@ +package mineplex.core.boosters.command; + +import mineplex.core.boosters.Booster; +import mineplex.core.boosters.BoosterManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.Map; + +/** + * @author Shaun Bennett + */ +public class ReloadCommand extends CommandBase +{ + public ReloadCommand(BoosterManager plugin) + { + super(plugin, Rank.DEVELOPER, "reload"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.getBoostersAsync(data -> { + if (data != null) + { + UtilPlayer.message(caller, F.main("Booster", "Boosters reloaded!")); + } + }); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index 3417d38aa..1564e3563 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -104,9 +104,9 @@ public class BoosterPodium extends MiniPlugin armorStand.setHelmet(UtilSkull.getPlayerHead(activeBooster.getPlayerName(), activeBooster.getPlayerName(), null)); - armorStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.GREEN).build()); - armorStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.GREEN).build()); - armorStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.GREEN).build()); + armorStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.LIME).build()); + armorStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.LIME).build()); + armorStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.LIME).build()); // armorStand.setItemInHand(); if (_hologram == null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index 1a52cf716..95cdba8df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -16,6 +16,7 @@ import mineplex.core.hologram.HologramManager; import mineplex.core.npc.NpcManager; 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.plugin.java.JavaPlugin; @@ -61,10 +62,10 @@ public class GameBoosterManager extends MiniPlugin _boosterManager.getTipManager().addTip(player, active, result -> { if (result == TipAddResult.SUCCESS) { - UtilPlayer.message(player, F.main("Tip", "Thanks for your tip! You earned " - + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER))); - } - else + UtilPlayer.message(player, F.main("Tip", "You tipped " + F.name(active.getPlayerName()) + " " + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got " + + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!"); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + } else { if (result.getFriendlyMessage() != null) { @@ -80,17 +81,10 @@ public class GameBoosterManager extends MiniPlugin Booster booster = event.getBooster(); if (event.getBoosterGroup().equals(_boosterGroup)) { - Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster for " + booster.getMultiplier() + "x Gems!" )); - } - else + Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster for " + booster.getMultiplier() + "x Gems!")); + } else { Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster on " + F.elem(event.getBoosterGroup()))); } } - - @EventHandler - public void onDeactivate(BoosterExpireEvent event) - { - System.out.println("booster deactivate: " + event.getBooster()); - } } From a8e67eda881ac42cfa3fb9a8f342c36a4b14b0a8 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 18 Jun 2016 14:45:39 -0500 Subject: [PATCH 23/49] Rename tip message PC-566 --- .../src/nautilus/game/arcade/managers/GameGemManager.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index b225577dd..473dfee36 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -314,8 +314,7 @@ public class GameGemManager implements Listener if (game.GemBoosterEnabled && booster != null) { int addedGems = (int) (earnedGems * booster.getMultiplier()) - earnedGems; - UtilPlayer.message(player, F.elem(C.cGreen + "+" + addedGems + " Gems") + " for gem booster from " - + F.name(booster.getPlayerName())); + UtilPlayer.message(player, F.elem(C.cGreen + "+" + addedGems + " Gems") + " for " + F.name(booster.getPlayerName()) + "'s Game Amplifier"); totalGems *= booster.getMultiplier(); } From 38058bc67098053492ccdccad2c366d15117455a Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 19 Jun 2016 05:49:32 -0500 Subject: [PATCH 24/49] Confirmation Paging --- .../core/boosters/BoosterProcessor.java | 52 +++++ .../core/boosters/gui/BoosterPage.java | 17 +- .../core/boosters/gui/BoosterShop.java | 2 +- .../confirmation/ConfirmationCallback.java | 11 + .../shop/confirmation/ConfirmationPage.java | 210 ++++++++++++++++++ .../confirmation/ConfirmationProcessor.java | 9 + 6 files changed, 299 insertions(+), 2 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationCallback.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationProcessor.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java new file mode 100644 index 000000000..9670f6df0 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java @@ -0,0 +1,52 @@ +package mineplex.core.boosters; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilTime; +import mineplex.core.shop.confirmation.ConfirmationCallback; +import mineplex.core.shop.confirmation.ConfirmationProcessor; +import org.bukkit.entity.Player; + +/** + * @author Shaun Bennett + */ +public class BoosterProcessor implements ConfirmationProcessor +{ + private BoosterManager _boosterManager; + private Player _player; + + public BoosterProcessor(BoosterManager boosterManager, Player player) + { + _boosterManager = boosterManager; + _player = player; + } + + @Override + public void process(ConfirmationCallback callback) + { + _boosterManager.chargeBooster(_player, data -> { + if (data) + { + _boosterManager.activateBooster(_player, response -> { + if (response.isSuccess()) + { + long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); + if (timeToStart <= 0) _player.sendMessage(F.main("Booster", "Booster Activated!")); + else _player.sendMessage(F.main("Booster", "Booster Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)))); + callback.resolve("Success!"); + } + else + { + _player.sendMessage(C.cRed + "There was an error trying to enable your booster :("); + callback.reject("Failed to Process"); + } + }); + } + else + { + callback.reject("Failed charging account."); + _player.sendMessage(F.main("Booster", "There was an error charging your account. Try again later!")); + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index 13db7cf48..c81dcc808 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -3,15 +3,18 @@ package mineplex.core.boosters.gui; import mineplex.core.account.CoreClientManager; import mineplex.core.boosters.Booster; import mineplex.core.boosters.BoosterManager; +import mineplex.core.boosters.BoosterProcessor; import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; +import mineplex.core.shop.confirmation.ConfirmationPage; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; import org.apache.commons.lang3.tuple.Triple; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; import java.util.ArrayList; import java.util.List; @@ -71,7 +74,7 @@ public class BoosterPage extends ShopPageBase ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); if (getPlugin().canActivateBoosters()) { - addButton(13, booster, new ActivateBoosterButton(getShop(), getPlugin())); + addButton(13, booster, this::openConfirmation); } else { @@ -82,6 +85,18 @@ public class BoosterPage extends ShopPageBase addOtherBoosters(); } + private void openConfirmation(Player player, ClickType type) + { + ArrayList lore = new ArrayList<>(); + lore.add(C.cWhite + "Activate booster"); + ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); + + BoosterProcessor processor = new BoosterProcessor(getPlugin(), getPlayer()); + ConfirmationPage page = new ConfirmationPage<>(getPlugin(), getShop(), + getClientManager(), getDonationManager(), getPlayer(), this, processor, booster); + getShop().openPageForPlayer(getPlayer(), page); + } + private void addBoosterQueue() { if (getPlugin().getBoosters() == null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java index 92a515587..6628dd8a3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java @@ -32,6 +32,6 @@ public class BoosterShop extends ShopBase if (event.getType() != UpdateType.SEC) return; - getPlayerPageMap().values().forEach(ShopPageBase::refresh); + getPlayerPageMap().values().stream().filter(value -> value instanceof BoosterPage).forEach(ShopPageBase::refresh); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationCallback.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationCallback.java new file mode 100644 index 000000000..7dd6903f9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationCallback.java @@ -0,0 +1,11 @@ +package mineplex.core.shop.confirmation; + +/** + * @author Shaun Bennett + */ +public interface ConfirmationCallback +{ + public void resolve(String message); + + public void reject(String message); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationPage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationPage.java new file mode 100644 index 000000000..5bcdcfb82 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationPage.java @@ -0,0 +1,210 @@ +package mineplex.core.shop.confirmation; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +/** + * @author Shaun Bennett + */ +public class ConfirmationPage> extends ShopPageBase implements Runnable, ConfirmationCallback +{ + private int _taskId; + + private ShopPageBase _returnPage; + private ItemStack _displayItem; + + private ItemStack _progressItem = new ShopItem(Material.LAPIS_BLOCK, (byte)11, ChatColor.BLUE + "Processing", null, 1, false, true); + private int _okSquareSlotStart = 27; + private int _progressCount; + private ConfirmationProcessor _processor; + private boolean _processing; + + public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, Player player, ShopPageBase returnPage, ConfirmationProcessor processor, ItemStack displayItem) + { + super(plugin, shop, clientManager, donationManager, "Confirmation", player); + + _returnPage = returnPage; + _displayItem = displayItem; + _processor = processor; + + buildPage(); + } + + @Override + protected void buildPage() + { + setItem(22, _displayItem); + + buildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte) 0, ChatColor.GREEN + "OK", null, 1, false, true), this::okClicked); + buildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte) 0, ChatColor.RED + "CANCEL", null, 1, false, true), this::cancelClicked); + } + + protected void okClicked(Player player, ClickType clickType) + { + processTransaction(); + } + + protected void cancelClicked(Player player, ClickType clickType) + { + getPlugin().getScheduler().cancelTask(_taskId); + + if (_returnPage != null) + getShop().openPageForPlayer(player, _returnPage); + else + { + player.closeInventory(); + } + + } + + private void buildSquareAt(int slot, ShopItem item, IButton button) + { + addButton(slot, item, button); + addButton(slot + 1, item, button); + addButton(slot + 2, item, button); + + slot += 9; + + addButton(slot, item, button); + addButton(slot + 1, item, button); + addButton(slot + 2, item, button); + + slot += 9; + + addButton(slot, item, button); + addButton(slot + 1, item, button); + addButton(slot + 2, item, button); + } + + private void processTransaction() + { + for (int i=_okSquareSlotStart; i < 54; i++) + { + getButtonMap().remove(i); + clear(i); + } + + _processing = true; + + _processor.process(this); + + _taskId = getPlugin().getScheduler().scheduleSyncRepeatingTask(getPlugin().getPlugin(), this, 2L, 2L); + } + + private void buildErrorPage(String... message) + { + ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, ChatColor.RED + "" + ChatColor.UNDERLINE + "ERROR", message, 1, false, true); + for (int i = 0; i < this.getSize(); i++) + { + addButton(i, item, this::cancelClicked); + } + + getPlayer().playSound(getPlayer().getLocation(), Sound.BLAZE_DEATH, 1, .1f); + } + + private void buildSuccessPage(String message) + { + ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, ChatColor.GREEN + message, null, 1, false, true); + for (int i = 0; i < this.getSize(); i++) + { + addButton(i, item, this::cancelClicked); + } + + getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, .9f); + } + + @Override + public void playerClosed() + { + super.playerClosed(); + + Bukkit.getScheduler().cancelTask(_taskId); + + if (_returnPage != null && getShop() != null) + getShop().setCurrentPageForPlayer(getPlayer(), _returnPage); + } + + @Override + public void run() + { + if (_processing) + { + if (_progressCount == 9) + { + for (int i=45; i < 54; i++) + { + clear(i); + } + + _progressCount = 0; + } + + setItem(45 + _progressCount, _progressItem); + } + else + { + if (_progressCount >= 20) + { + try + { + Bukkit.getScheduler().cancelTask(_taskId); + + if (_returnPage != null && getShop() != null) + { + getShop().openPageForPlayer(getPlayer(), _returnPage); + } + else if (getPlayer() != null) + { + getPlayer().closeInventory(); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + finally + { + dispose(); + } + } + } + + _progressCount++; + } + + @Override + public void dispose() + { + super.dispose(); + + Bukkit.getScheduler().cancelTask(_taskId); + } + + @Override + public void resolve(String message) + { + _processing = false; + buildSuccessPage(message); + _progressCount = 0; + } + + @Override + public void reject(String message) + { + _processing = false; + buildErrorPage(message); + _progressCount = 0; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationProcessor.java new file mode 100644 index 000000000..318eead76 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/confirmation/ConfirmationProcessor.java @@ -0,0 +1,9 @@ +package mineplex.core.shop.confirmation; + +/** + * @author Shaun Bennett + */ +public interface ConfirmationProcessor +{ + public void process(ConfirmationCallback callback); +} From 63b7648608d85b858795c4fe17f98642083b4c7e Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 19 Jun 2016 19:05:04 -0500 Subject: [PATCH 25/49] Amplifier rename, move podium backwards --- .../core/boosters/BoosterManager.java | 2 +- .../core/boosters/gui/BoosterPage.java | 28 +++++++++---------- .../core/boosters/gui/BoosterShop.java | 2 +- .../game/arcade/booster/BoosterPodium.java | 8 +++--- .../arcade/booster/GameBoosterManager.java | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index 146ef9e7b..9f2aaa56e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -54,7 +54,7 @@ public class BoosterManager extends MiniPlugin // The InventoryManager item name for boosters. This is required to activate a booster on servers public static final String BOOSTER_ITEM = "Game Booster"; // Item in arcade lobbies that opens the booster gui - public static final ItemStack INTERFACE_ITEM = ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, ChatColor.RESET + C.cGreen + "Booster Menu"); + public static final ItemStack INTERFACE_ITEM = ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, ChatColor.RESET + C.cGreen + "Game Amplifiers"); // Slot for the booster gui item public static final int INTERFACE_SLOT = 7; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index c81dcc808..269d38f54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -27,7 +27,7 @@ public class BoosterPage extends ShopPageBase { public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Boosters", player, 45); + super(plugin, shop, clientManager, donationManager, "Game Amplifiers", player, 45); buildPage(); } @@ -39,7 +39,7 @@ public class BoosterPage extends ShopPageBase int count = getPlugin().getAvailableBoosterCount(getPlayer()); lore.add(" "); - lore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getAvailableBoosterCount(getPlayer()) + C.cWhite + " Game Boosters"); + lore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getAvailableBoosterCount(getPlayer()) + C.cWhite + " Game Amplifiers"); if (getPlugin().canActivateBoosters() && count > 0) { List boosters = getPlugin().getBoosters(); @@ -47,31 +47,31 @@ public class BoosterPage extends ShopPageBase long waitTime = getPlugin().getBoostTime(); if (waitTime == 0) { - lore.add(C.cWhite + "Booster would activate " + C.cGreen + "now"); + lore.add(C.cWhite + "Amplifier would activate " + C.cGreen + "now"); lore.add(" "); - lore.add(C.cGray + C.Italics + "Once a booster is activated"); + lore.add(C.cGray + C.Italics + "Once an Amplifier is activated"); lore.add(C.cGray + C.Italics + "or queued, you are not able to"); lore.add(C.cGray + C.Italics + "cancel it. You will still get"); lore.add(C.cGray + C.Italics + "tips if you are offline."); lore.add(" "); - lore.add(C.cWhite + "Click to Activate Booster"); + lore.add(C.cWhite + "Click to Activate Amplifier"); } else { lore.add(" "); - lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Boosters in queue"); - lore.add(C.cWhite + "Booster would activate in " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Amplifiers queued"); + lore.add(C.cWhite + "Amplifier would activate in " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); lore.add(" "); - lore.add(C.cGray + C.Italics + "Once a booster is activated"); + lore.add(C.cGray + C.Italics + "Once an Amplifier is activated"); lore.add(C.cGray + C.Italics + "or queued you are not able to"); lore.add(C.cGray + C.Italics + "cancel it. You will still get"); lore.add(C.cGray + C.Italics + "tips if you are offline."); lore.add(" "); - lore.add(C.cWhite + "Click to Queue Booster"); + lore.add(C.cWhite + "Click to Queue Amplifier"); } } - ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); + ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false); if (getPlugin().canActivateBoosters()) { addButton(13, booster, this::openConfirmation); @@ -88,8 +88,8 @@ public class BoosterPage extends ShopPageBase private void openConfirmation(Player player, ClickType type) { ArrayList lore = new ArrayList<>(); - lore.add(C.cWhite + "Activate booster"); - ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); + lore.add(C.cWhite + "Activate Amplifier"); + ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false); BoosterProcessor processor = new BoosterProcessor(getPlugin(), getPlayer()); ConfirmationPage page = new ConfirmationPage<>(getPlugin(), getShop(), @@ -139,7 +139,7 @@ public class BoosterPage extends ShopPageBase lore.add(C.cGray + "Added " + activationTime + " ago"); ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, - "Game Booster", lore.toArray(new String[0]), queueIndex, !active, false); + "Game Amplifier", lore.toArray(new String[0]), queueIndex, !active, false); setItem(slot, shopItem); // Add glow if the booster belongs to you @@ -200,7 +200,7 @@ public class BoosterPage extends ShopPageBase lore.add(C.cGray + "Added " + activationTime + " ago"); ShopItem shopItem = new ShopItem(Material.GOLD_BLOCK, - "Game Booster", lore.toArray(new String[0]), 1, false, false); + "Game Amplifier", lore.toArray(new String[0]), 1, false, false); setItem(startIndex + i + 27, shopItem); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java index 6628dd8a3..c23b1b491 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterShop.java @@ -17,7 +17,7 @@ public class BoosterShop extends ShopBase { public BoosterShop(BoosterManager plugin, CoreClientManager clientManager, DonationManager donationManager) { - super(plugin, clientManager, donationManager, "Booster Keeper"); + super(plugin, clientManager, donationManager, "Game Amplifiers"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index 1564e3563..50fa4576e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -62,7 +62,7 @@ public class BoosterPodium extends MiniPlugin NpcsRecord npcsRecord = new NpcsRecord(); npcsRecord.setServer(_npcManager.getServerName()); - npcsRecord.setName(C.cGreen + "Booster Keeper"); + npcsRecord.setName(C.cGreen + "Game Amplifiers"); npcsRecord.setWorld(_npcLocation.getWorld().getName()); npcsRecord.setX(_npcLocation.getX()); npcsRecord.setY(_npcLocation.getY()); @@ -172,15 +172,15 @@ public class BoosterPodium extends MiniPlugin private String getNameString(Booster booster) { - return C.cGreen + "Boosted by " + C.cWhite + booster.getPlayerName() + C.cGreen + " - " + C.cWhite + booster.getTimeRemainingString(); + return C.cGreen + "Amplified by " + C.cWhite + booster.getPlayerName() + C.cGreen + " - " + C.cWhite + booster.getTimeRemainingString(); } private String[] getHologramText(Booster booster) { return new String[] { - C.cGreen + "Boosted by " + C.cWhite + booster.getPlayerName(), + C.cGreen + "Amplified by " + C.cWhite + booster.getPlayerName(), C.cWhite + booster.getTimeRemainingString() + " Remaining", - C.cAqua + "Click to Tip. You get " + BoosterTipManager.TIP_FOR_TIPPER + " Treasure Shards" + C.cAqua + "Click to Thank. You get " + BoosterTipManager.TIP_FOR_TIPPER + " Treasure Shards" }; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index 95cdba8df..6545f77cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -40,7 +40,7 @@ public class GameBoosterManager extends MiniPlugin if (boosterGroup != null && boosterGroup.length() > 0) { - _boosterPodium = new BoosterPodium(plugin, this, disguiseManager, hologramManager, npcManager, new Location(UtilWorld.getWorld("world"), 0, 101.5, -12)); + _boosterPodium = new BoosterPodium(plugin, this, disguiseManager, hologramManager, npcManager, new Location(UtilWorld.getWorld("world"), 0, 101.5, -15)); } } From bb8d94f38a4accdd018de90a385c5982cb0ccfdb Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 19 Jun 2016 19:48:17 -0500 Subject: [PATCH 26/49] Fix a lot more Booster cases --- .../bonuses/gui/buttons/ClaimTipsButton.java | 10 +-- .../core/boosters/BoosterProcessor.java | 10 +-- .../core/boosters/command/AddCommand.java | 6 +- .../core/boosters/command/BoosterCommand.java | 6 +- .../core/boosters/command/ReloadCommand.java | 2 +- .../boosters/gui/ActivateBoosterButton.java | 9 +- .../core/boosters/tips/BoosterTipManager.java | 2 +- .../core/cosmetic/ui/CosmeticShop.java | 13 --- .../core/cosmetic/ui/page/BoosterPage.java | 45 ---------- .../mineplex/core/cosmetic/ui/page/Menu.java | 5 -- .../gadget/gadgets/item/ItemGemBooster.java | 30 ------- .../core/gamebooster/GameBoosterManager.java | 87 ------------------- .../mineplex/core/inventory/GemBooster.java | 38 -------- .../src/mineplex/enjinTranslator/Enjin.java | 3 +- .../game/arcade/booster/BoosterPodium.java | 5 +- 15 files changed, 28 insertions(+), 243 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BoosterPage.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemGemBooster.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gamebooster/GameBoosterManager.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java index 94f560fa1..c61a8e774 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java @@ -84,10 +84,10 @@ public class ClaimTipsButton implements GuiItem, Listener if (getPlayer().getOpenInventory() != null) { - new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Booster Tips Collected"), "Tips Collected", 6*9, 20*3, getGui()).openInventory(); + new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Amplifier Tips Collected"), "Tips Collected", 6*9, 20*3, getGui()).openInventory(); } - UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(CurrencyType.TREASURE_SHARD, claimed) + " from Booster Tips!")); + UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(CurrencyType.TREASURE_SHARD, claimed) + " from Amplifier Tips!")); // Pending explosions are strange.. Not sure why we are using strings. Either way, lets display a rank reward effect _bonusManager.addPendingExplosion(getPlayer(), "RANK"); getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); @@ -133,7 +133,7 @@ public class ClaimTipsButton implements GuiItem, Listener if (isAvailable()) { material = Material.EMERALD; - itemName = C.cGreen + C.Bold + "Booster Tips"; + itemName = C.cGreen + C.Bold + "Amplifier Tips"; lore.add(" "); lore.add(C.cYellow + "Your Tips"); lore.add(" " + C.cWhite + getTips() + " Treasure Shards"); @@ -143,10 +143,10 @@ public class ClaimTipsButton implements GuiItem, Listener else { material = Material.REDSTONE_BLOCK; - itemName = C.cRed + C.Bold + "Booster Tips"; + itemName = C.cRed + C.Bold + "Amplifier Tips"; lore.add(" "); - lore.add(C.Reset + "Activate Game Boosters to receive tips"); + lore.add(C.Reset + "Activate Game Amplifiers to receive tips"); } _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java index 9670f6df0..d43acd78b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java @@ -31,21 +31,21 @@ public class BoosterProcessor implements ConfirmationProcessor if (response.isSuccess()) { long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); - if (timeToStart <= 0) _player.sendMessage(F.main("Booster", "Booster Activated!")); - else _player.sendMessage(F.main("Booster", "Booster Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)))); + if (timeToStart <= 0) _player.sendMessage(F.main("Amplifier", "Game Amplifier Activated!")); + else _player.sendMessage(F.main("Amplifier", "Game Amplifier Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)))); callback.resolve("Success!"); } else { - _player.sendMessage(C.cRed + "There was an error trying to enable your booster :("); - callback.reject("Failed to Process"); + _player.sendMessage(C.cRed + "There was an error trying to enable your Game Amplifier :("); + callback.reject("Failed. Try again later."); } }); } else { callback.reject("Failed charging account."); - _player.sendMessage(F.main("Booster", "There was an error charging your account. Try again later!")); + _player.sendMessage(F.main("Amplifier", "There was an error charging your account. Try again later!")); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/AddCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/AddCommand.java index a938b2d20..b86e382e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/AddCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/AddCommand.java @@ -32,11 +32,11 @@ public class AddCommand extends CommandBase { if (response.isSuccess()) { - UtilPlayer.message(caller, F.main("Booster", "Successfully added booster to " + F.elem(serverGroup))); + UtilPlayer.message(caller, F.main("Amplifier", "Successfully added amplifier to " + F.elem(serverGroup))); } else { - UtilPlayer.message(caller, F.main("Booster", "Failed to add booster. Error: " + F.elem(response.getError()))); + UtilPlayer.message(caller, F.main("Amplifier", "Failed to add amplifier. Error: " + F.elem(response.getError()))); } } }); @@ -49,6 +49,6 @@ public class AddCommand extends CommandBase private void help(Player caller) { - UtilPlayer.message(caller, F.help("booster add ", "Add a booster to that server group", Rank.DEVELOPER)); + UtilPlayer.message(caller, F.help("amplifier add ", "Add an amplifier to that server group", Rank.DEVELOPER)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java index a7f2cd3e1..216130e12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/BoosterCommand.java @@ -15,7 +15,7 @@ public class BoosterCommand extends MultiCommandBase { public BoosterCommand(BoosterManager plugin) { - super(plugin, Rank.DEVELOPER, "booster"); + super(plugin, Rank.DEVELOPER, "amplifier", "booster"); AddCommand(new AddCommand(plugin)); AddCommand(new GuiCommand(plugin)); @@ -25,7 +25,7 @@ public class BoosterCommand extends MultiCommandBase @Override protected void Help(Player caller, String[] args) { - UtilPlayer.message(caller, F.help("booster add ", "Add a booster to that booster group", Rank.DEVELOPER)); - UtilPlayer.message(caller, F.help("booster gui", "Open Booster GUI", Rank.DEVELOPER)); + UtilPlayer.message(caller, F.help("amplifier add ", "Add an amplifier to that group", Rank.DEVELOPER)); + UtilPlayer.message(caller, F.help("amplifier gui", "Open Amplifier GUI", Rank.DEVELOPER)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java index dfedbd809..3b8c543fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/command/ReloadCommand.java @@ -28,7 +28,7 @@ public class ReloadCommand extends CommandBase Plugin.getBoostersAsync(data -> { if (data != null) { - UtilPlayer.message(caller, F.main("Booster", "Boosters reloaded!")); + UtilPlayer.message(caller, F.main("Amplifier", "Amplifiers reloaded!")); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java index a872b6ca0..a17995b87 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/ActivateBoosterButton.java @@ -13,6 +13,7 @@ import org.bukkit.event.inventory.ClickType; /** * @author Shaun Bennett */ +@Deprecated public class ActivateBoosterButton implements IButton { private BoosterShop _boosterShop; @@ -36,18 +37,18 @@ public class ActivateBoosterButton implements IButton if (response.isSuccess()) { long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); - if (timeToStart <= 0) player.sendMessage(F.main("Booster", "Booster Activated!")); - else player.sendMessage(F.main("Booster", "Booster Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)))); + if (timeToStart <= 0) player.sendMessage(F.main("Amplifier", "Amplifier Activated!")); + else player.sendMessage(F.main("Amplifier", "Game Amplifier Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)))); } else { - player.sendMessage(C.cRed + "There was an error trying to enable your booster :("); + player.sendMessage(C.cRed + "There was an error trying to enable your Amplifier :("); } }); } else { - player.sendMessage(F.main("Booster", "There was an error charging your account. Try again later!")); + player.sendMessage(F.main("Amplifier", "There was an error charging your account. Try again later!")); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java index 98a61f0f7..b27b1fda7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java @@ -33,7 +33,7 @@ public class BoosterTipManager extends MiniDbClientPlugin public void addTip(Player player, Booster booster, Callback callback) { - if (!Recharge.Instance.use(player, "Booster Tip", 1000 * 60, true, false)) + if (!Recharge.Instance.use(player, "Amplifier Tip", 1000 * 60, true, false)) { callback.run(TipAddResult.ON_COOLDOWN); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java index 64844f622..271dbe895 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java @@ -52,17 +52,4 @@ public class CosmeticShop extends ShopBase implements PluginMes { new GadgetPage(getPlugin(), this, getClientManager(), getDonationManager(), "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget()); } - - @EventHandler - public void updatePages(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (ShopPageBase> shop : getPlayerPageMap().values()) - { - if (shop instanceof BoosterPage) - ((BoosterPage) shop).updatePage(); - } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BoosterPage.java deleted file mode 100644 index fe2538d59..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BoosterPage.java +++ /dev/null @@ -1,45 +0,0 @@ -package mineplex.core.cosmetic.ui.page; - -import mineplex.core.account.CoreClientManager; -import mineplex.core.cosmetic.CosmeticManager; -import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.donation.DonationManager; -import mineplex.core.shop.item.ShopItem; -import mineplex.core.shop.page.ShopPageBase; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -import java.util.ArrayList; - -/** - * @author Shaun Bennett - */ -public class BoosterPage extends ShopPageBase -{ - public BoosterPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) - { - super(plugin, shop, clientManager, donationManager, "Game Boosters", player, 9); - - buildPage(); - } - - @Override - protected void buildPage() - { - ArrayList lore = new ArrayList<>(); - - lore.add(" "); - lore.add("You Own: " + _plugin.getBoosterManager().getAvailableBoosterCount(getPlayer())); - - ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false); - setItem(4, booster); - } - - public void updatePage() - { - refresh(); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 9f2069629..8774d1ccb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -259,9 +259,4 @@ public class Menu extends ShopPageBase { getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player)); } - - public void openBoosters(Player player) - { - getShop().openPageForPlayer(player, new BoosterPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemGemBooster.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemGemBooster.java deleted file mode 100644 index 35da6a038..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemGemBooster.java +++ /dev/null @@ -1,30 +0,0 @@ -package mineplex.core.gadget.gadgets.item; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.cosmetic.event.ActivateGemBoosterEvent; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.Ammo; -import mineplex.core.gadget.types.ItemGadget; -import org.bukkit.Material; -import org.bukkit.entity.Player; - -public class ItemGemBooster extends ItemGadget -{ - - public static final String NAME = "Gem Booster"; - private static final String[] LORE = UtilText.splitLineToArray(C.cGray + "Get triple gems in any game on this server!", LineFormat.LORE); - - public ItemGemBooster(GadgetManager manager) - { - super(manager, NAME, LORE, 1, Material.EMERALD, (byte) -1, 0, - new Ammo(NAME, NAME, Material.EMERALD, (byte) 0, LORE, -1, 0)); - } - - @Override - public void ActivateCustom(Player player) - { - player.getServer().getPluginManager().callEvent(new ActivateGemBoosterEvent(player)); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gamebooster/GameBoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gamebooster/GameBoosterManager.java deleted file mode 100644 index 3f4a4775d..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gamebooster/GameBoosterManager.java +++ /dev/null @@ -1,87 +0,0 @@ -package mineplex.core.gamebooster; - -import mineplex.core.MiniPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.cosmetic.ui.page.BoosterPage; -import mineplex.core.donation.DonationManager; -import mineplex.core.inventory.InventoryManager; -import mineplex.serverdata.Region; -import mineplex.serverdata.data.DataRepository; -import mineplex.serverdata.redis.RedisDataRepository; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import java.util.Set; -import java.util.UUID; - -/** - * Handles activation of GameBoosters - * - * @author Shaun Bennett - */ -public class GameBoosterManager extends MiniPlugin -{ - // The item name used for InventoryManager - private static final String BOOSTER_INVENTORY_ITEM = "Global.GameBooster"; - - private final CoreClientManager _clientManager; - private final DonationManager _donationManager; - private final InventoryManager _inventoryManager; - - private final DataRepository _boosterRepository; - private BoostGame _activeBoostGame; - - public GameBoosterManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) - { - super("Game Boosters", plugin); - - _clientManager = clientManager; - _donationManager = donationManager; - _inventoryManager = inventoryManager; - - _boosterRepository = new RedisDataRepository(Region.currentRegion(), BoosterData.class, "gemBooster"); - } - - - /** - * Get the number of boosters available for a player for a specific BoostGame. Currently the BoostGame has no - * affect on the output (there aren't separate types of boosters), but we may need to introduce different booster - * items for different games in the future. - * - * @param player The player that owns the boosters - * @param game The game to check for boosters - * @return The amount of unactivated boosters that player owns - */ - public int getAvailableBoosters(Player player, BoostGame game) - { - return _inventoryManager.Get(player).getItemCount(BOOSTER_INVENTORY_ITEM); - } - - /** - * Attempt to activate a booster from a player for a specific game. This will do all the required checks to make sure - * the player has boosters available and removes that booster from the player's account. This will return true if - * the booster was successfully added, or false if it wasn't - * - * @param player The player that owns the booster item - * @param game The game to be boosted - * @return True if the booster has been enabled and removed from the player account, false otherwise - */ - public boolean activateBooster(Player player, BoostGame game) - { - // TODO - return false; - } - - /** - * Return the BoosterData for a specific BoostGame - * @param game The BoostGame we want data for - * @return The BoosterData instance for that game - */ - public BoosterData getBoosterData(BoostGame game) - { - BoosterData data = new BoosterData(game); - data.getBoostQueue().add(new BoosterData.BoostedGame("Phinary", UUID.randomUUID())); - return data; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java deleted file mode 100644 index 2431b67c4..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java +++ /dev/null @@ -1,38 +0,0 @@ -package mineplex.core.inventory; - -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import mineplex.core.common.CurrencyType; -import mineplex.core.common.util.C; -import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.shop.item.SalesPackageBase; - -public class GemBooster extends SalesPackageBase -{ - public GemBooster(boolean enabled, int gemBoosters) - { - super("20 Gem Booster Pack", Material.EMERALD, (byte)0, new String[] - { - C.cYellow + "1000 Coins", - " ", - (enabled ? C.cGreen + "Left-Click To Use:" : ""), - C.cWhite + "Use these before games start to", - C.cWhite + "boost the amount of Gems earned", - C.cWhite + "for all players in the game!", - " ", - C.cGreen + "Right-Click To Purchase:", - C.cWhite + "20 Gem Boosters for " + C.cYellow + "1000 Coins", - " ", - C.cWhite + "Your Gem Boosters: " + C.cGreen + gemBoosters - }, 1000, 20); - - KnownPackage = false; - OneTimePurchaseOnly = false; - } - - @Override - public void Sold(Player player, CurrencyType currencyType) - { - } -} diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index c19ccea17..3c569acb1 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -23,7 +23,6 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UUIDFetcher; import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.gadgets.item.ItemGemBooster; import mineplex.core.inventory.InventoryManager; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; @@ -290,7 +289,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), "Gem Boosters", amount, response); } - }, client.getAccountId(), ItemGemBooster.NAME, amount); + }, client.getAccountId(), "Game Booster", amount); return true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index 50fa4576e..a0f73706d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -16,6 +16,7 @@ import mineplex.core.npc.NpcManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.database.tables.records.NpcsRecord; +import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; @@ -213,8 +214,9 @@ public class BoosterPodium extends MiniPlugin } @EventHandler - public void onInteract(PlayerInteractAtEntityEvent event) + public void one(PlayerInteractAtEntityEvent event) { + Bukkit.broadcastMessage("Interact Event. Target=" + event.getRightClicked() + ", Equals=" + event.getRightClicked().equals(_activeArmorStand)); if (event.getRightClicked().equals(_activeArmorStand)) { _gameBoosterManager.attemptTip(event.getPlayer()); @@ -225,6 +227,7 @@ public class BoosterPodium extends MiniPlugin @EventHandler public void onDamage(EntityDamageByEntityEvent event) { + Bukkit.broadcastMessage("Damage Event. Target=" + event.getEntity() + ", Equals=" + event.getEntity().equals(_activeArmorStand)); if (event.getDamager() instanceof Player && event.getEntity().equals(_activeArmorStand)) { _gameBoosterManager.attemptTip(((Player) event.getDamager())); From afc636b7c52dd75e86a087b75705d96d31aecbf1 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 19 Jun 2016 20:16:33 -0500 Subject: [PATCH 27/49] Fix amplifier reward message --- .../Mineplex.Core/src/mineplex/core/boosters/Booster.java | 5 +++++ .../src/nautilus/game/arcade/managers/GameGemManager.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java index 62a713513..5dfb90d42 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java @@ -123,6 +123,11 @@ public class Booster return result; } + public int getIncreasePercent() + { + return (int) (getMultiplier() - 1) * 100; + } + @Override public String toString() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 473dfee36..0c00e4fae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -314,7 +314,7 @@ public class GameGemManager implements Listener if (game.GemBoosterEnabled && booster != null) { int addedGems = (int) (earnedGems * booster.getMultiplier()) - earnedGems; - UtilPlayer.message(player, F.elem(C.cGreen + "+" + addedGems + " Gems") + " for " + F.name(booster.getPlayerName()) + "'s Game Amplifier"); + UtilPlayer.message(player, F.elem(C.cGreen + "+" + addedGems + " Gems") + " for " + F.elem(booster.getPlayerName() + "'s Game Amplifier" + C.cGreen + " +" + booster.getIncreasePercent() + "%")); totalGems *= booster.getMultiplier(); } From 73183af9bf77147430fc648fa7aad309241563a4 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 20 Jun 2016 00:45:57 -0500 Subject: [PATCH 28/49] Fixing podium npc bug --- .../src/nautilus/game/arcade/booster/BoosterPodium.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index a0f73706d..a474ca24f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -91,13 +91,16 @@ public class BoosterPodium extends MiniPlugin if (_activeArmorStand != null) { + if (_activeArmorStand.isValid()) + _activeArmorStand.teleport(new Location(_activeArmorStand.getLocation().getWorld(), 0, 0, 0)); + _activeArmorStand.remove(); } ArmorStand armorStand = _podiumLocation.getWorld().spawn(_npcLocation, ArmorStand.class); armorStand.setVisible(true); - armorStand.setCustomNameVisible(false); - armorStand.setCustomName(""); + armorStand.setCustomNameVisible(true); + armorStand.setCustomName("" + activeBooster.getId()); armorStand.setGravity(true); armorStand.setArms(true); armorStand.setBasePlate(true); From e855a866c7f3bd4de4ac8f2062f77cf1215ea442 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 08:58:27 -0700 Subject: [PATCH 29/49] Fix more thanks and booster occurrences --- .../bonuses/gui/buttons/ClaimTipsButton.java | 18 +++++++++--------- .../core/boosters/tips/BoosterTipManager.java | 4 ++-- .../core/boosters/tips/TipAddResult.java | 4 ++-- .../arcade/booster/GameBoosterManager.java | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java index c61a8e774..2b6c6fd4f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java @@ -84,10 +84,10 @@ public class ClaimTipsButton implements GuiItem, Listener if (getPlayer().getOpenInventory() != null) { - new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Amplifier Tips Collected"), "Tips Collected", 6*9, 20*3, getGui()).openInventory(); + new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Amplifier Thanks Collected"), "Thanks Collected", 6*9, 20*3, getGui()).openInventory(); } - UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(CurrencyType.TREASURE_SHARD, claimed) + " from Amplifier Tips!")); + UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(CurrencyType.TREASURE_SHARD, claimed) + " from Amplifiers!")); // Pending explosions are strange.. Not sure why we are using strings. Either way, lets display a rank reward effect _bonusManager.addPendingExplosion(getPlayer(), "RANK"); getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); @@ -97,10 +97,10 @@ public class ClaimTipsButton implements GuiItem, Listener // No tips to claim if (getPlayer().getOpenInventory() != null) { - new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "No Tips to Claim!"), "You have no tips to claim!", 6*9, 20*3, getGui()).openInventory(); + new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "No Thanks to Claim!"), "You have no thanks to claim!", 6*9, 20*3, getGui()).openInventory(); } - UtilPlayer.message(getPlayer(), F.main("Carl", "You have no tips to claim!")); + UtilPlayer.message(getPlayer(), F.main("Carl", "You have no thanks to claim!")); getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10); } else @@ -108,10 +108,10 @@ public class ClaimTipsButton implements GuiItem, Listener // Failed to claim if (getPlayer().getOpenInventory() != null) { - new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "Error collecting tips. Try again later."), "Error", 6*9, 20*3, getGui()).openInventory(); + new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "Error collecting rewards. Try again later."), "Error", 6*9, 20*3, getGui()).openInventory(); } - UtilPlayer.message(getPlayer(), F.main("Carl", "Error collecting tips. Try again later.")); + UtilPlayer.message(getPlayer(), F.main("Carl", "Error collecting rewards. Try again later.")); getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10); } @@ -133,9 +133,9 @@ public class ClaimTipsButton implements GuiItem, Listener if (isAvailable()) { material = Material.EMERALD; - itemName = C.cGreen + C.Bold + "Amplifier Tips"; + itemName = C.cGreen + C.Bold + "Amplifier Thanks"; lore.add(" "); - lore.add(C.cYellow + "Your Tips"); + lore.add(C.cYellow + "Your Thanks"); lore.add(" " + C.cWhite + getTips() + " Treasure Shards"); lore.add(" "); lore.add(ChatColor.RESET + "Click to Claim!"); @@ -143,7 +143,7 @@ public class ClaimTipsButton implements GuiItem, Listener else { material = Material.REDSTONE_BLOCK; - itemName = C.cRed + C.Bold + "Amplifier Tips"; + itemName = C.cRed + C.Bold + "Amplifier Thanks"; lore.add(" "); lore.add(C.Reset + "Activate Game Amplifiers to receive tips"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java index b27b1fda7..79e4fa8fb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java @@ -25,7 +25,7 @@ public class BoosterTipManager extends MiniDbClientPlugin public BoosterTipManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) { - super("Booster Tips", plugin, clientManager); + super("Amplifier Thanks", plugin, clientManager); _donationManager = donationManager; _repository = new BoosterTipRepository(plugin); @@ -33,7 +33,7 @@ public class BoosterTipManager extends MiniDbClientPlugin public void addTip(Player player, Booster booster, Callback callback) { - if (!Recharge.Instance.use(player, "Amplifier Tip", 1000 * 60, true, false)) + if (!Recharge.Instance.use(player, "Amplifier Thanks", 1000 * 60 * 10, true, false)) { callback.run(TipAddResult.ON_COOLDOWN); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java index c48f81c0f..82f491de2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java @@ -5,9 +5,9 @@ package mineplex.core.boosters.tips; */ public enum TipAddResult { - ALREADY_TIPPED_BOOSTER("You have already tipped!"), + ALREADY_TIPPED_BOOSTER("You have already thanked this booster!"), INVALID_ACCOUNT_ID("Uh oh, something went wrong. Try relogging"), - CANNOT_TIP_SELF("You can't tip yourself, silly!"), + CANNOT_TIP_SELF("You can't thank yourself, silly!"), ON_COOLDOWN(null), SUCCESS(null); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index 6545f77cd..fe6814431 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -55,21 +55,21 @@ public class GameBoosterManager extends MiniPlugin if (active == null) { - UtilPlayer.message(player, F.main("Tip", "There is no active booster to tip!")); + UtilPlayer.message(player, F.main("Thanks", "There is no active booster to Thank!")); return; } _boosterManager.getTipManager().addTip(player, active, result -> { if (result == TipAddResult.SUCCESS) { - UtilPlayer.message(player, F.main("Tip", "You tipped " + F.name(active.getPlayerName()) + " " + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got " + UtilPlayer.message(player, F.main("Tip", "You thanked " + F.name(active.getPlayerName()) + ". They earned " + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got " + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!"); player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); } else { if (result.getFriendlyMessage() != null) { - UtilPlayer.message(player, F.main("Tip", result.getFriendlyMessage())); + UtilPlayer.message(player, F.main("Thanks", result.getFriendlyMessage())); } } }); @@ -81,10 +81,10 @@ public class GameBoosterManager extends MiniPlugin Booster booster = event.getBooster(); if (event.getBoosterGroup().equals(_boosterGroup)) { - Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster for " + booster.getMultiplier() + "x Gems!")); + Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier for " + booster.getMultiplier() + "x Gems!")); } else { - Bukkit.broadcastMessage(F.main("Booster", F.name(booster.getPlayerName()) + " has activated a booster on " + F.elem(event.getBoosterGroup()))); + Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier on " + F.elem(event.getBoosterGroup()))); } } } From 906e0e004473ec45e802ae8f28415f11c7fbc3f6 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 20:31:18 -0700 Subject: [PATCH 30/49] Allow API error messages from HTTP 503 --- .../mineplex/core/common/api/ApiResponse.java | 16 +++++++++++++++- .../src/mineplex/core/common/api/ApiWebCall.java | 7 ++++++- .../mineplex/core/common/api/HttpStatusCode.java | 12 ++++++++++++ .../mineplex/core/boosters/BoosterManager.java | 5 +++++ .../mineplex/core/boosters/BoosterProcessor.java | 9 ++++++++- 5 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/HttpStatusCode.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiResponse.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiResponse.java index be08bf88f..5b20f11ad 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiResponse.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiResponse.java @@ -5,8 +5,10 @@ import java.util.Date; /** * @author Shaun Bennett */ -public class ApiResponse +public class ApiResponse implements HttpStatusCode { + // These do not have _ prefix because of gson. Please do not add underscores! + private int statusCode; private boolean success; private String error; @@ -33,4 +35,16 @@ public class ApiResponse ", error='" + error + '\'' + '}'; } + + @Override + public int getStatusCode() + { + return statusCode; + } + + @Override + public void setStatusCode(int statusCode) + { + this.statusCode = statusCode; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java index 053b349be..e59cb7f76 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/ApiWebCall.java @@ -92,6 +92,11 @@ public class ApiWebCall private T parseResponse(CloseableHttpResponse response, Type type) throws IOException { HttpEntity entity = response.getEntity(); - return _gson.fromJson(new InputStreamReader(entity.getContent()), type); + T parsed = _gson.fromJson(new InputStreamReader(entity.getContent()), type); + if (parsed instanceof HttpStatusCode && response.getStatusLine() != null) + { + ((HttpStatusCode) parsed).setStatusCode(response.getStatusLine().getStatusCode()); + } + return parsed; } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/HttpStatusCode.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/HttpStatusCode.java new file mode 100644 index 000000000..8daeb648f --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/api/HttpStatusCode.java @@ -0,0 +1,12 @@ +package mineplex.core.common.api; + +/** + * Interface used to also grab status code from ApiWebCall + * @author Shaun Bennett + */ +public interface HttpStatusCode +{ + public int getStatusCode(); + + public void setStatusCode(int statusCode); +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index 9f2aaa56e..cf7ba078b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -310,6 +310,11 @@ public class BoosterManager extends MiniPlugin _inventoryManager.addItemToInventory(callback, player, BOOSTER_ITEM, -1); } + public void refundBooster(Player player, Callback callback) + { + _inventoryManager.addItemToInventory(callback, player, BOOSTER_ITEM, 1); + } + public void openShop(Player player) { _shop.attemptShopOpen(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java index d43acd78b..0cc567715 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterProcessor.java @@ -37,7 +37,14 @@ public class BoosterProcessor implements ConfirmationProcessor } else { - _player.sendMessage(C.cRed + "There was an error trying to enable your Game Amplifier :("); + _player.sendMessage(C.cRed + "There was an error trying to enable your Game Amplifier"); + if (response.getStatusCode() == 503 && response.getError() != null && response.getError().length() > 0) + { + // Service Unavailable HTTP Code + _player.sendMessage(C.cRed + "Error: " + response.getError()); + } + + _boosterManager.refundBooster(_player, null); callback.reject("Failed. Try again later."); } }); From 621d72f5416d3ce6fba4e1b872b4ed023d0b3ada Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 20:51:58 -0700 Subject: [PATCH 31/49] Fix merge issues, update lore text --- .../bonuses/gui/buttons/ClaimTipsButton.java | 9 ++++--- .../core/boosters/gui/BoosterPage.java | 26 +++++++++++++------ .../Mineplex.Hub/src/mineplex/hub/Hub.java | 2 -- .../src/nautilus/game/arcade/Arcade.java | 8 ------ 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java index 2b6c6fd4f..2a37d243b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java @@ -133,9 +133,9 @@ public class ClaimTipsButton implements GuiItem, Listener if (isAvailable()) { material = Material.EMERALD; - itemName = C.cGreen + C.Bold + "Amplifier Thanks"; + itemName = C.cGreen + C.Bold + "Game Amplifiers"; lore.add(" "); - lore.add(C.cYellow + "Your Thanks"); + lore.add(C.cYellow + "Your Rewards"); lore.add(" " + C.cWhite + getTips() + " Treasure Shards"); lore.add(" "); lore.add(ChatColor.RESET + "Click to Claim!"); @@ -143,10 +143,11 @@ public class ClaimTipsButton implements GuiItem, Listener else { material = Material.REDSTONE_BLOCK; - itemName = C.cRed + C.Bold + "Amplifier Thanks"; + itemName = C.cRed + C.Bold + "Game Amplifiers"; lore.add(" "); - lore.add(C.Reset + "Activate Game Amplifiers to receive tips"); + lore.add(C.Reset + "Activate Amplifiers to earn rewards"); + lore.add(C.Reset + "Amplifiers can be purchased at mineplex.com/shop"); } _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index 269d38f54..055acfe00 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -49,10 +49,10 @@ public class BoosterPage extends ShopPageBase { lore.add(C.cWhite + "Amplifier would activate " + C.cGreen + "now"); lore.add(" "); - lore.add(C.cGray + C.Italics + "Once an Amplifier is activated"); - lore.add(C.cGray + C.Italics + "or queued, you are not able to"); - lore.add(C.cGray + C.Italics + "cancel it. You will still get"); - lore.add(C.cGray + C.Italics + "tips if you are offline."); + lore.add(C.cGray + "Once an Amplifier is activated"); + lore.add(C.cGray + "or queued, you are not able to"); + lore.add(C.cGray + "cancel it. You will still get"); + lore.add(C.cGray + "tips if you are offline."); lore.add(" "); lore.add(C.cWhite + "Click to Activate Amplifier"); } @@ -62,14 +62,24 @@ public class BoosterPage extends ShopPageBase lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Amplifiers queued"); lore.add(C.cWhite + "Amplifier would activate in " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); lore.add(" "); - lore.add(C.cGray + C.Italics + "Once an Amplifier is activated"); - lore.add(C.cGray + C.Italics + "or queued you are not able to"); - lore.add(C.cGray + C.Italics + "cancel it. You will still get"); - lore.add(C.cGray + C.Italics + "tips if you are offline."); + lore.add(C.cGray + "Once an Amplifier is activated"); + lore.add(C.cGray + "or queued you are not able to"); + lore.add(C.cGray + "cancel it. You will still get"); + lore.add(C.cGray + "tips if you are offline."); lore.add(" "); lore.add(C.cWhite + "Click to Queue Amplifier"); } } + else + { + lore.add(" "); + lore.add(C.cGray + "Game Amplifiers allow you to increase"); + lore.add(C.cGray + "gems and shards earned in that game for 1 hour."); + lore.add(C.cGray + "You can also earn bonus rewards from players"); + lore.add(C.cGray + "thanking you while your booster is active."); + lore.add(" "); + lore.add(C.cWhite + "You can purchase Amplifiers at " + C.cGreen + "mineplex.com/shop"); + } ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false); if (getPlugin().canActivateBoosters()) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 0c9fbea80..91c03bcdb 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -160,9 +160,7 @@ public class Hub extends JavaPlugin implements IRelation String boosterGroup = serverConfiguration.getServerGroup().getBoosterGroup(); BoosterManager boosterManager = new BoosterManager(this, boosterGroup, clientManager, donationManager, inventoryManager); HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, boosterManager); - BoosterManager boosterManager = new BoosterManager(this, clientManager, donationManager, inventoryManager); HologramManager hologramManager = new HologramManager(this, packetHandler); - HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, hologramManager, npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, boosterManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); ServerManager serverManager = new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager, boosterManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 3e5f6a886..fd734e420 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -11,11 +11,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.CustomTagFix; import mineplex.core.FoodDupeFix; import mineplex.core.PacketsInteractionFix; -import mineplex.core.chatsnap.publishing.SnapshotPublisher; import mineplex.core.customdata.CustomDataManager; -import mineplex.core.chatsnap.SnapshotManager; -import mineplex.core.chatsnap.SnapshotPlugin; -import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.GlobalPacketManager; import net.minecraft.server.v1_8_R3.BiomeBase; import net.minecraft.server.v1_8_R3.MinecraftServer; @@ -37,7 +33,6 @@ import mineplex.core.elo.EloManager; import mineplex.core.friend.FriendManager; import mineplex.core.gadget.GadgetManager; import mineplex.core.give.Give; -import mineplex.core.globalpacket.GlobalPacketManager; import mineplex.core.hologram.HologramManager; import mineplex.core.ignore.IgnoreManager; import mineplex.core.incognito.IncognitoManager; @@ -58,8 +53,6 @@ import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; import mineplex.core.recharge.Recharge; -import mineplex.core.report.ReportManager; -import mineplex.core.report.ReportPlugin; import mineplex.core.serverConfig.ServerConfiguration; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; @@ -70,7 +63,6 @@ import mineplex.core.velocity.VelocityFix; import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.DamageManager; -import nautilus.game.arcade.broadcast.BroadcastManager; import nautilus.game.arcade.game.GameServerConfig; public class Arcade extends JavaPlugin From 0873efd8761f22cd070df6d10b0f23ede38d28cc Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 20:54:29 -0700 Subject: [PATCH 32/49] Update more lore text --- .../core/boosters/gui/BoosterPage.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index 055acfe00..be53eaad5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -49,10 +49,10 @@ public class BoosterPage extends ShopPageBase { lore.add(C.cWhite + "Amplifier would activate " + C.cGreen + "now"); lore.add(" "); - lore.add(C.cGray + "Once an Amplifier is activated"); - lore.add(C.cGray + "or queued, you are not able to"); - lore.add(C.cGray + "cancel it. You will still get"); - lore.add(C.cGray + "tips if you are offline."); + lore.add(C.cGray + "Once this Amplifier is activated"); + lore.add(C.cGray + "or queued you are not able to"); + lore.add(C.cGray + "cancel or refund it. You will still"); + lore.add(C.cGray + "earn rewards if you are offline."); lore.add(" "); lore.add(C.cWhite + "Click to Activate Amplifier"); } @@ -62,10 +62,10 @@ public class BoosterPage extends ShopPageBase lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Amplifiers queued"); lore.add(C.cWhite + "Amplifier would activate in " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); lore.add(" "); - lore.add(C.cGray + "Once an Amplifier is activated"); + lore.add(C.cGray + "Once this Amplifier is activated"); lore.add(C.cGray + "or queued you are not able to"); - lore.add(C.cGray + "cancel it. You will still get"); - lore.add(C.cGray + "tips if you are offline."); + lore.add(C.cGray + "cancel or refund it. You will still"); + lore.add(C.cGray + "earn rewards if you are offline."); lore.add(" "); lore.add(C.cWhite + "Click to Queue Amplifier"); } @@ -98,7 +98,11 @@ public class BoosterPage extends ShopPageBase private void openConfirmation(Player player, ClickType type) { ArrayList lore = new ArrayList<>(); - lore.add(C.cWhite + "Activate Amplifier"); + lore.add(" "); + lore.add(C.cGray + "Once this Amplifier is activated"); + lore.add(C.cGray + "or queued you are not able to"); + lore.add(C.cGray + "cancel or refund it. You will still"); + lore.add(C.cGray + "earn rewards if you are offline."); ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false); BoosterProcessor processor = new BoosterProcessor(getPlugin(), getPlayer()); From 761e550d6c72f5082d39c4226def79616a3b4d8b Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 20:55:27 -0700 Subject: [PATCH 33/49] Add shards to announcement message --- .../src/nautilus/game/arcade/booster/GameBoosterManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index fe6814431..ef93af838 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -81,10 +81,10 @@ public class GameBoosterManager extends MiniPlugin Booster booster = event.getBooster(); if (event.getBoosterGroup().equals(_boosterGroup)) { - Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier for " + booster.getMultiplier() + "x Gems!")); + Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier for " + booster.getMultiplier() + "x Gems and Shards!")); } else { - Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier on " + F.elem(event.getBoosterGroup()))); + Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier on " + F.elem(event.getBoosterGroup()) + "!")); } } } From bcf82ad5132c454294aaa735b9107d2dd3a78f4f Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 21:00:50 -0700 Subject: [PATCH 34/49] Remove debug messages --- .../src/nautilus/game/arcade/ArcadeManager.java | 12 ------------ .../nautilus/game/arcade/booster/BoosterPodium.java | 1 - 2 files changed, 13 deletions(-) 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 8303ee681..4d7f47534 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -598,18 +598,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation return true; } - @EventHandler - public void onInteract(PlayerInteractEvent event) - { - if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.CHEST) - { - Chest chest = ((Chest) event.getClickedBlock().getState()); - event.getPlayer().openInventory(chest.getBlockInventory()); - Bukkit.broadcastMessage("cancelled and fired!"); - event.setCancelled(true); - } - } - @Override public boolean isSafe(Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index a474ca24f..1e772f856 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -230,7 +230,6 @@ public class BoosterPodium extends MiniPlugin @EventHandler public void onDamage(EntityDamageByEntityEvent event) { - Bukkit.broadcastMessage("Damage Event. Target=" + event.getEntity() + ", Equals=" + event.getEntity().equals(_activeArmorStand)); if (event.getDamager() instanceof Player && event.getEntity().equals(_activeArmorStand)) { _gameBoosterManager.attemptTip(((Player) event.getDamager())); From 1ea680cd2001e2187b522849aa2a8e84bd752af4 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 21:01:37 -0700 Subject: [PATCH 35/49] Return to an invisible armor stand name --- .../src/nautilus/game/arcade/booster/BoosterPodium.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index 1e772f856..d5debb134 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -99,7 +99,7 @@ public class BoosterPodium extends MiniPlugin ArmorStand armorStand = _podiumLocation.getWorld().spawn(_npcLocation, ArmorStand.class); armorStand.setVisible(true); - armorStand.setCustomNameVisible(true); + armorStand.setCustomNameVisible(false); armorStand.setCustomName("" + activeBooster.getId()); armorStand.setGravity(true); armorStand.setArms(true); From 6e2c751be167964864462480dfd776b98926242e Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 21:09:09 -0700 Subject: [PATCH 36/49] Adjust amplifiers queue message --- .../src/mineplex/core/boosters/gui/BoosterPage.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index be53eaad5..dc1f83802 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -59,8 +59,15 @@ public class BoosterPage extends ShopPageBase else { lore.add(" "); - lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Amplifiers queued"); lore.add(C.cWhite + "Amplifier would activate in " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS)); + if (boosters.size() - 1 == 1) + { + lore.add(C.cWhite + "There is " + C.cGreen + 1 + C.cWhite + " Amplifier queued"); + } + else if (boosters.size() - 1 > 0) + { + lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Amplifiers queued"); + } lore.add(" "); lore.add(C.cGray + "Once this Amplifier is activated"); lore.add(C.cGray + "or queued you are not able to"); From a441727e09fbc76825fd78214d064085ef91d12e Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 23 Jun 2016 16:09:31 -0300 Subject: [PATCH 37/49] Freedom update: Freedom chests Freedom Aura Shock and Awe Leap of Freedom Price of Freedom Uncle Sam Morph Freedom Mount Uncle Sam Hat Persistence update: Items will still be enabled after player leaves the server --- .../mineplex/core/common/skin/SkinData.java | 30 ++- .../core/common/util/UtilFirework.java | 6 + .../core/common/util/UtilParticle.java | 18 +- .../mineplex/core/common/util/UtilServer.java | 10 + .../mineplex/core/common/util/UtilText.java | 16 ++ .../core/common/util/banner/CountryFlag.java | 70 ++++++ .../core/common/util/banner/UtilBanner.java | 25 ++ .../util/particles/ColoredParticle.java | 56 +++++ .../common/util/particles/DustSpellColor.java | 39 +++ .../common/util/particles/NormalParticle.java | 14 ++ .../core/common/util/particles/NoteColor.java | 39 +++ .../common/util/particles/ParticleColor.java | 14 ++ .../common/util/particles/ParticleData.java | 57 +++++ .../{ => activate}/ActivateGadgetButton.java | 2 +- .../{ => activate}/ActivateMountButton.java | 4 +- .../{ => activate}/ActivatePetButton.java | 2 +- .../DeactivateGadgetButton.java | 2 +- .../DeactivateMountButton.java | 4 +- .../{ => deactivate}/DeactivatePetButton.java | 2 +- .../ui/button/{ => open}/OpenArrowTrails.java | 2 +- .../cosmetic/ui/button/open/OpenBalloons.java | 22 ++ .../ui/button/{ => open}/OpenCostumes.java | 2 +- .../{ => open}/OpenDeathAnimations.java | 2 +- .../ui/button/{ => open}/OpenDoubleJump.java | 2 +- .../ui/button/{ => open}/OpenGadgets.java | 2 +- .../button/{ => open}/OpenGameModifiers.java | 4 +- .../ui/button/{ => open}/OpenHats.java | 2 +- .../ui/button/{ => open}/OpenMorphs.java | 2 +- .../ui/button/{ => open}/OpenMounts.java | 4 +- .../ui/button/{ => open}/OpenMusic.java | 2 +- .../ui/button/{ => open}/OpenPageButton.java | 2 +- .../ui/button/{ => open}/OpenParticles.java | 2 +- .../ui/button/{ => open}/OpenPets.java | 2 +- .../ui/button/{ => open}/OpenWinEffect.java | 2 +- .../core/cosmetic/ui/page/BalloonsPage.java | 53 ++++ .../core/cosmetic/ui/page/GadgetPage.java | 52 +++- .../mineplex/core/cosmetic/ui/page/Menu.java | 21 +- .../core/cosmetic/ui/page/MountPage.java | 11 +- .../core/cosmetic/ui/page/PetPage.java | 4 +- .../{ => gamemodifiers}/GameModifierPage.java | 9 +- .../GameModifierSubPage.java | 9 +- .../KitGameModifierPage.java | 8 +- .../core/disguise/DisguiseManager.java | 4 +- .../disguise/disguises/DisguisePlayer.java | 8 + .../mineplex/core/gadget/GadgetManager.java | 235 ++++++++---------- .../gadget/commands/LockCosmeticsCommand.java | 2 + .../commands/UnlockCosmeticsCommand.java | 4 + .../arrowtrail/freedom/ArrowTrailFreedom.java | 64 +++++ .../gadgets/balloons/BabyCowBalloon.java | 52 ++++ .../gadgets/death/freedom/DeathFreedom.java | 36 +++ .../doublejump/freedom/DoubleJumpFreedom.java | 30 +++ .../gamemodifiers/kits/KitGameModifier.java | 12 +- .../GameModifierMineStrikeSkin.java | 10 +- .../core/gadget/gadgets/hat/HatCoal.java | 23 -- .../gadget/gadgets/hat/HatCompanionBlock.java | 20 -- .../core/gadget/gadgets/hat/HatGrinch.java | 21 -- .../core/gadget/gadgets/hat/HatItem.java | 26 ++ .../gadget/gadgets/hat/HatLovestruck.java | 20 -- .../core/gadget/gadgets/hat/HatPresent.java | 21 -- .../core/gadget/gadgets/hat/HatRudolph.java | 21 -- .../core/gadget/gadgets/hat/HatSanta.java | 21 -- .../gadget/gadgets/hat/HatSecretPackage.java | 20 -- .../core/gadget/gadgets/hat/HatSnowman.java | 20 -- .../core/gadget/gadgets/hat/HatTeddyBear.java | 19 -- .../core/gadget/gadgets/hat/HatType.java | 75 ++++++ .../core/gadget/gadgets/item/ItemCoal.java | 4 +- .../gadget/gadgets/morph/MorphUncleSam.java | 74 ++++++ .../particle/freedom/ParticleFreedom.java | 49 ++++ .../unrelated/BabyFireworkEffect.java | 94 +++++++ .../gadgets/particle/unrelated/Effect.java | 56 +++++ .../particle/unrelated/EffectLocation.java | 40 +++ .../unrelated/FreedomFireworkEffect.java | 50 ++++ .../unrelated/FreedomTrailEffect.java | 85 +++++++ .../gadgets/wineffect/WinEffectPodium.java | 26 +- .../persistence/UserGadgetPersistence.java | 17 +- .../mineplex/core/gadget/set/SetFreedom.java | 22 ++ .../core/gadget/types/ArrowEffectGadget.java | 1 + .../core/gadget/types/BalloonGadget.java | 64 +++++ .../mineplex/core/gadget/types/Gadget.java | 14 +- .../core/gadget/types/GadgetType.java | 3 +- ...eModifier.java => GameModifierGadget.java} | 4 +- .../mineplex/core/gadget/types/HatGadget.java | 22 +- .../core/gadget/types/MorphGadget.java | 2 +- .../core/gadget/types/OutfitGadget.java | 16 -- .../core/gadget/types/ParticleGadget.java | 16 ++ .../core/gadget/types/WinEffectGadget.java | 47 +++- .../src/mineplex/core/mount/DragonMount.java | 4 +- .../src/mineplex/core/mount/HorseMount.java | 4 +- .../src/mineplex/core/mount/Mount.java | 28 +-- .../src/mineplex/core/mount/MountManager.java | 30 +-- .../core/mount/types/MountBabyReindeer.java | 10 +- .../mineplex/core/mount/types/MountCart.java | 16 +- .../core/mount/types/MountDragon.java | 16 +- .../core/mount/types/MountFreedomHorse.java | 80 ++++++ .../mineplex/core/mount/types/MountFrost.java | 2 +- .../mineplex/core/mount/types/MountSheep.java | 4 +- .../mineplex/core/mount/types/MountSlime.java | 16 +- .../core/mount/types/MountSpider.java | 12 +- .../mineplex/core/mount/types/MountTitan.java | 18 +- .../core/mount/types/MountUndead.java | 4 +- .../mount/types/MountValentinesSheep.java | 8 +- .../mineplex/core/reward/RewardManager.java | 82 +++--- .../src/mineplex/core/reward/RewardPool.java | 1 + .../src/mineplex/core/reward/RewardType.java | 1 + .../src/mineplex/core/treasure/Treasure.java | 42 ++-- .../core/treasure/TreasureLocation.java | 27 +- .../core/treasure/TreasureManager.java | 11 +- .../mineplex/core/treasure/TreasureStyle.java | 8 + .../mineplex/core/treasure/TreasureType.java | 4 +- .../animation/BlockChangeAnimation.java | 22 ++ .../animation/ChestOpenAnimation.java | 3 +- .../animation/ChestSpawnAnimation.java | 44 +++- .../animation/FreedomChestAnimation.java | 37 +++ .../core/treasure/gui/BuyChestButton.java | 7 +- .../core/treasure/gui/TreasurePage.java | 84 ++++++- .../core/treasure/gui/TreasureShop.java | 7 +- .../src/mineplex/hub/HubManager.java | 2 +- .../customerSupport/CustomerSupport.java | 32 +++ .../salespackage/SalesPackageManager.java | 1 + .../salespackages/FreedomChest.java | 21 ++ .../arcade/game/games/event/EventModule.java | 2 +- 121 files changed, 2121 insertions(+), 670 deletions(-) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/CountryFlag.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/UtilBanner.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NormalParticle.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => activate}/ActivateGadgetButton.java (92%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => activate}/ActivateMountButton.java (90%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => activate}/ActivatePetButton.java (93%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => deactivate}/DeactivateGadgetButton.java (92%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => deactivate}/DeactivateMountButton.java (87%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => deactivate}/DeactivatePetButton.java (91%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenArrowTrails.java (92%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenCostumes.java (87%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenDeathAnimations.java (92%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenDoubleJump.java (92%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenGadgets.java (92%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenGameModifiers.java (81%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenHats.java (91%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenMorphs.java (92%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenMounts.java (91%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenMusic.java (87%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenPageButton.java (94%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenParticles.java (92%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenPets.java (93%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/{ => open}/OpenWinEffect.java (92%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/{ => gamemodifiers}/GameModifierPage.java (89%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/{ => gamemodifiers}/GameModifierSubPage.java (92%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/{ => gamemodifiers}/KitGameModifierPage.java (91%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanionBlock.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/EffectLocation.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java rename Plugins/Mineplex.Core/src/mineplex/core/gadget/types/{GadgetGameModifier.java => GameModifierGadget.java} (91%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFreedomHorse.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/FreedomChestAnimation.java create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index 7aa895666..b89b34866 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -19,21 +19,27 @@ import net.minecraft.server.v1_8_R3.NBTTagString; public class SkinData { - private static long _nameCount = -99999999999999L; - - public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ="); - public final static SkinData SNOWMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk4Nzk5NDIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzMTgxYWViODQzODk3NzM1ZDQwMmIyNDk2OTQxNmZkYjBjZTM0YTZiOTM3ODE2MjQzNzU2ZTlkYWU1OGUzIn19fQ==","NZvsNu+HQ5uvGWq6O8VNDGq9A145bmk2IkHiz916uRVPMRqqCI/zwhKWNLlFACE/feuLkhYAois29ec6sVVOtHIoNA+S5q1Mb/Vjc3TJQxzqmx2FZOhJiIttFwYuo9WomQKBqrPMSJ9tpQig4wzoqldeeTjWC3dLz7JeX+gkzinryVjG7NNN9L5hXK5/BBxRcrtwmXJfUlSANyrd8RZW7mEUgU8yxlzdqTu0w7bZLjQNd4vciwoF3NelXDorMIIqiHTkuQesG91Njtu25VCUDK3nXbqEnZw2ZtxB5fT5G2Omm/vkNSRXc0P7iqchVowdYQcMlQUsp65xpkBbFS4LwjzDkYIfLmF++hePb8z72Gz77FxhO5sRLGreSH227McyL/0CtWNKm9ZZIfQtZZjEZTj9+eiJMCloCMg3yWa1VBOiLHzz0wY6gGklccIImPyXEg7E0dIK8qYseJMhmmBNZ8pDOkbUDp3mRlrQ2iyClgQkbuR63j79IBUaCxmsa3NnrAtaJklzd9mzkHXfMBh2XT7Gl8AhJS6JK5kCvip1rBBI8yjrsjE/E+lyJFIbC4rXxyMDGZWkcdrd7U4ZFYKiLHbzdFRqX+11qs9xO2BvomGXkATCzYmOf2kQ86R6rNN0+JfE4QpKzj2WWt3C8ky2qpuXZz29p0816E3/qseYtgg="); - public final static SkinData SANTA = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3OTM3NTgsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyNTM5ZGFkZDUxYmE5ZTg0YzFhOTE1OTY3NWUxZTJiYWM1NmFlNmFlNTMxNTQyZDI1YTlkM2Q1YzQ2ODZmNiJ9fX0=","gvLc0Vo6+1vl17vrFCbK1eNqa4/ix4xiwcWae7WOCvqiVIX4sdIPagOGUrKsDdEhuWCKkTWILGP1K3wYfC9v/0mXZvbu0sRln+APTOsswMkQmbKcA1zTFTMpwEI+nIMzYJSbIx5wjz28K5hDf/umtHH2GADTENdJGGUtU4CyEdeHTzcqIAEV3bcMLkfTKvwKUWqI5gZbbercqmDeGkmXVS9297a9paRX1NfEL9pFT0pjdH3tCjgvvKfAwGC6tYtvTFbfcJocqgI+PI2f5OFf62A4XjWwWFi4wxCHVYNpqs/XTbfF64K7KVE0d9gsLjJoB8DMZPxlNpMFA0R5OIW6Q7Qjyz9IKxUqEYRCQbuUKpHyNDcmVKcTJRwBpCHeqAbTbweZHd5tzrT/terWhLEMsK1+lH2KBfIRIRB9kd3epyShNjSEKoly6uRXVxU+IJtfcq0aFVZlwgG3c1Ds9jbsNJV158e1n6WCmvT00RLdvpcIekwUKODhi3zFeFkrVvV50tGYqXLRZenitLJvDzx4c0IGK4krALrUS0oybinBS7/GmW3Ktz3xbGKZSzzaDw0EKB7Y6XHdb4yqR1xS7lAWgv4cNDEIUSzUDJ7HpmDCIF2A5kPS4XVYFCclyR6qPGD5e+9apVhBMz4lfYlT1IfRAUQlucO4UpAlkXs7ho3pQXU="); + private static long _nameCount = -99999999999999L; + + public final static SkinData FREEDOM_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjY1NzA5NDAzODcsInByb2ZpbGVJZCI6IjQwZWQ5NzU1OWIzNTQ1M2Q4NjU1ZmMwMDM5OGRiNmI5IiwicHJvZmlsZU5hbWUiOiJTcG9vYm5jb29iciIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc4N2Q4OGNlYzNmOWI0M2RiNDg1YTU0Mjc2YTQ1MjQzNGFiZDI2ZDMzY2QzZmZhMTM2N2ZiMzVmOWUzODQifX19", "UgsQyW/HJ/jmDzfI1d7RWFbhKi8PeJAKBuAOk7ajS5dzH5od301KfcmiT2X3TU7cBbUswcKtDb2F/m7gNrg/t+pU7Bi9UKzyALEu9HRjd4s1uKbqGkBip1z5Qycp4fhkSyKvtvTnA2fhpP9oHtE5FxGXdMhZXyFkLrli4Hyxp1BI0N4h7pgbcMaISPS0ZYzDRNxkrSnl3y3KyKn5Rl5qH7utmQtAjoyx9aueMZxG3tg/igfYF7uAvvmuYKsSiTZWZOOuSh+U1dkP+ZE/cQANfryXkLJSJHa9YZPCMJHXe4mMoAyu0/quwZCW9NlW3P30XeCfZ87IxfKxISIP0dLgY8hUJyCuI2u5U7TEDrDggPKr6XTcIbX2kFKOsYSeovsAgjC+1UKFH4Ba0jTbRmqzPK49fk/jU8XqRP2Gl9UZDIVbc0dMEXNOeJ0e0wejDtSyX8flBk9sIKYwqeB9ns4cFqSyTI5tKnNin12BNTFRK/bDp8dN7nloyQvhDGlW88UlnJmOFhR6R0naP89VM04VCLaYCr6jyv/ZwV88uPvL2kjhx14qSFfgqJI5ORhFgYkuc+nhyQaD8+y2t3ZMs0HAfoujmq98lp2ECLWyI0ATUcXjUyNYadLj4valS/m0jl7U2fwzcmVMQqOC3ddu6mHbt871hIkG2X4v6kEcVAtKmkg="); + public final static SkinData COMPANION_CUBE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDk5NjI0NjEsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyMTVkYmRhNTY1ZjVjYjhlYjEyZjU1NWY1ZTNkYTBlYTVmNTUxOTg5MWNjNWM1ZDY3NmZkODJjNjIifX19", "vaAQbhnhnTOs64ToFWLg7o4JmqkIl07HWJ6l7xibfISaOcU4BvYBxsfGvmoxlVdsUeCunAJ8/05qVLl5zZYd8Dt+To6JSY0RlqV8piRaaj3FztYWV2ZvG3YZxPxiD3HRJTAQnDobSuxHyPa1e3khjAFp9xJo4q1oqQ28oI2WDuoT+IHqxwkKVbGzO7UD5lzz5chjQC46E8SxddNKp9aqwbbccrkHYT4gteoonOXu4MFxZniJN12LqUCb6+G15rU8MijlBkWx0xE5NMUloeTGuJZItbHun9fysLk/+HE5xJOKYtpZNMuWX+DB/O5ds9dXrOoSAg+Vn0QU4CZbwcxzLii5ILOfEEBtePuEAgzROri+iCKp59CqlEMBrCsd3Um0MCdbuOfvkXGBHBz+bqX7VJY1ujlSdMefmbJtHAkDANnsaaVb+eli9Dk6139041sptsLytD+EfJzaitX6crBwKZ2WDx2P6LHo8B+iSOzOJxjf/08zlXqFw1vsk62IN6lisuZ89QyZw23RvOx3obLAGYs1GxAlMl9qQdpXcmuE1+lPR3g8gZ0BfnTeYwflC2wbR1tuwGG98lyUGCvGLyqNKAQTN87XV4IFQWR81mi1c5CcasoWhKf9D9nAik9aK7A915fEE5IvpeuUdZseDxDVVN5dBIs5q2PIHFAS0rDsDBc="); + public final static SkinData THE_GRINCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTYxNDMwMDQsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg4ZWRlOTI3ZDQzOWVmMzliMzFhYzFkYzJhODM5NGZlNzlhY2U4NDMyNzBjYmUxMjg2ZGM3NTE3ZjMxYTk2In19fQ==","ELo594vTzPq9ZmPYOtVr4kim/k19gzmoxEIK1ehS87gwgag5HcgM+P1FMnHIyrmSvTVaMh0NxwXmNS+JETFL7OrmgRYNpkxkkO4VBA0pfSn3dA9ujnXpDnDiWEPxKdMgQspIOOI0Z3esNt3pj8qIj6dWPtGwtso48tjHl2o/kazfa82yvGORlFhGkeEJKQMno/Buc12C0foQw39XI8GjvlSkFN2eH4Fp16RLu8/hf7SqJQC3L1KacvzMW1d8BWEIgACCJDni29+YqxflSqSyYrV4Z+D66S0jYvUUL/vM4/q/p/YWX/vs/FtMtHQTj4PCpAmMNTgfkahuhb6rCvKHukbjA+WhUdwyxSqXU5YnpXCu1M2dzZgiXjIi+fnyn4CmXKindWCQtSwu+mCA2ILv/6vEHoYJgdlz+DXyRkFx+DH4Sl74HBCOXTOq5AGjq5h3LYfsre+UjCCUv8VgxbVprOyj35So7K0m+6faCFVSt35T3RgicDQfdiWUrW7kmHQVvJpvaq9Vu+63F/0X93cwqwaR0buMirxRx7qkFrRunSI4T+9fsN02t1fAieeu80lBSv83wr7BFneSsLsdVAND9xttTb6fClg7anr8/XVEVIkylB4B+ZcWQbH61XP1nn7oFP2VBg1h6XuuLp8FGSgYf/LW+54/KZci/MnanqQE6QQ="); + public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0="); public final static SkinData PRESENT = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3MDIxNjIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2U2YzRkZWQwNTdjMjhiMTU0NjVkYzQzNmFmODIyYTNkZTY4NzgyZTZjMzgyOGMzMmFhYWE4ZjRiOTIzOWVjIn19fQ==","rJNlxTqHHmOoWwbXdMQLcj0P9w/PIr/hWKXH0nbhm/S2CFo/zfefffZlnQmpKCgn1Y8tXvcRwLGQ4CLpm9m2ZrKprSWRhrnOtZWYabrhExQESEammS3TY81VoNt+4On0pAGBippz/bRfWLuDne2rDbhuljnqvxjROmxpky7gRCU06VMlm2WLFC5XYJkiAaOXBqzpiHMMRPNnCvtcbtpILKi/Luj302eyN8nRKjHHbbiDmttwvlshxZ8UxJHvALtM506IUHba10Q6QX2zCeDAU5/WYRKa6e19r8plROcgGbKYFSq8JW5cWuWT3/rveZM6FnU6ABn9DWsCyfQ5wr2jdBd+xaevGTAScRHA5J493GqL1bBZYKj9yhQFtxJHCAf0++raAVPCZgyPtwTth4TAQisn8gnhM5R+txnW6xK+oflLy0dwEN1YdPLN/h7yuDnyjSMDe9RZT2NKMjok2C6Kux4WBI0KFXKC5Gqwa3Htku4v3WEOWMaVoWOtchQ9BzpQ/etD0ylmzjALQLB+HtndEEm1Jd3tmob42X4hBE8hCce7C3EtGINB33dlx4CK1xBqyGTJEqi69DJRzVL99u98+7kJ1Db9+MaPOfI4B2RY3XbvnSYwecandY//A3bb19FGSdl299ZXbp4zpm8fivzeB1rUAhhmtaA3Iwu/nEQNMkU="); public final static SkinData RUDOLPH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk1NjgxODIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IzZjdlMjhiNTJkZjJjZjhlZWM2NDk2ZmM0NWFlMGQ2NTM0Njc5OGIxYWRjNzM3ZDcxYzBmOTRlNDIyMSJ9fX0=","uUBOTe63CL+qRvtsb2g4AjB2YzxE3N6AUqIsTv8n0jYyPsuXpuOmZPSMEdgDVONywEJ1L4XRx05sjnGu56A8vuXmGI/uHQWuMZzbOSjiFfT3DkEm8zEl5AWpH9dz/t8nZ1WYUIwy0pN5VrZqIr1DAkF6AMh/Qy+FGDw1GG9ReRr80eJ0JiRskpkCpCZIGGjrgwNKAM8JOuNZ4gCQOTRC3etrcfls3qmUMFcVlhuB4bydxSR01i2w0A4b5KpufsJjLKw4InWn2+m/druo8hl9sYuusTeItW0MQmZqCAqXCc9YBnRPQ0hDXFgnPxOh3RwGWiZvL4MnWUVmLwZWh/Fk9QmyVbd7zVao0lxS8YNsKtP8j5B+hs4l9qNohhf0A07bt4oPeTtd5fQeOU5N87fUGuUAcpC4gP9U5WpVY5FFPBvLvGbXdV5jpuAQz4lLSoo1grsP9baR2IBvdN/0awjQWoPJfGOttegubkBHwz3LNcVqvZLtX/M13IDHZa6zQZEX0wsnMX60LeWgBWfTON1l2cSgaPTerHFS2EifJ2LvTBife3s9/4XR6Zth3FLFqxI3MSlqT2hVFRPLke6rBqfqPoWOj2MCykQ70IAwb3oTHcJDJ86V2DdNaU2bZ8V4TjaP+nRobsLJOImoPYEPq23MP36X8gbXEIjmuu8S5xRlrrc="); - public final static SkinData THE_GRINCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTYxNDMwMDQsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg4ZWRlOTI3ZDQzOWVmMzliMzFhYzFkYzJhODM5NGZlNzlhY2U4NDMyNzBjYmUxMjg2ZGM3NTE3ZjMxYTk2In19fQ==","ELo594vTzPq9ZmPYOtVr4kim/k19gzmoxEIK1ehS87gwgag5HcgM+P1FMnHIyrmSvTVaMh0NxwXmNS+JETFL7OrmgRYNpkxkkO4VBA0pfSn3dA9ujnXpDnDiWEPxKdMgQspIOOI0Z3esNt3pj8qIj6dWPtGwtso48tjHl2o/kazfa82yvGORlFhGkeEJKQMno/Buc12C0foQw39XI8GjvlSkFN2eH4Fp16RLu8/hf7SqJQC3L1KacvzMW1d8BWEIgACCJDni29+YqxflSqSyYrV4Z+D66S0jYvUUL/vM4/q/p/YWX/vs/FtMtHQTj4PCpAmMNTgfkahuhb6rCvKHukbjA+WhUdwyxSqXU5YnpXCu1M2dzZgiXjIi+fnyn4CmXKindWCQtSwu+mCA2ILv/6vEHoYJgdlz+DXyRkFx+DH4Sl74HBCOXTOq5AGjq5h3LYfsre+UjCCUv8VgxbVprOyj35So7K0m+6faCFVSt35T3RgicDQfdiWUrW7kmHQVvJpvaq9Vu+63F/0X93cwqwaR0buMirxRx7qkFrRunSI4T+9fsN02t1fAieeu80lBSv83wr7BFneSsLsdVAND9xttTb6fClg7anr8/XVEVIkylB4B+ZcWQbH61XP1nn7oFP2VBg1h6XuuLp8FGSgYf/LW+54/KZci/MnanqQE6QQ="); - public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRfwZfFemkuZYnNbO82qLUm+6zTm0fbC90Swt8nNr/42ajzEoUjnL6VsERIXS5/fPwjftbQAC60ujy8yo66Sp3sSAALNg5zjM+Uizkq2f9Axc+kind22hp10M="); - public final static SkinData COMPANION_CUBE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDk5NjI0NjEsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyMTVkYmRhNTY1ZjVjYjhlYjEyZjU1NWY1ZTNkYTBlYTVmNTUxOTg5MWNjNWM1ZDY3NmZkODJjNjIifX19", "vaAQbhnhnTOs64ToFWLg7o4JmqkIl07HWJ6l7xibfISaOcU4BvYBxsfGvmoxlVdsUeCunAJ8/05qVLl5zZYd8Dt+To6JSY0RlqV8piRaaj3FztYWV2ZvG3YZxPxiD3HRJTAQnDobSuxHyPa1e3khjAFp9xJo4q1oqQ28oI2WDuoT+IHqxwkKVbGzO7UD5lzz5chjQC46E8SxddNKp9aqwbbccrkHYT4gteoonOXu4MFxZniJN12LqUCb6+G15rU8MijlBkWx0xE5NMUloeTGuJZItbHun9fysLk/+HE5xJOKYtpZNMuWX+DB/O5ds9dXrOoSAg+Vn0QU4CZbwcxzLii5ILOfEEBtePuEAgzROri+iCKp59CqlEMBrCsd3Um0MCdbuOfvkXGBHBz+bqX7VJY1ujlSdMefmbJtHAkDANnsaaVb+eli9Dk6139041sptsLytD+EfJzaitX6crBwKZ2WDx2P6LHo8B+iSOzOJxjf/08zlXqFw1vsk62IN6lisuZ89QyZw23RvOx3obLAGYs1GxAlMl9qQdpXcmuE1+lPR3g8gZ0BfnTeYwflC2wbR1tuwGG98lyUGCvGLyqNKAQTN87XV4IFQWR81mi1c5CcasoWhKf9D9nAik9aK7A915fEE5IvpeuUdZseDxDVVN5dBIs5q2PIHFAS0rDsDBc="); - public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0="); + public final static SkinData SANTA = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3OTM3NTgsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyNTM5ZGFkZDUxYmE5ZTg0YzFhOTE1OTY3NWUxZTJiYWM1NmFlNmFlNTMxNTQyZDI1YTlkM2Q1YzQ2ODZmNiJ9fX0=","gvLc0Vo6+1vl17vrFCbK1eNqa4/ix4xiwcWae7WOCvqiVIX4sdIPagOGUrKsDdEhuWCKkTWILGP1K3wYfC9v/0mXZvbu0sRln+APTOsswMkQmbKcA1zTFTMpwEI+nIMzYJSbIx5wjz28K5hDf/umtHH2GADTENdJGGUtU4CyEdeHTzcqIAEV3bcMLkfTKvwKUWqI5gZbbercqmDeGkmXVS9297a9paRX1NfEL9pFT0pjdH3tCjgvvKfAwGC6tYtvTFbfcJocqgI+PI2f5OFf62A4XjWwWFi4wxCHVYNpqs/XTbfF64K7KVE0d9gsLjJoB8DMZPxlNpMFA0R5OIW6Q7Qjyz9IKxUqEYRCQbuUKpHyNDcmVKcTJRwBpCHeqAbTbweZHd5tzrT/terWhLEMsK1+lH2KBfIRIRB9kd3epyShNjSEKoly6uRXVxU+IJtfcq0aFVZlwgG3c1Ds9jbsNJV158e1n6WCmvT00RLdvpcIekwUKODhi3zFeFkrVvV50tGYqXLRZenitLJvDzx4c0IGK4krALrUS0oybinBS7/GmW3Ktz3xbGKZSzzaDw0EKB7Y6XHdb4yqR1xS7lAWgv4cNDEIUSzUDJ7HpmDCIF2A5kPS4XVYFCclyR6qPGD5e+9apVhBMz4lfYlT1IfRAUQlucO4UpAlkXs7ho3pQXU="); public final static SkinData SECRET_PACKAGE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAzNzE3OTIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyNWI5YTRjOWRhOThkZTliZmIwZDNjOWI1M2MzMjJhMjgxN2IyMTMxOTQzY2E1YWM2NTBjZThmMzEzZjdhIn19fQ==", "Wb5T0Zhp1RVt78V/i8dYrwZCNT0xZIRe3LvL0bngH498f8Jrl43KHgTi4f299zE9giVynkTogGhJ8inq/xqFCRctl7Nn9L3LVu78uQwt+fs+o+kw/Qc+lggFSjEIc+fc13AZndpec0Df46Kh/OGD7NXbtbLb6TE/0dU2RwQlvZrZ/QHYJb8OJ6aUcnHvAZim8NUtG/nlZtSClepHVSuKdNnfzoF9rFVFA/x4jTr6mZYPZ33YgQd2oTAPk+qE3iN+0InjZQNs2YLoKFmFrgzn+tGvNApC0siF0HEZGQCFIwJOtnBsasGoxujIrln/ZdOil+5ac4VWInXr8lKgY0Q3Ocy8/0cJl+E/XqB+ztG29zhB8B1zdHBfJr+MgeSIqBCPx4SCtY6r7gnMlQYG+uVx5NP3S5aJW/cEfDyXmpCykIcBPzeErnKC0SiAqXkCVNjWJpX6qRWvWMXqS69w6ht6qHvEY2GxlZUb5AP+JgFlsl3hJDms6EPvM4zNL0Ko4oWIBzwYRQXiemrP9TGgyo0aL1RcQ0JgBFO2hSo37PK0YL3tUPgteJXzm21wu0TiZLkLCWSgMUfYfvVnhTa+xzod0xvfujpN6Y1DUTdcf8WS8TRYw2JigSkWrRW0fXPBCtTtQN5jiwM5/HrTpNLzg03J6SpfZ+rr8Rhq0S/8beQOMas="); - - public final static SkinData CHISS = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI5NjgyNDEsInByb2ZpbGVJZCI6IjFkMmJmZTYxN2ViZDQ0NWRiYTdkODM1NGEwZmZkMWVhIiwicHJvZmlsZU5hbWUiOiJDaGlzcyIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg3MmNkMzRjY2IzMTIxYjRjNmEzOGFjM2JmOGVkM2UwMzk3YmQ2YTg4NDI4YjdhZmM2ZTUyNTI4NTVhMzQzIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "hNTLRA2acZYx2dM90lnJN8FMK/ceD3+AxKNdD5FrXzxGtYL4C1Jr/vbTE0UosmwFP3wScNEW/fuDOjeZRjZHMJdvgDZMlMK/5KDhOY6sj/RS9RckztsgummSyjH/hdDn7TWWfhZLMbiia/K0VReI9eq2yD6zGQpvMlz5hB/5SX5YHWXvCah3TL4UzYSlSVDlwY/Q3sVuIZUr8m/LIXJwniJKLGo6tUgtiJd9eseOsbBpVjzCUtLD8A9WBe2/eODgmLfqEvXESIoDRG8vL2nPSXWma/YolYHIl32/i+ZxVD7dRRaXQFYSiLI24EtzX1pPhMjyaTLazP9abH43J6J31w02pKM7N/xTa62020L/YfRRKGT5lygEDb1NMoSpAjszPxah+Ra2/L+yUWEI8cMES6I4mIJ00tclPjWK01xhIn3tqg+y2gqsGHwPhu/7vmF5NirNfKFw0qciKNBfbCAF7ae+mkUKjmAPuvBUBqQb7BOcpNVWsCo/XvzmiZZYsf5P4Uwz8LqUK4uH6V/5dg7lY2Xg3+IUylsrDqLGFDI8iy/NdjIQMbuRadh4IDO6DcmxBri2Ax4JNBPBTnRezge8uq37MZcft/IXQgFWKB9RtidVEACaTOkRj27k+Ojnkki+j44k0wZB47hiXFUHMCHl3a0SVdQe15ZbVsQj/HAvAS0="); - public final static SkinData DEFEK7 = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI3ODkwNTksInByb2ZpbGVJZCI6Ijg5ZDQ2M2Y3MjNlYzQ3MGE4MjQ0NDU3ZjBjOGQ4NjFjIiwicHJvZmlsZU5hbWUiOiJkZWZlazciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmYWNjOWM4ZjhlY2E1OWU0NTE4MTUxZmE4OGFiMDZjOTFmNjM3OTE2NzJmMTRlNGYzODY3YTI2OTVlN2NmYmYifSwiQ0FQRSI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIyYjljNWVhNzYzYzg2ZmM1Y2FlYTMzZDgyYjBmYTY1YTdjMjI4ZmQzMjFiYTU0NzY2ZWE5NWEzZDBiOTc5MyJ9fX0=", "jBoRvkhQXz+nap8yJJIZ+4HClMItWODumeSOYjXytP3WWKHK0UMq0xC/keXsnmvo89lMRdRbknPt2ZX5Flgyjgr4Rt0KtDvpL/hG4BUsTWryUZZMKxdd6DkZXYRtTogLUfHeDYIz+cZQ0aXGMtvX/ZYTXJfMi6FYbIHY/qEEDnWhDX5y+SPpaJaZByPsvzi+qbfcFGnJ6nqi9ccyZYnYpnI2IVBM/yO/VRXWHxfqvJ0VVvv5KsGmVbko2Jxo0SDCxUL2UTH2+eol53FxhkkC+m2geC14k1zsZQLHDF3BgAG9+kFJ4UEoYRKF2Gy1FxeDCJtjYNdrYR8fdaUKRMcpBgEs+ZGe2U9EVVS/ZcBCjB7S+1Ne2bPzPFzTQPuBoMgggo1xbxBmQ5NyhYo4gwgj/xjSLIhb+5h7ioN1URfSRcfYdVv6RRO9l/u9l09jEom8y/jGRviefpEr+/e9iAl5Dd/6nzQgosBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60="); + public final static SkinData SNOWMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk4Nzk5NDIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzEzMTgxYWViODQzODk3NzM1ZDQwMmIyNDk2OTQxNmZkYjBjZTM0YTZiOTM3ODE2MjQzNzU2ZTlkYWU1OGUzIn19fQ==","NZvsNu+HQ5uvGWq6O8VNDGq9A145bmk2IkHiz916uRVPMRqqCI/zwhKWNLlFACE/feuLkhYAois29ec6sVVOtHIoNA+S5q1Mb/Vjc3TJQxzqmx2FZOhJiIttFwYuo9WomQKBqrPMSJ9tpQig4wzoqldeeTjWC3dLz7JeX+gkzinryVjG7NNN9L5hXK5/BBxRcrtwmXJfUlSANyrd8RZW7mEUgU8yxlzdqTu0w7bZLjQNd4vciwoF3NelXDorMIIqiHTkuQesG91Njtu25VCUDK3nXbqEnZw2ZtxB5fT5G2Omm/vkNSRXc0P7iqchVowdYQcMlQUsp65xpkBbFS4LwjzDkYIfLmF++hePb8z72Gz77FxhO5sRLGreSH227McyL/0CtWNKm9ZZIfQtZZjEZTj9+eiJMCloCMg3yWa1VBOiLHzz0wY6gGklccIImPyXEg7E0dIK8qYseJMhmmBNZ8pDOkbUDp3mRlrQ2iyClgQkbuR63j79IBUaCxmsa3NnrAtaJklzd9mzkHXfMBh2XT7Gl8AhJS6JK5kCvip1rBBI8yjrsjE/E+lyJFIbC4rXxyMDGZWkcdrd7U4ZFYKiLHbzdFRqX+11qs9xO2BvomGXkATCzYmOf2kQ86R6rNN0+JfE4QpKzj2WWt3C8ky2qpuXZz29p0816E3/qseYtgg="); + public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRfwZfFemkuZYnNbO82qLUm+6zTm0fbC90Swt8nNr/42ajzEoUjnL6VsERIXS5/fPwjftbQAC60ujy8yo66Sp3sSAALNg5zjM+Uizkq2f9Axc+kind22hp10M="); + public final static SkinData UNCLE_SAM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjYxODA0NjY4NTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "NmJ+hXmvwQlYFYY7YVQWRr11yBbAfJP+jk11SQ91gUUtJJjb4v8RFbNu5UXNCKxYj3BPtldqshG1maNB0NWJRud7ZyAdHc0JMmR1vtHEge9Hhet4fLyyaZ9rZn4BvD9Guqgv9H/mZzUzrft9TIho0Qbu/U++lVsbZXC2GrJDDMyLnYr9C7f+FUnr0z4WvkNcg23SHBOYkOYT95NSdykIka3c3v+/HvSvuwOnMsfVxqLyCZLpo20vamBJ1uK1dmx2+TVGnUPlofFHRdOXOpJc+YmicJvrsQR6a9zlvnTbU4MYClMOKvjLe6aX5Af+n8Gw3oKcm0PuR8CPLyf9kjcmUF6XMiEXAWWJtCgvhCiFV5/mQQH3cQ1kqk4BDLUxMVhG5tzjKLoQQy39cFM32ee+QFjXlzy59meC8jgvPmOVU3GpJ32XWOtaXMCyeJrhz2QVKRLEr2KZgz8Pd8VrHARXVZsNYEasj8z0cHjgSJqTU9kD90CC+4YpvdyRBRqbNQig5KuGCqUHKgflsEsM7YrFRKP5As1LgqYQfqRAMmLSo47eW0onOwchC9wCqqisPlYSuDRt4Mun/KFGqYh1Sghn8/gzu49La8BpwlekjVEoPEcDaIIgnFzOvgmmgMANkoJ3PzhHoHMoXtObe3eSTi+eYp4qAQVzkTxfF3WXY2fui1M="); + + // Comments this out for now, so it doesn't load the player profile + // A better way to do this would check for the properties when getting the skull or the skin + // Might change on the next version + //public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2Q1OGFiNWRhNDA2YjBhOTJhYjNhODI0MjI1MjY2Nzc3ZTUzNGI3ZGI2YzM3MmRkZmY3ZiJ9fX0=","UoSif81+UyvkcaanU8KAMYBpw9mefAmWehE2liDUFvk+y0X/9NovsxTYVpIDCltTSpLW3sNgamvbj4Ybs+s6DbudPiEkvh0ER7Bv2v29UJw7RzIdr6/1g548X12zcnh5iPGz/P75uNRnSfTFQx0ed8P/GNkPIjWpDuJFxEj6KcPzrCAGMx+BVw1VwryBIYf9cCDHky8z0bxR89rjiIvPTBFI6MRhqI3vgpEBTySHDS+Ki0Hwl5oa3PwS6+jgYx/4RSfFsb+BawcvDk2Xpkt5UimvqZ5BceYLIfCt4KbShYipgLXLfYUZrntjPemd3SxthjxUuA07i44UxRdiC8uqy1twLT/HUS28gpk68lA/id9tKFwu1CUzshgcmvQPt3ghtNViNziR/2t7D/+5D31Vzmhf6n7Pnpdirt/5frMi2BKMMs7pLa0EF8CrrDU7QCwPav+EZVGFvVZbxSkCDq+n3IQ3PUWSCzy6KPxpdOlUjD0pAfLoiNj0P8u4+puQtID76r/St8ExchYl2dodUImu1ZETWeFUClF3ZGat62evx8uRQEI2W4dsVwj40VUfjaAuvyDzuouaKTrCzJXLQZZjR1B8URvuK61fGX0nhW607mEi6DE+nxP2ZoBrROEX4e37Ap6+TQn9Q8tKDPdcxtwSOpPO4Qkncjn/mGtP9lZU/DQ="); + + //public final static SkinData CHISS = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI5NjgyNDEsInByb2ZpbGVJZCI6IjFkMmJmZTYxN2ViZDQ0NWRiYTdkODM1NGEwZmZkMWVhIiwicHJvZmlsZU5hbWUiOiJDaGlzcyIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTg3MmNkMzRjY2IzMTIxYjRjNmEzOGFjM2JmOGVkM2UwMzk3YmQ2YTg4NDI4YjdhZmM2ZTUyNTI4NTVhMzQzIiwibWV0YWRhdGEiOnsibW9kZWwiOiJzbGltIn19fX0=", "hNTLRA2acZYx2dM90lnJN8FMK/ceD3+AxKNdD5FrXzxGtYL4C1Jr/vbTE0UosmwFP3wScNEW/fuDOjeZRjZHMJdvgDZMlMK/5KDhOY6sj/RS9RckztsgummSyjH/hdDn7TWWfhZLMbiia/K0VReI9eq2yD6zGQpvMlz5hB/5SX5YHWXvCah3TL4UzYSlSVDlwY/Q3sVuIZUr8m/LIXJwniJKLGo6tUgtiJd9eseOsbBpVjzCUtLD8A9WBe2/eODgmLfqEvXESIoDRG8vL2nPSXWma/YolYHIl32/i+ZxVD7dRRaXQFYSiLI24EtzX1pPhMjyaTLazP9abH43J6J31w02pKM7N/xTa62020L/YfRRKGT5lygEDb1NMoSpAjszPxah+Ra2/L+yUWEI8cMES6I4mIJ00tclPjWK01xhIn3tqg+y2gqsGHwPhu/7vmF5NirNfKFw0qciKNBfbCAF7ae+mkUKjmAPuvBUBqQb7BOcpNVWsCo/XvzmiZZYsf5P4Uwz8LqUK4uH6V/5dg7lY2Xg3+IUylsrDqLGFDI8iy/NdjIQMbuRadh4IDO6DcmxBri2Ax4JNBPBTnRezge8uq37MZcft/IXQgFWKB9RtidVEACaTOkRj27k+Ojnkki+j44k0wZB47hiXFUHMCHl3a0SVdQe15ZbVsQj/HAvAS0="); + //public final static SkinData DEFEK7 = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTk1NDI3ODkwNTksInByb2ZpbGVJZCI6Ijg5ZDQ2M2Y3MjNlYzQ3MGE4MjQ0NDU3ZjBjOGQ4NjFjIiwicHJvZmlsZU5hbWUiOiJkZWZlazciLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JmYWNjOWM4ZjhlY2E1OWU0NTE4MTUxZmE4OGFiMDZjOTFmNjM3OTE2NzJmMTRlNGYzODY3YTI2OTVlN2NmYmYifSwiQ0FQRSI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIyYjljNWVhNzYzYzg2ZmM1Y2FlYTMzZDgyYjBmYTY1YTdjMjI4ZmQzMjFiYTU0NzY2ZWE5NWEzZDBiOTc5MyJ9fX0=", "jBoRvkhQXz+nap8yJJIZ+4HClMItWODumeSOYjXytP3WWKHK0UMq0xC/keXsnmvo89lMRdRbknPt2ZX5Flgyjgr4Rt0KtDvpL/hG4BUsTWryUZZMKxdd6DkZXYRtTogLUfHeDYIz+cZQ0aXGMtvX/ZYTXJfMi6FYbIHY/qEEDnWhDX5y+SPpaJaZByPsvzi+qbfcFGnJ6nqi9ccyZYnYpnI2IVBM/yO/VRXWHxfqvJ0VVvv5KsGmVbko2Jxo0SDCxUL2UTH2+eol53FxhkkC+m2geC14k1zsZQLHDF3BgAG9+kFJ4UEoYRKF2Gy1FxeDCJtjYNdrYR8fdaUKRMcpBgEs+ZGe2U9EVVS/ZcBCjB7S+1Ne2bPzPFzTQPuBoMgggo1xbxBmQ5NyhYo4gwgj/xjSLIhb+5h7ioN1URfSRcfYdVv6RRO9l/u9l09jEom8y/jGRviefpEr+/e9iAl5Dd/6nzQgosBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60="); private Property _skinProperty; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java index ba7e00bb9..ec8b4ae5e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java @@ -108,4 +108,10 @@ public class UtilFirework UtilMath.random.nextBoolean() ); } + + public static void playFreedomFirework(Location location) + { + playFirework(location, FireworkEffect.builder().withColor(Color.RED).withColor(Color.BLUE) + .withColor(Color.WHITE).withFade(Color.RED).withFade(Color.BLUE).withFade(Color.WHITE).build()); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java index 162d038ff..abe2a726f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java @@ -1,5 +1,6 @@ package mineplex.core.common.util; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -340,6 +341,21 @@ public class UtilParticle { PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers()); } - + + public static void playColoredParticle(Color color, ParticleType particleType, Location location, int count, ViewDist dist, Player... players) + { + if (particleType != ParticleType.RED_DUST + && particleType != ParticleType.MOB_SPELL_AMBIENT) + return; + PlayParticle(particleType, location, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1f, count, dist, players); + } + + public static void playColoredParticleToAll(Color color, ParticleType particleType, Location location, int count, ViewDist dist) + { + if (particleType != ParticleType.RED_DUST + && particleType != ParticleType.MOB_SPELL_AMBIENT) + return; + PlayParticleToAll(particleType, location, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1f, count, dist); + } } \ No newline at end of file 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..524e2ba3d 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 @@ -196,4 +196,14 @@ public class UtilServer { return Lists.newArrayList(getPlayers()); } + + public static boolean isTestServer() + { + return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + } + + public static boolean isHubServer() + { + return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Lobby"); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 794e676bf..9d1c5f183 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -746,4 +746,20 @@ public class UtilText } return array; } + + public static String colorWords(String str, ChatColor... colors) + { + int c = 0, maxC = colors.length - 1; + StringBuilder stringBuilder = new StringBuilder(); + for (String word : str.split(" ")) + { + stringBuilder.append(colors[c]); + stringBuilder.append(word + " "); + if (c < maxC) + c++; + else + c = 0; + } + return stringBuilder.toString(); + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/CountryFlag.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/CountryFlag.java new file mode 100644 index 000000000..af4dfec31 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/CountryFlag.java @@ -0,0 +1,70 @@ +package mineplex.core.common.util.banner; + +import org.bukkit.DyeColor; +import org.bukkit.block.banner.Pattern; +import org.bukkit.block.banner.PatternType; +import org.bukkit.inventory.ItemStack; + +public enum CountryFlag +{ + + Brazil(DyeColor.GREEN, new Pattern(DyeColor.YELLOW, PatternType.RHOMBUS_MIDDLE), new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)), + Usa(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.BLUE, PatternType.SQUARE_TOP_RIGHT)), + Canada(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM), + new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)), + Uk(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNLEFT), new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNRIGHT), + new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.CROSS)), + Ireland(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.STRIPE_TOP), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_BOTTOM)), + Spain(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.RED, PatternType.STRIPE_RIGHT)), + Japan(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)), + South_Sudan(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_RIGHT), + new Pattern(DyeColor.GREEN, PatternType.TRIANGLE_BOTTOM)), + Jamaica(DyeColor.GREEN, new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_TOP), new Pattern(DyeColor.BLACK, PatternType.TRIANGLES_BOTTOM), + new Pattern(DyeColor.YELLOW, PatternType.CROSS)), + Italy(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM)), + Senegal(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM), + new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)), + France(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)), + India(DyeColor.WHITE, new Pattern(DyeColor.ORANGE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.GREEN, PatternType.STRIPE_RIGHT), + new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)), + Belgium(DyeColor.YELLOW, new Pattern(DyeColor.BLACK, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)), + England(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS)), + Austria(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER)), + Armenia(DyeColor.RED, new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_RIGHT)), + Argentina(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)), + Greece(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.LIGHT_BLUE, PatternType.SQUARE_BOTTOM_LEFT)), + Czech_Republic(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.BLUE, PatternType.TRIANGLE_BOTTOM)), + Romania(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)), + Honduras(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT)), + Algeria(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.HALF_HORIZONTAL_MIRROR), new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)), + Portugal(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.STRIPE_TOP), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)), + Bahrain(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.TRIANGLES_BOTTOM)), + Germany(DyeColor.RED, new Pattern(DyeColor.BLACK, PatternType.STRIPE_LEFT), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_RIGHT)), + Gabon(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT), new Pattern(DyeColor.LIME, PatternType.STRIPE_LEFT)), + Scotland(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.CROSS)), + Peru(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM)), + Tanzania(DyeColor.LIME, new Pattern(DyeColor.LIGHT_BLUE, PatternType.DIAGONAL_RIGHT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_DOWNLEFT)), + Morocco(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)), + Solomon_Islands(DyeColor.GREEN, new Pattern(DyeColor.BLUE, PatternType.DIAGONAL_LEFT_MIRROR), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_DOWNRIGHT)), + Switzerland(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM), + new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)), + Finland(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_LEFT), new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_RIGHT), + new Pattern(DyeColor.WHITE, PatternType.HALF_HORIZONTAL), new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER)), + South_Africa(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL), + new Pattern(DyeColor.GREEN, PatternType.STRIPE_CENTER), new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_BOTTOM)), + Poland(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.HALF_VERTICAL_MIRROR)); + + private DyeColor _baseColor; + private Pattern[] _patterns; + + CountryFlag(DyeColor baseColor, Pattern... patterns){ + _baseColor = baseColor; + _patterns = patterns; + } + + public ItemStack getBanner() + { + return UtilBanner.createBanner(_baseColor, _patterns); + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/UtilBanner.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/UtilBanner.java new file mode 100644 index 000000000..25693bb2a --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/banner/UtilBanner.java @@ -0,0 +1,25 @@ +package mineplex.core.common.util.banner; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.block.banner.Pattern; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; + +public class UtilBanner +{ + + public static ItemStack createBanner(DyeColor baseColor, Pattern... patterns) + { + ItemStack banner = new ItemStack(Material.BANNER); + BannerMeta bannerMeta = (BannerMeta) banner.getItemMeta(); + bannerMeta.setBaseColor(baseColor); + for (Pattern pattern : patterns) + { + bannerMeta.addPattern(pattern); + } + banner.setItemMeta(bannerMeta); + return banner; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java new file mode 100644 index 000000000..09ef34668 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java @@ -0,0 +1,56 @@ +package mineplex.core.common.util.particles; + + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public class ColoredParticle extends ParticleData +{ + + private ParticleColor _color; + + public ColoredParticle(UtilParticle.ParticleType particleType, ParticleColor color, Location location) + { + super(particleType, location); + if ((particleType == UtilParticle.ParticleType.RED_DUST || particleType == UtilParticle.ParticleType.MOB_SPELL_AMBIENT) + && !(color instanceof DustSpellColor)) + throw new IllegalArgumentException("RED_DUST and MOB_SPELL_AMBIENT particle types require a DustSpellColor!"); + else if(particleType == UtilParticle.ParticleType.NOTE && !(color instanceof NoteColor)) + throw new IllegalArgumentException("NOTE particle type requires a NoteColor!"); + else if(particleType != UtilParticle.ParticleType.RED_DUST && particleType != UtilParticle.ParticleType.MOB_SPELL_AMBIENT + && particleType != UtilParticle.ParticleType.NOTE) + throw new IllegalArgumentException("Particle Type must be RED_DUST, MOB_SPELL_AMBIENT!"); + _particleType = particleType; + _color = color; + _location = location; + } + + @Override + public void display(UtilParticle.ViewDist viewDist, Player... players) + { + float x = _color.getX(); + if (_particleType == UtilParticle.ParticleType.RED_DUST && x == 0) + x = Float.MIN_NORMAL; + UtilParticle.PlayParticle(_particleType, _location, x, _color.getY(), _color.getZ(), 1, 0, viewDist, players); + } + + @Override + public void display(UtilParticle.ViewDist viewDist) + { + display(viewDist, UtilServer.getPlayers()); + } + + @Override + public void display() + { + display(UtilParticle.ViewDist.NORMAL); + } + + public void setColor(ParticleColor color) + { + _color = color; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java new file mode 100644 index 000000000..be36f059d --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java @@ -0,0 +1,39 @@ +package mineplex.core.common.util.particles; + +import java.awt.*; + +public class DustSpellColor extends ParticleColor +{ + + private int _red, _green, _blue; + + public DustSpellColor(Color color) + { + _red = color.getRed(); + _green = color.getGreen(); + _blue = color.getBlue(); + } + + public DustSpellColor(int r, int g, int b) + { + _red = r; + _green = g; + _blue = b; + } + + public float getX() + { + return (float) _red / 255f; + } + + public float getY() + { + return (float) _green / 255f; + } + + public float getZ() + { + return (float) _blue / 255f; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NormalParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NormalParticle.java new file mode 100644 index 000000000..d7963c80a --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NormalParticle.java @@ -0,0 +1,14 @@ +package mineplex.core.common.util.particles; + +import mineplex.core.common.util.UtilParticle; +import org.bukkit.Location; + +public class NormalParticle extends ParticleData +{ + + public NormalParticle(UtilParticle.ParticleType particleType, Location location) + { + super(particleType, location); + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java new file mode 100644 index 000000000..94cf5d5d2 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java @@ -0,0 +1,39 @@ +package mineplex.core.common.util.particles; + +import java.awt.*; + +public class NoteColor extends ParticleColor +{ + + private int _red, _green, _blue; + + public NoteColor(Color color) + { + _red = color.getRed(); + _green = color.getGreen(); + _blue = color.getBlue(); + } + + public NoteColor(int r, int g, int b) + { + _red = r; + _green = g; + _blue = b; + } + + public float getX() + { + return (float) _red / 24f; + } + + public float getY() + { + return 0f; + } + + public float getZ() + { + return 0f; + } + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java new file mode 100644 index 000000000..56fff7eca --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java @@ -0,0 +1,14 @@ +package mineplex.core.common.util.particles; + +import java.awt.*; + +public abstract class ParticleColor +{ + + public abstract float getX(); + + public abstract float getY(); + + public abstract float getZ(); + +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java new file mode 100644 index 000000000..c6e020ddf --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java @@ -0,0 +1,57 @@ +package mineplex.core.common.util.particles; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public class ParticleData +{ + + protected UtilParticle.ParticleType _particleType; + protected Location _location; + + public ParticleData(UtilParticle.ParticleType particleType, Location location) + { + _particleType = particleType; + _location = location; + } + + /** + * Displays the particles for selected players + * @param viewDist The distance of the particle view + * @param players The players that will receive the particle + */ + public void display(UtilParticle.ViewDist viewDist, Player... players) + { + UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, 1, viewDist); + } + + /** + * Displays the particles for all the players + * @param viewDist The distance of the particle view + */ + public void display(UtilParticle.ViewDist viewDist) + { + display(viewDist, UtilServer.getPlayers()); + } + + /** + * Displays the particles for all the players, with a NORMAL view distance + */ + public void display() + { + display(UtilParticle.ViewDist.NORMAL); + } + + public void setLocation(Location location) + { + _location = location; + } + + public Location getLocation() + { + return _location; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateGadgetButton.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateGadgetButton.java index f3f4cca6d..b953faafc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateGadgetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateGadgetButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.activate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateMountButton.java similarity index 90% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateMountButton.java index ffa63ca11..d76f34950 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivateMountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivateMountButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.activate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -23,7 +23,7 @@ public class ActivateMountButton implements IButton public void onClick(Player player, ClickType clickType) { _page.playAcceptSound(player); - _mount.Enable(player); + _mount.enable(player); _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java index cc2012e0b..2f1dffd96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/ActivatePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.activate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateGadgetButton.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateGadgetButton.java index f5cd11834..589494d30 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateGadgetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateGadgetButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.deactivate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateMountButton.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateMountButton.java index 0a18d74f3..cb9854dc6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivateMountButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivateMountButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.deactivate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -21,7 +21,7 @@ public class DeactivateMountButton implements IButton public void onClick(Player player, ClickType clickType) { _page.playAcceptSound(player); - _mount.Disable(player); + _mount.disable(player); _page.refresh(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java index f05e36139..2b3fb0c61 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/DeactivatePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.deactivate; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenArrowTrails.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenArrowTrails.java index e9a17fd73..02fc1f8dd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenArrowTrails.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenArrowTrails.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java new file mode 100644 index 000000000..ed816cf42 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenBalloons.java @@ -0,0 +1,22 @@ +package mineplex.core.cosmetic.ui.button.open; + +import mineplex.core.cosmetic.ui.page.BalloonsPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.gadget.types.Gadget; +import org.bukkit.entity.Player; + +public class OpenBalloons extends OpenPageButton +{ + + public OpenBalloons(Menu menu, Gadget active) + { + super(menu, active); + } + + @Override + protected void leftClick(Player player) + { + getMenu().getShop().openPageForPlayer(player, new BalloonsPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Win Effects", player)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenCostumes.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenCostumes.java index 01f528d6e..4add95287 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenCostumes.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenCostumes.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDeathAnimations.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDeathAnimations.java index 574d9f7b6..879f7d8d5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDeathAnimations.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDeathAnimations.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDoubleJump.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDoubleJump.java index 752a8da23..28802e69f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenDoubleJump.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenDoubleJump.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGadgets.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGadgets.java index 7926bf050..f85875f8c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGadgets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGadgets.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGameModifiers.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGameModifiers.java similarity index 81% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGameModifiers.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGameModifiers.java index 9ad9683a4..e01bbed6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenGameModifiers.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenGameModifiers.java @@ -1,8 +1,8 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; -import mineplex.core.cosmetic.ui.page.GameModifierPage; +import mineplex.core.cosmetic.ui.page.gamemodifiers.GameModifierPage; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.gadget.types.Gadget; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenHats.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenHats.java index 126382e58..2e818a7af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenHats.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenHats.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMorphs.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMorphs.java index 34d6ac932..933df4089 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMorphs.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMorphs.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.MorphPage; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMounts.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMounts.java index 75bcc3a78..016349c0e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMounts.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMounts.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -29,7 +29,7 @@ public class OpenMounts implements IButton if (_active != null) { _menu.playAcceptSound(player); - _active.Disable(player); + _active.disable(player); _menu.refresh(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMusic.java similarity index 87% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMusic.java index 0486bf151..f0ef119fb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenMusic.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenMusic.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPageButton.java similarity index 94% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPageButton.java index 350826677..318c61758 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPageButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPageButton.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenParticles.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenParticles.java index 2edea0122..7cc50a1ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenParticles.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenParticles.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java similarity index 93% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java index 5b7e2b700..711679214 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenPets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenWinEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenWinEffect.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenWinEffect.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenWinEffect.java index 8a530b03e..0bed3e436 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/OpenWinEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenWinEffect.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.button; +package mineplex.core.cosmetic.ui.button.open; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java new file mode 100644 index 000000000..ca7a38209 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java @@ -0,0 +1,53 @@ +package mineplex.core.cosmetic.ui.page; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +public class BalloonsPage extends GadgetPage +{ + + public BalloonsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + int slot = 19; + + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Balloon)) + { + addGadget(gadget, slot); + + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Balloon) == gadget) + addGlow(slot); + + slot++; + + if (slot == 26) + slot = 28; + if(slot == 35) + slot = 37; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + { + public void onClick(Player player, ClickType clickType) + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + } + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 2045d2c87..eef194ba6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -4,10 +4,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import mineplex.core.common.util.banner.CountryFlag; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; @@ -17,8 +19,8 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.cosmetic.ui.button.ActivateGadgetButton; -import mineplex.core.cosmetic.ui.button.DeactivateGadgetButton; +import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton; +import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton; import mineplex.core.cosmetic.ui.button.GadgetButton; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.gadgets.morph.MorphBlock; @@ -136,6 +138,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Purchased from shop.mineplex.com"); } + else if (gadget.getCost(CurrencyType.Coins) == -8) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Freedom Chests"); + } //Rank Unlocks else if (gadget.getCost(CurrencyType.Coins) == -10) @@ -262,19 +269,54 @@ public class GadgetPage extends ShopPageBase //Standard if (gadget.ownsGadget(getPlayer())) { + ItemStack gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData()); + ItemMeta meta = gadgetItemStack.getItemMeta(); + meta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); if (gadget.getActive().contains(getPlayer())) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); + meta.setLore(itemLore); + gadgetItemStack.setItemMeta(meta); + + if (gadget.getGadgetType() == GadgetType.ArrowTrail || gadget.getGadgetType() == GadgetType.Death + || gadget.getGadgetType() == GadgetType.Particle || gadget.getGadgetType() == GadgetType.DoubleJump) + { + if (gadget.getCost(CurrencyType.Coins) == -8) + { + gadgetItemStack = CountryFlag.Usa.getBanner(); + BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta(); + bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); + bannerMeta.setLore(meta.getLore()); + gadgetItemStack.setItemMeta(bannerMeta); + } + } + + addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); } else { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); + meta.setLore(itemLore); + gadgetItemStack.setItemMeta(meta); + + if (gadget.getGadgetType() == GadgetType.ArrowTrail || gadget.getGadgetType() == GadgetType.Death + || gadget.getGadgetType() == GadgetType.Particle || gadget.getGadgetType() == GadgetType.DoubleJump) + { + if (gadget.getCost(CurrencyType.Coins) == -8) + { + gadgetItemStack = CountryFlag.Usa.getBanner(); + BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta(); + bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); + bannerMeta.setLore(meta.getLore()); + gadgetItemStack.setItemMeta(bannerMeta); + } + } + + addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); } } else @@ -346,7 +388,7 @@ public class GadgetPage extends ShopPageBase playAcceptSound(player); gadget.enable(player); - getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + refresh(); } public void handleRightClick(Player player, Gadget gadget) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 10835827f..ed5400bfb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.EnumMap; import java.util.List; +import mineplex.core.cosmetic.ui.button.open.*; import org.bukkit.Material; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; @@ -18,19 +19,6 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilText; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.cosmetic.ui.button.OpenArrowTrails; -import mineplex.core.cosmetic.ui.button.OpenCostumes; -import mineplex.core.cosmetic.ui.button.OpenDeathAnimations; -import mineplex.core.cosmetic.ui.button.OpenDoubleJump; -import mineplex.core.cosmetic.ui.button.OpenGadgets; -import mineplex.core.cosmetic.ui.button.OpenGameModifiers; -import mineplex.core.cosmetic.ui.button.OpenHats; -import mineplex.core.cosmetic.ui.button.OpenMorphs; -import mineplex.core.cosmetic.ui.button.OpenMounts; -import mineplex.core.cosmetic.ui.button.OpenMusic; -import mineplex.core.cosmetic.ui.button.OpenParticles; -import mineplex.core.cosmetic.ui.button.OpenPets; -import mineplex.core.cosmetic.ui.button.OpenWinEffect; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -112,7 +100,7 @@ public class Menu extends ShopPageBase Mount mountActive = getPlugin().getMountManager().getActive(getPlayer()); for (Mount mount : getPlugin().getMountManager().getMounts()) { - if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName()) || mount.HasMount(getPlayer())) + if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName()) || mount.hasMount(getPlayer())) { mountOwned++; } @@ -207,6 +195,11 @@ public class Menu extends ShopPageBase lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type)); addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(gameModifierSlot); + + /*type = GadgetType.Balloon; + lore = getLore(ownedCount.get(type), maxCount.get(type), "Placeholder", "Placeholder", enabled.get(type)); + addButton(balloonSlot, new ShopItem(Material.BANNER, "Balloons", lore, 1, false), new OpenBalloons(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(balloonSlot);*/ } private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index f8c349237..bd7edb806 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -13,8 +13,8 @@ import mineplex.core.common.CurrencyType; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.cosmetic.ui.button.ActivateMountButton; -import mineplex.core.cosmetic.ui.button.DeactivateMountButton; +import mineplex.core.cosmetic.ui.button.activate.ActivateMountButton; +import mineplex.core.cosmetic.ui.button.deactivate.DeactivateMountButton; import mineplex.core.cosmetic.ui.button.MountButton; import mineplex.core.donation.DonationManager; import mineplex.core.mount.Mount; @@ -92,6 +92,11 @@ public class MountPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure"); } + else if (mount.getCost(CurrencyType.Coins) == -7) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Freedom Chests"); + } //Rank Unlocks else if (mount.getCost(CurrencyType.Coins) == -10) { @@ -117,7 +122,7 @@ public class MountPage extends ShopPageBase if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName())) { - if (mount.GetActive().containsKey(getPlayer())) + if (mount.getActive().containsKey(getPlayer())) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 7e97f02fc..50d797761 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -24,8 +24,8 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.PetSorter; -import mineplex.core.cosmetic.ui.button.ActivatePetButton; -import mineplex.core.cosmetic.ui.button.DeactivatePetButton; +import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; +import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton; import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.donation.DonationManager; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierPage.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierPage.java index 34ca04610..beeeba200 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierPage.java @@ -1,8 +1,9 @@ -package mineplex.core.cosmetic.ui.page; +package mineplex.core.cosmetic.ui.page.gamemodifiers; import java.util.List; -import org.bukkit.Bukkit; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.Menu; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -15,7 +16,7 @@ import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; @@ -37,7 +38,7 @@ public class GameModifierPage extends GadgetPage { int own = 0; int total = 0; - for(GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(type)) { + for(GameModifierGadget g : getPlugin().getGadgetManager().getGameModifiers(type)) { if(g.ownsGadget(getPlayer())) own++; total++; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierSubPage.java similarity index 92% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierSubPage.java index 4708af7a0..8049beb5d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierSubPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/GameModifierSubPage.java @@ -1,5 +1,6 @@ -package mineplex.core.cosmetic.ui.page; +package mineplex.core.cosmetic.ui.page.gamemodifiers; +import mineplex.core.cosmetic.ui.page.GadgetPage; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -11,7 +12,7 @@ import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import org.bukkit.inventory.ItemStack; @@ -47,7 +48,7 @@ public class GameModifierSubPage extends GadgetPage { int own = 0; int total = 0; - for (GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(kitModifierType)) + for (GameModifierGadget g : getPlugin().getGadgetManager().getGameModifiers(kitModifierType)) { if (g.ownsGadget(getPlayer())) own++; total++; @@ -83,7 +84,7 @@ public class GameModifierSubPage extends GadgetPage } else { - for (GadgetGameModifier gadget : getPlugin().getGadgetManager().getGameModifiers(_type)) + for (GameModifierGadget gadget : getPlugin().getGadgetManager().getGameModifiers(_type)) { addGadget(gadget, slot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/KitGameModifierPage.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/KitGameModifierPage.java index 6dfa6cf0a..77590aa93 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/KitGameModifierPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/gamemodifiers/KitGameModifierPage.java @@ -1,15 +1,15 @@ -package mineplex.core.cosmetic.ui.page; +package mineplex.core.cosmetic.ui.page.gamemodifiers; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilServer; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import org.bukkit.Material; @@ -38,7 +38,7 @@ public class KitGameModifierPage extends GadgetPage int slot = 19; - for (GadgetGameModifier gadget : getPlugin().getGadgetManager().getGameModifiers(_kitType)) + for (GameModifierGadget gadget : getPlugin().getGadgetManager().getGameModifiers(_kitType)) { if (gadget instanceof KitGameModifier) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index da4eeba8c..be83461c2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -344,9 +344,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler if (disguise.GetEntity() instanceof EntityPlayer && disguise instanceof DisguisePlayer) { - if (!((EntityPlayer) disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer) disguise).getName())) + if (!(disguise.GetEntity()).getName().equalsIgnoreCase(((DisguisePlayer) disguise).getName())) { - _blockedNames.add(((Player) disguise.GetEntity()).getName()); + _blockedNames.add((disguise.GetEntity()).getName()); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index 477be5d8b..3e114c350 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -21,9 +21,11 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_8_R3.WorldServer; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; import net.minecraft.server.v1_8_R3.WorldSettings; +import org.bukkit.entity.Entity; public class DisguisePlayer extends DisguiseHuman { + private Entity _entity; private GameProfile _profile; private boolean _sneaking; private BlockFace _sleeping; @@ -32,6 +34,7 @@ public class DisguisePlayer extends DisguiseHuman public DisguisePlayer(org.bukkit.entity.Entity entity) { super(entity); + _entity = entity; } public DisguisePlayer(org.bukkit.entity.Entity entity, GameProfile profile) @@ -170,4 +173,9 @@ public class DisguisePlayer extends DisguiseHuman sendPacket(packet); } + + public org.bukkit.entity.Entity getEntity() + { + return _entity; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 6bb1e5c66..f84541392 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -5,11 +5,20 @@ import java.util.function.Predicate; import mineplex.core.gadget.commands.LockCosmeticsCommand; import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier; +import mineplex.core.gadget.gadgets.hat.*; +import mineplex.core.gadget.gadgets.morph.*; import mineplex.core.gadget.gadgets.outfit.windupsuit.*; +import mineplex.core.gadget.gadgets.particle.*; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; +import mineplex.core.gadget.gadgets.wineffect.*; import mineplex.core.gadget.persistence.UserGadgetPersistence; -import mineplex.core.gadget.set.suits.SetWindUpSuit; +import mineplex.core.gadget.set.*; +import mineplex.core.gadget.types.*; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -75,16 +84,6 @@ import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; -import mineplex.core.gadget.gadgets.hat.HatCoal; -import mineplex.core.gadget.gadgets.hat.HatCompanionBlock; -import mineplex.core.gadget.gadgets.hat.HatGrinch; -import mineplex.core.gadget.gadgets.hat.HatLovestruck; -import mineplex.core.gadget.gadgets.hat.HatPresent; -import mineplex.core.gadget.gadgets.hat.HatRudolph; -import mineplex.core.gadget.gadgets.hat.HatSanta; -import mineplex.core.gadget.gadgets.hat.HatSecretPackage; -import mineplex.core.gadget.gadgets.hat.HatSnowman; -import mineplex.core.gadget.gadgets.hat.HatTeddyBear; import mineplex.core.gadget.gadgets.item.ItemBatGun; import mineplex.core.gadget.gadgets.item.ItemBow; import mineplex.core.gadget.gadgets.item.ItemCoal; @@ -102,21 +101,6 @@ import mineplex.core.gadget.gadgets.item.ItemPaintbrush; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemTNT; -import mineplex.core.gadget.gadgets.morph.MorphBat; -import mineplex.core.gadget.gadgets.morph.MorphBlaze; -import mineplex.core.gadget.gadgets.morph.MorphBlock; -import mineplex.core.gadget.gadgets.morph.MorphBunny; -import mineplex.core.gadget.gadgets.morph.MorphChicken; -import mineplex.core.gadget.gadgets.morph.MorphCow; -import mineplex.core.gadget.gadgets.morph.MorphCreeper; -import mineplex.core.gadget.gadgets.morph.MorphEnderman; -import mineplex.core.gadget.gadgets.morph.MorphPig; -import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; -import mineplex.core.gadget.gadgets.morph.MorphSlime; -import mineplex.core.gadget.gadgets.morph.MorphSnowman; -import mineplex.core.gadget.gadgets.morph.MorphTitan; -import mineplex.core.gadget.gadgets.morph.MorphVillager; -import mineplex.core.gadget.gadgets.morph.MorphWither; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; @@ -127,58 +111,18 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; -import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; -import mineplex.core.gadget.gadgets.particle.ParticleFairy; -import mineplex.core.gadget.gadgets.particle.ParticleFireRings; import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; -import mineplex.core.gadget.gadgets.particle.ParticleLegend; import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; -import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; -import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; -import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; -import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; -import mineplex.core.gadget.gadgets.particle.ParticleYinYang; -import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; -import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; -import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; -import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; -import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; -import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium; -import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; -import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; -import mineplex.core.gadget.set.SetCandyCane; -import mineplex.core.gadget.set.SetCupidsLove; -import mineplex.core.gadget.set.SetEmerald; -import mineplex.core.gadget.set.SetFrostLord; -import mineplex.core.gadget.set.SetHowlingWinds; -import mineplex.core.gadget.set.SetMusic; -import mineplex.core.gadget.set.SetParty; -import mineplex.core.gadget.set.SetShadow; -import mineplex.core.gadget.set.SetTitan; -import mineplex.core.gadget.set.SetVampire; -import mineplex.core.gadget.set.SetWisdom; import mineplex.core.gadget.set.suits.SetRaveSuit; import mineplex.core.gadget.set.suits.SetSpaceSuit; -import mineplex.core.gadget.types.ArrowEffectGadget; -import mineplex.core.gadget.types.DeathEffectGadget; -import mineplex.core.gadget.types.DoubleJumpEffectGadget; -import mineplex.core.gadget.types.Gadget; -import mineplex.core.gadget.types.GadgetGameModifier; -import mineplex.core.gadget.types.GadgetSet; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.gadget.types.ItemGadget; -import mineplex.core.gadget.types.MusicGadget; -import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.gadget.types.WinEffectGadget; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.MountManager; @@ -261,7 +205,7 @@ public class GadgetManager extends MiniPlugin //Costumes addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); - addSet(new SetWindUpSuit(this)); + //addSet(new SetWindUpSuit(this)); addSet(new SetParty(this)); addSet(new SetCupidsLove(this)); addSet(new SetEmerald(this)); @@ -270,6 +214,7 @@ public class GadgetManager extends MiniPlugin addSet(new SetHowlingWinds(this)); addSet(new SetVampire(this)); addSet(new SetMusic(this)); + addSet(new SetFreedom(this)); } private void createGadgets() @@ -306,10 +251,10 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitSpaceSuitLeggings(this)); addGadget(new OutfitSpaceSuitBoots(this)); - addGadget(new OutfitWindUpSuitHelmet(this)); + /*addGadget(new OutfitWindUpSuitHelmet(this)); addGadget(new OutfitWindUpSuitChestplate(this)); addGadget(new OutfitWindUpSuitLeggings(this)); - addGadget(new OutfitWindUpSuitBoots(this)); + addGadget(new OutfitWindUpSuitBoots(this));*/ addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); @@ -332,6 +277,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphSlime(this, _achievementManager)); addGadget(new MorphTitan(this)); addGadget(new MorphSnowman(this)); + addGadget(new MorphUncleSam(this)); // Particles addGadget(new ParticleFoot(this)); @@ -354,6 +300,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ParticleWingsInfernal(this)); addGadget(new ParticleWingsPixie(this)); addGadget(new ParticleYinYang(this)); + addGadget(new ParticleFreedom(this)); // Arrow Trails @@ -368,6 +315,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ArrowTrailStorm(this)); addGadget(new ArrowTrailBlood(this)); addGadget(new ArrowTrailMusic(this)); + addGadget(new ArrowTrailFreedom(this)); // Death Effect addGadget(new DeathFrostLord(this)); @@ -381,6 +329,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathStorm(this)); addGadget(new DeathBlood(this)); addGadget(new DeathMusic(this)); + addGadget(new DeathFreedom(this)); // Double Jump addGadget(new DoubleJumpFrostLord(this)); @@ -394,18 +343,13 @@ public class GadgetManager extends MiniPlugin addGadget(new DoubleJumpStorm(this)); addGadget(new DoubleJumpBlood(this)); addGadget(new DoubleJumpMusic(this)); + addGadget(new DoubleJumpFreedom(this)); // Hat - addGadget(new HatSanta(this)); - addGadget(new HatSnowman(this)); - addGadget(new HatPresent(this)); - addGadget(new HatCoal(this)); - addGadget(new HatRudolph(this)); - addGadget(new HatGrinch(this)); - addGadget(new HatCompanionBlock(this)); - addGadget(new HatLovestruck(this)); - addGadget(new HatSecretPackage(this)); - addGadget(new HatTeddyBear(this)); + for (HatType hatType : HatType.values()) + { + addGadget(new HatItem(this, hatType)); + } //Win Effects addGadget(new WinEffectPodium(this)); @@ -461,17 +405,18 @@ public class GadgetManager extends MiniPlugin // Survival Games - for (KitModifier kitModifier : KitModifier.values()) + /* for (KitModifier kitModifier : KitModifier.values()) { addGadget(new KitGameModifier(this, kitModifier)); - } - - for(GadgetType type : GadgetType.values()) + }*/ + + // Balloons + //addGadget(new BabyCowBalloon(this)); + + for (GadgetType gadgetType : GadgetType.values()) { - if(!_gadgets.containsKey(type)) - { - _gadgets.put(type, new ArrayList<>()); - } + if (!_gadgets.containsKey(gadgetType)) + _gadgets.put(gadgetType, new ArrayList<>()); } } @@ -514,7 +459,7 @@ public class GadgetManager extends MiniPlugin private void addGadget(Gadget gadget) { if (!_gadgets.containsKey(gadget.getGadgetType())) - _gadgets.put(gadget.getGadgetType(), new ArrayList()); + _gadgets.put(gadget.getGadgetType(), new ArrayList<>()); _gadgets.get(gadget.getGadgetType()).add(gadget); } @@ -556,14 +501,14 @@ public class GadgetManager extends MiniPlugin return null; } - public List getGameModifiers(GameModifierType gameType) + public List getGameModifiers(GameModifierType gameType) { - List list = new ArrayList<>(); + List list = new ArrayList<>(); for (Gadget g : getGadgets(GadgetType.GameModifier)) { - if (g instanceof GadgetGameModifier) + if (g instanceof GameModifierGadget) { - GadgetGameModifier mod = (GadgetGameModifier) g; + GameModifierGadget mod = (GameModifierGadget) g; if (mod.getGameType() == gameType) list.add(mod); } } @@ -572,7 +517,7 @@ public class GadgetManager extends MiniPlugin public GameModifierMineStrikeSkin getGameModifier(MineStrikeSkin skin) { - for(GadgetGameModifier g : getGameModifiers(GameModifierType.MineStrike)) + for(GameModifierGadget g : getGameModifiers(GameModifierType.MineStrike)) { GameModifierMineStrikeSkin gskin = (GameModifierMineStrikeSkin) g; if(g.getName().equals(skin.getSkinName())) return gskin; @@ -580,10 +525,10 @@ public class GadgetManager extends MiniPlugin return null; } - public List getGameModifiers(KitModifierType kitType) + public List getGameModifiers(KitModifierType kitType) { - List list = new ArrayList<>(); - for (GadgetGameModifier gadget : getGameModifiers(kitType.getGameModifierType())) + List list = new ArrayList<>(); + for (GameModifierGadget gadget : getGameModifiers(kitType.getGameModifierType())) { if (gadget instanceof KitGameModifier) { @@ -596,9 +541,9 @@ public class GadgetManager extends MiniPlugin return list; } - public GadgetGameModifier getActiveGameModifier(Player player, GameModifierType gameType, Predicate selector) + public GameModifierGadget getActiveGameModifier(Player player, GameModifierType gameType, Predicate selector) { - for (GadgetGameModifier g : getGameModifiers(gameType)) + for (GameModifierGadget g : getGameModifiers(gameType)) { if (!g.isActive(player)) { continue; } if (!selector.test(g)) { continue; } @@ -608,9 +553,9 @@ public class GadgetManager extends MiniPlugin } // Gets all the Game modifiers that are related to kits - public KitGameModifier getActiveGameModifier(Player player, KitModifierType kitType, Predicate selector) + public KitGameModifier getActiveGameModifier(Player player, KitModifierType kitType, Predicate selector) { - for (GadgetGameModifier g : getGameModifiers(kitType)) + for (GameModifierGadget g : getGameModifiers(kitType)) { if (!g.isActive(player)) { continue; } if (!selector.test(g)) { continue; } @@ -619,6 +564,20 @@ public class GadgetManager extends MiniPlugin } return null; } + + public HatGadget getHatGadget(HatType type) + { + for (Gadget gadget : getGadgets(GadgetType.Hat)) + { + if(gadget instanceof HatGadget) + { + HatGadget hatGadget = (HatGadget) gadget; + if (type.equals(hatGadget.getHatType())) + return hatGadget; + } + } + return null; + } // Disallows two armor gadgets in same slot. public void removeOutfit(Player player, ArmorSlot slot) @@ -682,7 +641,7 @@ public class GadgetManager extends MiniPlugin if (gadget instanceof WinEffectGadget) continue; - if(gadget instanceof GadgetGameModifier) + if(gadget instanceof GameModifierGadget) continue; for (Player player : UtilServer.getPlayers()) @@ -961,48 +920,48 @@ public class GadgetManager extends MiniPlugin Map cache = new HashMap<>(); for (Gadget gadget : getAllGadgets()) { - if (gadget.ownsGadget(player)) - { - GadgetType gadgetType = gadget.getGadgetType(); - switch (gadgetType) + GadgetType gadgetType = gadget.getGadgetType(); + if (gadget.ownsGadget(player)) { - case MusicDisc: - case Item: - case Morph: - break; - case Costume: - OutfitGadget outfitGadget = (OutfitGadget) gadget; - String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); - if (cache.containsKey(key)) - continue; - if (outfitGadget.isActive(player)) - cache.put(key, outfitGadget.getName()); - break; - case GameModifier: - GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; - if (gadgetGameModifier.canAllowMultiple()) - { - if (cache.containsKey(gadget.getName())) + switch (gadgetType) + { + case MusicDisc: + case Item: + case Morph: + case Balloon: + break; + case Costume: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); + if (cache.containsKey(key)) continue; - cache.put(gadget.getName(), (gadget.isActive(player)) ? "enabled" : "disabled"); - } - else - { - String dataKey = "activeModifier" + gadgetGameModifier.getGameType().getName().replace(" ", ""); - if (cache.containsKey(dataKey)) + if (outfitGadget.isActive(player)) + cache.put(key, outfitGadget.getName()); + break; + case GameModifier: + GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget; + if (gameModifierGadget.canAllowMultiple()) + { + if (cache.containsKey(gadget.getName())) + continue; + cache.put(gadget.getName(), (gadget.isActive(player)) ? "enabled" : "disabled"); + } else + { + String dataKey = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", ""); + if (cache.containsKey(dataKey)) + continue; + if (gadget.isActive(player)) + cache.put(dataKey, gadget.getName()); + } + break; + default: + if (cache.containsKey(gadgetType.getDatabaseKey())) continue; if (gadget.isActive(player)) - cache.put(dataKey, gadget.getName()); - } - break; - default: - if (cache.containsKey(gadgetType.getDatabaseKey())) - continue; - if (gadget.isActive(player)) - cache.put(gadgetType.getDatabaseKey(), gadget.getName()); - break; + cache.put(gadgetType.getDatabaseKey(), gadget.getName()); + break; + } } - } } _userGadgetPersistence.save(player, cache); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index 82eede2df..7137b9def 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -7,6 +7,8 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; +import mineplex.core.mount.Mount; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; public class LockCosmeticsCommand extends CommandBase diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java index 53ec47121..f55fb3394 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -7,6 +7,10 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; +import mineplex.core.mount.Mount; +import mineplex.core.mount.MountManager; +import mineplex.core.pet.Pet; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; public class UnlockCosmeticsCommand extends CommandBase diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java new file mode 100644 index 000000000..dc7e1ccb2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java @@ -0,0 +1,64 @@ +package mineplex.core.gadget.gadgets.arrowtrail.freedom; + +import java.awt.*; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; +import mineplex.core.gadget.gadgets.particle.unrelated.FreedomFireworkEffect; +import mineplex.core.gadget.types.ArrowEffectGadget; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; + +public class ArrowTrailFreedom extends ArrowEffectGadget +{ + + private Color _color = Color.RED; + private long _count; + + public ArrowTrailFreedom(GadgetManager manager) + { + super(manager, "Shock and Awe", UtilText.splitLineToArray(UtilText.colorWords("Send freedom directly into the faces of your foes.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), + -8, Material.WOOL, + (byte) 0); + } + + @Override + public void doTrail(Arrow arrow) + { + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_color), arrow.getLocation().clone().add(0, .5, 0)); + for (int i = 0; i < 7; i++) + { + coloredParticle.setLocation(arrow.getLocation().clone().add(0, .5, 0)); + coloredParticle.display(); + } + _count++; + if (_count % 5 == 0) + { + if (_color == Color.RED) + _color = Color.WHITE; + else if (_color == Color.WHITE) + _color = Color.BLUE; + else + _color = Color.RED; + } + if (_count == Long.MAX_VALUE - 1) + _count = 0; + } + + @Override + public void doHitEffect(Arrow arrow) + { + BabyFireworkEffect babyFireworkEffect = new BabyFireworkEffect(arrow.getLocation(), Manager.getPlugin(), _color); + babyFireworkEffect.start(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java new file mode 100644 index 000000000..361f44be7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java @@ -0,0 +1,52 @@ +package mineplex.core.gadget.gadgets.balloons; + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.BalloonGadget; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.*; + +public class BabyCowBalloon extends BalloonGadget +{ + + private ArmorStand _entityStand, _playerStand; + private Entity _balloonEntity; + + public BabyCowBalloon(GadgetManager manager) + { + super(manager, "Baby Cow Balloon", new String[]{"placeholder"}, 0, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.COW)); + } + + @Override + public void enableCustom(Player player) + { + if (!canSpawnBalloon(player)) + { + // TODO MESSAGE + return; + } + addPlayerBalloon(player); + _entityStand = player.getWorld().spawn(player.getLocation(), ArmorStand.class); + _entityStand.setGravity(false); + _entityStand.setVisible(false); + Cow babyCow = player.getWorld().spawn(player.getLocation(), Cow.class); + babyCow.setBaby(); + _balloonEntity = babyCow; + _entityStand.setPassenger(babyCow); + Location balloonLocation = player.getLocation().add(_random.nextDouble(), getNewHeight(player), _random.nextDouble()); + _entityStand.teleport(balloonLocation); + babyCow.setLeashHolder(player); + // TODO UPDATE BALLOONS + } + + @Override + public void disableCustom(Player player) + { + _entityStand.remove(); + _balloonEntity.remove(); + removePlayerBalloon(player); + // TODO UPDATE PLAYER HEIGHT + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java new file mode 100644 index 000000000..bb2f1e1fb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/freedom/DeathFreedom.java @@ -0,0 +1,36 @@ +package mineplex.core.gadget.gadgets.death.freedom; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DeathEffectGadget; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class DeathFreedom extends DeathEffectGadget +{ + + public DeathFreedom(GadgetManager manager) + { + super(manager, "Price of Freedom", UtilText.splitLineToArray(UtilText.colorWords("Freedom isn't always free, Soldier.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), + -8, Material.WOOL, (byte) 0); + } + + @Override + public void onBlood(Player player, BloodEvent event) + { + event.setCancelled(true); + + event.setItem(Material.INK_SACK, (byte) 15); + + Location loc = event.getLocation(); + UtilFirework.playFreedomFirework(loc); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java new file mode 100644 index 000000000..8caeb35e3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/freedom/DoubleJumpFreedom.java @@ -0,0 +1,30 @@ +package mineplex.core.gadget.gadgets.doublejump.freedom; + +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class DoubleJumpFreedom extends DoubleJumpEffectGadget +{ + + public DoubleJumpFreedom(GadgetManager manager) + { + super(manager, "Leap of Freedom", UtilText.splitLineToArray(UtilText.colorWords("FREEEEEEEEEEEDOM!", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, Material.WOOL, + (byte) 14); + } + + @Override + public void doEffect(Player player) + { + /*FreedomFireworkEffect freedomFireworkEffect = new FreedomFireworkEffect(player, Manager.getPlugin(), 3); + freedomFireworkEffect.start();*/ + UtilFirework.playFreedomFirework(player.getLocation()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java index 666db3575..49e617571 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/kits/KitGameModifier.java @@ -1,10 +1,8 @@ package mineplex.core.gadget.gadgets.gamemodifiers.kits; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; -import org.bukkit.Material; import org.bukkit.entity.Player; import java.util.function.Predicate; @@ -14,7 +12,7 @@ import java.util.function.Predicate; * * @author LCastr0 */ -public class KitGameModifier extends GadgetGameModifier +public class KitGameModifier extends GameModifierGadget { private KitModifier _kitModifier; @@ -51,11 +49,11 @@ public class KitGameModifier extends GadgetGameModifier * @param kitModifierType * @return */ - public static Predicate getKitFilter(KitModifierType kitModifierType) + public static Predicate getKitFilter(KitModifierType kitModifierType) { - return new Predicate() { + return new Predicate() { @Override - public boolean test(GadgetGameModifier g) { + public boolean test(GameModifierGadget g) { if (!(g instanceof KitGameModifier)) { return false; } return ((KitGameModifier)g).getKitType().equals(kitModifierType); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java index eb9efdfb9..c364a4c40 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/GameModifierMineStrikeSkin.java @@ -9,13 +9,13 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; /** * A gamemodifier to apply custom skin data to {@link GameModifierType#MineStrike} weapons */ -public class GameModifierMineStrikeSkin extends GadgetGameModifier +public class GameModifierMineStrikeSkin extends GameModifierGadget { private String _weapon; @@ -91,12 +91,12 @@ public class GameModifierMineStrikeSkin extends GadgetGameModifier } /** - * A simple {@link GadgetGameModifier} filter which filters out {@link GameModifierMineStrikeSkin} gadgets depending on weapon name + * A simple {@link GameModifierGadget} filter which filters out {@link GameModifierMineStrikeSkin} gadgets depending on weapon name * @param weaponName Exact weapon name to test for - * @return Returns a weapon filter which will filter out any {@link GadgetGameModifier} + * @return Returns a weapon filter which will filter out any {@link GameModifierGadget} * which is not instance of {@link GameModifierMineStrikeSkin} and which does not match the provided weapon name */ - public static Predicate getWeaponFilter(String weaponName) + public static Predicate getWeaponFilter(String weaponName) { return g -> g instanceof GameModifierMineStrikeSkin && ((GameModifierMineStrikeSkin)g).getWeaponName().equals(weaponName); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java deleted file mode 100644 index c83e00ed4..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java +++ /dev/null @@ -1,23 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatCoal extends HatGadget -{ - - public HatCoal(GadgetManager manager) - { - super(manager, "Lump of Coal Hat", - UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), - -1, - new ItemStack(Material.COAL_BLOCK)); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanionBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanionBlock.java deleted file mode 100644 index 770e16b2a..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCompanionBlock.java +++ /dev/null @@ -1,20 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatCompanionBlock extends HatGadget -{ - - public HatCompanionBlock(GadgetManager manager) - { - super(manager, "Companion Block", - UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE), - -2, SkinData.COMPANION_CUBE.getSkull(), "Companion"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java deleted file mode 100644 index 747d969d0..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java +++ /dev/null @@ -1,21 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatGrinch extends HatGadget -{ - - public HatGrinch(GadgetManager manager) - { - super(manager, "The Grinch", - UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), - -3, - SkinData.THE_GRINCH.getSkull(), "The Grinch Hat"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java new file mode 100644 index 000000000..daea695eb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java @@ -0,0 +1,26 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.HatGadget; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +public class HatItem extends HatGadget +{ + + public HatItem(GadgetManager manager, HatType hatType) + { + super(manager, hatType); + } + + public HatItem(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data) + { + super(manager, name, desc, cost, new ItemStack(material, 1, data)); + } + + public HatItem(GadgetManager manager, String name, String[] desc, int cost, String playerName) + { + super(manager, name, desc, cost, playerName); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java deleted file mode 100644 index 03a516090..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatLovestruck.java +++ /dev/null @@ -1,20 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatLovestruck extends HatGadget -{ - - public HatLovestruck(GadgetManager manager) - { - super(manager, "Love Struck", - UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), - -6, SkinData.LOVESTRUCK.getSkull(), "Love Struck Hat", "Lovestruck"); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java deleted file mode 100644 index 12ccc8db2..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java +++ /dev/null @@ -1,21 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatPresent extends HatGadget -{ - - public HatPresent(GadgetManager manager) - { - super(manager, "Present", - UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), - -3, - SkinData.PRESENT.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java deleted file mode 100644 index 574508d1e..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java +++ /dev/null @@ -1,21 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatRudolph extends HatGadget -{ - - public HatRudolph(GadgetManager manager) - { - super(manager, "Rudolph", - UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), - -3, - SkinData.RUDOLPH.getSkull()); - } - -} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java deleted file mode 100644 index 470b69a46..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSanta.java +++ /dev/null @@ -1,21 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatSanta extends HatGadget -{ - - public HatSanta(GadgetManager manager) - { - super(manager, "Santa", - UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), - -3, - SkinData.SANTA.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java deleted file mode 100644 index a369043ae..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSecretPackage.java +++ /dev/null @@ -1,20 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatSecretPackage extends HatGadget -{ - - public HatSecretPackage(GadgetManager manager) - { - super(manager, "Secret Package", - UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), - -6, SkinData.SECRET_PACKAGE.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java deleted file mode 100644 index 1ebfceab7..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatSnowman.java +++ /dev/null @@ -1,20 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatSnowman extends HatGadget -{ - - public HatSnowman(GadgetManager manager) - { - super(manager, "Snowman Head", - UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), - -2, SkinData.SNOWMAN.getSkull()); - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java deleted file mode 100644 index 6a5868d42..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatTeddyBear.java +++ /dev/null @@ -1,19 +0,0 @@ -package mineplex.core.gadget.gadgets.hat; - -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.HatGadget; - -public class HatTeddyBear extends HatGadget -{ - public HatTeddyBear(GadgetManager manager) - { - super(manager, "Teddy Bear", - UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), - -6, - SkinData.TEDDY_BEAR.getSkull()); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java new file mode 100644 index 000000000..7a8fa997b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java @@ -0,0 +1,75 @@ +package mineplex.core.gadget.gadgets.hat; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +public enum HatType +{ + + Coal("Lump of Coal Hat", UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), -1, Material.COAL_BLOCK), + Companion_Block("Companion Block", UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE), -2, SkinData.COMPANION_CUBE, "Companion"), + Grinch("The Grinch", UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), -3, SkinData.THE_GRINCH, "The Grinch Hat"), + Lovestruck("Love Struck", UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), -6, SkinData.LOVESTRUCK, "Love Struck Hat", "Lovestruck"), + Present("Present", UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), -3, SkinData.PRESENT), + Rudolph("Rudolph", UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), -3, SkinData.RUDOLPH), + Santa("Santa", UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), -3, SkinData.SANTA), + Secret_Package("Secret Package", UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), -6, SkinData.SECRET_PACKAGE), + Snowman("Snowman Head", UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), -2, SkinData.SNOWMAN), + Teddy_Bear("Teddy Bear", UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), -6, SkinData.TEDDY_BEAR), + Uncle_Sam("Uncle Sam Hat", UtilText.splitLineToArray(UtilText.colorWords("Uncle Sam has a big hat but now you can too.", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, SkinData.UNCLE_SAM); + + private final String _name; + private final String[] _lore; + private final int _cost; + private final ItemStack _hat; + private final String[] _altNames; + + HatType(String name, String[] lore, int cost, Material material, String... altNames) + { + _name = name; + _lore = lore; + _cost = cost; + _hat = new ItemStack(material); + _altNames = altNames; + } + + HatType(String name, String[] lore, int cost, SkinData skin, String... altNames) + { + _name = name; + _lore = lore; + _cost = cost; + _hat = skin.getSkull(); + _altNames = altNames; + } + + public String getName() + { + return _name; + } + + public String[] getLore() + { + return _lore; + } + + public int getCost() + { + return _cost; + } + + public ItemStack getHat() + { + return _hat; + } + + public String[] getAltNames() + { + return _altNames; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java index be4f1d5ef..377c596f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.item; +import mineplex.core.gadget.gadgets.hat.HatType; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; @@ -25,7 +26,6 @@ import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; import mineplex.core.gadget.gadgets.Ammo; -import mineplex.core.gadget.gadgets.hat.HatCoal; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.itemstack.ItemStackFactory; @@ -80,7 +80,7 @@ public class ItemCoal extends ItemGadget int goal = -1; //Coal Hat - if (!Manager.getGadget(HatCoal.class).ownsGadget(player)) + if (!Manager.getHatGadget(HatType.Coal).ownsGadget(player)) { goal = _hat; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java new file mode 100644 index 000000000..4bdfdb754 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java @@ -0,0 +1,74 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.UUID; + +import com.mojang.authlib.GameProfile; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.*; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +public class MorphUncleSam extends MorphGadget +{ + + public MorphUncleSam(GadgetManager manager) + { + super(manager, "Uncle Sam Morph", UtilText.splitLinesToArray(new String[] + { + UtilText.colorWords("Turn into Uncle Sam and bring Justice and Freedom with you!", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), + C.blankLine, + "#" + C.cWhite + "Left-click to use Freedom Fireworks", + C.blankLine, + "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "FREEDOM FIREWORKS ARE EXTREMELY PATRIOTIC" + }, LineFormat.LORE), + -8, Material.FIREWORK, (byte) 0); + } + + @Override + public void enableCustom(Player player) + { + this.ApplyArmor(player); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player); + disguisePlayer.setProfile(new GameProfile(UUID.randomUUID(), C.cRed + "Uncle " + C.cBlue + "Sam")); + SkinData uncleSam = SkinData.UNCLE_SAM; + disguisePlayer.setSkinData(uncleSam); + disguisePlayer.setSendSkinDataToSelf(true); + Manager.getDisguiseManager().disguise(disguisePlayer); + } + + @Override + public void disableCustom(Player player) + { + this.RemoveArmor(player); + + Manager.getDisguiseManager().undisguise(player); + } + + @EventHandler + public void firework(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!isActive(player)) + return; + + if (!UtilEvent.isAction(event, UtilEvent.ActionType.L)) + return; + + if (!Recharge.Instance.use(player, getName(), 2500, false, false, "Cosmetics")) + return; + + int r = (int) (Math.random() * 3); + UtilFirework.playFreedomFirework(player.getLocation().clone().add(0, 2, 0)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java new file mode 100644 index 000000000..68c253c4a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/freedom/ParticleFreedom.java @@ -0,0 +1,49 @@ +package mineplex.core.gadget.gadgets.particle.freedom; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.particle.unrelated.FreedomFireworkEffect; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class ParticleFreedom extends ParticleGadget +{ + + private Map _effects = new HashMap<>(); + + public ParticleFreedom(GadgetManager manager) + { + super(manager, "Freedom Aura", UtilText.splitLineToArray(UtilText.colorWords("Do you hear that? It's the sound of Freedom swirling around you.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, + Material.WOOL, (byte) 11); + } + + @Override + public void playParticle(Player player, UpdateEvent updateEvent) + { + + } + + @Override + public void startEffect(Player player) + { + _effects.put(player.getUniqueId(), new FreedomFireworkEffect(player, Manager.getPlugin(), true)); + _effects.get(player.getUniqueId()).start(); + } + + @Override + public void stopEffect(Player player) + { + if (_effects.containsKey(player.getUniqueId())) + _effects.get(player.getUniqueId()).stop(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java new file mode 100644 index 000000000..f6914a598 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java @@ -0,0 +1,94 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import java.awt.*; +import java.util.Random; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.common.util.particles.NormalParticle; +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + +public class BabyFireworkEffect extends Effect +{ + + private Color _fireworkColor; + private Location _fireworkLocation; + private Random _random = new Random(); + private int _count = 0, _fireworkCount = 0; + private boolean _multipleColors = false; + + public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color color) + { + super(10, new EffectLocation(location), javaPlugin, 2); + _fireworkColor = color; + _fireworkLocation = location.clone(); + if (color == null) + { + _multipleColors = true; + _fireworkColor = Color.RED; + } + } + + @Override + public void runEffect() + { + if (_count == 0) + { + double randX = _random.nextDouble() * 2 - 1, randY = _random.nextDouble() + .5, + randZ = _random.nextDouble() * 2 - 1; + _fireworkLocation = _fireworkLocation.clone().add(randX, randY, randZ); + } + if (_count < 6 && _count % 2 == 0) + { + NormalParticle normalParticle = new NormalParticle(UtilParticle.ParticleType.FIREWORKS_SPARK, + _fireworkLocation.clone()); + normalParticle.display(); + _fireworkLocation = _fireworkLocation.clone().add(0, .2, 0); + } + // Displays the colored baby firework + else if (_count == 6) + { + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_fireworkColor), _fireworkLocation.clone()); + coloredParticle.display(); + } + else + { + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_fireworkColor), _fireworkLocation.clone()); + // Y UP + coloredParticle.setLocation(_fireworkLocation.clone().add(0, (_fireworkCount * .125), 0)); + coloredParticle.display(); + // Y DOWN + coloredParticle.setLocation(_fireworkLocation.clone().add(0, (_fireworkCount * .125) * -1, 0)); + coloredParticle.display(); + // X POSITIVE + coloredParticle.setLocation(_fireworkLocation.clone().add((_fireworkCount * .125), 0, 0)); + coloredParticle.display(); + // X NEGATIVE + coloredParticle.setLocation(_fireworkLocation.clone().add((_fireworkCount * .125) * -1, 0, 0)); + coloredParticle.display(); + // Z POSITIVE + coloredParticle.setLocation(_fireworkLocation.clone().add(0, 0, (_fireworkCount * .125))); + coloredParticle.display(); + // Z NEGATIVE + coloredParticle.setLocation(_fireworkLocation.clone().add(0, 0, (_fireworkCount * .125) * -1)); + coloredParticle.display(); + _fireworkCount++; + if (_multipleColors) + { + if (_fireworkColor == Color.RED) + _fireworkColor = Color.WHITE; + else if (_fireworkColor == Color.WHITE) + _fireworkColor = Color.BLUE; + else + _fireworkColor = Color.RED; + } + } + + _count++; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java new file mode 100644 index 000000000..3a30b84c2 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/Effect.java @@ -0,0 +1,56 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +public abstract class Effect +{ + + public int _ticksToRun = 20, _ticks = 0, _task; + public long _delay = 1; + public EffectLocation _effectLocation; + protected JavaPlugin _javaPlugin; + + public Effect(int ticks, EffectLocation effectLocation, JavaPlugin javaPlugin) + { + _ticksToRun = ticks; + _effectLocation = effectLocation; + _javaPlugin = javaPlugin; + } + + public Effect(int ticks, EffectLocation effectLocation, JavaPlugin javaPlugin, long delay) + { + _ticksToRun = ticks; + _effectLocation = effectLocation; + _javaPlugin = javaPlugin; + _delay = delay; + } + + public void start() + { + _task = Bukkit.getScheduler().scheduleSyncRepeatingTask(_javaPlugin, new Runnable() + { + @Override + public void run() + { + runEffect(); + update(); + } + }, 1, _delay); + } + + public void stop() + { + Bukkit.getScheduler().cancelTask(_task); + } + + private void update() + { + _ticks++; + if (_ticks == _ticksToRun) + Bukkit.getScheduler().cancelTask(_task); + } + + public abstract void runEffect(); + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/EffectLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/EffectLocation.java new file mode 100644 index 000000000..81ab19200 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/EffectLocation.java @@ -0,0 +1,40 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; + +public class EffectLocation +{ + + private Location _location; + private Entity _entity; + + public EffectLocation(Location location) + { + _location = location; + _entity = null; + } + + public EffectLocation(Entity entity) + { + _location = entity.getLocation(); + _entity = entity; + } + + public Location getLocation() + { + if (_entity != null && _entity.isValid() && !_entity.isDead()) + return _entity.getLocation().clone(); + if (_location != null) + return _location.clone(); + return null; + } + + public Location getFixedLocation() + { + if (_location != null) + return _location.clone(); + return null; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java new file mode 100644 index 000000000..5f1558e67 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java @@ -0,0 +1,50 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import java.awt.*; +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.plugin.java.JavaPlugin; + +public class FreedomFireworkEffect extends Effect +{ + + private Color _fireworkColor = Color.RED; + private int _count = 0, _max = -1; + private boolean _increaseY; + private Entity _playerEntity; + + public FreedomFireworkEffect(Entity entity, JavaPlugin javaPlugin, boolean increaseY) + { + super(-1, new EffectLocation(entity), javaPlugin, 15); + _increaseY = increaseY; + _playerEntity = entity; + } + + @Override + public void runEffect() + { + if (_playerEntity.isDead() || !_playerEntity.isValid()) + { + this.stop(); + return; + } + if (_count == _max) + { + this.stop(); + return; + } + Location location = _effectLocation.getLocation().clone().add(0, (_increaseY) ? 1 : 0, 0); + BabyFireworkEffect babyFireworkEffect = new BabyFireworkEffect(location, _javaPlugin, _fireworkColor); + babyFireworkEffect.start(); + _count++; + if (_fireworkColor == null) + _fireworkColor = Color.RED; + if (_fireworkColor == Color.RED) + _fireworkColor = Color.WHITE; + else if (_fireworkColor == Color.WHITE) + _fireworkColor = Color.BLUE; + else if (_fireworkColor == Color.BLUE) + _fireworkColor = null; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java new file mode 100644 index 000000000..67b04993a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java @@ -0,0 +1,85 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import java.awt.Color; + +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import org.bukkit.*; +import org.bukkit.entity.Entity; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +public class FreedomTrailEffect extends Effect +{ + + private Color _color = Color.RED; + private long _count, _jumpingTimer = 0; + private boolean _isJumping = false; + private Entity _entity; + + public FreedomTrailEffect(Entity entity, JavaPlugin javaPlugin) + { + super(-1, new EffectLocation(entity), javaPlugin); + _entity = entity; + } + + @Override + public void runEffect() + { + if (!_entity.isValid() || _entity.isDead()) + { + stop(); + return; + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(_color), _effectLocation.getLocation().clone().add(0, .5, 0)); + for (int i = 0; i < 7; i++) + { + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(0, .5, 0)); + coloredParticle.display(); + if (_isJumping) + { + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(.25, .5, 0)); + coloredParticle.display(); + coloredParticle.setLocation(_effectLocation.getLocation().clone().add(0, .5, .25)); + coloredParticle.display(); + } + } + if (_isJumping) + { + _jumpingTimer++; + if (_jumpingTimer >= 30) + { + setJumping(false); + _jumpingTimer = 0; + } + } + _count++; + if (_count % 5 == 0) + { + if (_color == Color.RED) + _color = Color.WHITE; + else if (_color == Color.WHITE) + _color = Color.BLUE; + else + _color = Color.RED; + } + if (_count == Long.MAX_VALUE - 1) + _count = 0; + } + + public void setJumping(boolean jumping) + { + _isJumping = jumping; + if (_isJumping) + { + int r = (int) (Math.random() * 3); + UtilFirework.launchFirework(_effectLocation.getLocation().clone(), FireworkEffect.Type.BALL, (r == 0) ? + org.bukkit.Color.RED : (r == 1) ? org.bukkit.Color.WHITE : org.bukkit.Color.BLUE, false, false, + new Vector(0, 0.01, 0), 1); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java index 8eec99719..5a4973f1f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectPodium.java @@ -62,19 +62,21 @@ public class WinEffectPodium extends WinEffectGadget } if(event.getType() != UpdateType.FAST) return; + + spawnFirework(event.getTick()); - Location loc = getBaseLocation(); - - for(int i = 0; i < 3; i++) - { - double r = 3; - double rad = (((Math.PI*2)/3.0)*i) + ((event.getTick()%240) * Math.PI/120.0); - double x = Math.sin(rad) * r; - double z = Math.cos(rad) * r; - - Location l = loc.clone().add(x, 0, z); - UtilFirework.launchFirework(l, Type.BALL, Color.fromRGB(UtilMath.r(255*255*255)), false, true, new Vector(0, 0.01, 0), 1); - } +// Location loc = getBaseLocation(); +// +// for(int i = 0; i < 3; i++) +// { +// double r = 3; +// double rad = (((Math.PI*2)/3.0)*i) + ((event.getTick()%240) * Math.PI/120.0); +// double x = Math.sin(rad) * r; +// double z = Math.cos(rad) * r; +// +// Location l = loc.clone().add(x, 0, z); +// UtilFirework.launchFirework(l, Type.BALL, Color.fromRGB(UtilMath.r(255*255*255)), false, true, new Vector(0, 0.01, 0), 1); +// } } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java index d2f8f9b67..026a8179c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java @@ -8,7 +8,7 @@ import mineplex.core.common.util.BukkitFuture; import mineplex.core.database.PlayerKeyValueRepository; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; -import mineplex.core.gadget.types.GadgetGameModifier; +import mineplex.core.gadget.types.GameModifierGadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.OutfitGadget; import org.bukkit.entity.Player; @@ -32,12 +32,15 @@ public class UserGadgetPersistence { for (Gadget gadget : _manager.getAllGadgets()) { + if (!gadget.ownsGadget(player)) + continue; GadgetType gadgetType = gadget.getGadgetType(); switch (gadgetType) { case MusicDisc: case Item: case Morph: + case Balloon: break; case Costume: OutfitGadget outfitGadget = (OutfitGadget) gadget; @@ -45,24 +48,24 @@ public class UserGadgetPersistence if (!values.containsKey(key)) continue; if (values.get(key).equals(gadget.getName())) - gadget.enable(player); + gadget.enable(player, false); break; case GameModifier: - GadgetGameModifier gadgetGameModifier = (GadgetGameModifier) gadget; - if (gadgetGameModifier.canAllowMultiple()) + GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget; + if (gameModifierGadget.canAllowMultiple()) { if (!values.containsKey(gadget.getName())) continue; if (values.get(gadget.getName()).equals("enabled")) - gadget.enable(player); + gadget.enable(player, false); } else { - String dataKey = "activeModifier" + gadgetGameModifier.getGameType().getName().replace(" ", ""); + String dataKey = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", ""); if (!values.containsKey(dataKey)) continue; if (values.get(dataKey).equals(gadget.getName())) - gadget.enable(player); + gadget.enable(player, false); } break; default: diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java new file mode 100644 index 000000000..ce9675b16 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetFreedom.java @@ -0,0 +1,22 @@ +package mineplex.core.gadget.set; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; +import mineplex.core.gadget.types.GadgetSet; + +public class SetFreedom extends GadgetSet +{ + + public SetFreedom(GadgetManager manager) + { + super(manager, "Freedom Set", "Coming soon...", + manager.getGadget(ArrowTrailFreedom.class), + manager.getGadget(DeathFreedom.class), + manager.getGadget(DoubleJumpFreedom.class), + manager.getGadget(ParticleFreedom.class)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java index 24cb0f684..b75cb3643 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java @@ -14,6 +14,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.inventory.ItemStack; public abstract class ArrowEffectGadget extends Gadget { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java new file mode 100644 index 000000000..f409db52c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java @@ -0,0 +1,64 @@ +package mineplex.core.gadget.types; + +import java.util.*; + +import mineplex.core.gadget.GadgetManager; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public abstract class BalloonGadget extends Gadget +{ + + protected static final Map> PLAYER_BALLOONS = new HashMap<>(); + + protected final Random _random; + + public BalloonGadget(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data, String... altNames) + { + super(manager, GadgetType.Balloon, name, desc, cost, material, data, 1, altNames); + _random = new Random(); + } + + protected boolean canSpawnBalloon(Player player) + { + if (PLAYER_BALLOONS.containsKey(player.getUniqueId())) + { + List balloonGadgets = PLAYER_BALLOONS.get(player.getUniqueId()); + return balloonGadgets.size() < 10; + } + return true; + } + + protected void addPlayerBalloon(Player player) + { + if (canSpawnBalloon(player)) + { + PLAYER_BALLOONS.computeIfAbsent(player.getUniqueId(), list -> new ArrayList<>()); + List balloonGadgets = PLAYER_BALLOONS.get(player.getUniqueId()); + balloonGadgets.add(this); + PLAYER_BALLOONS.put(player.getUniqueId(), balloonGadgets); + } + } + + protected void removePlayerBalloon(Player player) + { + List balloonGadgets = PLAYER_BALLOONS.computeIfPresent(player.getUniqueId(), (uuid, list) -> list); + if (balloonGadgets.contains(this)) + { + balloonGadgets.remove(this); + } + if (balloonGadgets.size() >= 1) + PLAYER_BALLOONS.put(player.getUniqueId(), balloonGadgets); + else + PLAYER_BALLOONS.remove(player.getUniqueId()); + } + + protected double getNewHeight(Player player) + { + List balloonGadgets = PLAYER_BALLOONS.computeIfPresent(player.getUniqueId(), (uuid, list) -> list); + if (balloonGadgets != null) + return balloonGadgets.size() * _random.nextDouble() * (_random.nextInt(1) + 2); + return 3; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index 05c4c501a..5b960957a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -93,16 +93,22 @@ public abstract class Gadget extends SalesPackageBase implements Listener public void enable(Player player) { - GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); + enable(player, true); + } + + public void enable(Player player, boolean message) + { + GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); - + if (gadgetEvent.isCancelled()) { UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); return; } - - System.out.println(player.getName() + " has activated " + Name); + + if (message) + System.out.println(player.getName() + " has activated " + Name); Manager.setActive(player, this); enableCustom(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java index 3ad4cb0e9..e36e30d47 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java @@ -16,7 +16,8 @@ public enum GadgetType Hat("Hats", "activeHat"), Taunt("Taunts", "activeTaunt"), WinEffect("Win Effects", "activeWinEffect"), - GameModifier("Game Modifiers", ""); + GameModifier("Game Modifiers", ""), + Balloon("Balloons", ""); private String _name; private String _databaseKey; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java similarity index 91% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java index 03d060e85..6fbb29c3c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetGameModifier.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java @@ -11,7 +11,7 @@ import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; /** * An abstract wrapper for Gadgets of the type GameModifiers */ -public abstract class GadgetGameModifier extends Gadget +public abstract class GameModifierGadget extends Gadget { protected final GameModifierType _type; @@ -26,7 +26,7 @@ public abstract class GadgetGameModifier extends Gadget * @param mat The display material used in GUIs * @param data The display data used in GUIs */ - public GadgetGameModifier(GadgetManager manager, GameModifierType type, String name, String[] desc, int cost, Material mat, byte data, boolean allowMultiple) + public GameModifierGadget(GadgetManager manager, GameModifierType type, String name, String[] desc, int cost, Material mat, byte data, boolean allowMultiple) { super(manager, GadgetType.GameModifier, name, desc, cost, mat, data); _type = type; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java index 0f6ff3dfb..9ad358907 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.types; +import mineplex.core.gadget.gadgets.hat.HatType; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -16,16 +17,23 @@ public abstract class HatGadget extends OutfitGadget { private ItemStack _hat; + private HatType _hatType; - public HatGadget(GadgetManager manager, String name, String[] desc, int cost, ItemStack item, String... altNames) + public HatGadget(GadgetManager manager, HatType type) { - super(manager, name, desc, cost, ArmorSlot.Helmet, item.getType(), item.getData().getData(), altNames); - _hat = item; + super(manager, type.getName(), type.getLore(), type.getCost(), ArmorSlot.Helmet, type.getHat().getType(), type.getHat().getData().getData(), type.getAltNames()); + _hat = type.getHat(); + _hatType = type; ItemMeta im = _hat.getItemMeta(); - im.setDisplayName(C.cGreen + C.Bold + name); + im.setDisplayName(C.cGreen + C.Bold + type.getName()); _hat.setItemMeta(im); } + + public HatGadget(GadgetManager manager, String name, String[] desc, int cost, ItemStack item) + { + super(manager, name, desc, cost, ArmorSlot.Helmet, item.getType(), item.getData().getData()); + } public HatGadget(GadgetManager manager, String name, String[] desc, int cost, String playerName) { @@ -92,7 +100,9 @@ public abstract class HatGadget extends OutfitGadget removeArmor(player); } - - + public HatType getHatType() + { + return _hatType; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java index a9c0de2f5..669d46c32 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java @@ -14,7 +14,7 @@ public abstract class MorphGadget extends Gadget public MorphGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data) { super(manager, GadgetType.Morph, name, desc, cost, mat, data); - } + } public void ApplyArmor(Player player) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java index 77d46f7f1..c53698df9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -79,20 +79,4 @@ public abstract class OutfitGadget extends Gadget else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(null); else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(null); } - - public String getDatabaseKey() - { - switch (_slot) - { - case Helmet: - return "activeCostumeHelmet"; - case Chest: - return "activeCostumeChestplate"; - case Legs: - return "activeCostumeLeggings"; - case Boots: - return "activeCostumeBoots"; - } - return ""; - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java index c46423965..6a4bf9842 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java @@ -35,6 +35,7 @@ public abstract class ParticleGadget extends Gadget { Manager.removeGadgetType(player, GadgetType.Particle, this); _active.add(player); + startEffect(player); UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(getName()) + ".")); } @@ -42,7 +43,10 @@ public abstract class ParticleGadget extends Gadget public void disableCustom(Player player) { if (_active.remove(player)) + { + stopEffect(player); UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + ".")); + } } public boolean shouldDisplay(Player player) @@ -74,4 +78,16 @@ public abstract class ParticleGadget extends Gadget * @param event The update event */ public abstract void playParticle(Player player, UpdateEvent event); + + /** + * Called when the effect starts + * @param player The player that activated it + */ + public void startEffect(Player player){} + + /** + * Called when the effect ends + * @param player The player that disabled it + */ + public void stopEffect(Player player){} } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index a576bf586..30020d430 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.types; +import java.awt.*; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -7,9 +8,8 @@ import java.util.List; import java.util.UUID; import mineplex.core.common.util.*; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; +import org.bukkit.*; +import org.bukkit.Color; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; @@ -28,6 +28,7 @@ import mineplex.core.common.block.schematic.UtilSchematic; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; /** * A wrapper for different win effects @@ -79,12 +80,12 @@ public abstract class WinEffectGadget extends Gadget * @param mat The display material of the WinEffect * @param data The display data of the WinEffect * @param free Sets the gadget to be free for all the players by default - * @param alternativesalepackageNames Alternative packet names used to check if the player owns this WinEffect + * @param altName Alternative package names used to check if the player owns this WinEffect */ public WinEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, - boolean free, String... alternativesalepackageNames) + boolean free, String... altName) { - super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, free, alternativesalepackageNames); + super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, free, altName); } public void runPlay() @@ -319,4 +320,38 @@ public abstract class WinEffectGadget extends Gadget } } + public void spawnFirework(int tick, Color fireworkColor) + { + Location loc = getBaseLocation(); + + for(int i = 0; i < 3; i++) + { + double r = 3; + double rad = (((Math.PI * 2) / 3.0) * i) + ((tick % 240) * Math.PI / 120.0); + double x = Math.sin(rad) * r; + double z = Math.cos(rad) * r; + + Location l = loc.clone().add(x, 0, z); + UtilFirework.launchFirework(l, FireworkEffect.Type.BALL, fireworkColor, false, + true, new Vector(0, 0.01, 0), 1); + } + } + + public void spawnFirework(int tick) + { + Location loc = getBaseLocation(); + + for(int i = 0; i < 3; i++) + { + double r = 3; + double rad = (((Math.PI * 2) / 3.0) * i) + ((tick % 240) * Math.PI / 120.0); + double x = Math.sin(rad) * r; + double z = Math.cos(rad) * r; + + Location l = loc.clone().add(x, 0, z); + UtilFirework.launchFirework(l, FireworkEffect.Type.BALL, Color.fromRGB(UtilMath.r(255 * 255 * 255)), false, + true, new Vector(0, 0.01, 0), 1); + } + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java index c25b3e2ad..242e21dfa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java @@ -16,7 +16,7 @@ public class DragonMount extends Mount } @Override - public void EnableCustom(final Player player) + public void enableCustom(final Player player) { player.leaveVehicle(); player.eject(); @@ -36,7 +36,7 @@ public class DragonMount extends Mount } @Override - public void Disable(Player player) + public void disable(Player player) { DragonData data = _active.remove(player); if (data != null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java index 0e0b801ac..232084feb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java @@ -82,7 +82,7 @@ public class HorseMount extends Mount> } } - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -117,7 +117,7 @@ public class HorseMount extends Mount> _active.put(player, mount); } - public void Disable(Player player) + public void disable(Player player) { SingleEntityMountData mount = _active.remove(player); if (mount != null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java index 5192598fc..b63bea8d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java @@ -41,7 +41,7 @@ public abstract class Mount extends SalesPackageBase implem } - public final void Enable(Player player) + public final void enable(Player player) { MountActivateEvent gadgetEvent = new MountActivateEvent(player, this); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); @@ -52,56 +52,56 @@ public abstract class Mount extends SalesPackageBase implem return; } - EnableCustom(player); + enableCustom(player); Manager.setActive(player, this); } - public abstract void EnableCustom(Player player); - public abstract void Disable(Player player); + public abstract void enableCustom(Player player); + public abstract void disable(Player player); - public void DisableForAll() + public void disableForAll() { for (Player player : UtilServer.getPlayers()) - Disable(player); + disable(player); } @EventHandler - public void PlayerJoin(PlayerJoinEvent event) + public void playerJoin(PlayerJoinEvent event) { if (event.getPlayer().isOp()) _owners.add(event.getPlayer()); } @EventHandler - public void PlayerQuit(PlayerQuitEvent event) + public void playerQuit(PlayerQuitEvent event) { _owners.remove(event.getPlayer()); - Disable(event.getPlayer()); + disable(event.getPlayer()); } - public HashSet GetOwners() + public HashSet getOwners() { return _owners; } - public HashMap GetActive() + public HashMap getActive() { return _active; } - public boolean IsActive(Player player) + public boolean isActive(Player player) { return _active.containsKey(player); } - public boolean HasMount(Player player) + public boolean hasMount(Player player) { return _owners.contains(player); } public T getMountData(Entity ent) { - for(T data : GetActive().values()) + for(T data : getActive().values()) { if(data.isPartOfMount(ent)) return data; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 905a61ba4..07f07b5a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -3,6 +3,7 @@ package mineplex.core.mount; import java.util.ArrayList; import java.util.List; +import mineplex.core.mount.types.*; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -23,17 +24,6 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; -import mineplex.core.mount.types.MountBabyReindeer; -import mineplex.core.mount.types.MountCart; -import mineplex.core.mount.types.MountDragon; -import mineplex.core.mount.types.MountFrost; -import mineplex.core.mount.types.MountMule; -import mineplex.core.mount.types.MountSlime; -import mineplex.core.mount.types.MountSpider; -import mineplex.core.mount.types.MountTitan; -import mineplex.core.mount.types.MountUndead; -import mineplex.core.mount.types.MountValentinesSheep; -import mineplex.core.mount.types.MountZombie; public class MountManager extends MiniPlugin { @@ -72,6 +62,7 @@ public class MountManager extends MiniPlugin _types.add(new MountTitan(this)); _types.add(new MountBabyReindeer(this)); _types.add(new MountValentinesSheep(this)); + _types.add(new MountFreedomHorse(this)); //_types.add(new MountSheep(this)); } @@ -84,7 +75,7 @@ public class MountManager extends MiniPlugin public void DeregisterAll(Player player) { for (Mount mount : _types) - mount.Disable(player); + mount.disable(player); } @EventHandler @@ -125,13 +116,13 @@ public class MountManager extends MiniPlugin { for (Mount mount : _types) for (Player player : UtilServer.getPlayers()) - mount.Disable(player); + mount.disable(player); } public void DisableAll(Player player) { for (Mount mount : _types) - mount.Disable(player); + mount.disable(player); } @EventHandler @@ -200,6 +191,17 @@ public class MountManager extends MiniPlugin return null; } + public Mount getMount(String name) + { + Mount fMount = null; + for (Mount mount : _types) + { + if (mount.getName().equalsIgnoreCase(name)) + fMount = mount; + } + return fMount; + } + public boolean isMount(Entity ent) { return getMount(ent) != null; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java index f9d10c5d5..eb97aa560 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java @@ -37,9 +37,9 @@ public class MountBabyReindeer extends HorseMount } @Override - public void EnableCustom(Player player) { - super.EnableCustom(player); - Horse horse = GetActive().get(player).getEntity(); + public void enableCustom(Player player) { + super.enableCustom(player); + Horse horse = getActive().get(player).getEntity(); horse.setBaby(); horse.setMaxHealth(20); } @@ -49,7 +49,7 @@ public class MountBabyReindeer extends HorseMount { if(event.getType() != UpdateType.TICK) return; - for(SingleEntityMountData horse : GetActive().values()) + for(SingleEntityMountData horse : getActive().values()) { if(horse.getEntity().getPassenger() != horse.getOwner()) continue; @@ -66,7 +66,7 @@ public class MountBabyReindeer extends HorseMount @EventHandler public void onClick(PlayerInteractEntityEvent event) { - if(!IsActive(event.getPlayer())) return; + if(!isActive(event.getPlayer())) return; SingleEntityMountDatadata = getMountData(event.getRightClicked()); if(data == null) return; if(data.getOwner() != event.getPlayer()) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java index 7bf339bc8..a1f9f5a5b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java @@ -36,7 +36,7 @@ public class MountCart extends Mount> KnownPackage = false; } - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -53,7 +53,7 @@ public class MountCart extends Mount> _active.put(player, mount); } - public void Disable(Player player) + public void disable(Player player) { SingleEntityMountData mount = _active.remove(player); if (mount != null) @@ -88,10 +88,10 @@ public class MountCart extends Mount> @EventHandler public void target(EntityTargetEvent event) { - if (!GetActive().containsKey(event.getTarget())) + if (!getActive().containsKey(event.getTarget())) return; - if (!GetActive().get(event.getTarget()).equals(event.getEntity())) + if (!getActive().get(event.getTarget()).equals(event.getEntity())) event.setCancelled(true); } @@ -102,7 +102,7 @@ public class MountCart extends Mount> return; //Bounce - for (SingleEntityMountData cartData : GetActive().values()) + for (SingleEntityMountData cartData : getActive().values()) { Minecart cart = cartData.getEntity(); @@ -124,7 +124,7 @@ public class MountCart extends Mount> } //Collide - for (SingleEntityMountData cartData : GetActive().values()) + for (SingleEntityMountData cartData : getActive().values()) { Minecart cart = cartData.getEntity(); @@ -139,7 +139,7 @@ public class MountCart extends Mount> if (!Recharge.Instance.usable(player, getName() + " Collide")) continue; - for (SingleEntityMountData otherData : GetActive().values()) + for (SingleEntityMountData otherData : getActive().values()) { Minecart other = otherData.getEntity(); if (other.equals(cart)) @@ -178,7 +178,7 @@ public class MountCart extends Mount> @EventHandler public void cancelBreak(VehicleDamageEvent event) { - if (GetActive().values().contains(event.getVehicle())) + if (getActive().values().contains(event.getVehicle())) event.setCancelled(true); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java index 2830acfa4..bf17e7716 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountDragon.java @@ -38,7 +38,7 @@ public class MountDragon extends DragonMount { if (event.getType() == UpdateType.TICK) { - for (DragonData data : GetActive().values()) + for (DragonData data : getActive().values()) { UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, data.Dragon.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0f, 20, @@ -53,14 +53,14 @@ public class MountDragon extends DragonMount if (event.getType() != UpdateType.TICK) return; - for (DragonData data : GetActive().values()) + for (DragonData data : getActive().values()) data.Move(); HashSet toRemove = new HashSet(); - for (Player player : GetActive().keySet()) + for (Player player : getActive().keySet()) { - DragonData data = GetActive().get(player); + DragonData data = getActive().get(player); if (data == null) { toRemove.add(player); @@ -76,25 +76,25 @@ public class MountDragon extends DragonMount } for (Player player : toRemove) - Disable(player); + disable(player); } @EventHandler public void DragonTargetCancel(EntityTargetEvent event) { - if (GetActive().containsValue(event.getEntity())) + if (getActive().containsValue(event.getEntity())) event.setCancelled(true); } public void SetName(String news) { - for (DragonData dragon : GetActive().values()) + for (DragonData dragon : getActive().values()) dragon.Dragon.setCustomName(news); } public void setHealthPercent(double healthPercent) { - for (DragonData dragon : GetActive().values()) + for (DragonData dragon : getActive().values()) { double health = healthPercent * dragon.Dragon.getMaxHealth(); if (health <= 0.0) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFreedomHorse.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFreedomHorse.java new file mode 100644 index 000000000..5f8c2d498 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFreedomHorse.java @@ -0,0 +1,80 @@ +package mineplex.core.mount.types; + +import java.util.*; +import java.util.List; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.gadgets.particle.unrelated.FreedomTrailEffect; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.recharge.Recharge; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.HorseJumpEvent; +import org.bukkit.inventory.ItemStack; + +public class MountFreedomHorse extends HorseMount +{ + + private Map, FreedomTrailEffect> _trailMap = new HashMap<>(); + + public MountFreedomHorse(MountManager manager) + { + super(manager, "Freedom Mount", + UtilText.splitLineToArray(UtilText.colorWords("The British might be coming, but with this impressive mount you have nothing to fear.", + ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), + Material.FIREWORK, (byte) 0, -7, Horse.Color.WHITE, Horse.Style.WHITE, Horse.Variant.HORSE, 1, null); + } + + @Override + public void enableCustom(Player player) + { + super.enableCustom(player); + SingleEntityMountData horseData = getActive().get(player); + horseData.getEntity().getInventory().setArmor(new ItemStack(Material.DIAMOND_BARDING)); + _trailMap.put(horseData, new FreedomTrailEffect(horseData.getEntity(), Manager.getPlugin())); + _trailMap.get(horseData).start(); + } + + @Override + public void disable(Player player) + { + super.disable(player); + List> toRemove = new ArrayList<>(); + for (SingleEntityMountData horseData : _trailMap.keySet()) + { + if (horseData.getOwner().equals(player)) + toRemove.add(horseData); + } + for (SingleEntityMountData horseData : toRemove) + { + _trailMap.get(horseData).stop(); + _trailMap.remove(horseData); + } + } + + @EventHandler + public void horseJump(HorseJumpEvent event) + { + for (SingleEntityMountData horseData : _trailMap.keySet()) + { + if (horseData.getEntity().equals(event.getEntity())) + { + if (!Recharge.Instance.use(horseData.getOwner(), getName(), 2500, false, false, "Cosmetics")) + { + event.setPower(0f); + event.setCancelled(true); + return; + } + _trailMap.get(horseData).setJumping(true); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java index e836ad324..d12a76f1b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java @@ -36,7 +36,7 @@ public class MountFrost extends HorseMount public void Trail(UpdateEvent event) { if (event.getType() == UpdateType.TICK) - for (SingleEntityMountData horseData : GetActive().values()) + for (SingleEntityMountData horseData : getActive().values()) { Horse horse = horseData.getEntity(); UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java index 89ba01f96..88c444306 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSheep.java @@ -36,7 +36,7 @@ public class MountSheep extends HorseMount } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -69,7 +69,7 @@ public class MountSheep extends HorseMount if (event.getType() != UpdateType.TICK) return; - for (SingleEntityMountData horseData : GetActive().values()) + for (SingleEntityMountData horseData : getActive().values()) { Horse horse = horseData.getEntity(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java index 3932c55aa..265601406 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java @@ -37,7 +37,7 @@ public class MountSlime extends Mount> KnownPackage = false; } - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -57,7 +57,7 @@ public class MountSlime extends Mount> _active.put(player, mount); } - public void Disable(Player player) + public void disable(Player player) { SingleEntityMountData mount = _active.remove(player); if (mount != null) @@ -77,7 +77,7 @@ public class MountSlime extends Mount> if (event.getRightClicked() == null) return; - SingleEntityMountData data = GetActive().get(event.getPlayer()); + SingleEntityMountData data = getActive().get(event.getPlayer()); if(data == null) return; @@ -94,10 +94,10 @@ public class MountSlime extends Mount> @EventHandler public void target(EntityTargetEvent event) { - if (!GetActive().containsKey(event.getTarget())) + if (!getActive().containsKey(event.getTarget())) return; - if (!GetActive().get(event.getTarget()).equals(event.getEntity())) + if (!getActive().get(event.getTarget()).equals(event.getEntity())) event.setCancelled(true); } @@ -108,7 +108,7 @@ public class MountSlime extends Mount> return; //Bounce - for (SingleEntityMountData slimeData : GetActive().values()) + for (SingleEntityMountData slimeData : getActive().values()) { Slime slime = slimeData.getEntity(); @@ -139,7 +139,7 @@ public class MountSlime extends Mount> } //Collide - for (SingleEntityMountData slimeData : GetActive().values()) + for (SingleEntityMountData slimeData : getActive().values()) { Slime slime = slimeData.getEntity(); if (slime.getPassenger() == null) @@ -153,7 +153,7 @@ public class MountSlime extends Mount> if (!Recharge.Instance.usable(player, getName() + " Collide")) continue; - for (SingleEntityMountData otherSlime : GetActive().values()) + for (SingleEntityMountData otherSlime : getActive().values()) { Slime other = otherSlime.getEntity(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 995fc38a9..6f22ffc3e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -55,7 +55,7 @@ public class MountSpider extends HorseMount } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { player.leaveVehicle(); player.eject(); @@ -105,9 +105,9 @@ public class MountSpider extends HorseMount return; ArrayList used = new ArrayList(); - for (Player player : GetActive().keySet()) + for (Player player : getActive().keySet()) { - Horse horse = GetActive().get(player).getEntity(); + Horse horse = getActive().get(player).getEntity(); used.add(horse); @@ -128,7 +128,7 @@ public class MountSpider extends HorseMount if (event.getType() != UpdateType.TICK) return; - for (Entry> entry : GetActive().entrySet()) + for (Entry> entry : getActive().entrySet()) { Player player = entry.getKey(); Horse horse = entry.getValue().getEntity(); @@ -194,9 +194,9 @@ public class MountSpider extends HorseMount if (event.getType() != UpdateType.TICK) return; - for (Player player : GetActive().keySet()) + for (Player player : getActive().keySet()) { - final Horse horse = GetActive().get(player).getEntity(); + final Horse horse = getActive().get(player).getEntity(); if (horse.getPassenger() != player) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java index 36b09d6af..5ee7e2377 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java @@ -31,9 +31,9 @@ public class MountTitan extends Mount } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - if(GetActive().size() >= 3) + if(getActive().size() >= 3) { UtilPlayer.message(player, F.main("Mount", "The maximum amount of simultaneous " + F.elem(getName()) + " in this lobby has been reached.")); return; @@ -53,7 +53,7 @@ public class MountTitan extends Mount } @Override - public void Disable(Player player) + public void disable(Player player) { MountTitanData data = _active.remove(player); if (data != null) @@ -85,7 +85,7 @@ public class MountTitan extends Mount if (event.getRightClicked() == null) return; - for(MountTitanData mount : GetActive().values()) + for(MountTitanData mount : getActive().values()) { if(mount.isPartOfMount(event.getRightClicked())) { @@ -94,10 +94,10 @@ public class MountTitan extends Mount } } - if (!GetActive().containsKey(event.getPlayer())) + if (!getActive().containsKey(event.getPlayer())) return; - if (!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer())) + if (!getActive().get(event.getPlayer()).ownsMount(event.getPlayer())) { UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!")); return; @@ -106,7 +106,7 @@ public class MountTitan extends Mount event.getPlayer().leaveVehicle(); event.getPlayer().eject(); - GetActive().get(event.getPlayer()).mount(event.getPlayer(), event.getRightClicked()); + getActive().get(event.getPlayer()).mount(event.getPlayer(), event.getRightClicked()); } @EventHandler @@ -115,10 +115,10 @@ public class MountTitan extends Mount if (!(event.getEntity() instanceof Player)) return; - if (!GetActive().containsKey(event.getTarget())) + if (!getActive().containsKey(event.getTarget())) return; - if (!GetActive().get(event.getTarget()).ownsMount((Player)event.getEntity())) + if (!getActive().get(event.getTarget()).ownsMount((Player)event.getEntity())) event.setCancelled(true); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java index fead4b102..dcc436651 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountUndead.java @@ -35,7 +35,7 @@ public class MountUndead extends HorseMount public void Trail(UpdateEvent event) { if (event.getType() == UpdateType.TICK) - for (SingleEntityMountData horseData : GetActive().values()) + for (SingleEntityMountData horseData : getActive().values()) { Horse horse = horseData.getEntity(); UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0), @@ -43,7 +43,7 @@ public class MountUndead extends HorseMount } if (event.getType() == UpdateType.FAST) - for (SingleEntityMountData horseData : GetActive().values()) + for (SingleEntityMountData horseData : getActive().values()) { Horse horse = horseData.getEntity(); UtilParticle.PlayParticleToAll(ParticleType.LAVA, horse.getLocation().add(0, 1, 0), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java index 5213be86b..c60fc1620 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountValentinesSheep.java @@ -37,11 +37,11 @@ public class MountValentinesSheep extends HorseMount } @Override - public void EnableCustom(Player player) + public void enableCustom(Player player) { - super.EnableCustom(player); + super.enableCustom(player); - Horse horse = GetActive().get(player).getEntity(); + Horse horse = getActive().get(player).getEntity(); UtilEnt.silence(horse, true); @@ -54,7 +54,7 @@ public class MountValentinesSheep extends HorseMount @EventHandler public void doAnimations(UpdateEvent event) { - for (SingleEntityMountData ent : GetActive().values()) + for (SingleEntityMountData ent : getActive().values()) { if (!ent.getEntity().isValid()) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 5e2b4edbb..48c341a2d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -5,10 +5,17 @@ import java.util.EnumMap; import java.util.List; import java.util.Random; +import mineplex.core.common.util.banner.CountryFlag; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; +import mineplex.core.gadget.gadgets.hat.*; +import mineplex.core.gadget.gadgets.morph.*; import mineplex.core.gadget.gadgets.particle.*; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord; import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; @@ -16,6 +23,7 @@ import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; +import mineplex.core.mount.types.*; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -53,13 +61,6 @@ import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; -import mineplex.core.gadget.gadgets.hat.HatCompanionBlock; -import mineplex.core.gadget.gadgets.hat.HatGrinch; -import mineplex.core.gadget.gadgets.hat.HatLovestruck; -import mineplex.core.gadget.gadgets.hat.HatPresent; -import mineplex.core.gadget.gadgets.hat.HatSecretPackage; -import mineplex.core.gadget.gadgets.hat.HatSnowman; -import mineplex.core.gadget.gadgets.hat.HatTeddyBear; import mineplex.core.gadget.gadgets.item.ItemBatGun; import mineplex.core.gadget.gadgets.item.ItemBow; import mineplex.core.gadget.gadgets.item.ItemCoal; @@ -73,14 +74,6 @@ import mineplex.core.gadget.gadgets.item.ItemPaintballGun; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemTNT; -import mineplex.core.gadget.gadgets.morph.MorphBat; -import mineplex.core.gadget.gadgets.morph.MorphBlock; -import mineplex.core.gadget.gadgets.morph.MorphChicken; -import mineplex.core.gadget.gadgets.morph.MorphCow; -import mineplex.core.gadget.gadgets.morph.MorphEnderman; -import mineplex.core.gadget.gadgets.morph.MorphSlime; -import mineplex.core.gadget.gadgets.morph.MorphSnowman; -import mineplex.core.gadget.gadgets.morph.MorphVillager; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -100,12 +93,6 @@ import mineplex.core.gadget.types.HatGadget; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.Mount; -import mineplex.core.mount.types.MountBabyReindeer; -import mineplex.core.mount.types.MountCart; -import mineplex.core.mount.types.MountFrost; -import mineplex.core.mount.types.MountMule; -import mineplex.core.mount.types.MountSlime; -import mineplex.core.mount.types.MountUndead; import mineplex.core.pet.Pet; import mineplex.core.pet.PetManager; import mineplex.core.reward.RewardPool.Type; @@ -635,8 +622,8 @@ public class RewardManager // addInventoryReward(Type.VALENTINES_GIFT, getGadget(ItemFlowerGift.class), rarity, 100, 0, 1, 1); // WINTER Gadgets - addGadget(Type.WINTER_HOLIDAY, getGadget(HatPresent.class), rarity, 5); - addGadget(Type.WINTER_HOLIDAY, getGadget(HatSnowman.class), rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.Present, rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.Snowman, rarity, 5); } @@ -715,10 +702,10 @@ public class RewardManager // VALENTINES //Hats - addGadget(Type.VALENTINES_GIFT, getGadget(HatCompanionBlock.class), rarity, 100, 0); - addGadget(Type.VALENTINES_GIFT, getGadget(HatLovestruck.class), rarity, 100, 0); - addGadget(Type.VALENTINES_GIFT, getGadget(HatSecretPackage.class), rarity, 100, 0); - addGadget(Type.VALENTINES_GIFT, getGadget(HatTeddyBear.class), rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.Companion_Block, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.Lovestruck, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.Secret_Package, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.Teddy_Bear, rarity, 100, 0); // WINTER @@ -727,6 +714,12 @@ public class RewardManager addGadget(Type.WINTER_HOLIDAY, getGadget(DeathCandyCane.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(DoubleJumpFirecracker.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(ParticleCandyCane.class), rarity, 5); + + // FREEDOM + addHat(Type.FREEDOM, HatType.Uncle_Sam, rarity, 100); + addGadget(Type.FREEDOM, getGadget(DoubleJumpFreedom.class), rarity, 50); + addGadget(Type.FREEDOM, getGadget(ArrowTrailFreedom.class), rarity, 10); + addGadget(Type.FREEDOM, getGadget(DeathFreedom.class), rarity, 75); } public void addLegendary() @@ -795,9 +788,9 @@ public class RewardManager addGadget(Type.WINTER_HOLIDAY, getGadget(DeathFrostLord.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(DoubleJumpFrostLord.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(ParticleFrostLord.class), rarity, 5); - addGadget(Type.WINTER_HOLIDAY, getGadget(HatGrinch.class), rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.Grinch, rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(MorphSnowman.class), rarity, 5); - addMount( Type.WINTER_HOLIDAY, getMount(MountBabyReindeer.class), rarity, 5); + addMount(Type.WINTER_HOLIDAY, getMount(MountBabyReindeer.class), rarity, 5); @@ -809,8 +802,12 @@ public class RewardManager addGadget(Type.VALENTINES_GIFT, getGadget(DeathCupidsBrokenHeart.class), rarity, 100); addGadget(Type.VALENTINES_GIFT, getGadget(DoubleJumpCupidsWings.class), rarity, 100); addGadget(Type.VALENTINES_GIFT, getGadget(ParticleHeart.class), rarity, 100, 0); - - + + + // FREEDOM + addMount(Type.FREEDOM, getMount(MountFreedomHorse.class), rarity, 1); + addGadget(Type.FREEDOM, getGadget(MorphUncleSam.class), rarity, 5); + addGadget(Type.FREEDOM, getGadget(ParticleFreedom.class), rarity, 50); } @@ -862,9 +859,17 @@ public class RewardManager public UnknownPackageReward addGadget(RewardPool.Type type, Gadget gadget, String displayName, RewardRarity rarity, int weight, int shards) { + ItemStack display = new ItemStack(gadget.getDisplayMaterial(), 1, (short) 0, gadget.getDisplayData()); + if (type == Type.FREEDOM) + { + if (!displayName.contains("Uncle Sam")) + { + display = CountryFlag.Usa.getBanner(); + } + } UnknownPackageReward reward = new UnknownPackageReward(_donationManager, gadget.getGadgetType().getCategoryType(), displayName, - gadget.getName(), new ItemStack(gadget.getDisplayMaterial(), 1, (short) 0, gadget.getDisplayData()), rarity, + gadget.getName(), display, rarity, weight, shards); addReward(type, reward); return reward; @@ -885,6 +890,17 @@ public class RewardManager Gadget gadget = _gadgetManager.getGameModifier(skin); return addGadget(type, gadget, gadget.getDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards); } + + public UnknownPackageReward addHat(Type type, HatType hatType, RewardRarity rarity, int weight) + { + return addHat(type, hatType, rarity, weight, getShards(rarity)); + } + + public UnknownPackageReward addHat(Type type, HatType hatType, RewardRarity rarity, int weight, int shards) + { + Gadget gadget = _gadgetManager.getHatGadget(hatType); + return addGadget(type, gadget, gadget.getDisplayName(), rarity, weight, shards); + } public InventoryReward addInventoryReward(RewardPool.Type type, ItemGadget gadget, RewardRarity rarity, int weight) { @@ -1001,7 +1017,7 @@ public class RewardManager public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType type) { int amount = 4; - if(type == RewardType.IlluminatedChest) amount = 1; + if(type == RewardType.IlluminatedChest || type == RewardType.FreedomChest) amount = 1; int currentReward = 0; Reward[] rewards = new Reward[amount]; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index cd783ad51..05ecc8971 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -51,6 +51,7 @@ public class RewardPool WINTER_HOLIDAY(true), VALENTINES_GIFT(false), ILLUMINATED(false), + FREEDOM(false), CARL_SPINNER(true); private boolean _useDuplicates; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index 04204d25b..c007105be 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -12,6 +12,7 @@ public enum RewardType MythicalChest( 0.1, 4, 16, 72), WinterChest( 0, 5, 18, 32), IlluminatedChest( 0, 2, 16, 72), + FreedomChest( 0, 5, 18, 0), ValentinesGift( 0, 7, 20, 20), SpinnerFiller( 0.1, 1, 4, 20), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index df12ec920..3540a8c96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -1,5 +1,7 @@ package mineplex.core.treasure; +import java.awt.*; +import java.awt.Color; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; @@ -8,22 +10,20 @@ import java.util.Random; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Bukkit; -import org.bukkit.Effect; -import org.bukkit.Material; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.*; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.treasure.animation.*; +import org.bukkit.*; import org.bukkit.block.Block; +import org.bukkit.block.Skull; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Player; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.hologram.HologramManager; import mineplex.core.reward.RankRewardData; import mineplex.core.reward.Reward; @@ -32,15 +32,6 @@ import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardType; import mineplex.core.status.ServerStatusManager; import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage; -import mineplex.core.treasure.animation.Animation; -import mineplex.core.treasure.animation.BlockChangeAnimation; -import mineplex.core.treasure.animation.ChestOpenAnimation; -import mineplex.core.treasure.animation.ChestSpawnAnimation; -import mineplex.core.treasure.animation.LootLegendaryAnimation; -import mineplex.core.treasure.animation.LootMythicalAnimation; -import mineplex.core.treasure.animation.LootRareAnimation; -import mineplex.core.treasure.animation.LootUncommonAnimation; -import mineplex.core.treasure.animation.TreasureRemoveAnimation; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; @@ -138,7 +129,7 @@ public class Treasure if (_tickCount % 10 == 0 && _currentChest < _chestData.length) { - ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this,_chestData[_currentChest].getBlock(), _chestBlockInfo, _centerBlock, _currentChest); + ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this,_chestData[_currentChest].getBlock(), _chestBlockInfo, _centerBlock, _currentChest, _statusManager.getPlugin()); _animations.add(chestSpawn); _currentChest++; } @@ -185,6 +176,15 @@ public class Treasure UtilParticle.PlayParticleToAll(type, block.getLocation().add(0.5, 0.0, 0.5), 0.1f, 0.1f, 0.1f, 0.05f, 4, ViewDist.NORMAL); } + else if (_treasureType == TreasureType.FREEDOM) + { + int r = (int) (Math.random() * 3); + double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.RED : (r == 1) ? Color.WHITE : Color.BLUE), + block.getLocation().add(.5 + rX, .7, .5 + rX)); + coloredParticle.display(); + } else { UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, @@ -256,6 +256,10 @@ public class Treasure _animations.add(chestOpenTask); // Extra effects based off the rarity of the treasure + if (_treasureType == TreasureType.FREEDOM) + { + _animations.add(new FreedomChestAnimation(Treasure.this, data.getBlock().getLocation().add(.5, .5, .5))); + } if (rewardData.getRarity() == RewardRarity.UNCOMMON) { _animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock())); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 07a9e25bf..a2cc71f46 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -2,6 +2,7 @@ package mineplex.core.treasure; import java.util.List; +import mineplex.core.gadget.GadgetManager; import mineplex.core.reward.RewardPool; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -57,7 +58,7 @@ public class TreasureLocation implements Listener private TreasureShop _shop; private Location _resetLocation; - public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager, ServerStatusManager statusManager) + public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager, GadgetManager gadgetManager, ServerStatusManager statusManager) { _treasureManager = treasureManager; _resetLocation = resetLocation; @@ -83,7 +84,7 @@ public class TreasureLocation implements Listener } }); setHoloChestVisible(true); - _shop = new TreasureShop(treasureManager, _inventoryManager, clientManager, donationManager, this); + _shop = new TreasureShop(treasureManager, _inventoryManager, clientManager, donationManager, gadgetManager, this); } @EventHandler @@ -118,23 +119,11 @@ public class TreasureLocation implements Listener public void run(Boolean success) { - boolean testServer = _treasureManager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - testServer = false; - // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - if (!success) { player.sendMessage(F.main("Treasure", "You don't have any chests to open!")); - if (testServer) - { - player.sendMessage("But like, lets just ignore that for now though ;)"); - } - else - { - return; - } + return; } @@ -145,8 +134,8 @@ public class TreasureLocation implements Listener _inventoryManager.addItemToInventory(player, treasureType.getItemName(), 1); return; } - - if(treasureType == TreasureType.ILLUMINATED) + + if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM) { if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player)) { @@ -162,8 +151,8 @@ public class TreasureLocation implements Listener if(r == null) { reset(); - player.sendMessage(F.main("Treasure", "There are no available items in this chest for you")); - player.sendMessage(F.main("Treasure", "to open")); + player.sendMessage(F.main("Treasure", "There are no available items in this chest for you to open")); + _inventoryManager.addItemToInventory(player, treasureType.getItemName(), 1); return; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index 65cc5f9db..2b82b9779 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -3,6 +3,7 @@ package mineplex.core.treasure; import java.util.ArrayList; import java.util.List; +import mineplex.core.gadget.GadgetManager; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -38,7 +39,7 @@ public class TreasureManager extends MiniPlugin private StatsManager _statsManager; private List _treasureLocations; - public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, RewardManager rewardManager) + public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, GadgetManager gadgetManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, RewardManager rewardManager) { super("Treasure", plugin); @@ -63,7 +64,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(-18, 72, -16); Block chestLoc8 = world.getBlockAt(-16, 72, -18); Location resetLocation = new Location(world, -23.5, 72, -23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, gadgetManager, statusManager)); } { @@ -77,7 +78,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(18, 72, 16); Block chestLoc8 = world.getBlockAt(16, 72, 18); Location resetLocation = new Location(world, 23.5, 72, 23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, gadgetManager, statusManager)); } { @@ -91,7 +92,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(18, 72, -16); Block chestLoc8 = world.getBlockAt(16, 72, -18); Location resetLocation = new Location(world, 23.5, 72, -23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, gadgetManager, statusManager)); } { @@ -105,7 +106,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(-18, 72, 16); Block chestLoc8 = world.getBlockAt(-16, 72, 18); Location resetLocation = new Location(world, -23.5, 72, 23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, gadgetManager, statusManager)); } for (TreasureLocation treasureLocation : _treasureLocations) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index d197de0af..671ca2ba1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -40,6 +40,14 @@ public enum TreasureStyle ParticleType.WITCH_MAGIC, Sound.ENDERDRAGON_DEATH, Sound.BLAZE_HIT + ), + + FREEDOM( + ParticleType.RED_DUST, + ParticleType.RED_DUST, + ParticleType.RED_DUST, + Sound.FIZZ, + Sound.FIREWORK_TWINKLE2 ); private ParticleType _secondaryParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 16617da09..6e424f0b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -16,7 +16,9 @@ public enum TreasureType CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000), - ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, Material.CHEST, TreasureStyle.ILLUMINATED, RewardPool.Type.ILLUMINATED, true, 20000); + ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, Material.CHEST, TreasureStyle.ILLUMINATED, RewardPool.Type.ILLUMINATED, true, 20000), + + FREEDOM(C.cRed + "Freedom " + C.cBlue + "Treasure", "Freedom Treasure", "Freedom", RewardType.FreedomChest, Material.CHEST, TreasureStyle.FREEDOM, RewardPool.Type.FREEDOM, true, 35000); private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 432807504..4ec8090b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -69,6 +69,11 @@ public class BlockChangeAnimation extends Animation mat = Material.PRISMARINE; data = 1; } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + mat = Material.WOOL; + data = 11; + } else continue; @@ -91,6 +96,11 @@ public class BlockChangeAnimation extends Animation mat = Material.PRISMARINE; data = 2; } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + mat = Material.WOOL; + data = 14; + } else continue; @@ -111,6 +121,18 @@ public class BlockChangeAnimation extends Animation } } } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + for(Block c : _chests) + { + if(c.equals(b)) + { + _blockInfoList.add(new BlockInfo(b)); + b.setType(Material.WOOL); + b.setData((byte) 0); + } + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java index 251db9632..6b723e8f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestOpenAnimation.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.animation; +import mineplex.core.common.util.banner.CountryFlag; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -74,7 +75,7 @@ public class ChestOpenAnimation extends Animation { double y = UtilBlock.getSize(_chestData.getBlock(), BlockFace.UP); Location location = _chestData.getBlock().getLocation().add(0.5, y, 0.5); - _itemEntity = location.getWorld().dropItem(location, _rewardData.getDisplayItem()); + _itemEntity = location.getWorld().dropItem(location, _rewardData.getDisplayItem()); _itemEntity.setVelocity(new Vector(0, 0, 0)); _itemEntity.setPickupDelay(Integer.MAX_VALUE); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index 199f7954f..29d6a816f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -1,7 +1,11 @@ package mineplex.core.treasure.animation; +import java.awt.*; import java.util.List; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; @@ -10,6 +14,7 @@ import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; import net.minecraft.server.v1_8_R3.BlockPosition; @@ -43,7 +48,10 @@ public class ChestSpawnAnimation extends Animation private double _radialOffset; - public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset) + private JavaPlugin _javaPlugin; + private int _babyFireworks = 0; + + public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { super(treasure); _block = block; @@ -74,6 +82,8 @@ public class ChestSpawnAnimation extends Animation _radialOffset = radialOffset; + + _javaPlugin = javaPlugin; } @Override @@ -140,6 +150,20 @@ public class ChestSpawnAnimation extends Animation UtilParticle.PlayParticleToAll(ParticleType.PORTAL, loc, null, 0.55f, 20, ViewDist.NORMAL); } } + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + { + if (_babyFireworks <= 2) + { + Location loc = _centerLocation.clone().add(Vector.getRandom().subtract(Vector.getRandom()).multiply(0.5)); + + int r = (int) (Math.random() * 3); + + BabyFireworkEffect babyFireworkEffect = new BabyFireworkEffect(loc, _javaPlugin, (r == 0) ? + Color.RED : (r == 1) ? Color.WHITE : Color.BLUE); + babyFireworkEffect.start(); + _babyFireworks++; + } + } //Spawn Chest if (getTicks() >= ANIMATION_DURATION) @@ -159,15 +183,25 @@ public class ChestSpawnAnimation extends Animation UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), loc, 0.7f, 0.7f, 0.7f, 1, 50, ViewDist.NORMAL, UtilServer.getPlayers()); } - + UtilParticle.ParticleType particleType = getTreasure().getTreasureType().getStyle().getChestSpawnParticle(); if (particleType != null) { - UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50, - ViewDist.NORMAL, UtilServer.getPlayers()); - + if (getTreasure().getTreasureType() != TreasureType.FREEDOM) + { + UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + else + { + int r = (int) (Math.random() * 3); + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.RED : (r == 1) ? Color.WHITE : Color.BLUE), + _centerLocation.clone().add(.5, .5, .5)); + coloredParticle.display(); + } } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/FreedomChestAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/FreedomChestAnimation.java new file mode 100644 index 000000000..64f09c1d8 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/FreedomChestAnimation.java @@ -0,0 +1,37 @@ +package mineplex.core.treasure.animation; + +import mineplex.core.common.util.UtilFirework; +import mineplex.core.treasure.Treasure; +import org.bukkit.Location; + +public class FreedomChestAnimation extends Animation +{ + + private Location _centerLocation; + + public FreedomChestAnimation(Treasure treasure, Location location) + { + super(treasure); + _centerLocation = location; + } + + @Override + protected void tick() + { + if (getTicks() == 2) + { + UtilFirework.playFreedomFirework(_centerLocation); + } + else if (getTicks() >= 60) + { + finish(); + } + } + + @Override + protected void onFinish() + { + + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index b74ded372..866b611ee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -22,9 +22,10 @@ public class BuyChestButton implements IButton private String _chestName; private Material _chestMat; private int _chestCost; + private TreasureType _chestType; public BuyChestButton(InventoryManager inventoryManager, TreasurePage page, - String chestName, Material chestMat, int chestCost) + String chestName, Material chestMat, int chestCost, TreasureType chestType) { _inventoryManager = inventoryManager; @@ -33,12 +34,14 @@ public class BuyChestButton implements IButton _chestName = chestName; _chestMat = chestMat; _chestCost = chestCost; + _chestType = chestType; } @Override public void onClick(final Player player, ClickType clickType) { - if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player)) + if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player) + && _chestType == TreasureType.ILLUMINATED) { player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index e44327fa2..f77f05a20 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -3,6 +3,16 @@ package mineplex.core.treasure.gui; import java.util.ArrayList; import java.util.List; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; +import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; +import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom; +import mineplex.core.gadget.gadgets.morph.MorphUncleSam; +import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.mount.Mount; +import mineplex.core.reward.RewardPool; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -24,13 +34,15 @@ public class TreasurePage extends ShopPageBase { private TreasureLocation _treasureLocation; private InventoryManager _inventoryManager; + private GadgetManager _gadgetManager; - public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, Player player) + public TreasurePage(TreasureManager plugin, TreasureShop shop, TreasureLocation treasureLocation, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, Player player) { super(plugin, shop, clientManager, donationManager, "Open Treasure", player, 54); _treasureLocation = treasureLocation; _inventoryManager = inventoryManager; + _gadgetManager = gadgetManager; buildPage(); } @@ -45,6 +57,7 @@ public class TreasurePage extends ShopPageBase int legendaryCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MYTHICAL.getItemName()); int christmasCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.CHRISTMAS.getItemName()); int illuminatedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ILLUMINATED.getItemName()); + int freedomCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.FREEDOM.getItemName()); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -146,17 +159,39 @@ public class TreasurePage extends ShopPageBase illuminatedLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); } + List freedomLore = new ArrayList<>(); + freedomLore.add(" "); + freedomLore.add(F.value("Freedom Chests Owned", "" + freedomCount)); + freedomLore.add(" "); + freedomLore.add(C.cGray + "It is said that George Washington"); + freedomLore.add(C.cGray + "carved this chest himself from the wood"); + freedomLore.add(C.cGray + "of the apple tree he cut down..."); + freedomLore.add(" "); + if (freedomCount > 0) + freedomLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + else + { + freedomLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "35000 Treasure Shards"); + freedomLore.add(" "); + freedomLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } + freedomLore.add(" "); + freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked"); + ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false); ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Treasure", heroicLore.toArray(new String[0]), 0, false, false); ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Treasure", legendaryLore.toArray(new String[0]), 0, false, false); ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore); ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false); + ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRed + C.Bold + "Freedom " + C.cBlue + C.Bold + "Treasure", freedomLore); addItem(40, shards); - addChest(12, christmas, TreasureType.CHRISTMAS, christmasCount); - addChest(14, illuminated, TreasureType.ILLUMINATED, illuminatedCount); + addChest(11, christmas, TreasureType.CHRISTMAS, christmasCount); + if (!hasAllFreedomItems(getPlayer())) + addChest(13, freedom, TreasureType.FREEDOM, freedomCount); + addChest(15, illuminated, TreasureType.ILLUMINATED, illuminatedCount); addChest(20, basic, TreasureType.OLD, basicCount); addChest(22, heroic, TreasureType.ANCIENT, heroicCount); addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount); @@ -164,27 +199,60 @@ public class TreasurePage extends ShopPageBase private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned) { - boolean testServer = getPlugin().getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + //boolean testServer = getPlugin().getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - testServer = false; + //testServer = false; // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - if(testServer) + /*if(testServer) { addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); return; - } + }*/ if (owned > 0) { addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); } else if (treasureType.isPurchasable()) { - addButton(slot, item, new BuyChestButton(_inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice())); + addButton(slot, item, new BuyChestButton(_inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice(), treasureType)); } else { setItem(slot, item); } } + + public boolean hasAllFreedomItems(Player player) + { + return !getPlugin().hasItemsToGivePlayer(TreasureType.FREEDOM.getRewardPool(), player); + } + + public int getFreedomUnlockedAmount(Player player) + { + if (hasAllFreedomItems(player)) + return 7; + int amount = 0; + Gadget[] gadgets = new Gadget[] + { + _gadgetManager.getGadget("Uncle Sam Hat", GadgetType.Hat), + _gadgetManager.getGadget(ParticleFreedom.class), + _gadgetManager.getGadget(ArrowTrailFreedom.class), + _gadgetManager.getGadget(DoubleJumpFreedom.class), + _gadgetManager.getGadget(DeathFreedom.class), + _gadgetManager.getGadget(MorphUncleSam.class) + }; + Mount freedomMount = _gadgetManager.getMountManager().getMount("Freedom Mount"); + if (freedomMount != null) + { + if (freedomMount.hasMount(player)) + amount++; + } + for (Gadget gadget : gadgets) + { + if (gadget.ownsGadget(player)) + amount++; + } + return amount; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasureShop.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasureShop.java index ac345e064..3a421de6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasureShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasureShop.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.gui; +import mineplex.core.gadget.GadgetManager; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; @@ -14,17 +15,19 @@ public class TreasureShop extends ShopBase { private TreasureLocation _treasureLocation; private InventoryManager _inventoryManager; + private GadgetManager _gadgetManager; - public TreasureShop(TreasureManager plugin, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, TreasureLocation treasureLocation) + public TreasureShop(TreasureManager plugin, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager, TreasureLocation treasureLocation) { super(plugin, clientManager, donationManager, "Treasure Shop"); _treasureLocation = treasureLocation; _inventoryManager = inventoryManager; + _gadgetManager = gadgetManager; } @Override protected ShopPageBase> buildPagesFor(Player player) { - return new TreasurePage(getPlugin(), this, _treasureLocation, getClientManager(), getDonationManager(), _inventoryManager, player); + return new TreasurePage(getPlugin(), this, _treasureLocation, getClientManager(), getDonationManager(), _inventoryManager, _gadgetManager, player); } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 0df7f3c6b..da332274b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -227,7 +227,7 @@ public class HubManager extends MiniClientPlugin FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager); - _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); + _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager); new SoccerManager(this, _gadgetManager); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 33570939f..0ad0b31ea 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -17,6 +17,8 @@ import mineplex.core.donation.DonationManager; import mineplex.core.donation.Donor; import mineplex.core.donation.repository.token.CoinTransactionToken; import mineplex.core.donation.repository.token.TransactionToken; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.mount.Mount; import mineplex.serverdata.database.ResultSetCallable; import mineplex.staffServer.salespackage.SalesPackageManager; @@ -127,6 +129,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int winterChestsReceived = 0; int illuminatedChestsReceived = 0; int valentinesGiftsReceived = 0; + int freedomChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -194,6 +197,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } } + if (transaction.SalesPackageName.startsWith("Freedom Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + freedomChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + freedomChestsReceived += 1; + } + + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { if (transaction.Coins == 0 && transaction.Gems == 0) @@ -213,6 +227,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived); caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived); caller.sendMessage(C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived); + caller.sendMessage(C.cBlue + "Freedom Chests Received: " + C.cYellow + freedomChestsReceived); caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):"); if (_accountBonusLog.containsKey(client.getAccountId())) @@ -226,6 +241,14 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cDGreen + C.Strike + "============================================="); _salesPackageManager.displaySalesPackages(caller, playerName); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); + caller.sendMessage(C.cBlue + "Freedom Mount: " + getLockedFreedomStr(playerName, "Freedom Mount")); + caller.sendMessage(C.cBlue + "Uncle Sam Morph: " + getLockedFreedomStr(playerName, "Uncle Sam Morph")); + caller.sendMessage(C.cBlue + "Freedom Aura: " + getLockedFreedomStr(playerName, "Freedom Aura")); + caller.sendMessage(C.cBlue + "Shock and Awe: " + getLockedFreedomStr(playerName, "Shock and Awe")); + caller.sendMessage(C.cBlue + "Leap of Freedom: " + getLockedFreedomStr(playerName, "Leap of Freedom")); + caller.sendMessage(C.cBlue + "Price of Freedom: " + getLockedFreedomStr(playerName, "Price of Freedom")); + caller.sendMessage(C.cBlue + "Uncle Sam Hat: " + getLockedFreedomStr(playerName, "Uncle Sam Hat")); + caller.sendMessage(C.cDGreen + C.Strike + "============================================="); _accountBonusLog.remove(client.getAccountId()); } @@ -277,4 +300,13 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable if (accountId != 0) _accountBonusLog.put(accountId, log); } + + private String getLockedFreedomStr(String player, String name) + { + if (_donationManager.Get(player).OwnsUnknownPackage(name)) + { + return C.cGreen + C.Bold + "Unlocked"; + } + return C.cRed + C.Bold + "Locked"; + } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 1637cc111..65f25a186 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -50,6 +50,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new AncientChest(this)); AddSalesPackage(new MythicalChest(this)); AddSalesPackage(new IlluminatedChest(this)); + AddSalesPackage(new FreedomChest(this)); //AddSalesPackage(new ValentinesGift(this)); AddSalesPackage(new FrostLord(this)); AddSalesPackage(new EasterBunny(this)); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java new file mode 100644 index 000000000..2a7f74d79 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java @@ -0,0 +1,21 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.entity.Player; + +public class FreedomChest extends SalesPackageBase +{ + + public FreedomChest(SalesPackageManager manager) + { + super(manager, "1 Freedom Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Freedom Chest", "Give 1 Freedom Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 236d441d1..b1113f0ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -950,7 +950,7 @@ public class EventModule extends MiniPlugin if (((EventGame) Manager.GetGame()).getGadgetWhitelist().remove(mount)) { Manager.GetGame().Announce(F.main("Inventory", F.value(mount.getName() + " Gadget", F.ed(false)))); - mount.DisableForAll(); + mount.disableForAll(); } else { From c1b7be63638a24ac355297892b99808b53fb0acd Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 23 Jun 2016 16:33:20 -0300 Subject: [PATCH 38/49] Fix merge problems --- .../core/cosmetic/ui/page/CostumePage.java | 6 +- .../core/cosmetic/ui/page/GadgetPage.java | 128 ++++-------------- .../mineplex/core/cosmetic/ui/page/Menu.java | 12 -- .../core/cosmetic/ui/page/MountPage.java | 84 ++---------- .../core/cosmetic/ui/page/PetPage.java | 84 ++---------- .../core/shop/page/ConfirmationPage.java | 8 +- .../src/mineplex/hub/HubManager.java | 8 +- .../game/arcade/kit/perks/PerkWolfPet.java | 12 +- 8 files changed, 63 insertions(+), 279 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java index 0cbda6279..bd255d200 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/CostumePage.java @@ -38,11 +38,7 @@ public class CostumePage extends GadgetPage for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) { -<<<<<<< HEAD - if (gadget.getCost(CurrencyType.Coins) == -1) -======= - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -1) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1) continue; OutfitGadget outfitGadget = ((OutfitGadget) gadget); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 57980af1e..fd117802b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -48,11 +48,7 @@ public class GadgetPage extends ShopPageBase for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item)) { -<<<<<<< HEAD - if (gadget.getCost(CurrencyType.Coins) == -3) -======= - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -3) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3) continue; addGadget(gadget, slot); @@ -107,108 +103,64 @@ public class GadgetPage extends ShopPageBase if (!gadget.ownsGadget(getPlayer())) { -<<<<<<< HEAD - if (gadget.getCost(CurrencyType.Coins) == -1) -======= - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -1) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1) { //Nothing } //Chest Unlocks -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -2 || gadget.getCost(CurrencyType.Coins) > 0) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -2 || gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -2 || gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -3) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -3) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -4) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -4) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -5) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -5) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -6) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -6) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -6) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Valentines Gifts"); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -7) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -7) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -7) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Purchased from shop.mineplex.com"); } - else if (gadget.getCost(CurrencyType.Coins) == -8) + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Freedom Chests"); } //Rank Unlocks -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -10) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -10) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -11) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -11) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -12) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -12) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) == -13) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -13) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); @@ -285,34 +237,26 @@ public class GadgetPage extends ShopPageBase } else { -<<<<<<< HEAD - if (gadget.getCost(CurrencyType.Coins) > 0) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.Coins) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (gadget.getCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.getCost(CurrencyType.Coins)) -======= - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.GetCost(CurrencyType.TREASURE_SHARD)) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) > 0) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); @@ -345,7 +289,7 @@ public class GadgetPage extends ShopPageBase if (gadget.getGadgetType() == GadgetType.ArrowTrail || gadget.getGadgetType() == GadgetType.Death || gadget.getGadgetType() == GadgetType.Particle || gadget.getGadgetType() == GadgetType.DoubleJump) { - if (gadget.getCost(CurrencyType.Coins) == -8) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) { gadgetItemStack = CountryFlag.Usa.getBanner(); BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta(); @@ -368,7 +312,7 @@ public class GadgetPage extends ShopPageBase if (gadget.getGadgetType() == GadgetType.ArrowTrail || gadget.getGadgetType() == GadgetType.Death || gadget.getGadgetType() == GadgetType.Particle || gadget.getGadgetType() == GadgetType.DoubleJump) { - if (gadget.getCost(CurrencyType.Coins) == -8) + if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) { gadgetItemStack = CountryFlag.Usa.getBanner(); BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta(); @@ -382,35 +326,21 @@ public class GadgetPage extends ShopPageBase } } else - { -<<<<<<< HEAD - if (gadget.getCost(CurrencyType.Coins) > 0) + { + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.Coins) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (gadget.getCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.getCost(CurrencyType.Coins)) -======= - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) - { - itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); - } - - if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.GetCost(CurrencyType.TREASURE_SHARD)) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); } -<<<<<<< HEAD - else if (gadget.getCost(CurrencyType.Coins) > 0) -======= - else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); @@ -431,11 +361,7 @@ public class GadgetPage extends ShopPageBase { ItemGadget itemGadget = (ItemGadget)gadget; -<<<<<<< HEAD - if (itemGadget.getAmmo().getCost(CurrencyType.Coins) < 0) -======= - if (itemGadget.getAmmo().GetCost(CurrencyType.TREASURE_SHARD) < 0) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (itemGadget.getAmmo().getCost(CurrencyType.TREASURE_SHARD) < 0) return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 1a69c2608..0126131a4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -67,7 +67,6 @@ public class Menu extends ShopPageBase int tauntSlot = 49;//slots[11]; int winEffectSlot = 51; int gameModifierSlot = 53; - int boosterSlot = 52;// TODO EnumMap ownedCount = new EnumMap(GadgetType.class); EnumMap maxCount = new EnumMap(GadgetType.class); @@ -196,17 +195,6 @@ public class Menu extends ShopPageBase lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type)); addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(gameModifierSlot); - -<<<<<<< HEAD - /*type = GadgetType.Balloon; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Placeholder", "Placeholder", enabled.get(type)); - addButton(balloonSlot, new ShopItem(Material.BANNER, "Balloons", lore, 1, false), new OpenBalloons(this, enabled.get(type))); - if (enabled.containsKey(type)) addGlow(balloonSlot);*/ -======= -// addButton(boosterSlot, new ShopItem(Material.EMERALD, "Game Boosters", -// new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), -// (player, clickType) -> openBoosters(player)); ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 } private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 6bfde96cb..bc84607ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -62,98 +62,58 @@ public class MountPage extends ShopPageBase if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName())) { -<<<<<<< HEAD - if (mount.getCost(CurrencyType.Coins) == -1) -======= - if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -1) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (mount.getCost(CurrencyType.TREASURE_SHARD) == -1) { //Nothing } //Chest Unlocks -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -2 || mount.getCost(CurrencyType.Coins) > 0) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -2 || mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -2 || mount.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -3) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -3) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -4) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -4) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -5) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -5) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -6) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -6) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -6) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure"); } - else if (mount.getCost(CurrencyType.Coins) == -7) + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -7) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Freedom Chests"); } //Rank Unlocks -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -10) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -10) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -11) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -11) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -12) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -12) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) == -13) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -13) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); @@ -179,34 +139,20 @@ public class MountPage extends ShopPageBase } else { -<<<<<<< HEAD - if (mount.getCost(CurrencyType.Coins) > 0) + if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.getCost(CurrencyType.Coins) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (mount.getCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.getCost(CurrencyType.Coins)) -======= - if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) - { - itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); - } - - if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= mount.GetCost(CurrencyType.TREASURE_SHARD)) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= mount.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); } -<<<<<<< HEAD - else if (mount.getCost(CurrencyType.Coins) > 0) -======= - else if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index ea4b3605f..3b278c855 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -63,85 +63,49 @@ public class PetPage extends ShopPageBase //Chest Unlocks if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) { -<<<<<<< HEAD - if (pet.getCost(CurrencyType.Coins) == -1) -======= - if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -1) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (pet.getCost(CurrencyType.TREASURE_SHARD) == -1) { //Nothing } - -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) == -2 || pet.getCost(CurrencyType.Coins) > 0) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -2 || pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -2 || pet.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Treasure Chests"); } -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) == -3) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -3) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -3) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); } -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) == -4) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -4) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -4) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); } -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) == -5) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -5) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } //Rank Unlocks -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) == -10) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -10) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -10) { itemLore.add(C.cBlack); itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); } -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) == -11) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -11) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -11) { itemLore.add(C.cBlack); itemLore.add(C.cPurple + "Unlocked with Hero Rank"); } -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) == -12) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -12) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -12) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Unlocked with Legend Rank"); } -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) == -13) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -13) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -13) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Unlocked with Titan Rank"); @@ -181,34 +145,20 @@ public class PetPage extends ShopPageBase //Not Owned else { -<<<<<<< HEAD - if (pet.getCost(CurrencyType.Coins) > 0) + if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.getCost(CurrencyType.Coins) + " Treasure Shards"); + itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); } - if (pet.getCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= pet.getCost(CurrencyType.Coins)) -======= - if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) - { - itemLore.add(C.cBlack); - itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); - } - - if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= pet.GetCost(CurrencyType.TREASURE_SHARD)) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= pet.getCost(CurrencyType.TREASURE_SHARD)) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Purchase"); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this)); } -<<<<<<< HEAD - else if (pet.getCost(CurrencyType.Coins) > 0) -======= - else if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + else if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); @@ -244,11 +194,7 @@ public class PetPage extends ShopPageBase || getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.VILLAGER || getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.ZOMBIE) { -<<<<<<< HEAD - addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.getCost(CurrencyType.Coins) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); -======= - addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.TREASURE_SHARD) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.getCost(CurrencyType.TREASURE_SHARD) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); } slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java index c090ff3cb..75102a07b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ConfirmationPage.java @@ -78,12 +78,8 @@ public class ConfirmationPage>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + + this.getInventory().setItem(4, new ShopItem(getCurrencyType().getDisplayMaterial(), (byte)0, getCurrencyType().getPrefix(), new String[] { C.cGray + _salesItem.getCost(getCurrencyType()) + " " + getCurrencyType().getPrefix() + " will be", C.cGray + "deducted from your account balance." }, 1, false, true).getHandle()); } protected void okClicked(Player player) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 8f734ace9..c05e6a1ef 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -228,14 +228,10 @@ public class HubManager extends MiniClientPlugin FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager); - -<<<<<<< HEAD + _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); - new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager); -======= - _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager); ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + new SoccerManager(this, _gadgetManager); new KothManager(this, _gadgetManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index e6fb4be64..ca0374902 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -293,11 +293,6 @@ public class PerkWolfPet extends Perk } @EventHandler -<<<<<<< HEAD - public void playerDeath(PlayerDeathEvent event) - { - ArrayList wolves = _petMap.remove(event.getEntity()); -======= public void modTeleport(PlayerCommandPreprocessEvent event) { if (!Manager.GetGame().IsLive()) @@ -305,7 +300,6 @@ public class PerkWolfPet extends Perk if (!event.getMessage().toLowerCase().startsWith("/tp") && !event.getMessage().toLowerCase().startsWith("/teleport")) return; ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.MODERATOR) || Manager.GetClients().hasRank(event.getPlayer(), Rank.DEVELOPER)) @@ -326,16 +320,12 @@ public class PerkWolfPet extends Perk @EventHandler public void playerQuit(PlayerQuitEvent event) { -<<<<<<< HEAD - ArrayList wolves = _petMap.remove(event.getPlayer()); -======= despawnWolf(event.getPlayer()); } private void despawnWolf(Player player) { - ArrayList wolves = _wolfMap.remove(player); ->>>>>>> 0160efb5ab1d9b903d517f6339e286eb6727d7d3 + ArrayList wolves = _petMap.remove(player); if (wolves == null) return; From a33b070ae76e69f69da0ed65d98f44b453b79c90 Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 23 Jun 2016 15:34:29 -0400 Subject: [PATCH 39/49] 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 40/49] 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 41/49] 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 From a9f291338fcdf5c47ccef891872a370ddbf314b8 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 23 Jun 2016 22:49:12 -0700 Subject: [PATCH 42/49] Amplifiers GM Candidate --- .../bonuses/gui/buttons/ClaimTipsButton.java | 7 +- .../core/boosters/gui/BoosterPage.java | 20 +-- .../src/mineplex/core/hologram/Hologram.java | 123 ++++++++++++------ .../core/hologram/HologramManager.java | 2 +- .../clans/clans/siege/weapon/SiegeWeapon.java | 1 + .../hub/server/ui/ServerGameMenu.java | 33 ++--- .../customerSupport/CustomerSupport.java | 13 ++ .../game/arcade/booster/BoosterPodium.java | 22 +--- 8 files changed, 136 insertions(+), 85 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java index 2a37d243b..a0d53216e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/ClaimTipsButton.java @@ -100,7 +100,7 @@ public class ClaimTipsButton implements GuiItem, Listener new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "No Thanks to Claim!"), "You have no thanks to claim!", 6*9, 20*3, getGui()).openInventory(); } - UtilPlayer.message(getPlayer(), F.main("Carl", "You have no thanks to claim!")); + UtilPlayer.message(getPlayer(), F.main("Carl", "You have no rewards to claim!")); getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10); } else @@ -146,8 +146,9 @@ public class ClaimTipsButton implements GuiItem, Listener itemName = C.cRed + C.Bold + "Game Amplifiers"; lore.add(" "); - lore.add(C.Reset + "Activate Amplifiers to earn rewards"); - lore.add(C.Reset + "Amplifiers can be purchased at mineplex.com/shop"); + lore.add(C.cGray + "Use Amplifiers to earn rewards"); + lore.add(" "); + lore.add(C.cWhite + "Get Amplifiers at " + C.cGreen + "mineplex.com/shop"); } _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index dc1f83802..e565bac4a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -37,10 +37,10 @@ public class BoosterPage extends ShopPageBase { ArrayList lore = new ArrayList<>(); - int count = getPlugin().getAvailableBoosterCount(getPlayer()); + int amplifierCount = getPlugin().getAvailableBoosterCount(getPlayer()); lore.add(" "); - lore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getAvailableBoosterCount(getPlayer()) + C.cWhite + " Game Amplifiers"); - if (getPlugin().canActivateBoosters() && count > 0) + lore.add(C.cWhite + "You own " + C.cGreen + amplifierCount + C.cWhite + " Game Amplifiers"); + if (getPlugin().canActivateBoosters() && amplifierCount > 0) { List boosters = getPlugin().getBoosters(); @@ -80,16 +80,18 @@ public class BoosterPage extends ShopPageBase else { lore.add(" "); - lore.add(C.cGray + "Game Amplifiers allow you to increase"); - lore.add(C.cGray + "gems and shards earned in that game for 1 hour."); - lore.add(C.cGray + "You can also earn bonus rewards from players"); - lore.add(C.cGray + "thanking you while your booster is active."); + lore.add(C.cGray + "Game Amplifiers allow you to"); + lore.add(C.cGray + "increase the gems and shards"); + lore.add(C.cGray + "earned in that game for 1 hour."); + lore.add(C.cGray + "You will also earn bonus rewards"); + lore.add(C.cGray + "from players thanking you while"); + lore.add(C.cGray + "your amplifier is active."); lore.add(" "); - lore.add(C.cWhite + "You can purchase Amplifiers at " + C.cGreen + "mineplex.com/shop"); + lore.add(C.cWhite + "Get Amplifiers at " + C.cGreen + "mineplex.com/shop"); } ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false); - if (getPlugin().canActivateBoosters()) + if (getPlugin().canActivateBoosters() && amplifierCount > 0) { addButton(13, booster, this::openConfirmation); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java index 4a768f50a..5e2d8803e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java @@ -1,10 +1,6 @@ package mineplex.core.hologram; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.UUID; +import java.util.*; import org.bukkit.Location; import org.bukkit.entity.Entity; @@ -45,6 +41,7 @@ public class Hologram { private boolean _makeDestroyPackets = true; private boolean _makeSpawnPackets = true; private Packet[] _packets1_8; + private Packet[] _packets1_9; private HashSet _playersInList = new HashSet(); private ArrayList _playersTracking = new ArrayList(); private boolean _removeEntityDeath; @@ -58,13 +55,18 @@ public class Hologram { private long _startTime; public Hologram(HologramManager hologramManager, Location location, String... text) { - this(hologramManager, location, -1l, text); + this(hologramManager, location, false, -1l, text); } - public Hologram(HologramManager hologramManager, Location location, long maxLifetime, String... text) { + public Hologram(HologramManager hologramManager, Location location, boolean hideBoundingBox, String... text) { + this(hologramManager, location, hideBoundingBox, -1l, text); + } + + public Hologram(HologramManager hologramManager, Location location, boolean hideBoundingBox, long maxLifetime, String... text) { _hologramManager = hologramManager; _location = location.clone(); _maxLifetime = maxLifetime; + _hideBoundingBox = hideBoundingBox; setText(text); } @@ -163,13 +165,11 @@ public class Hologram { return _playersTracking; } - protected Packet[] getSpawnPackets() { + protected void checkSpawnPackets() { if (_makeSpawnPackets) { makeSpawnPackets(); _makeSpawnPackets = false; } - - return _packets1_8; } /** @@ -228,7 +228,8 @@ public class Hologram { } private void makeSpawnPackets() { - _packets1_8 = new Packet[_hologramText.length * 1]; + _packets1_8 = new Packet[_hologramText.length]; + _packets1_9 = new Packet[_hologramText.length]; if (_entityIds.size() < _hologramText.length) { _makeDestroyPackets = true; @@ -244,22 +245,39 @@ public class Hologram { } } for (int textRow = 0; textRow < _hologramText.length; textRow++) { - Packet[] packets1_8 = makeSpawnPackets1_8(textRow, _entityIds.get(textRow), _hologramText[textRow]); + PacketPlayOutSpawnEntityLiving packet1_8 = makeSpawnPacket1_8(textRow, _entityIds.get(textRow), _hologramText[textRow]); + PacketPlayOutSpawnEntityLiving packet1_9 = makeSpawnPacket1_9(textRow, _entityIds.get(textRow), _hologramText[textRow]); - for (int i = 0; i < packets1_8.length; i++) { - _packets1_8[textRow + i] = packets1_8[i]; - } + _packets1_8[textRow] = packet1_8; + _packets1_9[textRow] = packet1_9; } } - private Packet[] makeSpawnPackets1_8(int textRow, int entityId, String lineOfText) { + /** + * Used for sending 1.9 clients holograms with no bounding boxes + */ + private PacketPlayOutSpawnEntityLiving makeSpawnPacket1_9(int textRow, int entityId, String lineOfText) + { + PacketPlayOutSpawnEntityLiving packet = makeSpawnPacket1_8(textRow, entityId, lineOfText); + + if (_hideBoundingBox) + { + DataWatcher watcher = packet.l; + packet.d = (int) ((getLocation().getY() + ((double) textRow * 0.285)) * 32); + watcher.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); + } + + return packet; + } + + private PacketPlayOutSpawnEntityLiving makeSpawnPacket1_8(int textRow, int entityId, String lineOfText) { PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); DataWatcher watcher = new DataWatcher(null); packet.a = entityId; packet.b = 30; packet.c = (int) (getLocation().getX() * 32); - packet.d = (int) ((getLocation().getY() + (_hideBoundingBox ? 0 : -2.1) + ((double) textRow * 0.285)) * 32); + packet.d = (int) ((getLocation().getY() - 2.1 + ((double) textRow * 0.285)) * 32); packet.e = (int) (getLocation().getZ() * 32); packet.l = watcher; packet.uuid = UUID.randomUUID(); @@ -269,18 +287,7 @@ public class Hologram { watcher.a(2, lineOfText, EntityArmorStand.META_CUSTOMNAME, lineOfText); watcher.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true); - if (_hideBoundingBox) { - watcher.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); // TODO - // Uncomment - // after - // we - // can - // enforce - // 1.8.3 - } - // Also correct hologram positioning - - return new Packet[] { packet }; + return packet; } /** @@ -352,6 +359,7 @@ public class Hologram { } } itel = canSee.iterator(); + checkSpawnPackets(); while (itel.hasNext()) { Player player = itel.next(); @@ -359,7 +367,7 @@ public class Hologram { _playersTracking.add(player); itel.remove(); - UtilPlayer.sendPacket(player, getSpawnPackets()); + UtilPlayer.sendPacket(player, UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8); } } if (!canSee.isEmpty()) { @@ -452,6 +460,7 @@ public class Hologram { int[] destroy1_8 = new int[0]; ArrayList packets1_8 = new ArrayList(); + ArrayList packets1_9 = new ArrayList<>(); if (_hologramText.length != newText.length) { _makeDestroyPackets = true; @@ -465,7 +474,8 @@ public class Hologram { int entityId = UtilEnt.getNewEntityId(); _entityIds.add(entityId); - packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(i, entityId, newText[i]))); + packets1_8.add(makeSpawnPacket1_8(i, entityId, newText[i])); + packets1_9.add(makeSpawnPacket1_9(i, entityId, newText[i])); } // If less lines than previously else if (i >= newText.length) { @@ -479,29 +489,45 @@ public class Hologram { Integer entityId = _entityIds.get(i); PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata(); + PacketPlayOutEntityMetadata metadata1_9 = new PacketPlayOutEntityMetadata(); metadata1_8.a = entityId; + metadata1_9.a = entityId; DataWatcher watcher1_8 = new DataWatcher(null); + DataWatcher watcher1_9 = new DataWatcher(null); - watcher1_8.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32); - watcher1_8.a(2, newText[i], EntityArmorStand.META_CUSTOMNAME, newText[i]); - watcher1_8.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true); - // watcher1_8.a(10, (byte) 16);// TODO Uncomment after we - // can enforce 1.8.3 - // Also correct hologram positioning + { + watcher1_8.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32); + watcher1_8.a(2, newText[i], EntityArmorStand.META_CUSTOMNAME, newText[i]); + watcher1_8.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true); + } + { + watcher1_9.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32); + watcher1_9.a(2, newText[i], EntityArmorStand.META_CUSTOMNAME, newText[i]); + watcher1_9.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true); + if (_hideBoundingBox) + { + watcher1_9.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); + } + } metadata1_8.b = watcher1_8.c(); + metadata1_9.b = watcher1_9.c(); packets1_8.add(metadata1_8); + packets1_9.add(metadata1_9); } } if (destroy1_8.length > 0) { packets1_8.add(new PacketPlayOutEntityDestroy(destroy1_8)); + packets1_9.add(new PacketPlayOutEntityDestroy(destroy1_8)); } for (Player player : _playersTracking) { - for (Packet packet : packets1_8) { + List packets = UtilPlayer.is1_9(player) ? packets1_9 : packets1_8; + for (Packet packet : packets) + { UtilPlayer.sendPacket(player, packet); } } @@ -532,15 +558,30 @@ public class Hologram { _hologramManager.addHologram(this); _playersTracking.addAll(getNearbyPlayers()); - for (Player player : _playersTracking) { - UtilPlayer.sendPacket(player, getSpawnPackets()); - } + sendPackets(); _lastMovement = new Vector(); } return this; } + private void sendPackets() + { + checkSpawnPackets(); + + for (Player player : _playersTracking) + { + UtilPlayer.sendPacket(player, UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8); + } + } + + public Packet[] getSpawnPackets(Player player) + { + checkSpawnPackets(); + + return UtilPlayer.is1_9(player) ? _packets1_9 : _packets1_8; + } + /** * Stop the hologram */ diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java index 3ff9c3a35..618c30f44 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/HologramManager.java @@ -116,7 +116,7 @@ public class HologramManager implements Listener, IPacketHandler { hologram.getPlayersTracking().add(player); - UtilPlayer.sendPacket(player, hologram.getSpawnPackets()); + UtilPlayer.sendPacket(player, hologram.getSpawnPackets(player)); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java index 33c7a5cba..c09ec8f6d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/SiegeWeapon.java @@ -530,6 +530,7 @@ public abstract class SiegeWeapon implements Listener new Hologram( _siegeManager.getClansManager().getHologramManager(), _location.clone().add(UtilMath.random(-1, 1),1.4, UtilMath.random(-1, 1)), + false, 3500l, C.cRed + "-" + health) .start(); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 38a176d85..a268f006d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -48,7 +48,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Memorize Gwen the Guardian's builds", C.Reset + "Then recreate them in a short amount of time.", C.Reset + "The least correct builder is eliminated.", - }, "SB", "SpeedBuilders", new SelectSBButton(this)); + }, "SB", "Speed Builders", new SelectSBButton(this)); add(4, Material.BOOK_AND_QUILL, C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary", new String[] { @@ -57,7 +57,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Players take turns at drawing a random", C.Reset + "word. Whoever guesses it within the time", C.Reset + "limit gets some points!", - }, "DMT", "DrawMyThing", new SelectDMTButton(this)); + }, "DMT", "Draw My Thing", new SelectDMTButton(this)); add(6, Material.TNT, C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour", new String[] { @@ -75,7 +75,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Then the bridges drop, and all hell", C.Reset + "breaks loose as you battle to the", C.Reset + "death with the other teams.", - }, "BR", "Bridge", new SelectBRButton(this)); + }, "BR", "Bridges", new SelectBRButton(this)); add(11, Material.DIAMOND_SWORD, (byte) 0, C.cYellowB + "Survival Games " + C.cGray + "Solo/Team Survival", new String[] { @@ -83,7 +83,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Search for chests to find loot and ", C.Reset + "fight others to be the last man standing. ", C.Reset + "Stay away from the borders!", - }, new String[] {"HG", "SG2"}, "SurvivalGames", new SelectSGButton(this)); + }, new String[] {"HG", "SG2"}, "Survival Games", new SelectSGButton(this)); add(13, Material.FEATHER, (byte) 0, C.cYellowB + "Skywars " + C.cGray + "Solo/Team Survival", new String[] { @@ -93,7 +93,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Find weapons to take your enemies down!", C.Reset + "Up in the skies, death looming if you fall..", C.Reset + "Win! Fight! Send enemies flying in Skywars!", - }, new String[] {"SKY", "SKY2"}, "SkyWars", new SelectSKYButton(this)); + }, new String[] {"SKY", "SKY2"}, "Skywars", new SelectSKYButton(this)); add(15, Material.GOLDEN_APPLE, C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[] { @@ -133,7 +133,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Customize one of five exciting champions", C.Reset + "and battle with the opposing team to the", C.Reset + "last man standing.", - }, "TDM", "TeamDeathMatch", new SelectTDMButton(this)); + }, "TDM", "Team Deathmatch", new SelectTDMButton(this)); add(24, Material.DIAMOND_CHESTPLATE, C.cYellowB + "Castle Siege " + C.cGray + "Team Game", new String[] { @@ -141,7 +141,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Defenders must protect King Sparklez", C.Reset + "from the endless waves of Undead", C.Reset + "until the sun rises!", - }, "CS", "CastleSiege", new SelectCSButton(this)); + }, "CS", "Castle Siege", new SelectCSButton(this)); add(26, Material.GRASS, C.cYellowB + "Block Hunt " + C.cGray + "Cat and Mouse", new String[] { @@ -149,7 +149,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Hide as blocks/animals, upgrade your ", C.Reset + "weapon and fight to survive against", C.Reset + "the Hunters!", - }, "BH", "BlockHunt", new SelectBHButton(this)); + }, "BH", "Block Hunt", new SelectBHButton(this)); add(28, Material.TNT, C.cYellowB + "MineStrike " + C.cGray + "Team Survival", new String[] { @@ -171,7 +171,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Players are given a Build Theme and ", C.Reset + "must use blocks, monsters and more", C.Reset + "to create a masterpiece!", - }, "BLD", "MasterBuilders", new SelectBLDButton(this)); + }, "BLD", "Master Builders", new SelectBLDButton(this)); add(39, Material.SKULL_ITEM, (byte) 3, C.cYellowB + "Player Servers " + C.cGray + "Player Hosted Games", new String[] { @@ -188,7 +188,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Equip custom skills and builds", C.Reset + "and join your clan to destroy", C.Reset + "and raid others!", - }, "Clans", "Clans", new SelectCLANSButton(this)); + }, "Clans", null, new SelectCLANSButton(this)); add(41, Material.BREWING_STAND_ITEM, C.cYellowB + "Monster Maze " + C.cGray + "Snow Sprint", new String[] { @@ -197,17 +197,17 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Run along a maze avoiding", C.Reset + "evil monsters. Get to the", C.Reset + "Safe-Pad or be killed!", - }, "BETA", "Beta", new SelectBETAButton(this)); + }, "BETA", null, new SelectBETAButton(this)); } - private void add(int slot, Material material, String title, String[] lore, String serverTag, String serverGroup, IButton button) + private void add(int slot, Material material, String title, String[] lore, String serverTag, String boosterGroup, IButton button) { - add(slot, material, (byte) 0, title, lore, serverTag == null ? null : new String[]{serverTag}, serverGroup, button); + add(slot, material, (byte) 0, title, lore, serverTag == null ? null : new String[]{serverTag}, boosterGroup, button); } - private void add(int slot, Material material, byte data, String title, String[] lore, String[] serverTags, String serverGroup, IButton button) + private void add(int slot, Material material, byte data, String title, String[] lore, String[] serverTags, String boosterGroup, IButton button) { - add(slot, new ItemBuilder(material, 1, data), title, lore, serverTags, serverGroup, button); + add(slot, new ItemBuilder(material, 1, data), title, lore, serverTags, boosterGroup, button); } private void add(int slot, ItemBuilder builder, String title, String[] lore, String[] serverTags, String boosterGroup, IButton button) @@ -219,7 +219,8 @@ public class ServerGameMenu extends ShopPageBase if (booster != null) { // append to start of lore - builder.getLore().add(0, C.cGreen + "Boosted by " + C.cWhite + booster.getPlayerName() + C.cGreen + " - " + C.cWhite + booster.getTimeRemainingString()); + builder.getLore().add(0, C.cWhite + "Amplified by " + C.cGreen + booster.getPlayerName() + C.cWhite + " - " + C.cGreen + booster.getTimeRemainingString()); + builder.getLore().add(1, C.cWhite + "All players earn " + C.cYellow + "2x Exp" + C.cWhite + " and " + C.cAqua + "2x Shards"); builder.setGlow(true); } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 33570939f..58256a8f0 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -127,6 +127,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int winterChestsReceived = 0; int illuminatedChestsReceived = 0; int valentinesGiftsReceived = 0; + int boostersReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -205,6 +206,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } } + if (transaction.SalesPackageName.startsWith("Game Booster")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + boostersReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + boostersReceived += 1; + } + + } } // Strutt20 asked me to remove some stuff from the menu @@ -213,6 +225,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived); caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived); caller.sendMessage(C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived); + caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):"); if (_accountBonusLog.containsKey(client.getAccountId())) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java index d5debb134..8c6139b9f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/BoosterPodium.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.booster; -import com.mojang.authlib.GameProfile; import mineplex.core.MiniPlugin; import mineplex.core.boosters.Booster; import mineplex.core.boosters.event.BoosterActivateEvent; @@ -16,7 +15,6 @@ import mineplex.core.npc.NpcManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.database.tables.records.NpcsRecord; -import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; @@ -27,7 +25,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import java.util.HashSet; @@ -91,34 +88,30 @@ public class BoosterPodium extends MiniPlugin if (_activeArmorStand != null) { - if (_activeArmorStand.isValid()) - _activeArmorStand.teleport(new Location(_activeArmorStand.getLocation().getWorld(), 0, 0, 0)); - _activeArmorStand.remove(); } + if (_hologram == null) + { + _hologram = new Hologram(_hologramManager, _npcLocation.clone().add(0, 2.5, 0), true, getHologramText(activeBooster)); + _hologram.start(); + } + ArmorStand armorStand = _podiumLocation.getWorld().spawn(_npcLocation, ArmorStand.class); armorStand.setVisible(true); armorStand.setCustomNameVisible(false); - armorStand.setCustomName("" + activeBooster.getId()); + armorStand.setCustomName(""); armorStand.setGravity(true); armorStand.setArms(true); armorStand.setBasePlate(true); armorStand.setRemoveWhenFarAway(false); - armorStand.setHelmet(UtilSkull.getPlayerHead(activeBooster.getPlayerName(), activeBooster.getPlayerName(), null)); armorStand.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.LIME).build()); armorStand.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.LIME).build()); armorStand.setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.LIME).build()); // armorStand.setItemInHand(); - if (_hologram == null) - { - _hologram = new Hologram(_hologramManager, _npcLocation.clone().add(0, 2, 0), getHologramText(activeBooster)); - _hologram.start(); - } - /* runAsync(() -> { GameProfile profile = null; @@ -219,7 +212,6 @@ public class BoosterPodium extends MiniPlugin @EventHandler public void one(PlayerInteractAtEntityEvent event) { - Bukkit.broadcastMessage("Interact Event. Target=" + event.getRightClicked() + ", Equals=" + event.getRightClicked().equals(_activeArmorStand)); if (event.getRightClicked().equals(_activeArmorStand)) { _gameBoosterManager.attemptTip(event.getPlayer()); From 043f9576dd779a9e818145f8c96d05ac93d0a944 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 23 Jun 2016 22:50:31 -0700 Subject: [PATCH 43/49] Fix smash mobs booster group --- .../Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index a268f006d..723c0197a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -159,7 +159,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "and blow them up!", }, "MS", "MineStrike", new SelectMSButton(this)); - add(30, _superSmashCycle.get(_ssmIndex).clone(), null, null, new String[] {"SSM", "SSM2"}, "SmashMobs", new SelectSSMButton(this)); + add(30, _superSmashCycle.get(_ssmIndex).clone(), null, null, new String[] {"SSM", "SSM2"}, "Smash Mobs", new SelectSSMButton(this)); String[] games = new String[] {"MIN", "DR", "DE", "PB", "TF", "RUN", "SN", "DT", "SQ", "SA", "SS", "OITQ", "BB", "MB", "EVO", "GLD", "BL"}; From def57e2c0bd1ca762d1d2f51450e17f046ddcf22 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 23 Jun 2016 23:19:02 -0700 Subject: [PATCH 44/49] Fix HubManager, add failsafe for BoosterManager --- .../src/mineplex/core/boosters/BoosterManager.java | 14 +++++++++----- .../Mineplex.Hub/src/mineplex/hub/HubManager.java | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index cf7ba078b..a8b79473f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -120,7 +120,6 @@ public class BoosterManager extends MiniPlugin Map> boosters = _repository.getBoosters(); long timeTaken = System.currentTimeMillis() - time; runSync(() -> { - handleBoosterUpdate(boosters); if (callback != null) callback.run(boosters); }); @@ -219,10 +218,15 @@ public class BoosterManager extends MiniPlugin @EventHandler public void tickBoosters(UpdateEvent event) { - if (event.getType() != UpdateType.SEC) - return; - - tickBoosterCache(); + if (event.getType() == UpdateType.MIN_10) + { + // sync with API every 10 minutes, incase pubsub fails + getBoostersAsync(null); + } + else if (event.getType() == UpdateType.SEC) + { + tickBoosterCache(); + } } /** diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 276491f7c..62b398c5a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -229,7 +229,7 @@ public class HubManager extends MiniClientPlugin FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager, boosterManager); - _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); + _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager); From b58ff8c0664d8484e77e65e98df16a09697c8bab Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 24 Jun 2016 01:05:30 -0500 Subject: [PATCH 45/49] Add YouTube and Twitter buttons to UI --- .../mineplex/core/bonuses/BonusManager.java | 17 ++- .../core/bonuses/commands/GuiCommand.java | 2 +- .../mineplex/core/bonuses/gui/BonusGui.java | 16 ++- .../core/bonuses/gui/TwitterButton.java | 51 +++++++++ .../bonuses/gui/buttons/YoutubeButton.java | 82 +++++++++++++ .../mineplex/core/youtube/YoutubeClient.java | 23 ++++ .../mineplex/core/youtube/YoutubeManager.java | 84 ++++++++++++++ .../core/youtube/YoutubeRepository.java | 52 +++++++++ .../src/mineplex/hub/HubManager.java | 108 ++++++------------ .../nautilus/game/arcade/ArcadeManager.java | 4 +- 10 files changed, 357 insertions(+), 82 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index fd4ab502a..0fd3396b7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -6,7 +6,6 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.account.ILoginProcessor; import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.bonuses.animations.AnimationCarl; -import mineplex.core.bonuses.commands.AllowCommand; import mineplex.core.bonuses.commands.AnimationCommand; import mineplex.core.bonuses.commands.GuiCommand; import mineplex.core.bonuses.commands.TicketCommand; @@ -39,6 +38,7 @@ import mineplex.core.status.ServerStatusManager; import mineplex.core.treasure.TreasureType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.youtube.YoutubeManager; import mineplex.database.Tables; import mineplex.database.tables.records.BonusRecord; import mineplex.serverdata.commands.ServerCommandManager; @@ -122,6 +122,7 @@ public class BonusManager extends MiniClientPlugin implements I private RewardManager _rewardManager; private StatsManager _statsManager; private FacebookManager _facebookManager; + private YoutubeManager _youtubeManager; private BoosterManager _boosterManager; public boolean _enabled; private Npc _carlNpc; @@ -161,7 +162,7 @@ public class BonusManager extends MiniClientPlugin implements I updateOffSet(); } - public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, GadgetManager gadgetManager, BoosterManager boosterManager) + public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, BoosterManager boosterManager) { super("Bonus", plugin); _repository = new BonusRepository(plugin, this, donationManager); @@ -177,6 +178,7 @@ public class BonusManager extends MiniClientPlugin implements I _pollManager = pollManager; _statsManager = statsManager; _facebookManager = facebookManager; + _youtubeManager = youtubeManager; _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); @@ -415,6 +417,7 @@ public class BonusManager extends MiniClientPlugin implements I public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12; public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24; + public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback result) { if (timeTillDailyBonus(player) > 0) @@ -824,7 +827,7 @@ public class BonusManager extends MiniClientPlugin implements I if (entity.equals(_carlNpc.getEntity())) { updateDailyStreak(event.getPlayer()); - new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager, _boosterManager).openInventory(); + new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager, _youtubeManager, _boosterManager).openInventory(); } } @@ -840,7 +843,7 @@ public class BonusManager extends MiniClientPlugin implements I if (event.getEntity().equals(_carlNpc.getEntity())) { updateDailyStreak(player); - new BonusGui(_plugin, player, this, _rewardManager, _facebookManager, _boosterManager).openInventory(); + new BonusGui(_plugin, player, this, _rewardManager, _facebookManager, _youtubeManager, _boosterManager).openInventory(); } } } @@ -902,6 +905,7 @@ public class BonusManager extends MiniClientPlugin implements I int availableRewards = 0; if (canVote(player)) availableRewards++; + if (_youtubeManager.canYoutube(player)) availableRewards++; if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++; if (canDaily(player)) availableRewards++; if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++; @@ -1053,6 +1057,11 @@ public class BonusManager extends MiniClientPlugin implements I return _facebookManager; } + public YoutubeManager getYoutubeManager() + { + return _youtubeManager; + } + @EventHandler public void Join(final PlayerJoinEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java index b4b98c360..649f964e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/GuiCommand.java @@ -18,7 +18,7 @@ public class GuiCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager(), Plugin.getBoosterManager()).openInventory(); + new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager(), Plugin.getYoutubeManager(), Plugin.getBoosterManager()).openInventory(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index 7c3de784a..a8fef8c82 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -1,12 +1,12 @@ package mineplex.core.bonuses.gui; +import mineplex.core.bonuses.BonusManager; import mineplex.core.bonuses.gui.buttons.*; import mineplex.core.boosters.BoosterManager; import mineplex.core.facebook.FacebookManager; import mineplex.core.gui.SimpleGui; import mineplex.core.reward.RewardManager; -import mineplex.core.bonuses.BonusManager; - +import mineplex.core.youtube.YoutubeManager; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -15,7 +15,7 @@ public class BonusGui extends SimpleGui private BonusManager manager; - public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager, BoosterManager boosterManager) + public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager, YoutubeManager youtubeManager, BoosterManager boosterManager) { super(plugin, player, player.getName() + "'s Bonuses", 5 * 9); @@ -29,10 +29,14 @@ public class BonusGui extends SimpleGui setItem(16, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager)); - setItem(20, new FacebookButton(player, facebookManager)); + setItem(19, new FacebookButton(player, facebookManager)); + + setItem(21, new YoutubeButton(player, youtubeManager)); + + setItem(23, new TwitterButton(player)); + + setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); - setItem(24, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); - setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java new file mode 100644 index 000000000..fd9804d5d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/TwitterButton.java @@ -0,0 +1,51 @@ +package mineplex.core.bonuses.gui; + +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.gui.GuiItem; +import mineplex.core.itemstack.ItemBuilder; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +public class TwitterButton implements GuiItem +{ + private static final ItemStack ICON = new ItemBuilder(Material.EGG) + .setTitle(C.cGreen + C.Bold + "Visit us on Twitter") + .addLore( + C.cWhite + "Check out and follow Mineplex on", + C.cWhite + "Twitter for Giveaways, Announcements,", + C.cWhite + "Teasers, and Tips!", + " ", + C.cGreen + "Click to visit us on Twitter!" + ) + .build(); + private final Player _player; + + public TwitterButton(Player player) + { + this._player = player; + } + + @Override + public void setup() {} + + @Override + public void close() {} + + @Override + public void click(ClickType clickType) + { + _player.closeInventory(); + + new JsonMessage(C.cAquaB + "Click here to visit our Twitter page!").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player); + } + + @Override + public ItemStack getObject() + { + return ICON; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java new file mode 100644 index 000000000..475871234 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java @@ -0,0 +1,82 @@ +package mineplex.core.bonuses.gui.buttons; + +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.gui.GuiItem; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.youtube.YoutubeManager; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +public class YoutubeButton implements GuiItem +{ + private static final ItemStack DISABLED_ICON = new ItemBuilder(Material.APPLE) + .setTitle(C.cGreen + C.Bold + "Visit us on YouTube") + .addLore( + C.cWhite + "Come back tomorrow for your", + C.cWhite + "Daily 250 Shard Reward!", + " ", + C.cWhite + "Check out the latest Video", + C.cWhite + "on the MineplexGames Channel!", + " ", + C.cWhite + "Be sure and Subscribe so you", + C.cWhite + "don't miss a video!", + " ", + C.cGreen + "Click to visit us on YouTube!" + ) + .build(); + private static final ItemStack ENABLED_ICON = new ItemBuilder(Material.APPLE) + .setTitle(C.cGreen + C.Bold + "Visit us on YouTube") + .addLore( + C.cYellow + "Claim your Daily 250 Shard Reward", + C.cWhite + "by checking out the latest Video", + C.cWhite + "on the MineplexGames Channel!", + C.cWhite + " ", + C.cWhite + "Be sure and Subscribe so you", + C.cWhite + "don't miss a video!", + " ", + C.cGreen + "Click to visit us on YouTube!" + ) + .build(); + private final Player _player; + private final YoutubeManager _youtubeManager; + + public YoutubeButton(Player player, YoutubeManager youtubeManager) + { + this._player = player; + this._youtubeManager = youtubeManager; + } + + @Override + public void setup() {} + + @Override + public void close() {} + + @Override + public void click(ClickType clickType) + { + _player.closeInventory(); + + final String message; + if (_youtubeManager.canYoutube(_player)) + { + message = "Click here to claim YouTube Prize!"; + _youtubeManager.attemptYoutube(_player); + } else + { + message = "Click here to visit our YouTube page!"; + } + + new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/mineplexgamesofficial").sendToPlayer(_player); + } + + @Override + public ItemStack getObject() + { + return _youtubeManager.canYoutube(_player) ? ENABLED_ICON : DISABLED_ICON; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java new file mode 100644 index 000000000..fb28e1cba --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeClient.java @@ -0,0 +1,23 @@ +package mineplex.core.youtube; + +import java.time.LocalDate; + +public class YoutubeClient +{ + private LocalDate _clickDate; + + public YoutubeClient(LocalDate date) + { + this._clickDate = date; + } + + public LocalDate getClickDate() + { + return _clickDate; + } + + public void setClickDate(LocalDate date) + { + _clickDate = date; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java new file mode 100644 index 000000000..808087c36 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java @@ -0,0 +1,84 @@ +package mineplex.core.youtube; + +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.time.LocalDate; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; + +public class YoutubeManager extends MiniDbClientPlugin +{ + private final YoutubeRepository _repository; + private final DonationManager _donationManager; + + public YoutubeManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) + { + super("YoutubeManager", plugin, clientManager); + _donationManager = donationManager; + _repository = new YoutubeRepository(this); + } + + public boolean canYoutube(Player player) + { + YoutubeClient client = Get(player); + LocalDate date = client.getClickDate(); + + if (date == null) + { + return true; + } + + ZonedDateTime utcZoned = ZonedDateTime.now(ZoneOffset.UTC); + LocalDate utc = utcZoned.toLocalDate(); + + return !date.equals(utc); + } + + public void attemptYoutube(Player player) + { + if (!canYoutube(player)) + { + return; + } + YoutubeClient client = Get(player); + client.setClickDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate()); + _repository.attemptYoutube(player, client, success -> + { + if (success) + { + _donationManager.RewardCoinsLater("YouTube", player, 250); + } else + { + client.setClickDate(null); + } + }); + } + + @Override + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + boolean hasRow = resultSet.next(); + if (hasRow) + Set(playerName, new YoutubeClient(resultSet.getDate(1).toLocalDate())); + else + Set(playerName, new YoutubeClient(null)); + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT clicktime FROM youtube WHERE accountId=" + accountId + ";"; + } + + @Override + protected YoutubeClient AddPlayer(String player) + { + return new YoutubeClient(null); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java new file mode 100644 index 000000000..a108a0b3b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java @@ -0,0 +1,52 @@ +package mineplex.core.youtube; + +import mineplex.core.common.util.Callback; +import mineplex.serverdata.database.DBPool; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class YoutubeRepository +{ + private final YoutubeManager _manager; + + public YoutubeRepository(YoutubeManager manager) + { + _manager = manager; + } + + public void attemptYoutube(Player player, YoutubeClient client, Callback callback) + { + int accountId = _manager.getClientManager().Get(player).getAccountId(); + + Bukkit.getScheduler().runTaskAsynchronously(_manager.getPlugin(), () -> + { + try (Connection connection = DBPool.getAccount().getConnection()) + { + PreparedStatement statement = connection.prepareStatement("REPLACE INTO youtube (accountId, clicktime) VALUES (?, ?)"); + statement.setInt(1, accountId); + statement.setDate(2, Date.valueOf(client.getClickDate())); + statement.executeUpdate(); + + if (callback != null) + { + callback.run(true); + } + } + catch (SQLException e) + { + e.printStackTrace(); + } + + if (callback != null) + { + callback.run(false); + } + }); + } + +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 62b398c5a..642a50560 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,49 +1,5 @@ package mineplex.hub; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Random; - -import mineplex.core.boosters.BoosterManager; -import mineplex.core.brawl.fountain.FountainManager; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Egg; -import org.bukkit.entity.Entity; -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; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityTargetEvent.TargetReason; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.event.player.PlayerVelocityEvent; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.event.world.ChunkLoadEvent; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scoreboard.DisplaySlot; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; @@ -52,17 +8,10 @@ import mineplex.core.aprilfools.AprilFoolsManager; import mineplex.core.benefit.BenefitManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.bonuses.BonusManager; +import mineplex.core.boosters.BoosterManager; import mineplex.core.botspam.BotSpamManager; import mineplex.core.common.Rank; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; +import mineplex.core.common.util.*; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; @@ -105,21 +54,9 @@ import mineplex.core.treasure.TreasureManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.valentines.ValentinesGiftManager; -import mineplex.hub.commands.DisguiseCommand; -import mineplex.hub.commands.ForcefieldRadius; -import mineplex.hub.commands.GadgetToggle; -import mineplex.hub.commands.GameModeCommand; -import mineplex.hub.commands.NewsCommand; -import mineplex.hub.modules.ForcefieldManager; -import mineplex.hub.modules.HubVisibilityManager; -import mineplex.hub.modules.JumpManager; -import mineplex.hub.modules.KothManager; -import mineplex.hub.modules.NewsManager; -import mineplex.hub.modules.ParkourManager; -import mineplex.hub.modules.SoccerManager; -import mineplex.hub.modules.TextManager; -import mineplex.hub.modules.ValentinesManager; -import mineplex.hub.modules.WorldManager; +import mineplex.core.youtube.YoutubeManager; +import mineplex.hub.commands.*; +import mineplex.hub.modules.*; import mineplex.hub.profile.gui.GUIProfile; import mineplex.hub.tutorial.TutorialManager; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; @@ -133,6 +70,36 @@ import net.md_5.bungee.api.chat.HoverEvent.Action; import net.md_5.bungee.api.chat.TextComponent; import net.minecraft.server.v1_8_R3.EntityInsentient; import net.minecraft.server.v1_8_R3.EntityPlayer; +import org.bukkit.*; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.Egg; +import org.bukkit.entity.Entity; +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; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent.TargetReason; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.*; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; + +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Random; public class HubManager extends MiniClientPlugin { @@ -227,8 +194,9 @@ public class HubManager extends MiniClientPlugin _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager, packetHandler, hologramManager); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager, boosterManager); - + YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); + _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _gadgetManager, boosterManager); + _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager); 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 52ca492cc..65a69b863 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -50,6 +50,7 @@ import mineplex.core.teleport.Teleport; import mineplex.core.timing.TimingManager; import mineplex.core.titangiveaway.TitanGiveawayManager; import mineplex.core.valentines.ValentinesGiftManager; +import mineplex.core.youtube.YoutubeManager; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; @@ -286,7 +287,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation _gameTournamentManager = new GameTournamentManager(this); new GameStatManager(this); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _cosmeticManager.getGadgetManager(), boosterManager); + YoutubeManager youtubeManager = new YoutubeManager(plugin, clientManager, donationManager); + _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, youtubeManager, _cosmeticManager.getGadgetManager(), boosterManager); new GameLootManager(this, petManager, _bonusManager.getRewardManager()); new GameSpectatorManager(this); _gameWorldManager = new GameWorldManager(this); From 348cb9efba4a3c85b1d56e9cb8dcf6e6f44afc17 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 24 Jun 2016 00:17:26 -0700 Subject: [PATCH 46/49] Fix remaining booster message --- .../src/mineplex/core/boosters/tips/TipAddResult.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java index 82f491de2..965a8e738 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/TipAddResult.java @@ -5,7 +5,7 @@ package mineplex.core.boosters.tips; */ public enum TipAddResult { - ALREADY_TIPPED_BOOSTER("You have already thanked this booster!"), + ALREADY_TIPPED_BOOSTER("You have already thanked this Amplifier!"), INVALID_ACCOUNT_ID("Uh oh, something went wrong. Try relogging"), CANNOT_TIP_SELF("You can't thank yourself, silly!"), ON_COOLDOWN(null), From d708c478d7678eba69ad76e90d8f6e36bcf59da1 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 24 Jun 2016 00:54:18 -0700 Subject: [PATCH 47/49] Dont display other boosters, fix typo --- .../src/mineplex/core/boosters/gui/BoosterPage.java | 2 +- .../Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java index e565bac4a..e3a9da071 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/gui/BoosterPage.java @@ -101,7 +101,7 @@ public class BoosterPage extends ShopPageBase } addBoosterQueue(); - addOtherBoosters(); +// addOtherBoosters(); } private void openConfirmation(Player player, ClickType type) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 723c0197a..1ff43033c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -220,7 +220,7 @@ public class ServerGameMenu extends ShopPageBase { // append to start of lore builder.getLore().add(0, C.cWhite + "Amplified by " + C.cGreen + booster.getPlayerName() + C.cWhite + " - " + C.cGreen + booster.getTimeRemainingString()); - builder.getLore().add(1, C.cWhite + "All players earn " + C.cYellow + "2x Exp" + C.cWhite + " and " + C.cAqua + "2x Shards"); + builder.getLore().add(1, C.cWhite + "All players earn " + C.cGreen + "2x Gems" + C.cWhite + " and " + C.cAqua + "2x Shards"); builder.setGlow(true); } } From b4caf5125b8d29cd9f1b91eff3c7e66cb74c6ee6 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 24 Jun 2016 00:59:26 -0700 Subject: [PATCH 48/49] Adjust tip amounts --- .../src/mineplex/core/boosters/tips/BoosterTipManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java index 79e4fa8fb..1b5603ccd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java @@ -17,8 +17,8 @@ import java.sql.SQLException; */ public class BoosterTipManager extends MiniDbClientPlugin { - public static final int TIP_FOR_SPONSOR = 30; - public static final int TIP_FOR_TIPPER = 10; + public static final int TIP_FOR_SPONSOR = 5; + public static final int TIP_FOR_TIPPER = 5; private BoosterTipRepository _repository; private DonationManager _donationManager; From 560abc933c08cdede91a78edf0da4823de0e82b0 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 24 Jun 2016 01:11:17 -0700 Subject: [PATCH 49/49] Replace underscores with spaces in booster group --- .../src/nautilus/game/arcade/booster/GameBoosterManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java index ef93af838..5fe291f44 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/booster/GameBoosterManager.java @@ -84,7 +84,7 @@ public class GameBoosterManager extends MiniPlugin Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier for " + booster.getMultiplier() + "x Gems and Shards!")); } else { - Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier on " + F.elem(event.getBoosterGroup()) + "!")); + Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier on " + F.elem(event.getBoosterGroup().replaceAll("_", " ")) + "!")); } } }