From 460cb08f54bf04b8ee064ff17bd6bb9024c128b3 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 25 May 2016 12:19:06 -0300 Subject: [PATCH 001/115] 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 002/115] 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 365dd0e561c3a0ae4b6076f6ef50220505d3933a Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Mon, 30 May 2016 14:44:42 +0200 Subject: [PATCH 003/115] Disable particles in DMT, disable Monster Damage in OITQ, fix teleport out minion despawning, horsman description, ice melting in master builders and energy draining for spider leap in SSM --- .../game/arcade/game/games/build/Build.java | 8 +++++ .../game/arcade/game/games/draw/Draw.java | 13 +++---- .../game/arcade/game/games/quiver/Quiver.java | 9 +++++ .../games/survivalgames/SurvivalGames.java | 34 +++++++++++++++++++ .../games/survivalgames/kit/KitHorseman.java | 2 +- .../game/arcade/kit/perks/PerkHorsePet.java | 28 ++++++++++++++- .../game/arcade/kit/perks/PerkSkeletons.java | 27 ++++++++++++++- .../game/arcade/kit/perks/PerkSpiderLeap.java | 3 ++ .../game/arcade/kit/perks/PerkWolfPet.java | 34 ++++++++++++++----- 9 files changed, 141 insertions(+), 17 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index b97739e9f..04aa572bb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -38,6 +38,7 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.build.gui.MobShop; import nautilus.game.arcade.game.games.build.gui.OptionsShop; import nautilus.game.arcade.game.games.build.kits.KitBuilder; +import nautilus.game.arcade.game.games.christmas.content.IceMaze; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.BlockBreakStatTracker; @@ -75,6 +76,7 @@ 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.BlockFadeEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; @@ -1509,6 +1511,12 @@ public class Build extends SoloGame { event.blockList().clear(); } + + @EventHandler(priority = EventPriority.LOWEST) + public void iceMelt(BlockFadeEvent event) + { + event.setCancelled(true); + } @EventHandler public void openMobGui(PlayerInteractEntityEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index cc87cc712..8b6c61a77 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -100,7 +100,7 @@ public class Draw extends SoloGame { //new KitSlowAndSteady(manager), //new KitSelector(manager), -// new KitTools(manager), + //new KitTools(manager), new KitArtist(manager) }, @@ -111,11 +111,12 @@ public class Draw extends SoloGame "Hints are given at top of screen", }); - this.StrictAntiHack = true; - this.Damage = false; - this.HungerSet = 20; - this.WorldTimeSet = 8000; - + StrictAntiHack = true; + Damage = false; + HungerSet = 20; + WorldTimeSet = 8000; + AllowParticles = false; + _words = new String[] { "Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java index e3a2bf311..24451e519 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java @@ -34,6 +34,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -277,6 +278,14 @@ public class Quiver extends SoloGame @EventHandler public void ArrowDamage(CustomDamageEvent event) { + if (!(event.GetDamagerEntity(true) instanceof Arrow) + && !(event.GetDamagerEntity(true) instanceof Player) + && (event.GetDamagerEntity(true) instanceof Entity)) + { + event.setCancelled(true); + return; + } + if (event.GetProjectile() == null) return; 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..0b16cb33e 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 @@ -43,12 +43,14 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.inventory.FurnaceInventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkMeta; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Team; @@ -63,6 +65,7 @@ import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; @@ -774,6 +777,8 @@ public abstract class SurvivalGames extends Game { item = buildCompass(5); } + + handlePickup(item); chest.getBlockInventory().setItem(UtilMath.r(27), item); } @@ -808,6 +813,9 @@ public abstract class SurvivalGames extends Game @EventHandler public void ItemSpawn(ItemSpawnEvent event) { + if (event.getEntity().getItemStack().hasItemMeta()) + return; + Material mat = event.getEntity().getItemStack().getType(); switch (mat) @@ -1008,6 +1016,32 @@ public abstract class SurvivalGames extends Game } } + @EventHandler + public void pickupItems(PlayerPickupItemEvent event) + { + handlePickup(event.getItem().getItemStack()); + } + + private void handlePickup(ItemStack stack) + { + if (stack.getType() == Material.CARROT + || stack.getType() == Material.POTATO + || stack.getType() == Material.WHEAT + || stack.getType() == Material.CARROT_ITEM + || stack.getType() == Material.POTATO_ITEM) + { + String name = "Carrot"; + if (stack.getType() == Material.POTATO || stack.getType() == Material.POTATO_ITEM) + name = "Potato"; + if (stack.getType() == Material.WHEAT) + name = "Wheat"; + + ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(name); + stack.setItemMeta(meta); + } + } + @EventHandler public void OpenChest(PlayerInteractEvent event) { 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..497d14297 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 @@ -20,7 +20,7 @@ public class KitHorseman extends Kit new String[] { - "Proud owner of a (rapidly growing) horse!" + "Proud owner of a horse!" }, new Perk[] 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..676bec0f5 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 @@ -14,9 +14,11 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Horse; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; @@ -160,6 +162,25 @@ public class PerkHorsePet extends Perk horse.setHealth(Math.min(horse.getMaxHealth(), horse.getHealth()+1)); } } + + @EventHandler + public void modTeleport(PlayerCommandPreprocessEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!event.getMessage().toLowerCase().startsWith("/tp") && !event.getMessage().toLowerCase().startsWith("/teleport")) + return; + + if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.MODERATOR) + || Manager.GetClients().hasRank(event.getPlayer(), Rank.DEVELOPER)) + return; + + if (event.getMessage().split(" ").length < 2) + return; + + despawnHorse(event.getPlayer()); + } @EventHandler public void death(PlayerDeathEvent event) @@ -167,7 +188,12 @@ public class PerkHorsePet extends Perk if (!Manager.GetGame().IsLive()) return; - Horse horse = _horseMap.remove(event.getEntity()); + despawnHorse(event.getEntity()); + } + + private void despawnHorse(Player player) + { + Horse horse = _horseMap.remove(player); if (horse == null) return; 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..f8fae47de 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,5 +1,6 @@ package nautilus.game.arcade.kit.perks; +import mineplex.core.common.Rank; import mineplex.core.common.util.*; import mineplex.core.updater.*; import mineplex.core.updater.event.*; @@ -274,10 +275,34 @@ public class PerkSkeletons extends Perk event.AddMod("Skeleton Minion", "Damage", damage, false); } + @EventHandler + public void modTeleport(PlayerCommandPreprocessEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!event.getMessage().toLowerCase().startsWith("/tp") && !event.getMessage().toLowerCase().startsWith("/teleport")) + return; + + if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.MODERATOR) + || Manager.GetClients().hasRank(event.getPlayer(), Rank.DEVELOPER)) + return; + + if (event.getMessage().split(" ").length < 2) + return; + + despawnSkels(event.getPlayer()); + } + @EventHandler public void PlayerDeath(PlayerDeathEvent event) { - ArrayList skels = _minions.remove(event.getEntity()); + despawnSkels(event.getEntity()); + } + + private void despawnSkels(Player player) + { + ArrayList skels = _minions.remove(player); if (skels == null) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java index f2e8b18b1..c25b2959d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java @@ -110,6 +110,9 @@ public class PerkSpiderLeap extends Perk //Velocity UtilAction.velocity(player, 1.0, 0.2, 1.0, true); + //Energy + player.setExp((float) Math.max(0, player.getExp()-(1f/6f))); + //Sound player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 1f, 1.5f); 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..954892a20 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 @@ -20,9 +20,11 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; +import mineplex.core.common.Rank; import mineplex.core.common.util.*; import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; @@ -292,23 +294,39 @@ public class PerkWolfPet extends Perk } @EventHandler - public void PlayerDeath(PlayerDeathEvent event) + public void modTeleport(PlayerCommandPreprocessEvent event) { - ArrayList wolves = _wolfMap.remove(event.getEntity()); - - if (wolves == null) + if (!Manager.GetGame().IsLive()) + return; + + if (!event.getMessage().toLowerCase().startsWith("/tp") && !event.getMessage().toLowerCase().startsWith("/teleport")) return; - for (Wolf wolf : wolves) - wolf.remove(); + if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.MODERATOR) + || Manager.GetClients().hasRank(event.getPlayer(), Rank.DEVELOPER)) + return; - wolves.clear(); + if (event.getMessage().split(" ").length < 2) + return; + + despawnWolf(event.getPlayer()); + } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + despawnWolf(event.getEntity()); } @EventHandler public void PlayerQuit(PlayerQuitEvent event) { - ArrayList wolves = _wolfMap.remove(event.getPlayer()); + despawnWolf(event.getPlayer()); + } + + private void despawnWolf(Player player) + { + ArrayList wolves = _wolfMap.remove(player); if (wolves == null) return; From b3291476cb83b39b5b1d827f53660c10c0adba8c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 2 Jun 2016 18:25:16 -0300 Subject: [PATCH 004/115] 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 005/115] 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 9e88174c3682ba27a8c7b81f3e094f86e927a440 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Tue, 7 Jun 2016 00:19:56 +0200 Subject: [PATCH 006/115] slowly increase spider energy --- .../src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java index c25b2959d..37d07564d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSpiderLeap.java @@ -54,7 +54,7 @@ public class PerkSpiderLeap extends Perk { if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) { - player.setExp(0.999f); + player.setExp((float) Math.min(0.999, player.getExp()+(1f/80f))); _secondJump.remove(player); } @@ -107,6 +107,9 @@ public class PerkSpiderLeap extends Perk //Disable Flight player.setAllowFlight(false); + if (player.getExp() < (1f/6f)) + return; + //Velocity UtilAction.velocity(player, 1.0, 0.2, 1.0, true); From 8bf26dbc1101f575b242e912ae703f283ab2d5fe Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 9 Jun 2016 18:57:48 -0500 Subject: [PATCH 007/115] 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 008/115] 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 009/115] 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 010/115] 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 011/115] 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 012/115] 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 73d8aec4945aaf78548b13ede0256f5b29ae2ef8 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 11 Jun 2016 00:21:04 +0200 Subject: [PATCH 013/115] fix breakable Armor in Wizards --- .../src/nautilus/game/arcade/game/games/wizards/Wizards.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java index 424052df7..6ab2f5018 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizards.java @@ -957,6 +957,9 @@ public class Wizards extends SoloGame UtilInv.addDullEnchantment(item); } + if (UtilItem.isArmor(item)) + UtilItem.makeUnbreakable(item); + inv.setItem(UtilMath.r(inv.getSize()), item); } From 42c35063b3393a3fae07f3d5ed72c4e7a0b677d7 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 10 Jun 2016 17:40:59 -0500 Subject: [PATCH 014/115] 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 015/115] 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 016/115] 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 5e551a2ba6c954ce17e8d9c921afab0e2f5ba278 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 11 Jun 2016 15:49:31 +0200 Subject: [PATCH 017/115] fix waller only being able to make two walls --- .../arcade/game/games/lobbers/kits/perks/PerkWaller.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index 90550c8c4..89a415a4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -7,6 +7,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; @@ -76,6 +77,11 @@ public class PerkWaller extends Perk return; } + if (!Recharge.Instance.usable(event.getPlayer(), "Waller")) + return; + + Recharge.Instance.use(event.getPlayer(), "Waller", 100, false, false); + UtilInv.remove(event.getPlayer(), Material.STONE_SPADE, (byte) 0, 1); _wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw())); From 75e36d0e08d9b89306193d4eacdea79e86592c22 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 11 Jun 2016 16:13:07 +0200 Subject: [PATCH 018/115] fix pickup of dropped tnt --- .../game/arcade/game/games/skywars/Skywars.java | 3 +-- .../game/games/skywars/data/TNTGenerator.java | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 019d23f96..a99565c9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -674,8 +674,7 @@ public abstract class Skywars extends Game Player player = e.getPlayer(); if (is.getType() == Material.TNT) { - e.setCancelled(true); - _tntGen.pickup(player, e.getItem()); + e.setCancelled(_tntGen.pickup(player, e.getItem())); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/data/TNTGenerator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/data/TNTGenerator.java index ebff5b18f..cd05c76e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/data/TNTGenerator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/data/TNTGenerator.java @@ -76,23 +76,23 @@ public class TNTGenerator .trail(true).build()); } - public void pickup(Player player, Item item) + public boolean pickup(Player player, Item item) { if (_ent == null) - return; + return false; if (!_ent.equals(item)) - return; + return false; if (!Host.IsAlive(player)) - return; + return true; if (Host.Manager.isSpectator(player)) - return; + return true; GameTeam team = Host.GetTeam(player); if (team == null) - return; + return true; // Remove _ent.remove(); @@ -124,6 +124,7 @@ public class TNTGenerator player.playSound(player.getLocation(), Sound.ENDERDRAGON_HIT, 3F, 1F); Bukkit.getPluginManager().callEvent(new TNTPickupEvent(player)); + return true; } public String getScoreboardInfo() From a461e9cf1c1fc7f3b51183777ae9c68867d3fb1e Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 11 Jun 2016 16:27:31 +0200 Subject: [PATCH 019/115] fix inventory being editable while voting phase --- .../src/nautilus/game/arcade/game/games/build/Build.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index f737f6790..e5aab2079 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -1505,6 +1505,11 @@ public class Build extends Game { Player player = ((Player) event.getWhoClicked()); + if (_buildGameState == 2 || _buildGameState == 3) + { + event.setCancelled(true); + } + if (IsLive() && IsAlive(player)) { BuildData buildData = _data.get(player); From bc77605dcdd5a24a857e6a54dbb9d2f2452238f1 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 11 Jun 2016 16:43:56 +0200 Subject: [PATCH 020/115] make crafted weapons in SG unbreakable --- .../arcade/game/games/survivalgames/SurvivalGames.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 37e1ab59a..212fbd386 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 @@ -37,6 +37,7 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.hanging.HangingBreakEvent; +import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -1936,6 +1937,15 @@ public abstract class SurvivalGames extends Game } } } + + @EventHandler + public void craftedItems(CraftItemEvent event) + { + if (UtilItem.isWeapon(event.getCurrentItem()) || UtilItem.isArmor(event.getCurrentItem())) + { + UtilItem.makeUnbreakable(event.getCurrentItem()); + } + } @EventHandler public void UpdateNametagVisibility(UpdateEvent event) From bf4de4471addeaf3f9a6368ba012eae81322e70b Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 11 Jun 2016 17:33:12 +0200 Subject: [PATCH 021/115] fix permanent item removal and battle items in inventory --- .../gladiators/hotbar/HotbarPageListener.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarPageListener.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarPageListener.java index 470421046..ead613383 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarPageListener.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarPageListener.java @@ -12,10 +12,17 @@ import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; /** * Created by William (WilliamTiger). @@ -142,4 +149,51 @@ public class HotbarPageListener implements Listener i.remove(); } + + @EventHandler + public void updateInv(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (Player player : UtilServer.GetPlayers()) + { + if (player.getOpenInventory() == null) + continue; + + if (player.getOpenInventory().getTopInventory() == null) + continue; + + if (!player.getOpenInventory().getTopInventory().getName().equals("Hotbar Editor")) + continue; + + for (Material mat : new Material[]{Material.DIAMOND_SWORD, Material.BOW, Material.FISHING_ROD, Material.ARROW}) + { + boolean founditem = false; + for (ItemStack item : player.getOpenInventory().getTopInventory().getContents()) + { + if (item != null && item.getType() == mat) + { + founditem = true; + } + } + if (player.getItemOnCursor() != null) + { + if (player.getItemOnCursor().getType() == mat) + founditem = true; + } + + if (!founditem) + { + player.getOpenInventory().getTopInventory().addItem(new ItemStack(mat)); + } + + + if (UtilInv.contains(player, null, mat, (byte) 0, 1, false, true, false)) + { + UtilInv.removeAll(player, mat, (byte) 0); + } + } + } + } } From aa785ed3d579e1da2d5298de217ba412dd4c160d Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 12 Jun 2016 21:18:11 -0500 Subject: [PATCH 022/115] 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 023/115] 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 024/115] 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 9e75cc6224076c40e4dfbee139dcc70d4c1eec6f Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Jun 2016 11:12:16 +0100 Subject: [PATCH 025/115] Fixes incorrect item in OITQ Players should now get the stone sword that is intended with the leaper kit, assuming it was some merge or pushing error. --- .../nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java index c67f789fa..f12ed6a8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java @@ -31,7 +31,7 @@ public class KitLeaper extends ProgressingKit private static final ItemStack IN_HAND = new ItemStack(Material.STONE_SWORD); private static final ItemStack[] PLAYER_ITEMS = { - ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), ItemStackFactory.Instance.CreateStack(Material.BOW) }; From c3a18813ee7f48935f295232bb8a991bd77feba6 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Jun 2016 11:39:51 +0100 Subject: [PATCH 026/115] PC-555 Fixes an issue where vanished players would show up in the "Give Co-Host" and "Remove player" menus in MPS. --- .../game/arcade/gui/privateServer/page/PlayerPage.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/PlayerPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/PlayerPage.java index c2f6f2817..c6cf102d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/PlayerPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/PlayerPage.java @@ -44,7 +44,12 @@ public abstract class PlayerPage extends BasePage players = new ArrayList<>(); for (String s : _players) { - players.add(Bukkit.getPlayer(s)); + Player player = Bukkit.getPlayer(s); + + if (!_plugin.isVanished(player)) + { + players.add(player); + } } } else @@ -56,7 +61,7 @@ public abstract class PlayerPage extends BasePage int slot = 9; for (Player player : players) { - if (showPlayer(player)) + if (showPlayer(player) && !_plugin.isVanished(player)) { ItemStack head = getPlayerHead(player.getName(), C.cGreen + C.Bold + player.getName(), new String[]{ ChatColor.RESET + C.cGray + getDisplayString(player) }); addButton(slot, head, new Button(slot, player)); From 1d3e12dfb643e694e62c420681c755d12a0f596a Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Jun 2016 12:10:39 +0100 Subject: [PATCH 027/115] PC-574 Fixes an issue where staff in vanish would be placed in the game after each round. --- .../game/arcade/game/games/minestrike/MineStrike.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 a7468cf90..f6b99efc2 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 @@ -2138,7 +2138,13 @@ public class MineStrike extends TeamGame team.SpawnTeleport(false); //Revive Dead Players - for (Player player : GetPlayers(false)) + for (Player player : GetPlayers(false)) + { + if (Manager.isVanished(player)) + { + continue; + } + if (!IsAlive(player)) { SetPlayerState(player, PlayerState.IN); @@ -2156,6 +2162,7 @@ public class MineStrike extends TeamGame if (GetKit(player) != null) GetKit(player).ApplyKit(player); } + } //Remove Scope for (Player player : GetPlayers(false)) From ce23a94f3f32f5b76f3d5435f6e8cdf41b4cb99f Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Jun 2016 12:25:21 +0100 Subject: [PATCH 028/115] PC-550 Fixes an issue where players would be able to interact with blocks on other people's islands in Speed Builders --- .../games/speedbuilders/SpeedBuilders.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index da4406b2c..1ff25e748 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -1694,6 +1694,33 @@ public class SpeedBuilders extends SoloGame UtilAction.velocity(event.getPlayer(), new Vector(0, 1, 0)); } + + @EventHandler + public void fixDoorToggling(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + if (_state != SpeedBuildersState.BUILDING) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + if (_perfectBuild.containsKey(event.getPlayer())) + { + event.setCancelled(true); + return; + } + + Block block = event.getClickedBlock(); + + if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block)) + { + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Build", "You cannot modify other player\'s builds")); + } + } @Override public void EndCheck() From ea551182b6b52c726c084672c0711a1a03a0ce9d Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 16 Jun 2016 15:29:05 -0500 Subject: [PATCH 029/115] 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 030/115] 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 79085c1ecff09373d5fa9be0c172e748bd1485ba Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Jun 2016 00:26:24 +0100 Subject: [PATCH 031/115] PC-541 Fixes an issue where glowing redstone ore would not be counted if the expected block was redstone ore. --- .../arcade/game/games/speedbuilders/data/RecreationData.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 268434338..4fd17f57c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -324,6 +324,11 @@ public class RecreationData score++; } + if (expectedState.getType() == Material.REDSTONE_ORE && currentBlock.getType() == Material.GLOWING_REDSTONE_ORE) + { + score++; + } + //Fix for corner stair shape if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs) { From a20ae6b58d1db779718614d20b64ca3bb2f99a9b Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Jun 2016 00:31:32 +0100 Subject: [PATCH 032/115] PC-540 Fixes an issue where players could lose water blocks in Speed builders. --- .../arcade/game/games/speedbuilders/SpeedBuilders.java | 10 +++++++++- .../game/games/speedbuilders/data/RecreationData.java | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 1ff25e748..9aff3a136 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -17,6 +17,7 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -1541,6 +1542,13 @@ public class SpeedBuilders extends SoloGame UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); } + else + { + if (liquid.getType() == Material.STATIONARY_WATER) + { + event.setCancelled(true); + } + } } @EventHandler @@ -1713,7 +1721,7 @@ public class SpeedBuilders extends SoloGame return; } - Block block = event.getClickedBlock(); + Block block = event.getClickedBlock().getRelative(event.getBlockFace()); if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 4fd17f57c..f8d04201e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -324,6 +324,7 @@ public class RecreationData score++; } + //Fix for glowing redstone ore if (expectedState.getType() == Material.REDSTONE_ORE && currentBlock.getType() == Material.GLOWING_REDSTONE_ORE) { score++; From cbca7e9f7e1567458d7e1bb3da82767c8a802c4a Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Jun 2016 12:06:56 +0100 Subject: [PATCH 033/115] PC-540 Fixed unneeded messages --- .../game/games/speedbuilders/SpeedBuilders.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 9aff3a136..0c02a2c71 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -17,7 +17,6 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -56,7 +55,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.ArmorStand; @@ -1544,7 +1542,7 @@ public class SpeedBuilders extends SoloGame } else { - if (liquid.getType() == Material.STATIONARY_WATER) + if (liquid.getType() == Material.STATIONARY_WATER || liquid.getType() == Material.WATER) { event.setCancelled(true); } @@ -1721,12 +1719,18 @@ public class SpeedBuilders extends SoloGame return; } + if (event.getPlayer().getItemInHand() == null) + { + event.setCancelled(true); + return; + } + Block block = event.getClickedBlock().getRelative(event.getBlockFace()); if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block)) { event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main("Build", "You cannot modify other player\'s builds")); + UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); } } From 35b00679e09ea851b7486b2ca8dc06183696d038 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Jun 2016 18:08:37 +0100 Subject: [PATCH 034/115] PC-516 When out of leaps in dragon escape there is no longer the "You can now use Leap" message. --- .../src/nautilus/game/arcade/kit/perks/PerkLeap.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java index f971ae57a..0c2b37ecf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; @@ -72,7 +73,7 @@ public class PerkLeap extends Perk if (event.getPlayer().getItemInHand() == null) return; - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + if (!UtilItem.isAxe(event.getPlayer().getItemInHand())) return; Player player = event.getPlayer(); @@ -94,7 +95,7 @@ public class PerkLeap extends Perk } //Energy - if (!Recharge.Instance.use(player, _name, _recharge, true, true)) + if (!Recharge.Instance.use(player, _name, _recharge, false, true)) return; //Use Use From 4e3062f41360dde3392a1b16b5c08f6adcb02f33 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 17 Jun 2016 15:23:53 -0500 Subject: [PATCH 035/115] 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 036/115] 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 09957c203b8951a9abc3b73c34b953289df3a8a9 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Jun 2016 22:24:46 +0100 Subject: [PATCH 037/115] PC-506 Fixes an issue where the creeper's passive in SSM would activate when they took starvation damage. --- .../game/arcade/kit/perks/PerkCreeperElectricity.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java index c9054de14..0b6ae7d62 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperElectricity.java @@ -39,10 +39,7 @@ public class PerkCreeperElectricity extends Perk if (event.IsCancelled()) return; - if (event.GetCause() == DamageCause.ENTITY_ATTACK) - return; - - if (event.GetCause() == DamageCause.FIRE_TICK) + if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.FIRE_TICK || event.GetCause() == DamageCause.STARVATION) return; Player damagee = event.GetDamageePlayer(); From c19af4e1c53f1551f1229bb8fa0e6db8f7b3ca28 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 18 Jun 2016 00:04:03 +0100 Subject: [PATCH 038/115] PC-505 Fixed an issue where players could hit team members with Bouncy Bacon and get the health bonus from it. --- .../game/arcade/kit/perks/PerkPigBaconBounce.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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..8b5d15ddc 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 @@ -33,6 +33,7 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; public class PerkPigBaconBounce extends SmashPerk implements IThrown @@ -108,6 +109,18 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown if (target == null) return; + + if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.GetThrower() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) target; + Player throwerPlayer = (Player) data.GetThrower(); + + if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + { + return; + } + } //Damage Event Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, From d167f934860ea51425b66c922a093929b6fe5cf5 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 18 Jun 2016 15:33:39 +0100 Subject: [PATCH 039/115] PC-507 Fixes an issue where Blaze's "Firefly" and "Phoenix" abilities did no damage or knockback. --- .../nautilus/game/arcade/kit/perks/PerkFirefly.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java index 5b8a4d23a..dfa1aac38 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java @@ -3,11 +3,8 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; import java.util.Iterator; -import org.bukkit.Color; import org.bukkit.EntityEffect; -import org.bukkit.FireworkEffect; import org.bukkit.Sound; -import org.bukkit.FireworkEffect.Type; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; @@ -19,7 +16,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; @@ -30,7 +26,6 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.perks.data.FireflyData; @@ -93,7 +88,7 @@ public class PerkFirefly extends SmashPerk if (event.getType() != UpdateType.TICK) return; - _tick = (_tick + 1)%1000; + _tick++; Iterator dataIterator = _data.iterator(); @@ -147,11 +142,10 @@ public class PerkFirefly extends SmashPerk continue; other.playEffect(EntityEffect.HURT); - - if (_tick == 0) + + if (_tick % 12 == 0) { if (Recharge.Instance.use(other, GetName() + " hit by " + data.Player.getName(), 2000, false, false)) - { //Damage Event Manager.GetDamage().NewDamageEvent(other, data.Player, null, DamageCause.CUSTOM, 10, true, true, false, From 690c6160b9259801610ea073383f2d4951b3e3be Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 18 Jun 2016 14:27:53 -0500 Subject: [PATCH 040/115] 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 041/115] 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 042/115] 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 043/115] 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 e8b8a3cd66f2c725fa5c1affa91b13136cb712fb Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 19 Jun 2016 17:10:22 +0100 Subject: [PATCH 044/115] PC-504 Fixes an issue where if players in SSM destroyed all of the spawn point locations, players would not be handled correctly --- .../game/arcade/kit/perks/PerkCreeperExplode.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java index 5a97d8a8f..2f30b18fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java @@ -21,8 +21,10 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.SmashPerk; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -165,6 +167,16 @@ public class PerkCreeperExplode extends SmashPerk if (UtilMath.offset(player.getLocation(), spawn) < 14) spawnIterator.remove(); } + + //If all spawns have been destroyed revert to using the spectator spawn + for (GameTeam team : Manager.GetGame().GetTeamList()) + { + if (team.GetSpawns().isEmpty()) + { + Bukkit.broadcastMessage(F.main("Debug", "Ran out of spawns!")); + team.GetSpawns().add(Manager.GetGame().GetSpectatorLocation()); + } + } } //Damage From a830b5b388e90f5ff6084c14471f7c9f49fa4438 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 19 Jun 2016 17:12:58 +0100 Subject: [PATCH 045/115] Removal of debug message and compilation error --- .../src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java | 1 - .../src/nautilus/game/arcade/kit/perks/PerkFirefly.java | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java index 2f30b18fa..fee25dd52 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java @@ -173,7 +173,6 @@ public class PerkCreeperExplode extends SmashPerk { if (team.GetSpawns().isEmpty()) { - Bukkit.broadcastMessage(F.main("Debug", "Ran out of spawns!")); team.GetSpawns().add(Manager.GetGame().GetSpectatorLocation()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java index dfa1aac38..df7e17b2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFirefly.java @@ -146,6 +146,7 @@ public class PerkFirefly extends SmashPerk if (_tick % 12 == 0) { if (Recharge.Instance.use(other, GetName() + " hit by " + data.Player.getName(), 2000, false, false)) + { //Damage Event Manager.GetDamage().NewDamageEvent(other, data.Player, null, DamageCause.CUSTOM, 10, true, true, false, @@ -160,7 +161,7 @@ public class PerkFirefly extends SmashPerk { dataIterator.remove(); } - } + } } @EventHandler From 63b7648608d85b858795c4fe17f98642083b4c7e Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 19 Jun 2016 19:05:04 -0500 Subject: [PATCH 046/115] 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 047/115] 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 048/115] 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 049/115] 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 0131850fc371a25d2683b12de051cc635fd7bb66 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 21 Jun 2016 20:41:53 +0100 Subject: [PATCH 050/115] SSM fixes --- .../items/grenades/HighExplosive.java | 6 +- .../arcade/kit/perks/PerkNightLivingDead.java | 12 ++++ .../arcade/kit/perks/PerkSlimeRocket.java | 13 ++++ .../arcade/kit/perks/PerkWitherImage.java | 65 ++++++++++++------- 4 files changed, 70 insertions(+), 26 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java index 02c7b7300..0587fef2b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java @@ -49,7 +49,11 @@ public class HighExplosive extends Grenade for (Player player : players.keySet()) { if (!game.IsAlive(player)) - continue; + { + Bukkit.broadcastMessage("They are dead"); + } + + Bukkit.broadcastMessage("Dealing damage"); // Damage Event game.Manager.GetDamage().NewDamageEvent(player, _thrower, null, ent.getLocation(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java index 64dcdc9b7..c2373d488 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.kit.perks; +import java.lang.annotation.Target; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -22,6 +23,7 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.perks.data.NightLivingDeadData; @@ -128,6 +130,16 @@ public class PerkNightLivingDead extends SmashPerk { if (data.Player.equals(event.getTarget())) { + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if (!smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer))) + { + return; + } + } event.setCancelled(true); } } 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..1371ddc1d 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 @@ -33,6 +33,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; public class PerkSlimeRocket extends SmashPerk implements IThrown @@ -225,6 +226,18 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Slime slime = (Slime)data.GetThrown(); + if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.GetThrower() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) target; + Player throwerPlayer = (Player) data.GetThrower(); + + if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + { + return; + } + } + //Damage Event Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 3 + slime.getSize() * 3, true, true, false, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index 5a7fccc01..a4422bc8e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -2,6 +2,17 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; +import nautilus.game.arcade.kit.SmashPerk; import org.bukkit.Location; import org.bukkit.Material; @@ -17,20 +28,10 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.SmashPerk; - public class PerkWitherImage extends SmashPerk { - private HashMap _images = new HashMap(); + private HashMap _ownerToSkeleton = new HashMap(); + private HashMap _skeletonToOwner = new HashMap(); public PerkWitherImage() { @@ -67,7 +68,7 @@ public class PerkWitherImage extends SmashPerk if (!Kit.HasKit(player)) return; - if (!_images.containsKey(player)) + if (!_ownerToSkeleton.containsKey(player)) { if (!Recharge.Instance.use(player, GetName(), 12000, true, true)) return; @@ -94,7 +95,8 @@ public class PerkWitherImage extends SmashPerk UtilAction.velocity(skel, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, true); - _images.put(player, skel); + _ownerToSkeleton.put(player, skel); + _skeletonToOwner.put(skel, player); Recharge.Instance.use(player, "Wither Swap", 500, false, false); @@ -109,7 +111,7 @@ public class PerkWitherImage extends SmashPerk if (!Recharge.Instance.use(player, "Wither Swap", 2000, true, false)) return; - Skeleton skel = _images.get(player); + Skeleton skel = _ownerToSkeleton.get(player); Location loc = skel.getLocation(); skel.teleport(player.getLocation()); @@ -126,9 +128,21 @@ public class PerkWitherImage extends SmashPerk @EventHandler public void entityTarget(EntityTargetEvent event) { - if (_images.containsKey(event.getTarget())) - if (_images.get(event.getTarget()).equals(event.getEntity())) + if (_ownerToSkeleton.containsKey(event.getTarget()) && _skeletonToOwner.containsKey(event.getEntity())) + if (_ownerToSkeleton.get(event.getTarget()).equals(event.getEntity())) + { + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if(!smash.GetTeam(_skeletonToOwner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) + { + return; + } + } event.setCancelled(true); + } } @EventHandler @@ -137,13 +151,13 @@ public class PerkWitherImage extends SmashPerk Player damagee = event.GetDamageePlayer(); if (damagee == null) return; - if (!_images.containsKey(damagee)) + if (!_ownerToSkeleton.containsKey(damagee.getUniqueId())) return; LivingEntity damager = event.GetDamagerEntity(false); if (damager == null) return; - if (_images.get(damagee).equals(damager)) + if (_ownerToSkeleton.get(damagee.getUniqueId()).equals(damager)) event.SetCancelled("Wither Image"); } @@ -153,12 +167,12 @@ public class PerkWitherImage extends SmashPerk LivingEntity damager = event.GetDamagerEntity(true); if (damager == null) return; - if (!_images.containsValue(damager)) + if (!_ownerToSkeleton.containsValue(damager)) return; - for (Player player : _images.keySet()) + for (Player player : _ownerToSkeleton.keySet()) { - if (_images.get(player).equals(damager)) + if (_ownerToSkeleton.get(player).equals(damager)) { event.SetDamager(player); event.setKnockbackOrigin(damager.getLocation()); @@ -173,12 +187,12 @@ public class PerkWitherImage extends SmashPerk if (event.getType() != UpdateType.FAST) return; - Iterator playerIterator = _images.keySet().iterator(); + Iterator playerIterator = _ownerToSkeleton.keySet().iterator(); while (playerIterator.hasNext()) { Player player = playerIterator.next(); - Skeleton skel = _images.get(player); + Skeleton skel = _ownerToSkeleton.get(player); if (!player.isValid() || !skel.isValid() || skel.getTicksLived() > 160) { @@ -195,7 +209,8 @@ public class PerkWitherImage extends SmashPerk @EventHandler(priority = EventPriority.LOWEST) public void clean(PlayerDeathEvent event) { - Skeleton skel = _images.remove(event.getEntity()); + Skeleton skel = _ownerToSkeleton.remove(event.getEntity()); + _skeletonToOwner.remove(skel); if (skel != null) { From e855a866c7f3bd4de4ac8f2062f77cf1215ea442 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 22 Jun 2016 08:58:27 -0700 Subject: [PATCH 051/115] 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 052/115] 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 053/115] 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 054/115] 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 055/115] 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 056/115] 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 057/115] 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 058/115] 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 059/115] 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 060/115] 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 061/115] 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 f8080d2663e1e59484d176276ed6abfb8af13df8 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 23 Jun 2016 22:40:15 +0100 Subject: [PATCH 062/115] PC-574 Another fix for the minestrike vanish problem, this one fixes staff being assigned teams on join. --- .../game/arcade/game/games/minestrike/MineStrike.java | 5 +++++ 1 file changed, 5 insertions(+) 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 f6b99efc2..19073efd4 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 @@ -2326,6 +2326,11 @@ public class MineStrike extends TeamGame if (GetState() == GameState.Recruit || GetState() == GameState.Loading) return; + if (Manager.isVanished(event.getPlayer())) + { + return; + } + //Target Team GameTeam targetTeam = null; if (GetTeamList().get(0).GetPlayers(false).size() < GetTeamList().get(1).GetPlayers(false).size()) From 399ab5c36367ac321e650ada7311baf35e223edf Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Fri, 17 Jun 2016 20:25:57 +0200 Subject: [PATCH 063/115] 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 064/115] 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 065/115] 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 066/115] 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 067/115] 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 068/115] 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 069/115] 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 070/115] 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 071/115] 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 072/115] 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("_", " ")) + "!")); } } } From c40e07695c67bf99ad7391410803bb7b3d972962 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 24 Jun 2016 04:06:28 -0500 Subject: [PATCH 073/115] Only close open UIs when choosing SSM kits --- .../src/nautilus/game/arcade/game/Game.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index e75edf107..94dcb1d71 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 @@ -22,6 +22,8 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.smash.SuperSmash; +import nautilus.game.arcade.game.games.smash.SuperSmashDominate; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -887,7 +889,7 @@ public abstract class Game implements Listener { kit.ApplyKit(player); } - else + else if (this instanceof SuperSmash || this instanceof SuperSmashDominate) { player.closeInventory(); } From 95f7c757cbd12d1b5d704f89478bd149e543ecb5 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 24 Jun 2016 02:03:20 -0700 Subject: [PATCH 074/115] Fix booster group naming for the quick menu --- .../mineplex/hub/server/ui/ServerGameMenu.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 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 1ff43033c..517720f53 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", "Speed Builders", 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", "Draw My Thing", 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[] { @@ -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"}, "Survival Games", 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[] { @@ -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", "Team Deathmatch", 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", "Castle Siege", 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", "Block Hunt", new SelectBHButton(this)); + }, "BH", "Block_Hunt", new SelectBHButton(this)); add(28, Material.TNT, C.cYellowB + "MineStrike " + C.cGray + "Team Survival", new String[] { @@ -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"}, "Smash Mobs", 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"}; @@ -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", "Master Builders", 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[] { From 14542d7dac1e29f567efd0a983fdbaa62e9962ed Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 24 Jun 2016 04:10:08 -0500 Subject: [PATCH 075/115] Close open UIs except for Champions kits --- .../src/nautilus/game/arcade/game/Game.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 94dcb1d71..531b5045f 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 @@ -22,12 +22,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.smash.SuperSmash; -import nautilus.game.arcade.game.games.smash.SuperSmashDominate; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.ProgressingKit; +import nautilus.game.arcade.kit.*; import nautilus.game.arcade.managers.GameLobbyManager; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.scoreboard.GameScoreboard; @@ -889,7 +884,7 @@ public abstract class Game implements Listener { kit.ApplyKit(player); } - else if (this instanceof SuperSmash || this instanceof SuperSmashDominate) + else if (!(kit instanceof ChampionsKit)) { player.closeInventory(); } From dc9145c707e1dbba45e9624c52c2b438a8d4d3bc Mon Sep 17 00:00:00 2001 From: Kenny Goodin Date: Fri, 24 Jun 2016 15:33:07 -0400 Subject: [PATCH 076/115] Hotfix, disable youtube and twitter buttons in BonusGUI --- .../src/mineplex/core/bonuses/gui/BonusGui.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 a8fef8c82..d76317a21 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -1,14 +1,18 @@ package mineplex.core.bonuses.gui; import mineplex.core.bonuses.BonusManager; -import mineplex.core.bonuses.gui.buttons.*; +import mineplex.core.bonuses.gui.buttons.CarlSpinButton; +import mineplex.core.bonuses.gui.buttons.ClaimTipsButton; +import mineplex.core.bonuses.gui.buttons.DailyBonusButton; +import mineplex.core.bonuses.gui.buttons.FacebookButton; +import mineplex.core.bonuses.gui.buttons.PollButton; +import mineplex.core.bonuses.gui.buttons.RankBonusButton; +import mineplex.core.bonuses.gui.buttons.VoteButton; import mineplex.core.boosters.BoosterManager; import mineplex.core.facebook.FacebookManager; import mineplex.core.gui.SimpleGui; import mineplex.core.reward.RewardManager; import mineplex.core.youtube.YoutubeManager; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; public class BonusGui extends SimpleGui { @@ -31,9 +35,9 @@ public class BonusGui extends SimpleGui setItem(19, new FacebookButton(player, facebookManager)); - setItem(21, new YoutubeButton(player, youtubeManager)); + //setItem(21, new YoutubeButton(player, youtubeManager)); - setItem(23, new TwitterButton(player)); + //setItem(23, new TwitterButton(player)); setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); From 94fe9f57d2234b11e1fa251c2625fb3bf93bf59f Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 24 Jun 2016 12:36:56 -0700 Subject: [PATCH 077/115] Add missing imports --- .../Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java | 2 ++ 1 file changed, 2 insertions(+) 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 d76317a21..7eba1b985 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -13,6 +13,8 @@ import mineplex.core.facebook.FacebookManager; import mineplex.core.gui.SimpleGui; import mineplex.core.reward.RewardManager; import mineplex.core.youtube.YoutubeManager; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; public class BonusGui extends SimpleGui { From c430566c6dc8ecb4f4ac525af3eb7c0cd4cc0780 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 24 Jun 2016 16:59:27 -0500 Subject: [PATCH 078/115] Never reset a player's YouTube click time locally --- .../src/mineplex/core/bonuses/gui/BonusGui.java | 12 +++--------- .../src/mineplex/core/youtube/YoutubeManager.java | 11 +---------- .../mineplex/core/youtube/YoutubeRepository.java | 13 ++----------- 3 files changed, 6 insertions(+), 30 deletions(-) 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 7eba1b985..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,13 +1,7 @@ package mineplex.core.bonuses.gui; import mineplex.core.bonuses.BonusManager; -import mineplex.core.bonuses.gui.buttons.CarlSpinButton; -import mineplex.core.bonuses.gui.buttons.ClaimTipsButton; -import mineplex.core.bonuses.gui.buttons.DailyBonusButton; -import mineplex.core.bonuses.gui.buttons.FacebookButton; -import mineplex.core.bonuses.gui.buttons.PollButton; -import mineplex.core.bonuses.gui.buttons.RankBonusButton; -import mineplex.core.bonuses.gui.buttons.VoteButton; +import mineplex.core.bonuses.gui.buttons.*; import mineplex.core.boosters.BoosterManager; import mineplex.core.facebook.FacebookManager; import mineplex.core.gui.SimpleGui; @@ -37,9 +31,9 @@ public class BonusGui extends SimpleGui setItem(19, new FacebookButton(player, facebookManager)); - //setItem(21, new YoutubeButton(player, youtubeManager)); + setItem(21, new YoutubeButton(player, youtubeManager)); - //setItem(23, new TwitterButton(player)); + setItem(23, new TwitterButton(player)); setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java index 808087c36..45963b9b8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java @@ -48,16 +48,7 @@ public class YoutubeManager extends MiniDbClientPlugin } 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); - } - }); + _repository.attemptYoutube(player, client, () -> _donationManager.RewardCoinsLater("YouTube", player, 250)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java index a108a0b3b..7e437d0cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeRepository.java @@ -1,6 +1,5 @@ package mineplex.core.youtube; -import mineplex.core.common.util.Callback; import mineplex.serverdata.database.DBPool; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -19,7 +18,7 @@ public class YoutubeRepository _manager = manager; } - public void attemptYoutube(Player player, YoutubeClient client, Callback callback) + public void attemptYoutube(Player player, YoutubeClient client, Runnable runnable) { int accountId = _manager.getClientManager().Get(player).getAccountId(); @@ -32,20 +31,12 @@ public class YoutubeRepository statement.setDate(2, Date.valueOf(client.getClickDate())); statement.executeUpdate(); - if (callback != null) - { - callback.run(true); - } + runnable.run(); } catch (SQLException e) { e.printStackTrace(); } - - if (callback != null) - { - callback.run(false); - } }); } From 285d94a2ca25af5dc0f7402d9c68dfd81a9840a9 Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 25 Jun 2016 04:48:59 +0200 Subject: [PATCH 079/115] Fill hotbar editor with glass panes --- .../arcade/game/games/gladiators/hotbar/HotbarInventory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarInventory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarInventory.java index 9ffc569ae..61f38d12e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarInventory.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarInventory.java @@ -21,7 +21,7 @@ public class HotbarInventory { Inventory inv = UtilServer.getServer().createInventory(null, 36, "Hotbar Editor"); - for (int slot : Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26)) + for (int slot : Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 33, 34, 35)) { inv.setItem(slot, getGlass(slot)); } From 83f4b2588720f11cd7418eb09194f53b1f88ea4a Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 25 Jun 2016 00:33:36 -0300 Subject: [PATCH 080/115] Testing persistence fixes --- .../core/cosmetic/CosmeticManager.java | 2 +- .../core/cosmetic/ui/page/ArrowTrailPage.java | 4 +- .../core/cosmetic/ui/page/BalloonsPage.java | 4 +- .../core/cosmetic/ui/page/CostumePage.java | 4 +- .../cosmetic/ui/page/DeathEffectPage.java | 4 +- .../core/cosmetic/ui/page/DoubleJumpPage.java | 4 +- .../core/cosmetic/ui/page/GadgetPage.java | 10 +-- .../core/cosmetic/ui/page/HatPage.java | 4 +- .../mineplex/core/cosmetic/ui/page/Menu.java | 22 +++--- .../core/cosmetic/ui/page/MorphPage.java | 4 +- .../core/cosmetic/ui/page/MusicPage.java | 2 +- .../core/cosmetic/ui/page/ParticlePage.java | 4 +- .../core/cosmetic/ui/page/TauntPage.java | 4 +- .../core/cosmetic/ui/page/WinEffectPage.java | 4 +- .../mineplex/core/gadget/GadgetManager.java | 68 +++++++++++++++---- .../core/gadget/commands/AmmoCommand.java | 2 +- .../core/gadget/event/GadgetEnableEvent.java | 12 +++- .../gadgets/balloons/BabyCowBalloon.java | 2 +- .../gamemodifiers/kits/KitGameModifier.java | 4 +- .../GameModifierMineStrikeSkin.java | 4 +- .../gadget/gadgets/item/ItemDuelingSword.java | 2 +- .../gadget/gadgets/item/ItemLovePotion.java | 2 +- .../gadget/gadgets/item/ItemPaintbrush.java | 6 +- .../core/gadget/gadgets/morph/MorphBat.java | 4 +- .../core/gadget/gadgets/morph/MorphBlaze.java | 4 +- .../core/gadget/gadgets/morph/MorphBlock.java | 4 +- .../core/gadget/gadgets/morph/MorphBunny.java | 4 +- .../gadget/gadgets/morph/MorphChicken.java | 4 +- .../core/gadget/gadgets/morph/MorphCow.java | 4 +- .../gadget/gadgets/morph/MorphCreeper.java | 4 +- .../gadget/gadgets/morph/MorphEnderman.java | 4 +- .../core/gadget/gadgets/morph/MorphPig.java | 4 +- .../gadgets/morph/MorphPumpkinKing.java | 4 +- .../core/gadget/gadgets/morph/MorphSlime.java | 4 +- .../gadget/gadgets/morph/MorphSnowman.java | 4 +- .../core/gadget/gadgets/morph/MorphTitan.java | 4 +- .../gadget/gadgets/morph/MorphUncleSam.java | 4 +- .../gadget/gadgets/morph/MorphVillager.java | 4 +- .../gadget/gadgets/morph/MorphWither.java | 4 +- .../gadget/gadgets/outfit/OutfitTeam.java | 10 +-- .../outfit/ravesuit/OutfitRaveSuit.java | 4 +- .../outfit/spacesuit/OutfitSpaceSuit.java | 4 +- .../outfit/windupsuit/OutfitWindUpSuit.java | 4 +- .../persistence/UserGadgetPersistence.java | 32 +++++++-- .../core/gadget/types/ArrowEffectGadget.java | 3 +- .../core/gadget/types/BalloonGadget.java | 2 +- .../core/gadget/types/DeathEffectGadget.java | 2 +- .../gadget/types/DoubleJumpEffectGadget.java | 2 +- .../mineplex/core/gadget/types/Gadget.java | 14 ++-- .../mineplex/core/gadget/types/GadgetSet.java | 13 ++-- .../core/gadget/types/GadgetType.java | 26 +++---- .../core/gadget/types/GameModifierGadget.java | 7 +- .../mineplex/core/gadget/types/HatGadget.java | 15 ++-- .../core/gadget/types/ItemGadget.java | 8 +-- .../core/gadget/types/MorphGadget.java | 11 +-- .../core/gadget/types/MusicGadget.java | 2 +- .../core/gadget/types/OutfitGadget.java | 11 +-- .../core/gadget/types/ParticleGadget.java | 9 +-- .../core/gadget/types/WinEffectGadget.java | 15 ++-- .../commands/IncognitoToggleCommand.java | 1 + .../mineplex/core/reward/RewardManager.java | 2 +- .../core/treasure/gui/TreasurePage.java | 3 +- .../src/mineplex/hub/HubManager.java | 3 +- .../hub/commands/DisguiseCommand.java | 4 +- .../src/mineplex/hub/modules/KothManager.java | 4 +- .../src/mineplex/hub/modules/NewsManager.java | 3 +- .../mineplex/hub/modules/SoccerManager.java | 2 +- .../mineplex/hub/modules/StackerManager.java | 2 +- .../game/classcombat/Class/PvpClass.java | 5 +- .../customerSupport/CustomerSupport.java | 2 +- .../salespackages/FreedomChest.java | 4 +- .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../game/arcade/command/DisguiseCommand.java | 4 +- .../arcade/game/games/event/EventModule.java | 2 +- .../game/arcade/managers/GameManager.java | 2 +- .../arcade/wineffect/WinEffectManager.java | 4 +- 76 files changed, 278 insertions(+), 207 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index 66a7af21b..0f0686a42 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -205,7 +205,7 @@ public class CosmeticManager extends MiniPlugin public void disableTeamArmor() { - for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.Costume)) + for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.COSTUME)) { if (gadget instanceof OutfitTeam) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java index 621b36d20..52c877e7d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ArrowTrailPage.java @@ -28,11 +28,11 @@ public class ArrowTrailPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ArrowTrail)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ARROW_TRAIL)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ArrowTrail) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ARROW_TRAIL) == gadget) addGlow(slot); slot++; 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 index ca7a38209..6eebd5515 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/BalloonsPage.java @@ -26,11 +26,11 @@ public class BalloonsPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Balloon)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.BALLOON)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Balloon) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.BALLOON) == gadget) addGlow(slot); slot++; 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 bd255d200..525594815 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 @@ -36,7 +36,7 @@ public class CostumePage extends GadgetPage { int slot; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME)) { if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1) continue; @@ -69,7 +69,7 @@ public class CostumePage extends GadgetPage public void onClick(Player player, ClickType clickType) { boolean gadgetDisabled = false; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME)) { if (gadget.isActive(player)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java index 65d92f6e0..22a203051 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DeathEffectPage.java @@ -28,11 +28,11 @@ public class DeathEffectPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Death)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DEATH)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Death) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DEATH) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java index 5b7c18b70..9e7ab7349 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/DoubleJumpPage.java @@ -28,11 +28,11 @@ public class DoubleJumpPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DoubleJump)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DOUBLE_JUMP)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DoubleJump) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DOUBLE_JUMP) == gadget) addGlow(slot); slot++; 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 fd117802b..154188ad8 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,7 +46,7 @@ public class GadgetPage extends ShopPageBase { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ITEM)) { if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3) continue; @@ -286,8 +286,8 @@ public class GadgetPage extends ShopPageBase 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.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH + || gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP) { if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) { @@ -309,8 +309,8 @@ public class GadgetPage extends ShopPageBase 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.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH + || gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP) { if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java index 54da91d25..c37e4dc9c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/HatPage.java @@ -31,13 +31,13 @@ public class HatPage extends GadgetPage { int slot = 19; - List list = getPlugin().getGadgetManager().getGadgets(GadgetType.Hat); + List list = getPlugin().getGadgetManager().getGadgets(GadgetType.HAT); if(list != null) for (Gadget gadget : list) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Hat) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.HAT) == gadget) 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 0126131a4..756edee53 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 @@ -122,32 +122,32 @@ public class Menu extends ShopPageBase } Creature petActive = getPlugin().getPetManager().GetPet(getPlayer()); - GadgetType type = GadgetType.Particle; + GadgetType type = GadgetType.PARTICLE; String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type)); addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(particleSlot); - type = GadgetType.ArrowTrail; + type = GadgetType.ARROW_TRAIL; lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type)); addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), new OpenArrowTrails(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(arrowSlot); - type = GadgetType.DoubleJump; + type = GadgetType.DOUBLE_JUMP; lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", "Visible Everywhere", enabled.get(type)); addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(jumpSlot); - type = GadgetType.Death; + type = GadgetType.DEATH; lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", "Visible in Games", enabled.get(type)); addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(deathSlot); - type = GadgetType.Item; + type = GadgetType.ITEM; lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type)); addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(gadgetSlot); - type = GadgetType.Morph; + type = GadgetType.MORPH; lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(morphSlot); @@ -160,18 +160,18 @@ public class Menu extends ShopPageBase addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this)); if (petActive != null) addGlow(petSlot); - type = GadgetType.Hat; + type = GadgetType.HAT; lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type)); addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(hatSlot); - type = GadgetType.Costume; + type = GadgetType.COSTUME; // Fixes more than 8 costumes being counted, even without the WindUp lore = getLore((ownedCount.get(type) > 8) ? 8 : ownedCount.get(type), /*maxCount.get(type)*/ 8, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type)); addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(costumeSlot); - type = GadgetType.MusicDisc; + type = GadgetType.MUSIC_DISC; lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type)); addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(musicSlot); @@ -185,13 +185,13 @@ public class Menu extends ShopPageBase } }); - type = GadgetType.WinEffect; + type = GadgetType.WIN_EFFECT; 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); - type = GadgetType.GameModifier; + type = GadgetType.GAME_MODIFIER; 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); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java index fb425172d..0d7daaafb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java @@ -26,11 +26,11 @@ public class MorphPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Morph)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MORPH)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java index 390d937ae..7acb6a46c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MusicPage.java @@ -28,7 +28,7 @@ public class MusicPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MusicDisc)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MUSIC_DISC)) { addGadget(gadget, slot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java index 1a59f158e..479841a09 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/ParticlePage.java @@ -26,11 +26,11 @@ public class ParticlePage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Particle)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.PARTICLE)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.PARTICLE) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java index 93aeac8d5..1ff5531fc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TauntPage.java @@ -31,13 +31,13 @@ public class TauntPage extends GadgetPage { int slot = 19; - List list = getPlugin().getGadgetManager().getGadgets(GadgetType.Taunt); + List list = getPlugin().getGadgetManager().getGadgets(GadgetType.TAUNT); if(list != null) for (Gadget gadget : list) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java index 505bc4dde..74b50f0ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/WinEffectPage.java @@ -28,11 +28,11 @@ public class WinEffectPage extends GadgetPage { int slot = 19; - for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WinEffect)) + for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WIN_EFFECT)) { addGadget(gadget, slot); - if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WinEffect) == gadget) + if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WIN_EFFECT) == gadget) addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index f3f6ede7d..0f0fd1dc3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -19,10 +19,9 @@ import mineplex.core.gadget.gadgets.wineffect.*; import mineplex.core.gadget.persistence.UserGadgetPersistence; import mineplex.core.gadget.set.*; import mineplex.core.gadget.types.*; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; +import mineplex.core.incognito.events.IncognitoHidePlayerEvent; +import mineplex.core.incognito.events.IncognitoStatusChangeEvent; +import org.bukkit.*; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.PlayerDeathEvent; @@ -504,7 +503,7 @@ public class GadgetManager extends MiniPlugin public List getGameModifiers(GameModifierType gameType) { List list = new ArrayList<>(); - for (Gadget g : getGadgets(GadgetType.GameModifier)) + for (Gadget g : getGadgets(GadgetType.GAME_MODIFIER)) { if (g instanceof GameModifierGadget) { @@ -567,7 +566,7 @@ public class GadgetManager extends MiniPlugin public HatGadget getHatGadget(HatType type) { - for (Gadget gadget : getGadgets(GadgetType.Hat)) + for (Gadget gadget : getGadgets(GadgetType.HAT)) { if(gadget instanceof HatGadget) { @@ -837,7 +836,7 @@ public class GadgetManager extends MiniPlugin public void redisplayActiveItem(Player player) { - for (Gadget gadget : _gadgets.get(GadgetType.Item)) + for (Gadget gadget : _gadgets.get(GadgetType.ITEM)) { if (gadget instanceof ItemGadget) { @@ -851,7 +850,7 @@ public class GadgetManager extends MiniPlugin public boolean canPlaySongAt(Location location) { - for (Gadget gadget : _gadgets.get(GadgetType.MusicDisc)) + for (Gadget gadget : _gadgets.get(GadgetType.MUSIC_DISC)) { if (gadget instanceof MusicGadget) { @@ -917,6 +916,8 @@ public class GadgetManager extends MiniPlugin private void saveGadgets(Player player) { + if (player.getGameMode() == GameMode.SPECTATOR) + return; Map cache = new HashMap<>(); for (Gadget gadget : getAllGadgets()) { @@ -925,12 +926,12 @@ public class GadgetManager extends MiniPlugin { switch (gadgetType) { - case MusicDisc: - case Item: - case Morph: - case Balloon: + case MUSIC_DISC: + case ITEM: + case MORPH: + case BALLOON: break; - case Costume: + case COSTUME: OutfitGadget outfitGadget = (OutfitGadget) gadget; String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); if (cache.containsKey(key)) @@ -938,7 +939,7 @@ public class GadgetManager extends MiniPlugin if (outfitGadget.isActive(player)) cache.put(key, outfitGadget.getName()); break; - case GameModifier: + case GAME_MODIFIER: GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget; if (gameModifierGadget.canAllowMultiple()) { @@ -963,12 +964,29 @@ public class GadgetManager extends MiniPlugin } } } + cache = updateDefaultGadgets(cache); _userGadgetPersistence.save(player, cache); } + private Map updateDefaultGadgets(Map cache) + { + for (GadgetType gadgetType : GadgetType.values()) + { + if (gadgetType == GadgetType.MUSIC_DISC || gadgetType == GadgetType.ITEM + || gadgetType == GadgetType.MORPH || gadgetType == GadgetType.BALLOON + || gadgetType == GadgetType.GAME_MODIFIER) + continue; + if (!cache.containsKey(gadgetType.getDatabaseKey())) + { + cache.put(gadgetType.getDatabaseKey(), "disabled"); + } + } + return cache; + } + public boolean isKitModifierActive(KitModifier kitModifier, Player player) { - for (Gadget gadget : getGadgets(GadgetType.GameModifier)) + for (Gadget gadget : getGadgets(GadgetType.GAME_MODIFIER)) { if (gadget instanceof KitGameModifier) { @@ -990,4 +1008,24 @@ public class GadgetManager extends MiniPlugin } return null; } + + @EventHandler + public void onVanish(IncognitoStatusChangeEvent event) + { + if (event.getNewState()) + { + for (Gadget gadget : getGadgets(GadgetType.PARTICLE)) + { + if (gadget.isActive(event.getPlayer())) + { + gadget.disable(event.getPlayer()); + } + } + } + } + + public UserGadgetPersistence getUserGadgetPersistence() + { + return _userGadgetPersistence; + } } 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 6b8969fed..9135d6f38 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/AmmoCommand.java @@ -104,7 +104,7 @@ public class AmmoCommand extends CommandBase private Gadget getGadgetByName(String gadgetName) { - for (Gadget gadget : _plugin.getGadgets(GadgetType.Item)) + for (Gadget gadget : _plugin.getGadgets(GadgetType.ITEM)) { if (gadget.getName().equalsIgnoreCase(gadgetName.replaceAll("_", " "))) return gadget; 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 57cb590d9..cc1050a84 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetEnableEvent.java @@ -12,7 +12,7 @@ public class GadgetEnableEvent extends Event private Player _player; private Gadget _gadget; - + private boolean _showMessage = true; private boolean _cancelled = false; @@ -51,4 +51,14 @@ public class GadgetEnableEvent extends Event { return _cancelled; } + + public void setShowMessage(boolean showMessage) + { + _showMessage = showMessage; + } + + public boolean canShowMessage() + { + return _showMessage; + } } \ No newline at end of file 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 index 361f44be7..883957f59 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BabyCowBalloon.java @@ -19,7 +19,7 @@ public class BabyCowBalloon extends BalloonGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { if (!canSpawnBalloon(player)) { 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 49e617571..d06bffbe8 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 @@ -37,11 +37,11 @@ public class KitGameModifier extends GameModifierGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kitType)).forEach(g -> g.disable(player)); - super.enableCustom(player); + super.enableCustom(player, message); } /** 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 c364a4c40..a9f2ebcaf 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 GameModifierGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.disable(player)); - super.enableCustom(player); + super.enableCustom(player, message); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java index bb4a64339..09d4499ae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemDuelingSword.java @@ -28,7 +28,7 @@ public class ItemDuelingSword extends ItemGadget @Override public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item); + Manager.removeGadgetType(player, GadgetType.ITEM); _active.add(player); 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 51ae35988..cea21e874 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 @@ -70,7 +70,7 @@ public class ItemLovePotion extends ItemGadget @Override public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item); + Manager.removeGadgetType(player, GadgetType.ITEM); _active.add(player); 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 d1aff120d..0c75b1a81 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 @@ -52,7 +52,7 @@ public class ItemPaintbrush extends ItemGadget @Override public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item); + Manager.removeGadgetType(player, GadgetType.ITEM); _active.add(player); @@ -79,9 +79,9 @@ public class ItemPaintbrush extends ItemGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyItem(player, true); + ApplyItem(player, message); _brushColor.put(player.getName(), (byte)15); _playerLocation.put(player.getName(), player.getLocation()); 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 7b3e0902c..d8ca2a8eb 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 @@ -54,9 +54,9 @@ public class MorphBat extends MorphGadget implements IThrown } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseBat disguise = new DisguiseBat(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 9fd7c7b72..57bb92473 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 @@ -37,9 +37,9 @@ public class MorphBlaze extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseBlaze disguise = new DisguiseBlaze(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 71f3040be..c04d0eba3 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,9 +46,9 @@ public class MorphBlock extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); _active.put(player, new BlockForm(this, player, Material.EMERALD_BLOCK)); } 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 7ffe3527b..60bd653e9 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 @@ -65,9 +65,9 @@ public class MorphBunny extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseRabbit disguise = new DisguiseRabbit(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 9ff4d5e56..34a3cd6b9 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 @@ -43,9 +43,9 @@ public class MorphChicken extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseChicken disguise = new DisguiseChicken(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 2b6694280..4cbe53990 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,9 +31,9 @@ public class MorphCow extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseCow disguise = new DisguiseCow(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 1d5126468..fe68c21f0 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 @@ -45,9 +45,9 @@ public class MorphCreeper extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseCreeper disguise = new DisguiseCreeper(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 2ad50feb3..e167ec7c8 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,9 +42,9 @@ public class MorphEnderman extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseEnderman disguise = new DisguiseEnderman(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 2ce744cb0..b8a94970b 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 @@ -44,9 +44,9 @@ public class MorphPig extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguisePig disguise = new DisguisePig(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 622a4c042..7bed212fc 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,9 +29,9 @@ public class MorphPumpkinKing extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.showArmor(); 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 51db16da6..a184823ac 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,9 +43,9 @@ public class MorphSlime extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseSlime disguise = new DisguiseSlime(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 7e31855f3..e8b1786ef 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,9 +55,9 @@ public class MorphSnowman extends MorphGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseSnowman disguise = new DisguiseSnowman(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 0c3d7a65a..558335c68 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,9 +55,9 @@ public class MorphTitan extends MorphGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseGuardian disguise = new DisguiseGuardian(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 index 4bdfdb754..5c525b591 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphUncleSam.java @@ -33,9 +33,9 @@ public class MorphUncleSam extends MorphGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguisePlayer disguisePlayer = new DisguisePlayer(player); disguisePlayer.setProfile(new GameProfile(UUID.randomUUID(), C.cRed + "Uncle " + C.cBlue + "Sam")); 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 d51112fbe..9290bd13b 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 @@ -53,9 +53,9 @@ public class MorphVillager extends MorphGadget implements IThrown } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); DisguiseVillager disguise = new DisguiseVillager(player); disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); 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 d2cccc413..aa1f7a03f 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,9 +56,9 @@ public class MorphWither extends MorphGadget } @Override - public void enableCustom(final Player player) + public void enableCustom(final Player player, boolean message) { - this.ApplyArmor(player); + this.ApplyArmor(player, message); player.setMaxHealth(300); player.setHealth(300); 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 778d5b9a3..8aa3d98ad 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 @@ -49,15 +49,15 @@ public class OutfitTeam extends OutfitGadget return; } - enableCustom(player); + enableCustom(player, true); Manager.setActive(player, this); Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); } @Override - public void applyArmor(Player player) + public void applyArmor(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Morph); + Manager.removeGadgetType(player, GadgetType.MORPH); Manager.removeOutfit(player, _slot); @@ -89,9 +89,9 @@ public class OutfitTeam extends OutfitGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - applyArmor(player); + applyArmor(player, message); colorArmor(player); } 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 64a0b6a90..4140410f4 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,9 +36,9 @@ public class OutfitRaveSuit extends OutfitGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - applyArmor(player); + applyArmor(player, message); _colorPhase.put(player.getName(), -1); } 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 acf7e9e32..d27a3f56c 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,9 +26,9 @@ public class OutfitSpaceSuit extends OutfitGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - applyArmor(player); + applyArmor(player, message); } @Override 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 dcd3620ab..c67e5a9c2 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,9 +33,9 @@ public class OutfitWindUpSuit extends OutfitGadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - applyArmor(player); + applyArmor(player, message); _colorPhase.put(player, 0); _percentage.put(player, 0); } 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 026a8179c..b6634219f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/persistence/UserGadgetPersistence.java @@ -5,6 +5,7 @@ import java.sql.ResultSet; import java.util.*; import mineplex.core.common.util.BukkitFuture; +import mineplex.core.common.util.F; import mineplex.core.database.PlayerKeyValueRepository; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; @@ -30,6 +31,7 @@ public class UserGadgetPersistence _repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values -> { if (player.isOnline()) { + boolean enabledGadget = false; for (Gadget gadget : _manager.getAllGadgets()) { if (!gadget.ownsGadget(player)) @@ -37,27 +39,33 @@ public class UserGadgetPersistence GadgetType gadgetType = gadget.getGadgetType(); switch (gadgetType) { - case MusicDisc: - case Item: - case Morph: - case Balloon: + case MUSIC_DISC: + case ITEM: + case MORPH: + case BALLOON: break; - case Costume: + case COSTUME: 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, false); + enabledGadget = true; + } break; - case GameModifier: + case GAME_MODIFIER: GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget; if (gameModifierGadget.canAllowMultiple()) { if (!values.containsKey(gadget.getName())) continue; if (values.get(gadget.getName()).equals("enabled")) + { gadget.enable(player, false); + enabledGadget = true; + } } else { @@ -65,17 +73,27 @@ public class UserGadgetPersistence if (!values.containsKey(dataKey)) continue; if (values.get(dataKey).equals(gadget.getName())) + { gadget.enable(player, false); + enabledGadget = true; + } } break; default: if (!values.containsKey(gadgetType.getDatabaseKey())) continue; if (values.get(gadgetType.getDatabaseKey()).equals(gadget.getName())) - gadget.enable(player); + { + gadget.enable(player, false); + enabledGadget = true; + } break; } } + if (enabledGadget) + { + player.sendMessage(F.main("Cosmetics", "You enabled all your previously enabled cosmetics!")); + } } })); } 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 b75cb3643..4d3b5b0d4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ArrowEffectGadget.java @@ -14,7 +14,6 @@ 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 { @@ -22,7 +21,7 @@ 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); + super(manager, GadgetType.ARROW_TRAIL, name, desc, cost, mat, data, 1, altNames); } public boolean shouldDisplay(Player player) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java index f409db52c..721282b33 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java @@ -15,7 +15,7 @@ public abstract class BalloonGadget extends Gadget 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); + super(manager, GadgetType.BALLOON, name, desc, cost, material, data, 1, altNames); _random = new Random(); } 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 ff6ddcbe7..35eeb4737 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DeathEffectGadget.java @@ -12,7 +12,7 @@ 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); + super(manager, GadgetType.DEATH, name, desc, cost, mat, data, 1, altNames); } public boolean shouldDisplay(Player player) 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 baf23b1fb..e1076dba7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/DoubleJumpEffectGadget.java @@ -12,7 +12,7 @@ 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); + super(manager, GadgetType.DOUBLE_JUMP, name, desc, cost, mat, data, 1, altNames); } public boolean shouldDisplay(Player player) 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 5b960957a..136fd8093 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -99,19 +99,20 @@ public abstract class Gadget extends SalesPackageBase implements Listener public void enable(Player player, boolean message) { GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this); + gadgetEvent.setShowMessage(message); Bukkit.getServer().getPluginManager().callEvent(gadgetEvent); if (gadgetEvent.isCancelled()) { - UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); + if (message) + UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled.")); return; } - if (message) - System.out.println(player.getName() + " has activated " + Name); + System.out.println(player.getName() + " has activated " + Name); Manager.setActive(player, this); - enableCustom(player); + enableCustom(player, message); Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); } @@ -132,11 +133,12 @@ public abstract class Gadget extends SalesPackageBase implements Listener } } - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { Manager.removeGadgetType(player, _gadgetType, this); _active.add(player); - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + ".")); + if (message) + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + ".")); } public void disableCustom(Player player) 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 e985fce7f..14a138de7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetSet.java @@ -41,7 +41,7 @@ public abstract class GadgetSet implements Listener Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin()); } - public void checkPlayer(Player player, Gadget gadget, boolean enable) + public void checkPlayer(Player player, Gadget gadget, boolean enable, boolean message) { boolean wasActive = isActive(player); @@ -60,20 +60,20 @@ public abstract class GadgetSet implements Listener _active.add(player); if(!wasActive) { - customEnable(player); + customEnable(player, message); } } @EventHandler(priority = EventPriority.MONITOR) public void onActivate(GadgetEnableEvent event) { - checkPlayer(event.getPlayer(), event.getGadget(), true); + checkPlayer(event.getPlayer(), event.getGadget(), true, event.canShowMessage()); } @EventHandler(priority = EventPriority.MONITOR) public void onDeativate(GadgetDisableEvent event) { - checkPlayer(event.getPlayer(), event.getGadget(), false); + checkPlayer(event.getPlayer(), event.getGadget(), false, true); } public boolean isActive(Player player) @@ -81,9 +81,10 @@ public abstract class GadgetSet implements Listener return _active.contains(player); } - public void customEnable(Player player) + public void customEnable(Player player, boolean message) { - player.sendMessage(F.main("Gadget", "Set Enabled: " + F.elem(C.cGreen + getName()))); + if (message) + player.sendMessage(F.main("Gadget", "Set Enabled: " + F.elem(C.cGreen + getName()))); } public void customDisable(Player 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 e36e30d47..6f06cb54c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GadgetType.java @@ -5,19 +5,19 @@ package mineplex.core.gadget.types; */ public enum GadgetType { - 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", ""), - Balloon("Balloons", ""); + ITEM("Items", "activeItem"), + MORPH("Morphs", "activeMorph"), + PARTICLE("Particles", "activeParticle"), + MUSIC_DISC("Music Discs", ""), + COSTUME("Costumes", ""), + DOUBLE_JUMP("Double Jump Effects", "activeDoubleJump"), + ARROW_TRAIL("Arrow Trails", "activeArrowTrail"), + DEATH("Death Effects", "activeDeathEffect"), + HAT("Hats", "activeHat"), + TAUNT("Taunts", "activeTaunt"), + WIN_EFFECT("Win Effects", "activeWinEffect"), + GAME_MODIFIER("Game Modifiers", ""), + BALLOON("Balloons", ""); private String _name; private String _databaseKey; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java index 6fbb29c3c..4962e246c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/GameModifierGadget.java @@ -28,7 +28,7 @@ public abstract class GameModifierGadget extends Gadget */ 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); + super(manager, GadgetType.GAME_MODIFIER, name, desc, cost, mat, data); _type = type; _allowMultiple = allowMultiple; } @@ -44,10 +44,11 @@ public abstract class GameModifierGadget extends Gadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { _active.add(player); - UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + ".")); + if (message) + UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + ".")); } } 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 9ad358907..55c249907 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/HatGadget.java @@ -45,15 +45,16 @@ public abstract class HatGadget extends OutfitGadget return _hat.clone(); } - public void applyArmor(Player player) + public void applyArmor(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Morph, this); + Manager.removeGadgetType(player, GadgetType.MORPH, this); Manager.removeOutfit(player, _slot); _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); + + if (message) + UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); player.getInventory().setHelmet(getHelmetItem()); } @@ -84,14 +85,14 @@ public abstract class HatGadget extends OutfitGadget @Override public GadgetType getGadgetType() { - return GadgetType.Hat; + return GadgetType.HAT; } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - applyArmor(player); + applyArmor(player, message); } @Override 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 178fcfbb6..e6125a64f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java @@ -34,7 +34,7 @@ public abstract class ItemGadget extends Gadget public ItemGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, long recharge, Ammo ammo) { - super(manager, GadgetType.Item, name, desc, cost, mat, data); + super(manager, GadgetType.ITEM, name, desc, cost, mat, data); _ammo = ammo; _recharge = recharge; @@ -50,9 +50,9 @@ public abstract class ItemGadget extends Gadget } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - ApplyItem(player, true); + ApplyItem(player, message); } @Override @@ -73,7 +73,7 @@ public abstract class ItemGadget extends Gadget public void ApplyItem(Player player, boolean inform) { - Manager.removeGadgetType(player, GadgetType.Item, this); + Manager.removeGadgetType(player, GadgetType.ITEM, this); _active.add(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 669d46c32..3719d5583 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java @@ -13,16 +13,17 @@ 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); + super(manager, GadgetType.MORPH, name, desc, cost, mat, data); } - public void ApplyArmor(Player player) + public void ApplyArmor(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Morph, this); + Manager.removeGadgetType(player, GadgetType.MORPH, this); _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You morphed into " + F.elem(getName()) + ".")); + + if (message) + UtilPlayer.message(player, F.main("Gadget", "You morphed into " + F.elem(getName()) + ".")); } public void RemoveArmor(Player player) 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 d0955ebbb..7e103aa6c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java @@ -31,7 +31,7 @@ public class MusicGadget extends Gadget public MusicGadget(GadgetManager manager, String name, String[] desc, int cost, int id, long duration) { - super(manager, GadgetType.MusicDisc, name, desc, cost, Material.getMaterial(id), (byte)0); + super(manager, GadgetType.MUSIC_DISC, name, desc, cost, Material.getMaterial(id), (byte)0); _id = id; _duration = duration; 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 c53698df9..1b0d32d54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/OutfitGadget.java @@ -34,7 +34,7 @@ public abstract class OutfitGadget extends Gadget public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data, String... altNames) { - super(manager, GadgetType.Costume, name, desc, cost, mat, data, 1, altNames); + super(manager, GadgetType.COSTUME, name, desc, cost, mat, data, 1, altNames); _slot = slot; } @@ -44,15 +44,16 @@ public abstract class OutfitGadget extends Gadget return _slot; } - public void applyArmor(Player player) + public void applyArmor(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Morph, this); + Manager.removeGadgetType(player, GadgetType.MORPH, this); Manager.removeOutfit(player, _slot); _active.add(player); - - UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + ".")); + + if (message) + 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())); 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 6a4bf9842..aaaeb60d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java @@ -27,16 +27,17 @@ public abstract class ParticleGadget extends Gadget */ public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) { - super(manager, GadgetType.Particle, name, desc, cost, mat, data, 1, altNames); + super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames); } @Override - public void enableCustom(Player player) + public void enableCustom(Player player, boolean message) { - Manager.removeGadgetType(player, GadgetType.Particle, this); + Manager.removeGadgetType(player, GadgetType.PARTICLE, this); _active.add(player); startEffect(player); - UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(getName()) + ".")); + if (message) + UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(getName()) + ".")); } @Override 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 30020d430..b70b8ca49 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.types; -import java.awt.*; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -15,9 +14,7 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -69,7 +66,7 @@ public abstract class WinEffectGadget extends Gadget public WinEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String... alternativesalepackageNames) { - super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, alternativesalepackageNames); + super(manager, GadgetType.WIN_EFFECT, name, desc, cost, mat, data, 1, alternativesalepackageNames); } /** @@ -85,7 +82,7 @@ public abstract class WinEffectGadget extends Gadget public WinEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, boolean free, String... altName) { - super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, free, altName); + super(manager, GadgetType.WIN_EFFECT, name, desc, cost, mat, data, 1, free, altName); } public void runPlay() @@ -152,6 +149,11 @@ public abstract class WinEffectGadget extends Gadget _other = null; _locked.clear(); _locked = null; + // Loads gadgets back when players are teleported to the arcade hub, after the win effect + for (Player player : UtilServer.getPlayers()) + { + Manager.getUserGadgetPersistence().load(player); + } } /** @@ -260,8 +262,9 @@ public abstract class WinEffectGadget extends Gadget UtilPlayer.hideFromAll(p); p.setGameMode(GameMode.ADVENTURE); p.getInventory().clear(); - p.teleport(loc); + p.teleport(loc.clone().add(.5, 0, .5)); p.setAllowFlight(false); + Manager.disableAll(p, false); } } }; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java index 84b27464b..b648ba36b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/commands/IncognitoToggleCommand.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; public class IncognitoToggleCommand extends CommandBase { + public IncognitoToggleCommand(IncognitoManager plugin) { super(plugin, Rank.HELPER, "incognito", "vanish"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 48c341a2d..7ff0962ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -832,7 +832,7 @@ public class RewardManager public UnknownPackageReward addMusicReward(Type type, String musicDisk, RewardRarity rarity, int weight, int shards) { - for(Gadget gadget : _gadgetManager.getGadgets(GadgetType.MusicDisc)) + for(Gadget gadget : _gadgetManager.getGadgets(GadgetType.MUSIC_DISC)) { if(gadget.getName().equals(musicDisk) || gadget.getName().equals(musicDisk + " Disk")) { 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 f77f05a20..3b91b09f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -12,7 +12,6 @@ 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; @@ -235,7 +234,7 @@ public class TreasurePage extends ShopPageBase int amount = 0; Gadget[] gadgets = new Gadget[] { - _gadgetManager.getGadget("Uncle Sam Hat", GadgetType.Hat), + _gadgetManager.getGadget("Uncle Sam Hat", GadgetType.HAT), _gadgetManager.getGadget(ParticleFreedom.class), _gadgetManager.getGadget(ArrowTrailFreedom.class), _gadgetManager.getGadget(DoubleJumpFreedom.class), diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index c05e6a1ef..9298ec3b5 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -10,7 +10,6 @@ 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; @@ -1071,7 +1070,7 @@ public class HubManager extends MiniClientPlugin @EventHandler public void disableMusicChristmas(GadgetEnableEvent event) { - if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc) + if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MUSIC_DISC) { UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now!")); event.setCancelled(true); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java index 75c929335..bc34a9e79 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/commands/DisguiseCommand.java @@ -213,7 +213,7 @@ public class DisguiseCommand extends CommandBase implements Listener changeName(caller, args[0], true); - Plugin.GetGadget().removeGadgetType(caller, GadgetType.Item); + Plugin.GetGadget().removeGadgetType(caller, GadgetType.ITEM); // Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller)); UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + args[0])); @@ -399,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 801b7a228..6c0ad0d5b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java @@ -68,7 +68,7 @@ public class KothManager extends MiniPlugin _cp = new CapturePoint(this, "Desert Pyramid", new Location(Manager.GetSpawn().getWorld(), -95.5,72,54.5)); //Store Gadgets - for (Gadget gadget : gadgets.getGadgets(GadgetType.Costume)) + for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME)) { if (gadget instanceof OutfitTeam) { @@ -76,7 +76,7 @@ public class KothManager extends MiniPlugin } } - for (Gadget gadget : gadgets.getGadgets(GadgetType.Item)) + for (Gadget gadget : gadgets.getGadgets(GadgetType.ITEM)) { if (gadget instanceof ItemDuelingSword) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 1172751de..403d168db 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -30,7 +30,6 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; -import org.bukkit.entity.Wither; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; @@ -450,7 +449,7 @@ public class NewsManager extends MiniPlugin } } - for (Gadget gadget : Manager.GetGadget().getGadgets(GadgetType.Morph)) + for (Gadget gadget : Manager.GetGadget().getGadgets(GadgetType.MORPH)) { if (gadget instanceof MorphWither) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index 8a116b0d4..04fb771b8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -111,7 +111,7 @@ public class SoccerManager extends MiniPlugin _cornerBlueGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-28.75); //Store Gadgets - for (Gadget gadget : gadgets.getGadgets(GadgetType.Costume)) + for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME)) { if (gadget instanceof OutfitTeam) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 7684044f2..4ff70bf32 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -112,7 +112,7 @@ public class StackerManager extends MiniPlugin implements IThrown return; } - if (Manager.GetGadget().getActive(stacker, GadgetType.Morph) instanceof MorphBlock) + if (Manager.GetGadget().getActive(stacker, GadgetType.MORPH) instanceof MorphBlock) { UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while using the Block Morph.")); return; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java index 488942a3e..ff31e7c64 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java @@ -1,14 +1,11 @@ package mineplex.minecraft.game.classcombat.Class; import java.util.HashSet; -import java.util.concurrent.ConcurrentHashMap; import mineplex.core.common.util.Callback; import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.types.GadgetType; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Skill.ISkill; @@ -198,7 +195,7 @@ public class PvpClass implements IPvpClass continue; } - if (_classes.getGadgetManager() != null && _classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null) + if (_classes.getGadgetManager() != null && _classes.getGadgetManager().getActive(cur, GadgetType.COSTUME) != null) continue; Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 0ad0b31ea..74ef16cda 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -197,7 +197,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } } - if (transaction.SalesPackageName.startsWith("Freedom Chest")) + if (transaction.SalesPackageName.startsWith("Freedom Treasure")) { if (transaction.Coins == 0 && transaction.Gems == 0) { diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java index 2a7f74d79..214495bd4 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/FreedomChest.java @@ -8,12 +8,12 @@ public class FreedomChest extends SalesPackageBase public FreedomChest(SalesPackageManager manager) { - super(manager, "1 Freedom Chest"); + super(manager, "1 Freedom Treasure"); } public void displayToAgent(Player agent, String playerName) { - addButton(agent, "/sales item " + playerName + " 1 Item Freedom Chest", "Give 1 Freedom Chest."); + addButton(agent, "/sales item " + playerName + " 1 Item Freedom Treasure", "Give 1 Freedom Chest."); agent.sendMessage(" "); addBackButton(agent, playerName); } 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 d41d89768..5f373ee06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1003,7 +1003,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation GetDisguise().undisguise(player); - Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph); + Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.MORPH); if (morph != null && morph.isActive(player)) morph.disable(player); } 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 37e77a858..118be3200 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 @@ -216,7 +216,7 @@ public class DisguiseCommand extends CommandBase implements Liste changeName(caller, args[0], true); - Plugin.getCosmeticManager().getGadgetManager().removeGadgetType(caller, GadgetType.Item); + Plugin.getCosmeticManager().getGadgetManager().removeGadgetType(caller, GadgetType.ITEM); // Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller)); UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + args[0])); @@ -425,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/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index b1113f0ab..9f19b1475 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 @@ -1931,7 +1931,7 @@ public class EventModule extends MiniPlugin if (!Manager.GetGame().IsAlive(event.getPlayer())) return; - if (Manager.getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph) instanceof MorphBlock) + if (Manager.getCosmeticManager().getGadgetManager().getActive(player, GadgetType.MORPH) instanceof MorphBlock) { UtilPlayer.message(player, F.main("Stacker", "You cannot stack while using the Block Morph.")); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 4e3f110ac..b57c40277 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -175,7 +175,7 @@ public class GameManager implements Listener } } - for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(GadgetType.Morph)) + for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(GadgetType.MORPH)) { if (gadget instanceof MorphWither) { 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 ad1c23631..922a164d7 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 @@ -37,7 +37,7 @@ public class WinEffectManager _game.CreatureAllowOverride = true; for(Player p : UtilServer.getPlayers()) { - Gadget g = _game.getArcadeManager().getCosmeticManager().getGadgetManager().getActive(p, GadgetType.Item); + Gadget g = _game.getArcadeManager().getCosmeticManager().getGadgetManager().getActive(p, GadgetType.ITEM); if(g != null) g.disable(p); } playEffect(); @@ -74,7 +74,7 @@ public class WinEffectManager public WinEffectGadget getWinEffect() { GadgetManager manager = _game.getArcadeManager().getCosmeticManager().getGadgetManager(); - Gadget gadget = manager.getActive(_winner, GadgetType.WinEffect); + Gadget gadget = manager.getActive(_winner, GadgetType.WIN_EFFECT); if(gadget == null) gadget = manager.getGadget(WinEffectPodium.class); return (WinEffectGadget) gadget; } From 30f413d04eb5076e22831ed3cc7857ab2abfd398 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 25 Jun 2016 02:22:20 -0300 Subject: [PATCH 081/115] Fixes for persistence: No longer save items after they are disabled No longer keep the particle effect after a staff vanishes --- .../src/mineplex/core/gadget/GadgetManager.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 0f0fd1dc3..f8c68e0ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -978,7 +978,22 @@ public class GadgetManager extends MiniPlugin continue; if (!cache.containsKey(gadgetType.getDatabaseKey())) { - cache.put(gadgetType.getDatabaseKey(), "disabled"); + String key = gadgetType.getDatabaseKey(); + if (gadgetType.equals(GadgetType.COSTUME)) + { + for (ArmorSlot armorSlot : ArmorSlot.values()) + { + key = "activeCostume" + armorSlot.getDatabaseKey(); + if (!cache.containsKey(key)) + { + cache.put(key, "disabled"); + } + } + } + else + { + cache.put(key, "disabled"); + } } } return cache; From fbd9b17ba01039c700c76400abf89cd42031e28e Mon Sep 17 00:00:00 2001 From: xXVevzZXx Date: Sat, 25 Jun 2016 19:33:56 +0200 Subject: [PATCH 082/115] fix playeringametime being 0 --- .../src/nautilus/game/arcade/game/games/uhc/UHC.java | 6 +++++- .../nautilus/game/arcade/stats/ExperienceStatTracker.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index d46f2f7f6..0999ecd4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -1202,7 +1202,11 @@ public class UHC extends TeamGame { for (Player player : teamsAlive.get(0).GetPlayers(false)) { - int gems = Math.round((System.currentTimeMillis() - getPlayerIngameTime(player))/1000); + long ingameTime = getPlayerIngameTime(player); + if (ingameTime == 0) + ingameTime = GetStateTime(); + + int gems = Math.round((System.currentTimeMillis() - ingameTime)/1000); AddGems(player, gems, "Winning Team", false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java index 90ae84bce..1e4316316 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ExperienceStatTracker.java @@ -72,7 +72,7 @@ public class ExperienceStatTracker extends StatTracker //Game Time = 1 Exp per 3 Seconds long time = System.currentTimeMillis(); long playerJoin = getGame().getPlayerIngameTime(player); - + if (playerJoin == 0) playerJoin = _startTime; From 24186d9992828079f12d584398e49405cf93546d Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 28 Jun 2016 18:11:00 -0300 Subject: [PATCH 083/115] More fixes for gadget persistence --- .../src/mineplex/core/MiniClientPlugin.java | 4 +- .../mineplex/core/benefit/BenefitManager.java | 2 +- .../mineplex/core/bonuses/BonusManager.java | 2 +- .../core/boosters/tips/BoosterTipManager.java | 2 +- .../core/cosmetic/CosmeticManager.java | 2 +- .../mineplex/core/cosmetic/ui/PetSorter.java | 2 +- .../ui/button/activate/ActivatePetButton.java | 2 +- .../deactivate/DeactivatePetButton.java | 2 +- .../cosmetic/ui/button/open/OpenPets.java | 2 +- .../core/cosmetic/ui/page/GadgetPage.java | 8 + .../mineplex/core/cosmetic/ui/page/Menu.java | 10 +- .../core/cosmetic/ui/page/PetPage.java | 28 +-- .../core/cosmetic/ui/page/PetTagPage.java | 12 +- .../core/customdata/CustomDataManager.java | 2 +- .../core/delayedtask/DelayedTask.java | 2 +- .../core/donation/DonationManager.java | 2 +- .../src/mineplex/core/elo/EloManager.java | 2 +- .../src/mineplex/core/energy/Energy.java | 2 +- .../core/facebook/FacebookManager.java | 2 +- .../mineplex/core/friend/FriendManager.java | 2 +- .../mineplex/core/gadget/GadgetManager.java | 204 +++++++++++------- .../gadget/commands/LockCosmeticsCommand.java | 74 ++++++- .../commands/UnlockCosmeticsCommand.java | 58 ++++- .../core/gadget/event/GadgetChangeEvent.java | 55 +++++ .../core/gadget/gadgets/item/ItemCoal.java | 2 +- .../core/gadget/types/WinEffectGadget.java | 1 - .../core/giveaway/GiveawayManager.java | 2 +- .../mineplex/core/ignore/IgnoreManager.java | 2 +- .../core/incognito/IncognitoManager.java | 2 +- .../core/inventory/InventoryManager.java | 2 +- .../mineplex/core/message/MessageManager.java | 2 +- .../src/mineplex/core/movement/Movement.java | 2 +- .../src/mineplex/core/pet/Pet.java | 6 +- .../src/mineplex/core/pet/PetClient.java | 4 +- .../src/mineplex/core/pet/PetManager.java | 48 ++--- .../src/mineplex/core/poll/PollManager.java | 2 +- .../core/preferences/PreferencesManager.java | 2 +- .../progression/KitProgressionManager.java | 2 +- .../mineplex/core/reward/RewardManager.java | 2 +- .../core/reward/rewards/PetReward.java | 6 +- .../src/mineplex/core/stats/StatsManager.java | 2 +- .../src/mineplex/core/task/TaskManager.java | 2 +- .../core/tournament/TournamentManager.java | 2 +- .../mineplex/core/youtube/YoutubeManager.java | 2 +- .../game/clans/clans/ClansManager.java | 2 +- .../clans/clans/murder/MurderManager.java | 2 +- .../game/clans/clans/playtime/Playtime.java | 4 +- .../src/mineplex/hub/HubManager.java | 2 +- .../src/mineplex/hub/mail/MailManager.java | 2 +- .../src/mineplex/hub/modules/KothManager.java | 2 +- .../mineplex/hub/modules/SoccerManager.java | 2 +- .../mineplex/hub/server/ServerManager.java | 2 +- .../game/classcombat/Class/ClassManager.java | 2 +- 53 files changed, 413 insertions(+), 185 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java index 391e86a54..d90d08fe5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java @@ -35,7 +35,7 @@ public abstract class MiniClientPlugin extends MiniPlug synchronized (_clientDataLock) { if (!_clientData.containsKey(name)) - _clientData.put(name, AddPlayer(name)); + _clientData.put(name, addPlayer(name)); return _clientData.get(name); } @@ -66,5 +66,5 @@ public abstract class MiniClientPlugin extends MiniPlug } } - protected abstract DataType AddPlayer(String player); + protected abstract DataType addPlayer(String player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java index 045d6f42f..804ba1931 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java @@ -67,7 +67,7 @@ public class BenefitManager extends MiniDbClientPlugin } @Override - protected BenefitData AddPlayer(String player) + protected BenefitData addPlayer(String player) { return new BenefitData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 0fd3396b7..45736c3d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -989,7 +989,7 @@ public class BonusManager extends MiniClientPlugin implements I } @Override - protected BonusClientData AddPlayer(String player) + protected BonusClientData addPlayer(String player) { return new BonusClientData(); } 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 1b5603ccd..be7f28ca9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/tips/BoosterTipManager.java @@ -110,7 +110,7 @@ public class BoosterTipManager extends MiniDbClientPlugin } @Override - protected PlayerTipData AddPlayer(String player) + protected PlayerTipData addPlayer(String player) { return new PlayerTipData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index 0f0686a42..8da12b5d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -180,7 +180,7 @@ public class CosmeticManager extends MiniPlugin { _gadgetManager.disableAll(); _mountManager.DisableAll(); - _petManager.DisableAll(); + _petManager.disableAll(); } public void setHideParticles(boolean b) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/PetSorter.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/PetSorter.java index 8d339374e..64de96efc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/PetSorter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/PetSorter.java @@ -8,7 +8,7 @@ public class PetSorter implements Comparator { public int compare(Pet a, Pet b) { - if (a.GetPetType().getTypeId() < b.GetPetType().getTypeId()) + if (a.getPetType().getTypeId() < b.getPetType().getTypeId()) return -1; return 1; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java index 2f1dffd96..61539e368 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/activate/ActivatePetButton.java @@ -23,7 +23,7 @@ public class ActivatePetButton implements IButton public void onClick(Player player, ClickType clickType) { _page.playAcceptSound(player); - _page.getPlugin().getPetManager().AddPetOwner(player, _pet.GetPetType(), player.getLocation()); + _page.getPlugin().getPetManager().addPetOwner(player, _pet.getPetType(), player.getLocation()); _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/deactivate/DeactivatePetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java index 2b3fb0c61..1fc5c2af1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/deactivate/DeactivatePetButton.java @@ -21,7 +21,7 @@ public class DeactivatePetButton implements IButton public void onClick(Player player, ClickType clickType) { _page.playAcceptSound(player); - _petManager.RemovePet(player, true); + _petManager.removePet(player, true); _page.refresh(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java index 711679214..a8ac5e906 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/open/OpenPets.java @@ -24,7 +24,7 @@ public class OpenPets implements IButton else { _menu.playAcceptSound(player); - _menu.getPlugin().getPetManager().RemovePet(player, true); + _menu.getPlugin().getPetManager().removePet(player, true); _menu.refresh(); } } 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 154188ad8..ed351310b 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,7 +4,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.banner.CountryFlag; +import mineplex.core.gadget.event.GadgetChangeEvent; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -393,6 +395,9 @@ public class GadgetPage extends ShopPageBase playAcceptSound(player); gadget.enable(player); + GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget, + GadgetChangeEvent.GadgetState.ENABLED); + UtilServer.getPluginManager().callEvent(gadgetChangeEvent); refresh(); } @@ -409,6 +414,9 @@ public class GadgetPage extends ShopPageBase { playAcceptSound(player); gadget.disable(player); + GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget, + GadgetChangeEvent.GadgetState.DISABLED); + UtilServer.getPluginManager().callEvent(gadgetChangeEvent); refresh(); } } \ No newline at end of file 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 a12a14307..c5d8df866 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 @@ -100,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 (mount.hasMount(getPlayer())) { mountOwned++; } @@ -110,17 +110,17 @@ public class Menu extends ShopPageBase int petOwned = 0; int petMax = 0; - for (Pet pet : getPlugin().getPetManager().GetFactory().GetPets()) + for (Pet pet : getPlugin().getPetManager().getFactory().GetPets()) { - NautHashMap pets = getPlugin().getPetManager().Get(getPlayer()).GetPets(); - if (pets != null && pets.containsKey(pet.GetPetType())) + NautHashMap pets = getPlugin().getPetManager().Get(getPlayer()).getPets(); + if (pets != null && pets.containsKey(pet.getPetType())) { petOwned++; } petMax++; } - Creature petActive = getPlugin().getPetManager().GetPet(getPlayer()); + Creature petActive = getPlugin().getPetManager().getPet(getPlayer()); GadgetType type = GadgetType.PARTICLE; String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type)); 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 3b278c855..8ecd60944 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 @@ -49,7 +49,7 @@ public class PetPage extends ShopPageBase { int slot = 19; - List pets = new ArrayList(getPlugin().getPetManager().GetFactory().GetPets()); + List pets = new ArrayList(getPlugin().getPetManager().getFactory().GetPets()); Collections.sort(pets, new PetSorter()); @@ -61,7 +61,7 @@ public class PetPage extends ShopPageBase itemLore.add(C.cGray + "Your very own " + pet.getName() + "!"); //Chest Unlocks - if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) + if (!getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType())) { if (pet.getCost(CurrencyType.TREASURE_SHARD) == -1) { @@ -113,21 +113,21 @@ public class PetPage extends ShopPageBase } //Owned - if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) + if (getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType())) { - String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType()); + String petName = getPlugin().getPetManager().Get(getPlayer()).getPets().get(pet.getPetType()); if (petName == null) { petName = pet.getName(); } - if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType()) + if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.getPetType()) { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), - pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", + addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(), + pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager())); addGlow(slot); @@ -137,8 +137,8 @@ public class PetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Enable"); - addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), - pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", + addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(), + pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this)); } } @@ -156,18 +156,18 @@ public class PetPage extends ShopPageBase 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)); + 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.TREASURE_SHARD) > 0) { itemLore.add(C.cBlack); itemLore.add(C.cRed + "Not enough Treasure Shards."); - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } else { - setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); + setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); } } @@ -178,7 +178,7 @@ public class PetPage extends ShopPageBase } slot = 49; - for (PetExtra petExtra : getPlugin().getPetManager().GetFactory().GetPetExtras()) + for (PetExtra petExtra : getPlugin().getPetManager().getFactory().GetPetExtras()) { List itemLore = new ArrayList(); @@ -233,7 +233,7 @@ public class PetPage extends ShopPageBase public void deactivatePet(Player player) { playAcceptSound(player); - getPlugin().getPetManager().RemovePet(player, true); + getPlugin().getPetManager().removePet(player, true); refresh(); } } \ No newline at end of file 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 4bc7ac740..27997f3a8 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 @@ -108,8 +108,8 @@ public class PetTagPage extends ShopPageBase token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId(); token.Name = getPlayer().getName(); - token.PetType = _pet.GetPetType().toString(); - token.PetId = _pet.GetPetType().ordinal(); + token.PetType = _pet.getPetType().toString(); + token.PetId = _pet.getPetType().ordinal(); token.PetName = _tagName; PetToken petToken = new PetToken(); @@ -117,16 +117,16 @@ public class PetTagPage extends ShopPageBase if (_petPurchase) { - getPlugin().getPetManager().GetRepository().AddPet(token); - getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.GetPetType()); + getPlugin().getPetManager().getRepository().AddPet(token); + getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.getPetType()); } else { - getPlugin().getPetManager().GetRepository().UpdatePet(token); + getPlugin().getPetManager().getRepository().UpdatePet(token); getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName); } - getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName); + getPlugin().getPetManager().Get(getPlayer()).getPets().put(_pet.getPetType(), token.PetName); getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer())); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java index 26652d24a..45893a07d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java @@ -43,7 +43,7 @@ public class CustomDataManager extends MiniDbClientPlugin } @Override - protected PlayerCustomData AddPlayer(String player) + protected PlayerCustomData addPlayer(String player) { return new PlayerCustomData(_repository); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/delayedtask/DelayedTask.java b/Plugins/Mineplex.Core/src/mineplex/core/delayedtask/DelayedTask.java index da5c6c7c0..d407ec093 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/delayedtask/DelayedTask.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/delayedtask/DelayedTask.java @@ -58,7 +58,7 @@ public class DelayedTask extends MiniClientPlugin } @Override - protected DelayedTaskClient AddPlayer(String player) + protected DelayedTaskClient addPlayer(String player) { return new DelayedTaskClient(Bukkit.getPlayer(player)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index b5708c16e..fd0862c9d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -518,7 +518,7 @@ public class DonationManager extends MiniDbClientPlugin } @Override - protected Donor AddPlayer(String player) + protected Donor addPlayer(String player) { return new Donor(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 4ba9e6932..cbfec07b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -114,7 +114,7 @@ public class EloManager extends MiniDbClientPlugin } @Override - protected EloClientData AddPlayer(String player) + protected EloClientData addPlayer(String player) { return new EloClientData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java b/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java index 313bde55d..51849c397 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java @@ -137,7 +137,7 @@ public class Energy extends MiniClientPlugin } @Override - protected ClientEnergy AddPlayer(String player) + protected ClientEnergy addPlayer(String player) { return new ClientEnergy(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookManager.java b/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookManager.java index 054ac2c79..4f1e56d17 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/facebook/FacebookManager.java @@ -106,7 +106,7 @@ public class FacebookManager extends MiniDbClientPlugin } @Override - protected FacebookClient AddPlayer(String player) + protected FacebookClient addPlayer(String player) { return new FacebookClient(false); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java index 4e64f95b1..355aa3407 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java @@ -70,7 +70,7 @@ public class FriendManager extends MiniDbClientPlugin } @Override - protected FriendData AddPlayer(String player) + protected FriendData addPlayer(String player) { return new FriendData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index f8c68e0ec..d143a6fb2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -4,6 +4,7 @@ import java.util.*; import java.util.function.Predicate; import mineplex.core.gadget.commands.LockCosmeticsCommand; +import mineplex.core.gadget.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom; import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom; @@ -776,7 +777,9 @@ public class GadgetManager extends MiniPlugin @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { - saveGadgets(event.getPlayer()); + //saveGadgets(event.getPlayer()); + event.getPlayer().setWalkSpeed(0.2f); + event.getPlayer().setFlySpeed(0.1f); disableAll(event.getPlayer(), false); _lastMove.remove(event.getPlayer()); _playerActiveGadgetMap.remove(event.getPlayer()); @@ -914,91 +917,144 @@ public class GadgetManager extends MiniPlugin event.setCancelled(true); } - private void saveGadgets(Player player) + @EventHandler + private void saveGadget(GadgetChangeEvent event) { - if (player.getGameMode() == GameMode.SPECTATOR) - return; - Map cache = new HashMap<>(); - for (Gadget gadget : getAllGadgets()) + Gadget gadget = event.getGadget(); + if (gadget != null) { + String value = "disabled", key = ""; GadgetType gadgetType = gadget.getGadgetType(); - if (gadget.ownsGadget(player)) - { - switch (gadgetType) - { - case MUSIC_DISC: - case ITEM: - case MORPH: - case BALLOON: - 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 GAME_MODIFIER: - 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(gadgetType.getDatabaseKey(), gadget.getName()); - break; - } - } - } - cache = updateDefaultGadgets(cache); - _userGadgetPersistence.save(player, cache); - } - - private Map updateDefaultGadgets(Map cache) - { - for (GadgetType gadgetType : GadgetType.values()) - { - if (gadgetType == GadgetType.MUSIC_DISC || gadgetType == GadgetType.ITEM - || gadgetType == GadgetType.MORPH || gadgetType == GadgetType.BALLOON - || gadgetType == GadgetType.GAME_MODIFIER) - continue; - if (!cache.containsKey(gadgetType.getDatabaseKey())) + switch (gadgetType) { - String key = gadgetType.getDatabaseKey(); - if (gadgetType.equals(GadgetType.COSTUME)) - { - for (ArmorSlot armorSlot : ArmorSlot.values()) + case MUSIC_DISC: + case ITEM: + case MORPH: + case BALLOON: + return; + case COSTUME: + OutfitGadget outfitGadget = (OutfitGadget) gadget; + key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey(); + if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED) { - key = "activeCostume" + armorSlot.getDatabaseKey(); - if (!cache.containsKey(key)) + value = outfitGadget.getName(); + } + break; + case GAME_MODIFIER: + GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget; + if (gameModifierGadget.canAllowMultiple()) + { + key = gameModifierGadget.getName(); + if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED) { - cache.put(key, "disabled"); + value = "enabled"; } } - } - else - { - cache.put(key, "disabled"); - } + else + { + key = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", ""); + if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED) + { + value = gameModifierGadget.getName(); + } + } + break; + default: + key = gadgetType.getDatabaseKey(); + if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED) + { + value = gadget.getName(); + } } + _userGadgetPersistence.save(event.getPlayer(), key, value); } - return cache; } +// private void saveGadgets(Player player) +// { +// if (player.getGameMode() == GameMode.SPECTATOR) +// return; +// Map cache = new HashMap<>(); +// for (Gadget gadget : getAllGadgets()) +// { +// GadgetType gadgetType = gadget.getGadgetType(); +// if (gadget.ownsGadget(player)) +// { +// switch (gadgetType) +// { +// case MUSIC_DISC: +// case ITEM: +// case MORPH: +// case BALLOON: +// 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 GAME_MODIFIER: +// 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(gadgetType.getDatabaseKey(), gadget.getName()); +// break; +// } +// } +// } +// cache = updateDefaultGadgets(cache); +// _userGadgetPersistence.save(player, cache); +// } + +// private Map updateDefaultGadgets(Map cache) +// { +// for (GadgetType gadgetType : GadgetType.values()) +// { +// if (gadgetType == GadgetType.MUSIC_DISC || gadgetType == GadgetType.ITEM +// || gadgetType == GadgetType.MORPH || gadgetType == GadgetType.BALLOON +// || gadgetType == GadgetType.GAME_MODIFIER) +// continue; +// if (!cache.containsKey(gadgetType.getDatabaseKey())) +// { +// String key = gadgetType.getDatabaseKey(); +// if (gadgetType.equals(GadgetType.COSTUME)) +// { +// for (ArmorSlot armorSlot : ArmorSlot.values()) +// { +// key = "activeCostume" + armorSlot.getDatabaseKey(); +// if (!cache.containsKey(key)) +// { +// cache.put(key, "disabled"); +// } +// } +// } +// else +// { +// cache.put(key, "disabled"); +// } +// } +// } +// return cache; +// } + public boolean isKitModifierActive(KitModifier kitModifier, Player player) { for (Gadget gadget : getGadgets(GadgetType.GAME_MODIFIER)) 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 7137b9def..1fc07c933 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -2,12 +2,17 @@ package mineplex.core.gadget.commands; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; +import mineplex.core.inventory.ClientItem; +import mineplex.core.inventory.data.Item; import mineplex.core.mount.Mount; +import mineplex.core.pet.Pet; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -28,7 +33,7 @@ public class LockCosmeticsCommand extends CommandBase // Removes all cosmetic types if (args.length == 0) { - addCosmetics(null, caller); + lockCosmetics(null, caller); } // Removes specific type else @@ -36,8 +41,16 @@ public class LockCosmeticsCommand extends CommandBase String type = args[0]; if (type.equalsIgnoreCase("all")) { - addCosmetics(null, caller); + lockCosmetics(null, caller); } + else if (type.equalsIgnoreCase("pet")) + { + lockPets(caller); + } + else if (type.equalsIgnoreCase("mount")) + { + lockMounts(caller); + } else { GadgetType gadgetType = GadgetType.valueOf(type); @@ -47,27 +60,74 @@ public class LockCosmeticsCommand extends CommandBase } else { - addCosmetics(gadgetType, caller); + lockCosmetics(gadgetType, caller); } } } } - private void addCosmetics(GadgetType gadgetType, Player caller) + private void lockCosmetics(GadgetType gadgetType, Player caller) { if (gadgetType == null) { for (GadgetType type : GadgetType.values()) { - addCosmetics(type, caller); + lockCosmetics(type, caller); } + lockMounts(caller); + lockPets(caller); return; } + int removed = 0; for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - _plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.getName()); + if (gadget.getGadgetType() == GadgetType.ITEM) + continue; + if (gadget.ownsGadget(caller)) + { + Item clientItem = _plugin.getInventoryManager().getItem(gadget.getName()); + if (clientItem == null) + continue; + _plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1)); + removed++; + } } - UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name() + " cosmetics!")); + UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase() + .replace("_", " ") + "! (Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("item", removed) + ")")); } + + private void lockMounts(Player caller) + { + int removed = 0; + for (Mount mount : _plugin.getMountManager().getMounts()) + { + if (mount.hasMount(caller)) + { + Item clientItem = _plugin.getInventoryManager().getItem(mount.getName()); + if (clientItem == null) + continue; + _plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1)); + removed++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("mount", removed) + "!")); + } + + private void lockPets(Player caller) + { + int removed = 0; + for (Pet pet : _plugin.getPetManager().getFactory().GetPets()) + { + if (_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType())) + { + _plugin.getPetManager().Get(caller).getPets().remove(pet.getPetType()); + removed++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " + + UtilText.plural("pet", removed) + "!")); + } } \ No newline at end of file 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 f55fb3394..36a279711 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -2,15 +2,15 @@ package mineplex.core.gadget.commands; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; 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 @@ -40,6 +40,14 @@ public class UnlockCosmeticsCommand extends CommandBase { addCosmetics(null, caller); } + else if (type.equalsIgnoreCase("pet")) + { + addPets(caller); + } + else if (type.equalsIgnoreCase("mount")) + { + addMounts(caller); + } else { GadgetType gadgetType = GadgetType.valueOf(type); @@ -64,12 +72,54 @@ public class UnlockCosmeticsCommand extends CommandBase { addCosmetics(type, caller); } + addMounts(caller); + addPets(caller); return; } + int added = 0; + int amount = 1; for (Gadget gadget : _plugin.getGadgets(gadgetType)) { - _plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.getName()); + if (gadgetType == GadgetType.ITEM) + amount = 20; + if (!gadget.ownsGadget(caller)) + { + _plugin.getInventoryManager().addItemToInventory(caller, gadget.getName(), amount); + added++; + } } - UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name() + " cosmetics!")); + UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name().toLowerCase() + .replace("_", " ") + "! (Added " + C.cRed + added + C.cGray + " " + + UtilText.plural("item", added) + ")")); } + + private void addMounts(Player caller) + { + int added = 0; + for (Mount mount : _plugin.getMountManager().getMounts()) + { + if (!mount.hasMount(caller)) + { + _plugin.getInventoryManager().addItemToInventory(caller, mount.getName(), 1); + added++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Added " + C.cRed + added + C.cGray + " " + + UtilText.plural("mount", added) + "!")); + } + + private void addPets(Player caller) + { + int added = 0; + for (Pet pet : _plugin.getPetManager().getFactory().GetPets()) + { + if (!_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType())) + { + _plugin.getPetManager().Get(caller).getPets().put(pet.getPetType(), pet.getName()); + added++; + } + } + UtilPlayer.message(caller, F.main("Cosmetics", "Added " + C.cRed + added + C.cGray + " " + + UtilText.plural("pet", added) + "!")); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java new file mode 100644 index 000000000..0cb01a1c1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java @@ -0,0 +1,55 @@ +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 GadgetChangeEvent extends Event +{ + + public enum GadgetState + { + ENABLED, + DISABLED + } + + private static final HandlerList handlers = new HandlerList(); + + private final Player _player; + private final Gadget _gadget; + private final GadgetState _gadgetState; + + public GadgetChangeEvent(Player player, Gadget gadget, GadgetState gadgetState) + { + _player = player; + _gadget = gadget; + _gadgetState = gadgetState; + } + + public Player getPlayer() + { + return _player; + } + + public Gadget getGadget() + { + return _gadget; + } + + public GadgetState getGadgetState() + { + return _gadgetState; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} 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 377c596f0..f031776d3 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 @@ -117,7 +117,7 @@ public class ItemCoal extends ItemGadget } //Coal Apparition - if (!Manager.getPetManager().Get(player).GetPets().containsKey(EntityType.PIG_ZOMBIE)) + if (!Manager.getPetManager().Get(player).getPets().containsKey(EntityType.PIG_ZOMBIE)) { goal = _pet; 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 b70b8ca49..059e4ec12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -262,7 +262,6 @@ public abstract class WinEffectGadget extends Gadget UtilPlayer.hideFromAll(p); p.setGameMode(GameMode.ADVENTURE); p.getInventory().clear(); - p.teleport(loc.clone().add(.5, 0, .5)); p.setAllowFlight(false); Manager.disableAll(p, false); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java index bfcfa4981..9d86ffa9c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayManager.java @@ -173,7 +173,7 @@ public class GiveawayManager extends MiniDbClientPlugin } @Override - protected PlayerGiveawayData AddPlayer(String player) + protected PlayerGiveawayData addPlayer(String player) { return new PlayerGiveawayData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java index a4735a7a4..15c0fca39 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java @@ -80,7 +80,7 @@ public class IgnoreManager extends MiniDbClientPlugin } @Override - protected IgnoreData AddPlayer(String player) + protected IgnoreData addPlayer(String player) { return new IgnoreData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java index 92a1cb641..2594b4188 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/incognito/IncognitoManager.java @@ -191,7 +191,7 @@ public class IncognitoManager extends MiniDbClientPlugin UtilPlayer.message(player, " "); } - protected IncognitoClient AddPlayer(String player) + protected IncognitoClient addPlayer(String player) { return new IncognitoClient(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 72a33d939..43a1d22e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -342,7 +342,7 @@ public class InventoryManager extends MiniDbClientPlugin } @Override - protected ClientInventory AddPlayer(String player) + protected ClientInventory addPlayer(String player) { return new ClientInventory(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 6d437d2d1..3faaee528 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -87,7 +87,7 @@ public class MessageManager extends MiniClientPlugin } @Override - protected ClientMessage AddPlayer(String player) + protected ClientMessage addPlayer(String player) { Set(player, new ClientMessage()); return Get(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java index 9f801a28c..40d547a39 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java @@ -40,7 +40,7 @@ public class Movement extends MiniClientPlugin } @Override - protected ClientMovement AddPlayer(String player) + protected ClientMovement addPlayer(String player) { return new ClientMovement(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java index 251b2827c..0ae459e78 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java @@ -24,17 +24,17 @@ public class Pet extends SalesPackageBase KnownPackage = false; } - public EntityType GetPetType() + public EntityType getPetType() { return _petType; } - public void Update(PetSalesToken petToken) + public void update(PetSalesToken petToken) { _name = petToken.Name; } - public String GetPetName() + public String getPetName() { return _name; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java index 5aa25843a..e24136065 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetClient.java @@ -11,7 +11,7 @@ public class PetClient private NautHashMap _pets; private int _petNameTagCount; - public void Load(ClientPetToken token) + public void load(ClientPetToken token) { _pets = new NautHashMap(); @@ -26,7 +26,7 @@ public class PetClient _petNameTagCount = Math.max(0, token.PetNameTagCount); } - public NautHashMap GetPets() + public NautHashMap getPets() { return _pets; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 4e609930f..d5f48d43b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -128,7 +128,7 @@ public class PetManager extends MiniClientPlugin if (player != null && player.isOnline()) { - AddPetOwner(player, _petOwnerQueue.get(playerName), player.getLocation()); + addPetOwner(player, _petOwnerQueue.get(playerName), player.getLocation()); } } @@ -160,24 +160,24 @@ public class PetManager extends MiniClientPlugin if (rank.has(Rank.LEGEND)) { - if (!Get(p).GetPets().containsKey(EntityType.WITHER)) - Get(p).GetPets().put(EntityType.WITHER, "Widder"); + if (!Get(p).getPets().containsKey(EntityType.WITHER)) + Get(p).getPets().put(EntityType.WITHER, "Widder"); } if (rank.has(Rank.TITAN)) { - if (!Get(p).GetPets().containsKey(EntityType.SKELETON)) - Get(p).GetPets().put(EntityType.SKELETON, "Guardian"); + if (!Get(p).getPets().containsKey(EntityType.SKELETON)) + Get(p).getPets().put(EntityType.SKELETON, "Guardian"); } } - public void AddPetOwner(Player player, EntityType entityType, Location location) + public void addPetOwner(Player player, EntityType entityType, Location location) { if (_activePetOwners.containsKey(player.getName())) { if (_activePetOwners.get(player.getName()).getType() != entityType) { - RemovePet(player, true); + removePet(player, true); } else return; @@ -214,10 +214,10 @@ public class PetManager extends MiniClientPlugin } //Named Pet - if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0) + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) { //pet.setCustomNameVisible(true); - pet.setCustomName(Get(player).GetPets().get(entityType)); + pet.setCustomName(Get(player).getPets().get(entityType)); } if (pet instanceof Zombie) @@ -245,9 +245,9 @@ public class PetManager extends MiniClientPlugin DisguiseGuardian disguise = new DisguiseGuardian(pet); - if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0) + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) { - disguise.setName(Get(player).GetPets().get(entityType)); + disguise.setName(Get(player).getPets().get(entityType)); } _disguiseManager.disguise(disguise); @@ -265,12 +265,12 @@ public class PetManager extends MiniClientPlugin UtilEnt.Vegetate(pet); } - public Creature GetPet(Player player) + public Creature getPet(Player player) { return _activePetOwners.get(player.getName()); } - public void RemovePet(final Player player, boolean removeOwner) + public void removePet(final Player player, boolean removeOwner) { if (_activePetOwners.containsKey(player.getName())) { @@ -303,7 +303,7 @@ public class PetManager extends MiniClientPlugin @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { - RemovePet(event.getPlayer(), true); + removePet(event.getPlayer(), true); } @EventHandler @@ -336,7 +336,7 @@ public class PetManager extends MiniClientPlugin if (player != null && player.isOnline()) { - RemovePet(player, true); + removePet(player, true); } } } @@ -438,25 +438,25 @@ public class PetManager extends MiniClientPlugin } @EventHandler - public void OnClientWebResponse(ClientWebResponseEvent event) + public void onClientWebResponse(ClientWebResponseEvent event) { ClientPetTokenWrapper token = new Gson().fromJson(event.GetResponse(), ClientPetTokenWrapper.class); - Get(token.Name).Load(token.DonorToken); + Get(token.Name).load(token.DonorToken); } @Override - protected PetClient AddPlayer(String player) + protected PetClient addPlayer(String player) { return new PetClient(); } - public PetFactory GetFactory() + public PetFactory getFactory() { return _petFactory; } - public PetRepository GetRepository() + public PetRepository getRepository() { return _repository; } @@ -471,15 +471,15 @@ public class PetManager extends MiniClientPlugin return _activePetOwners.get(name); } - public void DisableAll() + public void disableAll() { for (Player player : UtilServer.getPlayers()) - RemovePet(player, true); + removePet(player, true); } - public void DisableAll(Player player) + public void disableAll(Player player) { - RemovePet(player, true); + removePet(player, true); } public Collection getPets() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java index a2d5298b0..64abfc3cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollManager.java @@ -51,7 +51,7 @@ public class PollManager extends MiniDbClientPlugin } @Override - protected PlayerPollData AddPlayer(String player) + protected PlayerPollData addPlayer(String player) { return new PlayerPollData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java index 5622bdef6..07592704a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java @@ -59,7 +59,7 @@ public class PreferencesManager extends MiniDbClientPlugin } @Override - protected UserPreferences AddPlayer(String player) + protected UserPreferences addPlayer(String player) { return new UserPreferences(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java index 35511ac6a..4c3a962ea 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/progression/KitProgressionManager.java @@ -33,7 +33,7 @@ public class KitProgressionManager extends MiniClientPlugin @Override - protected PlayerKit AddPlayer(String player) + protected PlayerKit addPlayer(String player) { return null; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 7ff0962ab..a73557680 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -929,7 +929,7 @@ public class RewardManager public PetReward addPetReward(Type type, EntityType entityType, RewardRarity rarity, int weight, int shards) { - Pet pet = _petManager.GetFactory().getPet(entityType); + Pet pet = _petManager.getFactory().getPet(entityType); PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager, pet.getName() + " Pet", pet.getName(), entityType, rarity, weight, shards); addReward(type, reward); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java index d3dba4662..9589502eb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/PetReward.java @@ -50,8 +50,8 @@ public class PetReward extends UnknownPackageReward PetToken petToken = new PetToken(); petToken.PetType = token.PetType; - _petManager.GetRepository().AddPet(token); - _petManager.Get(player).GetPets().put(_petEntity, token.PetName); + _petManager.getRepository().AddPet(token); + _petManager.Get(player).getPets().put(_petEntity, token.PetName); _inventoryManager.addItemToInventory(player, _petEntity.toString(), 1); @@ -67,6 +67,6 @@ public class PetReward extends UnknownPackageReward return false; } - return !_petManager.Get(player).GetPets().containsKey(_petEntity); + return !_petManager.Get(player).getPets().containsKey(_petEntity); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 8c2bc5e06..52d19ec1e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -307,7 +307,7 @@ public class StatsManager extends MiniDbClientPlugin } @Override - protected PlayerStats AddPlayer(String player) + protected PlayerStats addPlayer(String player) { return new PlayerStats(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java index 0427cb53e..ef09c15cb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java @@ -49,7 +49,7 @@ public class TaskManager extends MiniDbClientPlugin } @Override - protected TaskClient AddPlayer(String playerName) + protected TaskClient addPlayer(String playerName) { return new TaskClient(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentManager.java b/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentManager.java index d5bdf1a0b..4166c6a36 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/tournament/TournamentManager.java @@ -80,7 +80,7 @@ public class TournamentManager extends MiniDbClientPlugin } @Override - protected ClientTournamentData AddPlayer(String player) + protected ClientTournamentData addPlayer(String player) { return new ClientTournamentData(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java index 45963b9b8..01dc0f954 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java @@ -68,7 +68,7 @@ public class YoutubeManager extends MiniDbClientPlugin } @Override - protected YoutubeClient AddPlayer(String player) + protected YoutubeClient addPlayer(String player) { return new YoutubeClient(null); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index 314623f33..327bc3be5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -984,7 +984,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati } @Override - protected ClientClan AddPlayer(String player) + protected ClientClan addPlayer(String player) { return new ClientClan(); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java index 8f10f9f0b..49143cff6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/murder/MurderManager.java @@ -204,7 +204,7 @@ public class MurderManager extends MiniClientPlugin } @Override - protected ClientMurder AddPlayer(String player) + protected ClientMurder addPlayer(String player) { return new ClientMurder(); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java index 52c3dfeba..c64fd698a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/playtime/Playtime.java @@ -45,7 +45,7 @@ public class Playtime extends MiniClientPlugin @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { - Set(event.getPlayer(), AddPlayer(event.getPlayer().getName())); + Set(event.getPlayer(), addPlayer(event.getPlayer().getName())); } @EventHandler @@ -73,7 +73,7 @@ public class Playtime extends MiniClientPlugin } @Override - protected PlayingClient AddPlayer(String player) + protected PlayingClient addPlayer(String player) { return new PlayingClient(Bukkit.getPlayer(player), TaskManager.Instance); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index f53d023f4..c5c46b005 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -786,7 +786,7 @@ public class HubManager extends MiniClientPlugin } @Override - protected HubClient AddPlayer(String player) + protected HubClient addPlayer(String player) { return new HubClient(player); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java index a5fd6ebb4..a31b07381 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailManager.java @@ -27,7 +27,7 @@ public class MailManager extends MiniClientPlugin implements Not } @Override - protected PlayerMailData AddPlayer(String player) + protected PlayerMailData addPlayer(String player) { return new PlayerMailData(); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java index 6c0ad0d5b..0787e225b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/KothManager.java @@ -197,7 +197,7 @@ public class KothManager extends MiniPlugin Manager.GetGadget().disableAll(player, outfit); Manager.GetMount().DisableAll(player); - Manager.getPetManager().DisableAll(player); + Manager.getPetManager().disableAll(player); } else { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index 04fb771b8..078303737 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -472,7 +472,7 @@ public class SoccerManager extends MiniPlugin Manager.GetGadget().disableAll(player, outfit); Manager.GetMount().DisableAll(player); - Manager.getPetManager().DisableAll(player); + Manager.getPetManager().disableAll(player); } else { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index da26f23fd..a92a99b2e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -948,7 +948,7 @@ public class ServerManager extends MiniDbClientPlugin implement } @Override - protected SimpleClanToken AddPlayer(String player) + protected SimpleClanToken addPlayer(String player) { return new SimpleClanToken(); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java index da87fc2da..4bc36c039 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java @@ -322,7 +322,7 @@ public class ClassManager extends MiniClientPlugin implements IClas } @Override - protected ClientClass AddPlayer(String player) + protected ClientClass addPlayer(String player) { return new ClientClass(this, _skillFactory, _itemFactory, _clientManager.Get(player), _donationManager.Get(player), null); } From 5c60819179ace3b8368d33f1825d1c88b43ee6ef Mon Sep 17 00:00:00 2001 From: Thanos Paravantis Date: Wed, 29 Jun 2016 12:21:37 +0300 Subject: [PATCH 084/115] Prevent NPE on player interact event --- .../game/arcade/game/games/dragonescape/DragonEscape.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index cc2f238b6..c6cead608 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -632,8 +632,15 @@ public class DragonEscape extends SoloGame @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { + if (!IsLive()) + return; + + if (event.getClickedBlock() == null) + return; + if(event.getClickedBlock().getType() != Material.TRAP_DOOR) return; + // Stops players using trap doors in game. event.setCancelled(true); } From e25a6e432790de5dc39d401fd544b8def03f7dc7 Mon Sep 17 00:00:00 2001 From: Thanos Paravantis Date: Wed, 29 Jun 2016 12:23:02 +0300 Subject: [PATCH 085/115] Reset leap data when needed (death/quit/game end) --- .../game/arcade/kit/perks/PerkLeap.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java index f971ae57a..035ffe685 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; @@ -18,6 +19,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; +import org.bukkit.event.player.PlayerQuitEvent; public class PerkLeap extends Perk { @@ -125,4 +127,22 @@ public class PerkLeap extends Perk PerkLeapEvent leapEvent = new PerkLeapEvent(player); UtilServer.getServer().getPluginManager().callEvent(leapEvent); } + + @EventHandler + public void removeDataOnQuit(PlayerQuitEvent event) + { + _uses.remove(event.getPlayer().getName()); + } + + @EventHandler + public void removeDataOnDeath(PlayerDeathEvent event) + { + _uses.remove(event.getEntity().getName()); + } + + @Override + public void unregisteredEvents() + { + _uses.clear(); + } } From 045e1b3064dc0a285afda75d9330657318c825bf Mon Sep 17 00:00:00 2001 From: samczsun Date: Wed, 29 Jun 2016 13:15:45 -0400 Subject: [PATCH 086/115] Fix various Clans bugs Viper destroying armor Legendaries not saving properly Combat log NPC for vanished players --- .../mineplex/core/common/util/UtilInv.java | 18 +++-- .../game/clans/clans/ClansManager.java | 16 +++++ .../clans/clans/commands/KillCommand.java | 6 ++ .../clans/clans/gui/page/ClanWhoPage.java | 2 +- .../game/clans/gameplay/safelog/SafeLog.java | 5 +- .../mineplex/game/clans/items/CustomItem.java | 5 +- .../game/clans/items/GearManager.java | 70 +++++++------------ .../game/clans/items/ItemListener.java | 5 +- .../items/legendaries/LegendaryItem.java | 2 +- 9 files changed, 75 insertions(+), 54 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java index 4f8313b43..f7b6cbec7 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -173,7 +173,17 @@ public class UtilInv return getItems(player, true, true, true); } + public static ArrayList getItemsUncloned(Player player) + { + return getItems(player, true, true, true, false); + } + public static ArrayList getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting) + { + return getItems(player, getArmor, getCursor, getCrafting, true); + } + + public static ArrayList getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting, boolean clone) { ArrayList items = new ArrayList(); PlayerInventory inv = player.getInventory(); @@ -182,7 +192,7 @@ public class UtilInv { if (item != null && item.getType() != Material.AIR) { - items.add(item.clone()); + items.add(clone ? item.clone() : item); } } @@ -192,7 +202,7 @@ public class UtilInv { if (item != null && item.getType() != Material.AIR) { - items.add(item.clone()); + items.add(clone ? item.clone() : item); } } } @@ -202,7 +212,7 @@ public class UtilInv ItemStack cursorItem = player.getItemOnCursor(); if (cursorItem != null && cursorItem.getType() != Material.AIR) - items.add(cursorItem.clone()); + items.add(clone ? cursorItem.clone() : cursorItem); } if (getCrafting) @@ -215,7 +225,7 @@ public class UtilInv { if (item != null && item.getType() != Material.AIR) { - items.add(item.clone()); + items.add(clone ? item.clone() : item); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index 314623f33..e4c0c7719 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -89,11 +89,14 @@ import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; import mineplex.minecraft.game.classcombat.shop.ClassShopManager; import mineplex.minecraft.game.core.IRelation; import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.mechanics.Weapon; import mineplex.serverdata.commands.ServerCommandManager; +import net.md_5.bungee.api.ChatColor; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -321,6 +324,19 @@ public class ClansManager extends MiniClientPluginimplements IRelati Material targetType = event.getTargetBlock().getType(); event.setCancelled(targetType == Material.POTATO || targetType == Material.CARROT); } + + @EventHandler + public void on(CustomDamageEvent event) + { + if (event.GetCause() == EntityDamageEvent.DamageCause.CUSTOM + && event.GetDamageInitial() == 0.1 + && event.GetDamageePlayer() != null) + { + Condition poisonShock = _condition.GetActiveCondition(event.GetDamageePlayer(), Condition.ConditionType.POISON_SHOCK); + if (poisonShock != null) + event.SetIgnoreArmor(true); + } + } }); _worldEvent.setFactory(skillManager); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/KillCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/KillCommand.java index 151567dbd..611838bd7 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/KillCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/commands/KillCommand.java @@ -1,6 +1,7 @@ package mineplex.game.clans.clans.commands; import mineplex.game.clans.clans.ClansManager; +import mineplex.minecraft.game.classcombat.Skill.Global.Recharge; import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; @@ -29,6 +30,11 @@ public class KillCommand extends CommandBase UtilPlayer.message(caller, F.main("Clans", "You cannot use this command whilst in the tutorial.")); return; } + if (mineplex.core.recharge.Recharge.Instance.use(caller, "Suicide", 5000, false, false)) + { + UtilPlayer.message(caller, F.main("Clans", "Please wait a bit before suiciding")); + return; + } UtilPlayer.message(caller, F.main("Clans", "You have imploded.")); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java index 6fe27d3ad..5550d370a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java @@ -62,7 +62,7 @@ public class ClanWhoPage extends ClanPageBase // Basic Clan Info lore.add(C.Reset + C.cYellow + "Founder " + C.cWhite + _lookupClan.getDesc()); - lore.add(C.Reset + C.cYellow + "Formed " + C.cWhite + UtilTime.convertString(System.currentTimeMillis() - _lookupClan.getDateCreated().getTime(), 1, UtilTime.TimeUnit.FIT)); + lore.add(C.Reset + C.cYellow + "Formed " + C.cWhite + UtilTime.convertString(System.currentTimeMillis() - _lookupClan.getDateCreated().getTime(), 1, UtilTime.TimeUnit.FIT) + " ago on " + UtilTime.when(_lookupClan.getDateCreated().getTime())); lore.add(C.Reset + C.cYellow + "Members " + C.cWhite + _lookupClan.getOnlinePlayerCount() + "/" + _lookupClan.getMembers().size()); lore.add(C.Reset + C.cYellow + "Territory " + C.cWhite + _lookupClan.getClaims() + "/" + _lookupClan.getClaimsMax()); lore.add(C.Reset + C.cYellow + "TNT Protection " + C.cWhite + _lookupClan.getProtected()); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java index 8d819ff9b..db6fa935f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/gameplay/safelog/SafeLog.java @@ -58,7 +58,10 @@ public class SafeLog extends MiniPlugin if (!isSafeLog) { - NPCManager.getInstance().spawnLogoutNpc(player); + if (!_clansManager.getIncognitoManager().Get(player).Status) + { + NPCManager.getInstance().spawnLogoutNpc(player); + } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java index 116cb315c..a16b7529b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/CustomItem.java @@ -6,6 +6,9 @@ import java.util.UUID; import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItem; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemFactory; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEvent; @@ -105,7 +108,7 @@ public class CustomItem implements Listener public ItemStack toItemStack(int amount) { - ItemStack item = new ItemStack(_material, amount); + ItemStack item = CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(new ItemStack(_material, amount))); update(item); if (_dullEnchantment) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java index 21befc0b9..43849130c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java @@ -2,6 +2,8 @@ package mineplex.game.clans.items; import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; @@ -86,21 +88,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutWindowItems; */ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { - private static final Field UNHANDLED_TAGS_FIELD; - - static - { - try - { - UNHANDLED_TAGS_FIELD = Class.forName("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem").getDeclaredField("unhandledTags"); - UNHANDLED_TAGS_FIELD.setAccessible(true); - } - catch (Throwable t) - { - throw new RuntimeException("Error getting unhandledTags field", t); - } - } - private static final String ITEM_SERIALIZATION_TAG = "-JSON-"; private static final Gson GSON; @@ -626,7 +613,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable return null; } - CraftItemStack originalItem = CraftItemStack.asCraftMirror(item); + CraftItemStack originalItem = CraftItemStack.asCraftMirror(item.cloneItemStack()); ItemMeta originalMeta = originalItem.getItemMeta(); // No need to modify item packets with no lore @@ -680,7 +667,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable List cleansed = new ArrayList<>(); for (String s : input) { - if (!s.startsWith(ITEM_SERIALIZATION_TAG)) + if (s.startsWith(ITEM_SERIALIZATION_TAG)) { cleansed.add(s); } @@ -697,40 +684,35 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable // This will not be persistent if the ItemStack is a block and placed then picked up private static Map getUnhandledTags(ItemStack itemStack) { - ItemMeta itemMeta = itemStack.getItemMeta(); - if (itemMeta == null) + net.minecraft.server.v1_8_R3.ItemStack handle = ((CraftItemStack) itemStack).getHandle(); + if (handle == null) + return Collections.emptyMap(); + + NBTTagCompound tag = handle.getTag(); + + if (tag == null) + return Collections.emptyMap(); + + Map unhandled = new HashMap<>(); + for (String name : tag.c()) { - return null; + unhandled.put(name, tag.get(name)); } - try - { - return (Map) UNHANDLED_TAGS_FIELD.get(itemMeta); - } - catch (IllegalAccessException e) - { - System.out.println("Could not get unhandledTags"); - e.printStackTrace(); - } - return null; + return unhandled; } private static void saveUnhandledTags(ItemStack itemStack, Map map) { - ItemMeta itemMeta = itemStack.getItemMeta(); - if (itemMeta == null) + net.minecraft.server.v1_8_R3.ItemStack handle = ((CraftItemStack) itemStack).getHandle(); + NBTTagCompound tag = handle.getTag(); + + if (tag != null) { - return; + for (String name : map.keySet()) + { + tag.set(name, map.get(name)); + } } - try - { - UNHANDLED_TAGS_FIELD.set(itemMeta, map); - } - catch (IllegalAccessException e) - { - System.out.println("Could not get unhandledTags"); - e.printStackTrace(); - } - itemStack.setItemMeta(itemMeta); } public static void save(ItemStack itemStack, boolean remove) @@ -743,7 +725,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable saveUnhandledTags(itemStack, data); if (remove) { - _customItemCache.remove(item); + _customItemCache.remove(UUID.fromString(item._uuid)); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java index c3bbbf9a8..02ff57e7e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/ItemListener.java @@ -16,6 +16,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; @@ -44,7 +45,7 @@ public class ItemListener implements Listener, Runnable public ItemListener(JavaPlugin plugin) { _plugin = plugin; - _plugin.getServer().getScheduler().runTaskTimer(_plugin, this, 20 * 60 * 5, 0); + _plugin.getServer().getScheduler().runTaskTimer(_plugin, this, 0, 20 * 60 * 5); } @Override @@ -65,7 +66,7 @@ public class ItemListener implements Listener, Runnable private void save(Player player, boolean remove) { - for (ItemStack item : UtilInv.getItems(player)) + for (ItemStack item : UtilInv.getItemsUncloned(player)) { GearManager.save(item, remove); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java index f01f68886..f27d909df 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/LegendaryItem.java @@ -13,7 +13,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class LegendaryItem extends CustomItem { - private final long BLOCK_COOLDOWN = 200L; // Right clicking activates right click for 200ms + private static final long BLOCK_COOLDOWN = 200L; // Right clicking activates right click for 200ms protected long _lastBlock; // Timestamp of last block from wielder From 40124b2cdde7c0ccbdd4d5014346c8eb02ae367b Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 30 Jun 2016 17:19:53 +0100 Subject: [PATCH 087/115] Updated changed method name (getThrower) In the ProjectileData class GetThrower was changed to getThrower, this fixes that in any of my classes --- .../nautilus/game/arcade/kit/perks/PerkPigBaconBounce.java | 4 ++-- .../src/nautilus/game/arcade/kit/perks/PerkSlimeRocket.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 6e6685993..195717459 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 @@ -110,11 +110,11 @@ public class PerkPigBaconBounce extends SmashPerk implements IThrown if (target == null) return; - if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.GetThrower() instanceof Player) + if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) { TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); Player targetPlayer = (Player) target; - Player throwerPlayer = (Player) data.GetThrower(); + Player throwerPlayer = (Player) data.getThrower(); if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) { 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 345f425d9..b296469af 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 @@ -226,11 +226,11 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown Slime slime = (Slime)data.getThrown(); - if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.GetThrower() instanceof Player) + if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) { TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); Player targetPlayer = (Player) target; - Player throwerPlayer = (Player) data.GetThrower(); + Player throwerPlayer = (Player) data.getThrower(); if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) { From 3e1c44bfa32722960ec688f9a509804a2934fb83 Mon Sep 17 00:00:00 2001 From: samczsun Date: Wed, 29 Jun 2016 00:22:44 -0400 Subject: [PATCH 088/115] UHC improvements Lots of hacky NMS stuff. Ask me if you're confused Basically, decorate the world async Keep spawn chunks loaded Make sure view distance is capped so no chunks are genned on teleport Add regeneration and resistance on spawn to prevent damage Set health objective score manually Teleport player two times to ensure no block glitching Disable kicking and NCP while teleporting --- .../src/mineplex/core/common/Pair.java | 28 +- Plugins/Nautilus.Game.Arcade/pom.xml | 4 + .../nautilus/game/arcade/game/GameTeam.java | 13 +- .../game/arcade/game/games/uhc/UHC.java | 647 ++++++++++++++++-- .../arcade/managers/GameLobbyManager.java | 2 +- .../game/arcade/managers/GameManager.java | 4 + .../arcade/scoreboard/GameScoreboard.java | 2 +- 7 files changed, 638 insertions(+), 62 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java index 7ec401ed6..e89e491af 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java @@ -45,21 +45,25 @@ public class Pair implements Serializable { return getLeft().toString() + ":" + getRight().toString(); } - @SuppressWarnings("rawtypes") + @Override - public boolean equals(Object obj) + public boolean equals(Object o) { - if (this == obj) - return true; - if (!(obj instanceof Pair)) - return false; + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; - Pair localPair = (Pair) obj; + Pair pair = (Pair) o; - if (getLeft() != null ? !getLeft().equals(localPair.getLeft()) : localPair.getLeft() != null) - return false; - if (getRight() != null ? !getRight().equals(localPair.getRight()) : localPair.getRight() != null) - return false; - return true; + if (left != null ? !left.equals(pair.left) : pair.left != null) return false; + return right != null ? right.equals(pair.right) : pair.right == null; + + } + + @Override + public int hashCode() + { + int result = left != null ? left.hashCode() : 0; + result = 31 * result + (right != null ? right.hashCode() : 0); + return result; } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/pom.xml b/Plugins/Nautilus.Game.Arcade/pom.xml index 6c69780d2..f23ada168 100644 --- a/Plugins/Nautilus.Game.Arcade/pom.xml +++ b/Plugins/Nautilus.Game.Arcade/pom.xml @@ -19,5 +19,9 @@ mineplex-minecraft-game-classcombat ${project.version} + + fr.neatmonster + nocheatplus + diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index 256771fdb..36bd685e2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -268,11 +268,18 @@ public class GameTeam return GetColor() + "§l" + GetName(); } - public void SpawnTeleport(Player player) - { + public Location SpawnTeleport(Player player) + { + Location l = GetSpawn(); + player.teleport(l); + return l; + } + + public void SpawnTeleport(Player player, Location location) + { player.leaveVehicle(); player.eject(); - player.teleport(GetSpawn()); + player.teleport(location); } public void SpawnTeleport() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 0999ecd4a..c7ea13cbd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -1,14 +1,27 @@ package nautilus.game.arcade.game.games.uhc; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import com.mineplex.spigot.ChunkPreLoadEvent; +import fr.neatmonster.nocheatplus.checks.CheckType; +import fr.neatmonster.nocheatplus.checks.access.IViolationInfo; +import fr.neatmonster.nocheatplus.hooks.NCPHook; +import fr.neatmonster.nocheatplus.hooks.NCPHookManager; +import mineplex.core.common.Pair; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; @@ -34,38 +47,35 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.serverdata.Utility; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GamePrepareCountdownCommence; import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; +import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Kit; import net.minecraft.server.v1_8_R3.BiomeCache; -import net.minecraft.server.v1_8_R3.ChunkCoordIntPair; import net.minecraft.server.v1_8_R3.ChunkProviderServer; -import net.minecraft.server.v1_8_R3.EmptyChunk; -import net.minecraft.server.v1_8_R3.ExceptionWorldConflict; +import net.minecraft.server.v1_8_R3.ChunkRegionLoader; import net.minecraft.server.v1_8_R3.FileIOThread; -import net.minecraft.server.v1_8_R3.IChunkLoader; import net.minecraft.server.v1_8_R3.IChunkProvider; -import net.minecraft.server.v1_8_R3.LongHashMap; import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.World; import net.minecraft.server.v1_8_R3.WorldChunkManager; +import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.Chunk; import org.bukkit.Difficulty; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.World; import org.bukkit.WorldBorder; import org.bukkit.World.Environment; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.generator.NormalChunkGenerator; import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; @@ -74,24 +84,27 @@ import org.bukkit.entity.Ghast; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; +import org.bukkit.entity.Villager; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.player.PlayerChangedWorldEvent; +import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -107,10 +120,16 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; -import org.spigotmc.WatchdogThread; +import org.spigotmc.AsyncCatcher; -public class UHC extends TeamGame +public class UHC extends TeamGame implements NCPHook { + // The view distance of UHC. The amount of time and ram needed grows polynomially + private static final int VIEW_DISTANCE = 5; + + // The number of threads to use for reading chunks from disk + private static final int THREADS_FOR_CHUNK_LOADING = 4; + private NautHashMap _teamReqs = new NautHashMap(); private NautHashMap _deathTime = new NautHashMap(); @@ -145,6 +164,14 @@ public class UHC extends TeamGame private double _previousBorder = 1000; private long _borderStartedMoving; + + private volatile boolean _isDecorating = false; + private volatile boolean _allowSpawning = true; + private int _teleportedPlayers = -1; + private int _totalPlayers = 0; + private AtomicInteger actual = new AtomicInteger(); + private AtomicInteger expected = new AtomicInteger(23000); // Most likely it'll be around 23000 + public UHC(ArcadeManager manager) { this(manager, GameType.UHC); @@ -157,7 +184,7 @@ public class UHC extends TeamGame DamageDealt ); } - + public UHC(ArcadeManager manager, GameType type) { super(manager, type, @@ -181,7 +208,7 @@ public class UHC extends TeamGame this.GameTimeout = 10800000; - this.DamagePvP = false; + this.DamagePvP = true; this.DeathDropItems = true; @@ -213,8 +240,6 @@ public class UHC extends TeamGame this.WorldBoundaryKill = false; - this.TickPerTeleport = 3; - this.GemBoosterEnabled = false; this.GemDoubleEnabled = false; this.GemHunterEnabled = false; @@ -243,6 +268,8 @@ public class UHC extends TeamGame _createTime = System.currentTimeMillis(); _serverTime = Utility.currentTimeMillis(); + + NCPHookManager.addHook(CheckType.ALL, this); } @Override @@ -274,23 +301,6 @@ public class UHC extends TeamGame border.setWarningTime(-99); } - @EventHandler - public void onDamage(CustomDamageEvent event) - { - if (!IsLive()) - return; - - if (UtilTime.elapsed(getGameLiveTime(), 20000)) - return; - - if (!(event.GetDamageeEntity() instanceof Player)) - return; - - event.SetCancelled("Spawn Invincibility"); - event.GetDamageeEntity().setFireTicks(0); - - } - @EventHandler public void onSecond(UpdateEvent event) { @@ -479,6 +489,333 @@ public class UHC extends TeamGame } TimingManager.stop("UHC Spawn Generation"); + + Location spawn = GetRandomSpawn(WorldData.World.getSpawnLocation()); + WorldData.World.setSpawnLocation(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()); + + WorldServer worldServer = ((CraftWorld) WorldData.World).getHandle(); + + // Update view distance + worldServer.spigotConfig.viewDistance = VIEW_DISTANCE; + worldServer.getPlayerChunkMap().a(VIEW_DISTANCE); + + if (Runtime.getRuntime().maxMemory() / 1024 / 1024 < 2048) + { + Announce(C.cGreen + C.Bold + "Skipping spawn pregeneration", false); + return; + } + + // Ensures the server does not tick us + worldServer.getMinecraftServer().worlds.remove(worldServer); + + _allowSpawning = false; + + new Thread(() -> + { + try + { + TimingManager.start("UHC Chunk Loading"); + + ChunkProviderServer chunkProviderServer = worldServer.chunkProviderServer; + + Field chunkLoaderField = chunkProviderServer.getClass().getDeclaredField("chunkLoader"); + chunkLoaderField.setAccessible(true); + + ChunkRegionLoader loader = (ChunkRegionLoader) chunkLoaderField.get(chunkProviderServer); + + Map loaded = new ConcurrentHashMap<>(); + Map compounds = new ConcurrentHashMap<>(); + + // Step 1: Read all the required chunks from the disk + // We're going to read all the required chunks from disk async + { + Set> coordPairs = new HashSet<>(); + + // Special case for 0, 0 + { + int x = spawn.getBlockX() >> 4; + int z = spawn.getBlockZ() >> 4; + + for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) + { + for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) + { + coordPairs.add(Pair.create(x + dx, z + dz)); + } + } + } + + // All the team spawns + { + for (int i = 0; i < GetTeamList().size(); i++) + { + GameTeam team = GetTeamList().get(i); + for (Location l : team.GetSpawns()) + { + int x = l.getChunk().getX(); + int z = l.getChunk().getZ(); + + for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) + { + for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) + { + coordPairs.add(Pair.create(x + dx, z + dz)); + } + } + } + } + } + + // Sigh... I don't want this to be here but it needs to be set somewhere... + // Multiply by 3 because there are 3 stages + expected.set(coordPairs.size() * 3); + + // Load them now + ExecutorService chunkLoaders = Executors.newFixedThreadPool(THREADS_FOR_CHUNK_LOADING); + + for (Pair coords : coordPairs) + { + chunkLoaders.submit(() -> + { + try + { + Object[] data = loader.loadChunk(worldServer, coords.getLeft(), coords.getRight()); + if (data != null) + { + NBTTagCompound compound = (NBTTagCompound) data[1]; + net.minecraft.server.v1_8_R3.Chunk chunk = (net.minecraft.server.v1_8_R3.Chunk) data[0]; + loaded.put(LongHash.toLong(coords.getLeft(), coords.getRight()), chunk); + compounds.put(LongHash.toLong(coords.getLeft(), coords.getRight()), compound); + } + else + { + System.out.println("Failed to load chunk " + coords.getLeft() + "," + coords.getRight()); + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + finally + { + actual.getAndIncrement(); + } + }); + } + + chunkLoaders.shutdown(); + + // We've got plenty of time to wait + System.out.println("Finished submitting tasks to executor, waiting..."); + chunkLoaders.awaitTermination(1, TimeUnit.DAYS); + + System.out.println("Loaded: " + loaded.size() + " and coords: " + coordPairs.size()); + } + + // Step 2: Recreate structures, update neighbors, load entities + // This step should be super quick so there's no point in scheduling it elsewhere + // Code is plain copypasted from ChunkIOProvider + { + for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) + { + NBTTagCompound compound = compounds.get(LongHash.toLong(chunk.locX, chunk.locZ)); + loader.loadEntities(chunk, compound.getCompound("Level"), worldServer); + chunk.setLastSaved(chunkProviderServer.world.getTime()); + if (chunkProviderServer.chunkProvider != null) + { + chunkProviderServer.chunkProvider.recreateStructures(chunk, chunk.locX, chunk.locZ); + } + for (int x = -2; x < 3; ++x) + { + for (int z = -2; z < 3; ++z) + { + if (x != 0 || z != 0) + { + net.minecraft.server.v1_8_R3.Chunk neighbor = loaded.get(LongHash.toLong(chunk.locX + x, chunk.locZ + z)); + if (neighbor != null) + { + neighbor.setNeighborLoaded(-x, -z); + chunk.setNeighborLoaded(x, z); + } + } + } + } + actual.getAndIncrement(); + } + } + + AtomicBoolean lockCompleted = new AtomicBoolean(false); + Object lock = new Object(); + + // Hop back onto the main thread + Manager.runSync(() -> + { + // We want to add all the chunks to the chunkmap so that the server is not out of sync + for (Map.Entry ent : loaded.entrySet()) + { + ent.getValue().addEntities(); + chunkProviderServer.chunks.put(ent.getKey(), ent.getValue()); + } + lockCompleted.set(true); + synchronized (lock) + { + lock.notifyAll(); + } + }); + + if (!lockCompleted.get()) + { + synchronized (lock) + { + lock.wait(); + } + } + if (!lockCompleted.get()) + { + throw new IllegalStateException("Lock was not completed"); + } + + + // Step 3: Decorate the chunks. This step must be performed async as otherwise the server lags way too hard + // Notes: Do not allow the server to tick the world. If this is allowed EntityTracker will raise CME + // NextTickList will also raise errors + // And worst case the server will crash + { + // Live life on the edge + AsyncCatcher.enabled = false; + _isDecorating = true; + int x = 0; + for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) + { + loadNearby(chunkProviderServer, chunkProviderServer, chunk.locX, chunk.locZ, worldServer, chunk); + x++; + if (x % 100 == 0) + { + System.out.println(x); + } + actual.getAndIncrement(); + } + TimingManager.stop("UHC Chunk Loading"); + _isDecorating = false; + AsyncCatcher.enabled = true; + + System.out.println("Expected: " + expected.get() + ", actual: " + actual.get()); + + Manager.runSync(() -> + { + World world = worldServer.getWorld(); + for (Entity entity : world.getLivingEntities()) + { + if (!(entity instanceof Player) && !(entity instanceof Villager)) + { + entity.remove(); + } + } + // You may tick again + worldServer.getMinecraftServer().worlds.add(worldServer); + + // Well, if they're not equal, not much we can do. We've hit the end + actual.set(expected.get()); + }); + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + }, "Chunk Loader").start(); + } + + // Plain copypasted from Chunk, but modified so that it doesn't load surrounding chunks if they're nonexistant + // This decorates the chunks. Do not remove! + public void loadNearby(ChunkProviderServer ichunkprovider, ChunkProviderServer ichunkprovider1, int i, int j, net.minecraft.server.v1_8_R3.World world, net.minecraft.server.v1_8_R3.Chunk chunk1) + { + boolean flag = ichunkprovider.isChunkLoaded(i, j - 1); + boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j); + boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1); + boolean flag3 = ichunkprovider.isChunkLoaded(i - 1, j); + boolean flag4 = ichunkprovider.isChunkLoaded(i - 1, j - 1); + boolean flag5 = ichunkprovider.isChunkLoaded(i + 1, j + 1); + boolean flag6 = ichunkprovider.isChunkLoaded(i - 1, j + 1); + boolean flag7 = ichunkprovider.isChunkLoaded(i + 1, j - 1); + if (flag1 && flag2 && flag5) + { + if (!chunk1.isDone()) + { + ichunkprovider.getChunkAt(ichunkprovider1, i, j); + } + else + { + ichunkprovider.a(ichunkprovider1, chunk1, i, j); + } + } + + net.minecraft.server.v1_8_R3.Chunk chunk; + if (flag3 && flag2 && flag6) + { + chunk = ichunkprovider.getChunkIfLoaded(i - 1, j); + if (chunk != null) + { + if (!chunk.isDone()) + { + ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j); + } + else + { + ichunkprovider.a(ichunkprovider1, chunk, i - 1, j); + } + } + } + + if (flag && flag1 && flag7) + { + chunk = ichunkprovider.getChunkIfLoaded(i, j - 1); + if (chunk != null) + { + if (!chunk.isDone()) + { + ichunkprovider.getChunkAt(ichunkprovider1, i, j - 1); + } + else + { + ichunkprovider.a(ichunkprovider1, chunk, i, j - 1); + } + } + } + + if (flag4 && flag && flag3) + { + chunk = ichunkprovider.getChunkIfLoaded(i - 1, j - 1); + if (chunk != null) + { + if (!chunk.isDone()) + { + ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1); + } + else + { + ichunkprovider.a(ichunkprovider1, chunk, i - 1, j - 1); + } + } + } + } + + @EventHandler + public void on(EntitySpawnEvent event) + { + // Don't allow entity spawns while decorating, period + if (_isDecorating || !_allowSpawning) + { + if (event.getLocation().getWorld().getUID() == WorldData.World.getUID()) + { + event.setCancelled(true); + } + } + } + + private boolean areSpawnsGenerated() + { + return actual.get() == expected.get(); } @EventHandler @@ -675,7 +1012,7 @@ public class UHC extends TeamGame while (!stopGen) { long now = System.currentTimeMillis(); - if ((now - last) >= 4000) + if ((now - last) >= 10 * 1000) { Announce(C.cGreen + C.Bold + "Generating Map: " + C.cWhite + getMapLoadETA() + " Remaining...", false); last = now; @@ -745,6 +1082,170 @@ public class UHC extends TeamGame }, "WorldGen Thread").start(); } + @EventHandler + public void on(ChunkUnloadEvent event) + { + if (IsLive()) + return; + event.setCancelled(true); + } + + private volatile boolean _isTeleporting = false; + + @EventHandler + public void on(ChunkPreLoadEvent event) + { + if (_isTeleporting) + { + System.out.println("WARNING: TRIED TO LOAD CHUNK WHILE TELEPORTING: " + event.getX() + " " + event.getZ()); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void on(PlayerKickEvent event) + { + // Don't kick players while teleporting. Probably NCP trying to kick for fly or something + if (_isTeleporting) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.LOW) + public void PlayerPrepare(GameStateChangeEvent event) + { + final Game game = event.GetGame(); + + if (event.GetState() != GameState.Prepare) + return; + + _isTeleporting = true; + + List players = game.GetPlayers(true); + + Location zero = WorldData.World.getSpawnLocation(); + + for (Player player : players) + { + player.teleport(zero); + + // Heal + player.setHealth(player.getMaxHealth()); + // Resistance and regen + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30 * 20, 128), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); + } + + Announce(C.cGreen + C.Bold + "Please wait while you are teleported to your spawn", false); + + _totalPlayers = players.size(); + + Map teleportedLocations = new HashMap<>(); + + AtomicInteger id = new AtomicInteger(); + id.set(UtilServer.getServer().getScheduler().runTaskTimer(Manager.getPlugin(), () -> + { + _teleportedPlayers++; + if (_teleportedPlayers >= players.size()) + { + Manager.runSyncLater(() -> + { + try + { + for (Player player : players) + { + GameTeam team = game.GetTeam(player); + if (team != null) + { + if (teleportedLocations.get(player.getUniqueId()) != null) + { + team.SpawnTeleport(player, teleportedLocations.get(player.getUniqueId())); + } + } + + // Heal + player.setHealth(player.getMaxHealth()); + // Resistance and regen + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30 * 20, 128), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); + } + } + finally + { + game.AnnounceGame(); + game.StartPrepareCountdown(); + + //Event + GamePrepareCountdownCommence gamePrepareCountdownCommence = new GamePrepareCountdownCommence(game); + UtilServer.getServer().getPluginManager().callEvent(gamePrepareCountdownCommence); + + _isTeleporting = false; + + Manager.runSyncLater(() -> + { + for (Player player : players) + { + player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); + player.removePotionEffect(PotionEffectType.REGENERATION); + } + }, 10 * 20L); + // Yes, right now they're both set to 10 seconds, but this may change in the future + Manager.runSyncLater(() -> + { + _allowSpawning = true; + }, 10 * 20L); + } + }, 3 * 20L); + Bukkit.getServer().getScheduler().cancelTask(id.get()); + return; + } + + Player player = players.get(_teleportedPlayers); + GameTeam team = game.GetTeam(player); + + // This could happen if the player left (and rejoined) while teleporting + // Team maps based on player as a key + if (team != null) + { + // Save where they teleported + teleportedLocations.put(player.getUniqueId(), team.SpawnTeleport(player)); + + // Update scoreboard + _scoreObj.getScore(player).setScore((int) player.getMaxHealth()); + + game.addPlayerInTime(player); + + Manager.Clear(player); + UtilInv.Clear(player); + + // Heal + player.setHealth(player.getMaxHealth()); + // Resistance and regen + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30 * 20, 128), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); + + + game.ValidateKit(player, game.GetTeam(player)); + + if (game.GetKit(player) != null) + game.GetKit(player).ApplyKit(player); + + //Event + PlayerPrepareTeleportEvent playerStateEvent = new PlayerPrepareTeleportEvent(game, player); + UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); + } + }, 4 * 20L, 4L).getTaskId()); + + //Spectators Move + for (Player player : UtilServer.getPlayers()) + { + if (Manager.GetGame().IsAlive(player)) + continue; + + Manager.addSpectator(player, true); + } + } + @EventHandler public void WorldBoundaryYLimit(BlockPlaceEvent event) { @@ -758,10 +1259,14 @@ public class UHC extends TeamGame public Location GetRandomSpawn(Location around) { + // Sometimes getting a random spawn at 0,0 hangs forever + int tries = 0; + Location loc = null; while (loc == null) { + tries++; Block block = null; // Get Team Location @@ -776,8 +1281,8 @@ public class UHC extends TeamGame // Get Radius Location else { - block = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 4 + UtilMath.r(8), around.getBlockZ() - 4 - + UtilMath.r(8), null); + block = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 4 + UtilMath.r(tries < 10 ? 8 : 30), around.getBlockZ() - 4 + + UtilMath.r(tries < 10 ? 8 : 30), null); } // Check Validity @@ -786,6 +1291,9 @@ public class UHC extends TeamGame if (block.getRelative(BlockFace.DOWN).isLiquid()) continue; + if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR) + continue; + // Suffocated if (block.getType() != Material.AIR || block.getRelative(BlockFace.UP).getType() != Material.AIR) continue; @@ -1273,8 +1781,18 @@ public class UHC extends TeamGame } Scoreboard.WriteBlank(); - Scoreboard.Write(C.cYellow + C.Bold + "Time"); - Scoreboard.Write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime())); + if (GetState() == GameState.Prepare) + { + Scoreboard.Write(C.cYellow + C.Bold + "Status"); + int players = _teleportedPlayers + 1; + if (players > _totalPlayers) players = _totalPlayers; + Scoreboard.Write("Teleporting Players (" + players + "/" + _totalPlayers + ")"); + } + else + { + Scoreboard.Write(C.cYellow + C.Bold + "Time"); + Scoreboard.Write(UtilTime.MakeStr(System.currentTimeMillis() - GetStateTime())); + } Scoreboard.WriteBlank(); Scoreboard.Write(C.cYellow + C.Bold + "Borders"); @@ -1584,8 +2102,8 @@ public class UHC extends TeamGame if (visible) break; } - - if(visible) + + if (visible) setOreType(vein); // Remove Vein @@ -1609,15 +2127,15 @@ public class UHC extends TeamGame } } } - + public void setOreType(ArrayList blocks) { - + } public boolean isMapLoaded() { - return _mapLoaded; + return _mapLoaded && areSpawnsGenerated(); } public String getMapLoadPercent() @@ -1625,6 +2143,23 @@ public class UHC extends TeamGame return (int) (_mapLoadPercent * 100) + "%"; } + public String getSpawnGenPercent() + { + return UtilMath.clamp((int) ((actual.get() * 1.0 / expected.get()) * 100), 0, 100) + "%"; + } + + public String getObjectiveName(boolean _colorTick) + { + if (!getMapLoadPercent().equals("100%")) + { + return getMapLoadPercent() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Map"; + } + else + { + return getSpawnGenPercent() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Spawns"; + } + } + public String getMapLoadETA() { int chunksToGo = _chunkTotal - _chunksLoaded; @@ -1768,4 +2303,26 @@ public class UHC extends TeamGame return null; } + + @Override + public String getHookName() + { + return "UHC Hook"; + } + + @Override + public String getHookVersion() + { + return "0.0.1"; + } + + @Override + public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo iViolationInfo) + { + if (GetState() == GameState.Prepare) + { + return false; + } + return true; + } } \ No newline at end of file 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 220745fb7..ae8e4157e 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 @@ -1048,7 +1048,7 @@ public class GameLobbyManager implements Listener { if (Manager.GetGame() instanceof UHC && !((UHC)Manager.GetGame()).isMapLoaded()) { - objective.setDisplayName(((UHC)Manager.GetGame()).getMapLoadPercent() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Map"); + objective.setDisplayName(((UHC) Manager.GetGame()).getObjectiveName(_colorTick)); } else { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index b57c40277..cc517cbf9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -741,6 +741,10 @@ public class GameManager implements Listener if (event.GetState() != GameState.Prepare) return; + // Sir, I'll handle this. + if (game instanceof UHC) + return; + final ArrayList players = game.GetPlayers(true); //Prepare Players 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 ce8c403eb..6500f6308 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 @@ -250,7 +250,7 @@ public class GameScoreboard if (i >= _chars.length) break; - String str = ChatColor.COLOR_CHAR + "" + _chars[i]; + String str = ChatColor.COLOR_CHAR + "" + _chars[i] + C.Reset; Score score = GetObjectiveSide().getScore(str); From 36bb0b9ae802b52d3dc201fb8d7cf315ad986726 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Tue, 28 Jun 2016 22:25:12 -0400 Subject: [PATCH 089/115] Force player visibility to refresh in games over a steady rate (Fixes PC-497) --- .../game/core/condition/ConditionManager.java | 12 ++++++ .../arcade/managers/GamePlayerManager.java | 42 ++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java index dbac07668..54b6e7437 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionManager.java @@ -402,6 +402,18 @@ public class ConditionManager extends MiniPlugin return false; } + + public boolean HasCondition(LivingEntity target, ConditionType type) + { + if (!_conditions.containsKey(target)) + return false; + + for (Condition cond : _conditions.get(target)) + if (type == null || cond.GetType() == type) + return true; + + return false; + } public WeakHashMap> GetActiveConditions() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index 899786190..1525077bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -1,12 +1,19 @@ package nautilus.game.arcade.managers; +import java.util.ArrayList; + import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTabTitle; +import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -16,6 +23,8 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.ProgressingKit; + +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; @@ -32,11 +41,12 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.scheduler.BukkitRunnable; -import java.util.ArrayList; - public class GamePlayerManager implements Listener { ArcadeManager Manager; + private static final long PLAYER_VISIBILITY_REFRESH_RATE = 30000; + private static final int VIEW_DISTANCE_BLOCK_VALUE = 8; + private long _lastVisibilityRefresh = 0; public GamePlayerManager(ArcadeManager manager) { @@ -44,6 +54,34 @@ public class GamePlayerManager implements Listener Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); } + + @EventHandler + public void onRefreshVisibility(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + if (UtilTime.elapsed(_lastVisibilityRefresh, PLAYER_VISIBILITY_REFRESH_RATE)) + { + _lastVisibilityRefresh = System.currentTimeMillis(); + if (Manager.GetGame() == null) + { + return; + } + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY)) + { + for (Player viewer : Bukkit.getOnlinePlayers()) + { + if (UtilMath.offset2d(viewer, player) <= (Bukkit.getViewDistance() * VIEW_DISTANCE_BLOCK_VALUE)) + { + viewer.showPlayer(player); + } + } + } + } + } + } @EventHandler(priority = EventPriority.HIGH) public void PlayerDeath(CombatDeathEvent event) From 9c4b78743661b5615143ceb881500ebeb0e2f696 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Tue, 28 Jun 2016 22:31:08 -0400 Subject: [PATCH 090/115] Make protection enchantments actually protect wearer from damage (Fixes PC-311) --- .../minecraft/game/core/damage/DamageManager.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index daba8449a..bec0ad90c 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -282,25 +282,25 @@ public class DamageManager extends MiniPlugin for (Enchantment e : enchants.keySet()) { if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL)) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); + event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); else if (e.equals(Enchantment.PROTECTION_FIRE) && event.GetCause() == DamageCause.FIRE && event.GetCause() == DamageCause.FIRE_TICK && event.GetCause() == DamageCause.LAVA) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); + event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); else if (e.equals(Enchantment.PROTECTION_FALL) && event.GetCause() == DamageCause.FALL) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); + event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) && event.GetCause() == DamageCause.ENTITY_EXPLOSION) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); + event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); else if (e.equals(Enchantment.PROTECTION_PROJECTILE) && event.GetCause() == DamageCause.PROJECTILE) - event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false); + event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); } } } From 37e50df9489c0574db7cafe964d994ed84977e2e Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Tue, 28 Jun 2016 22:41:31 -0400 Subject: [PATCH 091/115] Make kits ensure association with players using them (Fixes PC-588) --- .../src/nautilus/game/arcade/game/Game.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 531b5045f..74f0ee8af 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 @@ -917,7 +917,7 @@ public abstract class Game implements Listener if (GetKit(player) == null) return false; - return GetKit(player).equals(kit); + return GetKit(player).GetName().equals(kit.GetName()); } public boolean SetPlayerState(Player player, PlayerState state) From b0303a8870542c71415194785c688c2943b4f9a8 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Wed, 29 Jun 2016 19:42:08 -0400 Subject: [PATCH 092/115] Create new equations for Protection Enchantment functionality to make it work properly (Further fix for PC-311) --- .../game/core/damage/DamageManager.java | 141 ++++++++++++++---- .../game/games/minestrike/items/guns/Gun.java | 2 +- 2 files changed, 113 insertions(+), 30 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index bec0ad90c..f19f26b67 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -3,6 +3,9 @@ package mineplex.minecraft.game.core.damage; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.HashMap; import java.util.Map; import mineplex.core.MiniPlugin; @@ -57,6 +60,9 @@ public class DamageManager extends MiniPlugin public boolean DisableDamageChanges = false; private boolean _enabled = true; + + private final HashMap _protectionTypeModifiers = new HashMap(); + private final HashMap _protectionCauses = new HashMap(); public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager, ConditionManager conditionManager) { @@ -79,6 +85,102 @@ public class DamageManager extends MiniPlugin } registerEvents(new NpcProtectListener(npcManager)); + + _protectionTypeModifiers.put(Enchantment.PROTECTION_ENVIRONMENTAL.getName(), 1); + _protectionTypeModifiers.put(Enchantment.PROTECTION_FIRE.getName(), 2); + _protectionTypeModifiers.put(Enchantment.PROTECTION_EXPLOSIONS.getName(), 2); + _protectionTypeModifiers.put(Enchantment.PROTECTION_PROJECTILE.getName(), 2); + _protectionTypeModifiers.put(Enchantment.PROTECTION_FALL.getName(), 3); + + _protectionCauses.put(Enchantment.PROTECTION_ENVIRONMENTAL.getName(), new DamageCause[] {DamageCause.BLOCK_EXPLOSION, DamageCause.CONTACT, DamageCause.CUSTOM, DamageCause.DROWNING, DamageCause.ENTITY_ATTACK, DamageCause.ENTITY_EXPLOSION, DamageCause.FALL, DamageCause.FALLING_BLOCK, DamageCause.FIRE, DamageCause.FIRE_TICK, DamageCause.LAVA, DamageCause.LIGHTNING, DamageCause.PROJECTILE, DamageCause.SUFFOCATION, DamageCause.THORNS}); + _protectionCauses.put(Enchantment.PROTECTION_FIRE.getName(), new DamageCause[] {DamageCause.FIRE, DamageCause.FIRE_TICK, DamageCause.LAVA}); + _protectionCauses.put(Enchantment.PROTECTION_EXPLOSIONS.getName(), new DamageCause[] {DamageCause.BLOCK_EXPLOSION, DamageCause.ENTITY_EXPLOSION}); + _protectionCauses.put(Enchantment.PROTECTION_PROJECTILE.getName(), new DamageCause[] {DamageCause.PROJECTILE}); + _protectionCauses.put(Enchantment.PROTECTION_FALL.getName(), new DamageCause[] {DamageCause.FALL}); + } + + private int getHighestLevel(Enchantment ench, ItemStack[] items) + { + int level = 0; + + for (ItemStack item : items) + { + if (item == null && item.getType() == Material.AIR) + { + continue; + } + if (!item.containsEnchantment(ench)) + { + continue; + } + if (item.getEnchantmentLevel(ench) <= level) + { + continue; + } + level = item.getEnchantmentLevel(ench); + } + + return level; + } + + private int getTotalEPF(Enchantment ench, ItemStack[] items) + { + if (!_protectionTypeModifiers.containsKey(ench.getName())) + { + return 0; + } + if (!_protectionCauses.containsKey(ench.getName())) + { + return 0; + } + + int epf = 0; + + for (ItemStack item : items) + { + if (item == null || item.getType() == Material.AIR) + { + continue; + } + if (!item.containsEnchantment(ench)) + { + continue; + } + if (item.getEnchantmentLevel(ench) <= 0) + { + continue; + } + + epf += (item.getEnchantmentLevel(ench) * _protectionTypeModifiers.get(ench.getName())); + } + + return Math.min(20, epf); + } + + private double getTotalEnchantReduction(ItemStack[] armor, DamageCause cause) + { + int epf = 0; + + for (Enchantment ench : Enchantment.values()) + { + if (!_protectionTypeModifiers.containsKey(ench.getName())) + { + continue; + } + if (!_protectionCauses.containsKey(ench.getName())) + { + continue; + } + if (!Arrays.asList(_protectionCauses.get(ench.getName())).contains(cause)) + { + continue; + } + + epf += getTotalEPF(ench, armor); + } + + epf = Math.max(0, Math.min(20, epf)); + return new BigDecimal(1).subtract(new BigDecimal(epf).divide(new BigDecimal(25))).doubleValue(); } @EventHandler(priority = EventPriority.HIGHEST) @@ -273,35 +375,9 @@ public class DamageManager extends MiniPlugin Player damagee = event.GetDamageePlayer(); if (damagee != null) { - for (ItemStack stack : damagee.getInventory().getArmorContents()) + if (getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()) > 0) { - if (stack == null) - continue; - - Map enchants = stack.getEnchantments(); - for (Enchantment e : enchants.keySet()) - { - if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL)) - event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); - - else if (e.equals(Enchantment.PROTECTION_FIRE) && - event.GetCause() == DamageCause.FIRE && - event.GetCause() == DamageCause.FIRE_TICK && - event.GetCause() == DamageCause.LAVA) - event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); - - else if (e.equals(Enchantment.PROTECTION_FALL) && - event.GetCause() == DamageCause.FALL) - event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); - - else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) && - event.GetCause() == DamageCause.ENTITY_EXPLOSION) - event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); - - else if (e.equals(Enchantment.PROTECTION_PROJECTILE) && - event.GetCause() == DamageCause.PROJECTILE) - event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false); - } + event.AddMult("Ench Prot", damagee.getName(), getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()), false); } } @@ -324,8 +400,15 @@ public class DamageManager extends MiniPlugin else if (e.equals(Enchantment.FIRE_ASPECT)) if (_conditionManager != null) + { + double reduce = 0; + if (damagee != null) + { + reduce = (15 * getHighestLevel(Enchantment.PROTECTION_FIRE, damagee.getInventory().getArmorContents())) * (4 * (double)enchants.get(e)); + } _conditionManager.Factory().Ignite("Ench Fire", event.GetDamageeEntity(), damager, - 4 * (double)enchants.get(e), false, false); + (4 * (double)enchants.get(e)) - reduce, 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 cabfdcf94..102f87e3d 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 @@ -331,7 +331,7 @@ public class Gun extends StrikeItem { new BukkitRunnable() { public void run() { - PlayerStats remoteStats = game.getArcadeManager().GetStatsManager().Get(player);; + PlayerStats remoteStats = game.getArcadeManager().GetStatsManager().Get(player); _kills = (int) remoteStats.getStat(game.GetName() + "." + getStatNameKills(true)); Player owner = UtilPlayer.searchExact(getOwnerName()); From 005189c2d470e75b7a60900aa8d9f0ec6354273c Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Wed, 29 Jun 2016 19:57:13 -0400 Subject: [PATCH 093/115] Edit kit items in OITQ to fix bow instant charge glitch (Fixes PC-203) --- .../game/arcade/game/games/quiver/kits/KitEnchanter.java | 4 +++- .../game/arcade/game/games/quiver/kits/KitLeaper.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java index fcfce7584..1b38cfa92 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java @@ -4,6 +4,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; @@ -11,6 +12,7 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.perks.PerkArrowRebound; + import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -31,7 +33,7 @@ public class KitEnchanter extends ProgressingKit private static final ItemStack IN_HAND = new ItemStack(Material.BOW); private static final ItemStack[] PLAYER_ITEMS = { - ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), + new ItemBuilder(Material.STONE_SWORD).setGlow(true).build(), ItemStackFactory.Instance.CreateStack(Material.BOW) }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java index c67f789fa..f12ed6a8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java @@ -31,7 +31,7 @@ public class KitLeaper extends ProgressingKit private static final ItemStack IN_HAND = new ItemStack(Material.STONE_SWORD); private static final ItemStack[] PLAYER_ITEMS = { - ItemStackFactory.Instance.CreateStack(Material.IRON_AXE), + ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD), ItemStackFactory.Instance.CreateStack(Material.BOW) }; From c442376ccccd66c26fdd28e3cf9e3f965e8d19f5 Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 30 Jun 2016 22:04:34 -0400 Subject: [PATCH 094/115] Oops --- .../src/nautilus/game/arcade/game/games/uhc/UHC.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index c7ea13cbd..a6d564eea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -208,7 +208,7 @@ public class UHC extends TeamGame implements NCPHook this.GameTimeout = 10800000; - this.DamagePvP = true; + this.DamagePvP = false; this.DeathDropItems = true; From f6d882fcb4cf7747c3a661ee0cceacb017229d0d Mon Sep 17 00:00:00 2001 From: samczsun Date: Thu, 30 Jun 2016 19:44:36 -0400 Subject: [PATCH 095/115] Disallow placing throwing tnt --- .../src/nautilus/game/arcade/kit/perks/PerkBomber.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java index 95ca01a94..98bb50f9d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java @@ -127,6 +127,15 @@ public class PerkBomber extends Perk UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Throwing TNT") + ".")); } + @EventHandler (ignoreCancelled = true) + public void on(BlockPlaceEvent event) + { + if (!isThrowingTnt(event.getItemInHand())) + return; + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot place " + F.item("Throwing TNT") + ".")); + } + @EventHandler public void TNTDeathRemove(PlayerDeathEvent event) { @@ -139,6 +148,7 @@ public class PerkBomber extends Perk int oldAmount = _tntCount.get(event.getEntity()).get(); if (oldAmount < remove.size()) { + // fixme If you die with someone else's tnt, then this will occur System.out.println("Strange.... expected " + oldAmount + " of tnt for " + event.getEntity().getName() + " but removed " + remove.size() + " instead"); _tntCount.get(event.getEntity()).set(0); } From 5e994e37dab9a076b90562ce7ffd86b94fc839b2 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Fri, 1 Jul 2016 17:30:07 -0400 Subject: [PATCH 096/115] Fix Monster Maze jumping mechanics (Fixes PC-711 and PC-634) --- .../game/games/monstermaze/MonsterMaze.java | 37 ++++++++++++++++++- .../games/monstermaze/kits/KitJumper.java | 4 +- .../arcade/managers/GamePlayerManager.java | 2 +- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index d52c5039b..dc3538511 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -48,6 +48,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.scoreboard.Team; public class MonsterMaze extends SoloGame @@ -60,6 +62,9 @@ public class MonsterMaze extends SoloGame private Location _center; private HashMap _launched = new HashMap(); + + private static final int JUMP_POTION_AMPLIFIER = -10; + private int _potionMult = JUMP_POTION_AMPLIFIER; @SuppressWarnings("unchecked") public MonsterMaze(ArcadeManager manager) @@ -260,6 +265,36 @@ public class MonsterMaze extends SoloGame } } + @EventHandler + public void onDebug(PlayerCommandPreprocessEvent event) + { + if (!event.getPlayer().isOp()) + return; + + if (event.getMessage().toLowerCase().contains("/setmult ")) + { + event.setCancelled(true); + Integer mult = Integer.parseInt(event.getMessage().toLowerCase().replace("/setmult ", "")); + _potionMult = mult; + + for (Player pl : GetPlayers(true)) + { + Manager.GetCondition().Clean(pl); + } + } + } + + @EventHandler + public void onBreakJumper(InventoryClickEvent event) + { + if (!InProgress()) + return; + if (!IsAlive(event.getWhoClicked())) + return; + + event.setCancelled(true); + } + @EventHandler public void PotionEffects(UpdateEvent event) { @@ -276,7 +311,7 @@ public class MonsterMaze extends SoloGame else { if (!Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null)) - Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, 250, true, false, false); + Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, _potionMult, true, false, false); } // if (!Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java index 22c4d31a7..32841361a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java @@ -42,7 +42,7 @@ public class KitJumper extends ProgressingKit @Override public void GiveItems(Player player) { - player.getInventory().setItem(4, PLAYER_ITEMS[4]); - player.getInventory().setItem(8, PLAYER_ITEMS[8]); + player.getInventory().setItem(4, PLAYER_ITEMS[0]); + player.getInventory().setItem(8, PLAYER_ITEMS[1]); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index 1525077bd..cef0c62ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -69,7 +69,7 @@ public class GamePlayerManager implements Listener } for (Player player : Manager.GetGame().GetPlayers(true)) { - if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY)) + if (!Manager.GetCondition().HasCondition(player, ConditionType.INVISIBILITY) && Manager.GetGame().IsAlive(player) && !UtilPlayer.isSpectator(player)) { for (Player viewer : Bukkit.getOnlinePlayers()) { From e4c94f5421646924283fa2844de71ce9f326cd03 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Sat, 2 Jul 2016 01:20:07 -0400 Subject: [PATCH 097/115] Fix whitelist for Customer Support servers --- .../src/mineplex/core/account/CoreClientManager.java | 10 +++++++++- .../src/mineplex/staffServer/StaffServer.java | 9 +++++---- .../staffServer/customerSupport/CustomerSupport.java | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index f2c320b74..e025133f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -57,7 +57,14 @@ public class CoreClientManager extends MiniPlugin private static AtomicInteger _clientsConnecting = new AtomicInteger(0); private static AtomicInteger _clientsProcessing = new AtomicInteger(0); + private final Rank WHITELIST_BYPASS; + public CoreClientManager(JavaPlugin plugin, String webServer) + { + this(plugin, webServer, Rank.MODERATOR); + } + + public CoreClientManager(JavaPlugin plugin, String webServer, Rank whitelistBypass) { super("Client Manager", plugin); @@ -65,6 +72,7 @@ public class CoreClientManager extends MiniPlugin _repository = new AccountRepository(plugin, webServer); _clientList = new NautHashMap(); _duplicateLoginGlitchPreventionList = new HashSet(); + WHITELIST_BYPASS = whitelistBypass; } public AccountRepository getRepository() @@ -195,7 +203,7 @@ public class CoreClientManager extends MiniPlugin _clientsProcessing.decrementAndGet(); } - if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(Rank.MODERATOR)) + if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(WHITELIST_BYPASS)) { for (OfflinePlayer player : Bukkit.getWhitelistedPlayers()) { diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 5a58758c7..282933d23 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -7,6 +7,7 @@ import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; +import mineplex.core.common.Rank; import mineplex.core.creature.Creature; import mineplex.core.donation.DonationManager; import mineplex.core.elo.EloManager; @@ -48,7 +49,7 @@ public class StaffServer extends JavaPlugin //Static Modules CommandCenter.Initialize(this); - CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); + CoreClientManager clientManager = new CoreClientManager(this, webServerAddress, Rank.DEVELOPER); CommandCenter.Instance.setClientManager(clientManager); Recharge.Initialize(this); @@ -83,15 +84,15 @@ public class StaffServer extends JavaPlugin ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("57791647-93b1-4980-8835-7fddadd20eb8"), "xTheOnlyOreOx")); + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("231fb752-9556-489b-8428-f47c7598e061"), "Nuclear_Poptart")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s")); - ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); - ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); + ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("6edf17d5-6bb2-4ed9-92e9-bed8e96fff68"), "BlueBeetleHD")); new ProfileCacheManager(this); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 1842ee5e4..c4069fb94 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -57,9 +57,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable @EventHandler public void Join(PlayerJoinEvent event) { - if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR)) + if (!_clientManager.Get(event.getPlayer()).GetRank().has(Rank.SUPPORT)) { - event.getPlayer().kickPlayer("Only for staff."); + event.getPlayer().kickPlayer("Only for support staff."); return; } From 2b74ec00b4641949496cdd8db9a8765e9a3ebe92 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Sat, 2 Jul 2016 01:43:15 -0400 Subject: [PATCH 098/115] Change display menu for CUST-1 server to reflect recent updates --- .../staffServer/customerSupport/CustomerSupport.java | 4 ++-- .../staffServer/salespackage/SalesPackageManager.java | 4 ++-- .../staffServer/salespackage/command/CoinCommand.java | 6 +++--- .../staffServer/salespackage/salespackages/Coins.java | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index c4069fb94..c91f53c0e 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -119,7 +119,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cDGreen + C.Strike + "============================================="); caller.sendMessage(C.cBlue + "Name: " + C.cYellow + playerName); caller.sendMessage(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name))); - caller.sendMessage(C.cBlue + "Coins: " + C.cYellow + donor.getCoins()); + caller.sendMessage(C.cBlue + "Shards: " + C.cYellow + donor.getCoins()); caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.GetGems()); int enjinCoinsReceived = 0; @@ -234,7 +234,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } // Strutt20 asked me to remove some stuff from the menu - caller.sendMessage(C.cBlue + "Enjin Coin Total Received: " + C.cYellow + enjinCoinsReceived); + caller.sendMessage(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived); caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived); caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived); caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 65f25a186..67dea4d96 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -94,7 +94,7 @@ public class SalesPackageManager extends MiniPlugin public void displaySalesPackages(Player caller, String playerName) { - JsonMessage coinBuilder = new JsonMessage("Coins : ").color("blue"); + JsonMessage coinBuilder = new JsonMessage("Shards : ").color("blue"); JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue"); JsonMessage chestBuilder = new JsonMessage("Chest Packages : ").color("blue"); @@ -104,7 +104,7 @@ public class SalesPackageManager extends MiniPlugin { coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } - else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest) + else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest) { chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java index 02dd85695..3ced1fbc3 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/CoinCommand.java @@ -17,7 +17,7 @@ public class CoinCommand extends CommandBase { public CoinCommand(SalesPackageManager plugin) { - super(plugin, Rank.MODERATOR, "coin"); + super(plugin, Rank.MODERATOR, "coin", "shard", "shards"); } @Override @@ -43,11 +43,11 @@ public class CoinCommand extends CommandBase { if (completed) { - caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " coins to " + playerName + "'s account!")); + caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " shards to " + playerName + "'s account!")); } else { - UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Coins") + " to " + F.name(playerName) + ".")); + UtilPlayer.message(caller, F.main(Plugin.getName(), "There was an error giving " + F.elem(amount + "Shards") + " to " + F.name(playerName) + ".")); } } }, caller.getName(), playerName, client.getAccountId(), amount); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Coins.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Coins.java index 1091a16fd..51c79115d 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Coins.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/Coins.java @@ -10,13 +10,13 @@ public class Coins extends SalesPackageBase public Coins(SalesPackageManager manager, int amount) { - super(manager, amount + " Coins"); + super(manager, amount + " Shards"); _amount = amount; } public void displayToAgent(Player agent, String playerName) { - addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Coins."); + addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Shards."); agent.sendMessage(" "); addBackButton(agent, playerName); } From 8d8824446ddf3a68e76b49f298e48409eeb89de4 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 2 Jul 2016 12:12:15 +0100 Subject: [PATCH 099/115] PC-519 Fixes an issue where grenades would not do damage after you die. --- .../minestrike/items/grenades/HighExplosive.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java index 0587fef2b..c46e246d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/HighExplosive.java @@ -49,14 +49,16 @@ public class HighExplosive extends Grenade for (Player player : players.keySet()) { if (!game.IsAlive(player)) - { - Bukkit.broadcastMessage("They are dead"); - } - - Bukkit.broadcastMessage("Dealing damage"); + continue; // Damage Event - game.Manager.GetDamage().NewDamageEvent(player, _thrower, null, ent.getLocation(), + Player damager = null; + if (game.IsAlive(_thrower)) + { + damager = _thrower; + } + + game.Manager.GetDamage().NewDamageEvent(player, damager, null, ent.getLocation(), DamageCause.CUSTOM, 1 + (players.get(player) * 18), true, true, false, _thrower.getName(), getName()); From 26361eaee00cce5d2589a3e4bc4668aa997e699e Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 2 Jul 2016 13:38:22 +0100 Subject: [PATCH 100/115] PC-508 Fixes certain abilities in Team SSM that could be used to damage/knockback other team members --- .../game/arcade/kit/perks/PerkBoneRush.java | 13 ++++++++++ .../game/arcade/kit/perks/PerkInferno.java | 17 +++++++++++- .../arcade/kit/perks/PerkNightLivingDead.java | 23 +++++++--------- .../arcade/kit/perks/PerkWitherImage.java | 26 ++++++++++--------- 4 files changed, 53 insertions(+), 26 deletions(-) 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 4a5790f73..bdef9e25b 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 @@ -30,6 +30,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; public class PerkBoneRush extends SmashPerk implements IThrown @@ -151,6 +152,18 @@ public class PerkBoneRush extends SmashPerk implements IThrown double damage = 0.7; String reason = GetName(); + if (Manager.GetGame() instanceof TeamSuperSmash && target instanceof Player && data.getThrower() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) target; + Player throwerPlayer = (Player) data.getThrower(); + + if(smash.GetTeam(targetPlayer).equals(smash.GetTeam(throwerPlayer))) + { + return; + } + } + if (isSuperActive(damager)) { damage = 3; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java index ecf9b4bff..682c86fcd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Item; @@ -20,7 +21,8 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.kit.Perk; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.kit.SmashPerk; public class PerkInferno extends SmashPerk @@ -119,4 +121,17 @@ public class PerkInferno extends SmashPerk } } + @EventHandler + public void onCustomDamage(CustomDamageEvent event) + { + if (Manager.GetGame() instanceof TeamSuperSmash) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + if (smash.GetTeam(event.GetDamagerPlayer(false)).equals(smash.GetTeam(event.GetDamageePlayer()))) + { + event.GetDamageeEntity().setFireTicks(0); + event.SetCancelled("Team Damage"); + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java index c2373d488..9f0bcc8c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNightLivingDead.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.kit.perks; -import java.lang.annotation.Target; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -14,8 +13,6 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import mineplex.core.common.util.UtilAlg; @@ -128,18 +125,18 @@ public class PerkNightLivingDead extends SmashPerk { if (data.Zombies.contains(event.getEntity())) { + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if (smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer))) + { + event.setCancelled(true); + } + } if (data.Player.equals(event.getTarget())) { - if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) - { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - Player targetPlayer = (Player) event.getTarget(); - - if (!smash.GetTeam(data.Player).equals(smash.GetTeam(targetPlayer))) - { - return; - } - } event.setCancelled(true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java index a4422bc8e..28011f7ff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherImage.java @@ -128,21 +128,23 @@ public class PerkWitherImage extends SmashPerk @EventHandler public void entityTarget(EntityTargetEvent event) { - if (_ownerToSkeleton.containsKey(event.getTarget()) && _skeletonToOwner.containsKey(event.getEntity())) + if (_skeletonToOwner.containsKey(event.getEntity())) + { + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if(smash.GetTeam(_skeletonToOwner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) + { + event.setCancelled(true); + } + } if (_ownerToSkeleton.get(event.getTarget()).equals(event.getEntity())) { - if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) - { - TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - Player targetPlayer = (Player) event.getTarget(); - - if(!smash.GetTeam(_skeletonToOwner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) - { - return; - } - } - event.setCancelled(true); + event.setCancelled(true); } + } } @EventHandler From 7a6335a0213a403d97f9f527edf1d97d80540401 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 2 Jul 2016 13:32:35 -0300 Subject: [PATCH 101/115] Fixes for win rooms? Or not yet?! --- .../core/common/util/banner/CountryFlag.java | 72 +++++++++---------- .../core/cosmetic/ui/page/GadgetPage.java | 4 +- .../gadgets/wineffect/WinEffectLavaTrap.java | 2 +- .../core/gadget/types/WinEffectGadget.java | 32 ++++++--- .../mineplex/core/reward/RewardManager.java | 2 +- 5 files changed, 61 insertions(+), 51 deletions(-) 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 index af4dfec31..d4e48144f 100644 --- 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 @@ -8,51 +8,51 @@ 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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)); + POLAND(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.HALF_VERTICAL_MIRROR)); private DyeColor _baseColor; private Pattern[] _patterns; 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 ed351310b..b56d4cf8e 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 @@ -293,7 +293,7 @@ public class GadgetPage extends ShopPageBase { if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) { - gadgetItemStack = CountryFlag.Usa.getBanner(); + gadgetItemStack = CountryFlag.USA.getBanner(); BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta(); bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); bannerMeta.setLore(meta.getLore()); @@ -316,7 +316,7 @@ public class GadgetPage extends ShopPageBase { if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8) { - gadgetItemStack = CountryFlag.Usa.getBanner(); + gadgetItemStack = CountryFlag.USA.getBanner(); BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta(); bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName()); bannerMeta.setLore(meta.getLore()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java index 93262ead7..0f05294b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java @@ -146,7 +146,7 @@ public class WinEffectLavaTrap extends WinEffectGadget Location loc = getBaseLocation().add(UtilAlg.getRight(dir).multiply(5)).add(0, 2, 0).subtract(dir); loc.setDirection(getBaseLocation().subtract(loc).toVector()); - teleport(loc); + super.teleport(loc); } } 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 059e4ec12..f925bfd23 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -2,9 +2,7 @@ package mineplex.core.gadget.types; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; +import java.util.*; import mineplex.core.common.util.*; import org.bukkit.*; @@ -53,6 +51,8 @@ public abstract class WinEffectGadget extends Gadget protected List _other; /** All locked players */ protected List _locked; + /** Player armor stands */ + private Map _armorStands = new HashMap<>(); /** * @param manager The normal GadgetManager @@ -95,11 +95,16 @@ public abstract class WinEffectGadget extends Gadget * Lock the player. Disabling any jump or walk movement * @param p The player to lock in place */ - public void lockPlayer(Player p) + public void lockPlayer(Player p, Location standLoc) { _locked.add(p); - p.setWalkSpeed(0); - p.setFlySpeed(0); + //p.setWalkSpeed(0); + //p.setFlySpeed(0); + ArmorStand armorStand = standLoc.getWorld().spawn(standLoc, ArmorStand.class); + armorStand.setVisible(false); + armorStand.setGravity(false); + armorStand.setPassenger(p); + _armorStands.put(p, armorStand); } /** @@ -110,8 +115,13 @@ public abstract class WinEffectGadget extends Gadget { if (_locked.contains(p)) _locked.remove(p); - p.setWalkSpeed(0.2f); - p.setFlySpeed(0.1f); + //p.setWalkSpeed(0.2f); + //p.setFlySpeed(0.1f); + ArmorStand armorStand = _armorStands.get(p); + if (armorStand != null) + { + armorStand.remove(); + } } @EventHandler @@ -245,20 +255,20 @@ public abstract class WinEffectGadget extends Gadget */ public void teleport(Location loc) { - loc.getBlock().setType(Material.AIR); + /*loc.getBlock().setType(Material.AIR); loc.getBlock().getRelative(BlockFace.UP).setType(Material.AIR); loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.BARRIER); loc.getBlock().getRelative(BlockFace.EAST).getRelative(BlockFace.UP).setType(Material.BARRIER); loc.getBlock().getRelative(BlockFace.WEST).getRelative(BlockFace.UP).setType(Material.BARRIER); loc.getBlock().getRelative(BlockFace.NORTH).getRelative(BlockFace.UP).setType(Material.BARRIER); loc.getBlock().getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.clone().add(0, 2, 0).getBlock().setType(Material.BARRIER); + loc.clone().add(0, 2, 0).getBlock().setType(Material.BARRIER);*/ BukkitRunnable bRunnable = new BukkitRunnable() { @Override public void run() { for(Player p : UtilServer.getPlayers()) { - lockPlayer(p); + lockPlayer(p, loc.clone().subtract(0, 1, 0)); UtilPlayer.hideFromAll(p); p.setGameMode(GameMode.ADVENTURE); p.getInventory().clear(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index a73557680..508a59d2c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -864,7 +864,7 @@ public class RewardManager { if (!displayName.contains("Uncle Sam")) { - display = CountryFlag.Usa.getBanner(); + display = CountryFlag.USA.getBanner(); } } UnknownPackageReward reward = From bdc049efe1f44ad33f4663512025d0899a6ddf2d Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 3 Jul 2016 15:58:19 +0100 Subject: [PATCH 102/115] PC-508 Fixed an NPE with Inferno --- .../src/nautilus/game/arcade/kit/perks/PerkInferno.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java index 682c86fcd..afba15ebd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInferno.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Item; @@ -127,7 +126,13 @@ public class PerkInferno extends SmashPerk if (Manager.GetGame() instanceof TeamSuperSmash) { TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); - if (smash.GetTeam(event.GetDamagerPlayer(false)).equals(smash.GetTeam(event.GetDamageePlayer()))) + + if (event.GetDamagerPlayer(true) == null) + { + return; + } + + if (smash.GetTeam(event.GetDamagerPlayer(true)).equals(smash.GetTeam(event.GetDamageePlayer()))) { event.GetDamageeEntity().setFireTicks(0); event.SetCancelled("Team Damage"); From e96f7f121763d9137c55f3addb287e466571fb42 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 3 Jul 2016 15:58:54 +0100 Subject: [PATCH 103/115] PC-508 Fixes a hit box issue with Rocket Slimes --- .../arcade/kit/perks/PerkSlimeRocket.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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 b296469af..0bf4780f1 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 @@ -209,6 +209,17 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown if (!_owner.containsKey(event.getEntity())) return; + if (Manager.GetGame() instanceof TeamSuperSmash && event.getTarget() instanceof Player) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + Player targetPlayer = (Player) event.getTarget(); + + if (smash.GetTeam(_owner.get(event.getEntity())).equals(smash.GetTeam(targetPlayer))) + { + event.setCancelled(true); + } + } + if (_owner.get(event.getEntity()).equals(event.getTarget())) { event.setCancelled(true); @@ -288,6 +299,16 @@ public class PerkSlimeRocket extends SmashPerk implements IThrown //if (owner != null) // event.SetDamager(owner); This gives knockback from wrong direction :( + if (Manager.GetGame() instanceof TeamSuperSmash) + { + TeamSuperSmash smash = (TeamSuperSmash) Manager.GetGame(); + + if (smash.GetTeam(owner).equals(smash.GetTeam(event.GetDamageePlayer()))) + { + event.SetCancelled("Team Damage"); + return; + } + } if (owner != null && owner.equals(event.GetDamageeEntity())) { From 5644589b10e03a103db805b106a31d55667dfa6b Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 3 Jul 2016 20:57:58 +0100 Subject: [PATCH 104/115] PC-541 Covers all possible eventualities of redstone ore and glowing redstone ore --- .../arcade/game/games/speedbuilders/data/RecreationData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index f8d04201e..2bf2488c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -325,7 +325,7 @@ public class RecreationData } //Fix for glowing redstone ore - if (expectedState.getType() == Material.REDSTONE_ORE && currentBlock.getType() == Material.GLOWING_REDSTONE_ORE) + if ((expectedState.getType() == Material.REDSTONE_ORE && currentBlock.getType() == Material.GLOWING_REDSTONE_ORE) || (expectedState.getType() == Material.GLOWING_REDSTONE_ORE && currentBlock.getType() == Material.REDSTONE_ORE)) { score++; } From 295711d626c705ecb08b2ee1cb29c007d6fe4b50 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 4 Jul 2016 20:31:59 +0100 Subject: [PATCH 105/115] PC-632 Fixes an issue where going under the map in Wither Assault would cause you to have negative speed and not be able to move --- .../nautilus/game/arcade/game/games/wither/WitherGame.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index d85536b2a..20e743fc8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -633,7 +633,12 @@ public class WitherGame extends TeamGame implements IBlockRestorer { speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006; } - + + if (speed < 0.01) //This is to stop players having negative speed when they go under the map + { + speed = 0.01; + } + player.setFlySpeed((float) Math.min(1, speed)); // Bump From 0eab6db1166759ef824b5b58ed8f939d57f1baa1 Mon Sep 17 00:00:00 2001 From: Thanos Paravantis Date: Sat, 2 Jul 2016 00:06:00 +0300 Subject: [PATCH 106/115] Soccer bug fixes and minor improvements - Slimeball will no longer be able to get stacked. - Players in soccer mode will not able to stack others. - Guardian lazer can no longer be used in the soccer field. - Players in soccer won't get knockback, except if they double jump. --- .../event/GadgetSelectLocationEvent.java | 84 +++++++++++++++++ .../core/gadget/gadgets/morph/MorphTitan.java | 16 ++++ .../src/mineplex/hub/HubManager.java | 8 +- .../src/mineplex/hub/modules/JumpManager.java | 20 ++++- .../mineplex/hub/modules/SoccerManager.java | 90 +++++++++++++------ 5 files changed, 186 insertions(+), 32 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetSelectLocationEvent.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetSelectLocationEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetSelectLocationEvent.java new file mode 100644 index 000000000..fefbff7eb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetSelectLocationEvent.java @@ -0,0 +1,84 @@ +package mineplex.core.gadget.event; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.gadget.types.Gadget; + +/** + * This event is called when a gadget selects a location for a specific effect to be shown. + */ +public class GadgetSelectLocationEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private Gadget _gadget; + private Location _location; + private boolean _showMessage = true; + private boolean _cancelled = false; + + public GadgetSelectLocationEvent(Player player, Gadget gadget, Location location) + { + _player = player; + _gadget = gadget; + _location = location; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Gadget getGadget() + { + return _gadget; + } + + public Player getPlayer() + { + return _player; + } + + public Location getLocation() + { + return _location; + } + + public void setCancelled(boolean cancel) + { + _cancelled = cancel; + } + + public boolean isCancelled() + { + return _cancelled; + } + + /** + * Whether or not a cancellation message should be displayed. + * + * @param showMessage True for the message to be shown and false for the message to be hidden/ignored. + */ + public void setShowMessage(boolean showMessage) + { + _showMessage = showMessage; + } + + /** + * Returns whether or not a cancellation message can be shown. + * + * @return True if the message can be shown and false if the message should be hidden/ignored. + */ + public boolean canShowMessage() + { + return _showMessage; + } +} 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 558335c68..9881ffa93 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 @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -17,6 +18,7 @@ import org.bukkit.util.Vector; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; @@ -32,6 +34,7 @@ import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.recharge.Recharge; import mineplex.core.recharge.RechargedEvent; @@ -105,6 +108,19 @@ public class MorphTitan extends MorphGadget Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc); + Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent); + + if (gadgetSelectLocationEvent.isCancelled()) + { + if (gadgetSelectLocationEvent.canShowMessage()) + { + UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!")); + } + + return; + } + ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class); stand.setVisible(false); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index f53d023f4..30d650252 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -135,6 +135,7 @@ public class HubManager extends MiniClientPlugin private IncognitoManager _incognito; private ValentinesManager _valentinesManager; private BonusManager _bonusManager; + private JumpManager _jumpManager; // private HalloweenSpookinessManager _halloweenManager; // private TrickOrTreatManager _trickOrTreatManager; @@ -181,7 +182,7 @@ public class HubManager extends MiniClientPlugin _parkour = new ParkourManager(this, donationManager, taskManager); new WorldManager(this); - new JumpManager(this); + _jumpManager = new JumpManager(this); //new TournamentInviter(this); @@ -1072,4 +1073,9 @@ public class HubManager extends MiniClientPlugin { return _incognito; } + + public JumpManager getJumpManager() + { + return _jumpManager; + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java index e0367bdba..afa61a5a1 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java @@ -1,11 +1,13 @@ package mineplex.hub.modules; -import org.bukkit.Bukkit; +import java.util.HashSet; + import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.util.Vector; @@ -28,6 +30,7 @@ import mineplex.hub.HubManager; public class JumpManager extends MiniPlugin { public HubManager Manager; + private HashSet _preparedDoubleJump = new HashSet<>(); public JumpManager(HubManager manager) { @@ -66,8 +69,9 @@ public class JumpManager extends MiniPlugin vec.setY(Math.abs(vec.getY())); //Velocity + _preparedDoubleJump.add(player.getName()); UtilAction.velocity(player, vec, 1.4, false, 0, 0.2, 1, true); - + //Sound player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); @@ -105,8 +109,20 @@ public class JumpManager extends MiniPlugin { player.setAllowFlight(true); player.setFlying(false); + _preparedDoubleJump.remove(player.getName()); } } } } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) + { + _preparedDoubleJump.remove(event.getPlayer().getName()); + } + + public boolean hasDoubleJumped(Player player) + { + return _preparedDoubleJump.contains(player.getName()); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index 04fb771b8..bf5260b1c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -3,9 +3,9 @@ package mineplex.hub.modules; import java.util.ArrayList; import java.util.HashSet; +import org.bukkit.Color; import org.bukkit.EntityEffect; import org.bukkit.FireworkEffect.Type; -import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Bat; @@ -20,9 +20,10 @@ 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 org.bukkit.util.Vector; -import mineplex.core.MiniPlugin; +import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -37,8 +38,10 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.event.StackerEvent; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -50,8 +53,8 @@ import mineplex.hub.HubManager; public class SoccerManager extends MiniPlugin { - public HubManager Manager; - + private HubManager _hubManager; + private HashSet _active = new HashSet(); private ArrayList _teamArmor = new ArrayList(); @@ -71,10 +74,10 @@ public class SoccerManager extends MiniPlugin private Location _cornerBlueGoalA; private Location _cornerBlueGoalB; - int _blueGoals = 0; - int _redGoals = 0; + private int _blueGoals = 0; + private int _redGoals = 0; - int _insideGoalTicks = 0; + private int _insideGoalTicks = 0; private Slime _ball; private Vector _ballVel; @@ -89,29 +92,29 @@ public class SoccerManager extends MiniPlugin protected Location _lastLoc; protected ArrayList _velHistory = new ArrayList(); - public SoccerManager(HubManager manager, GadgetManager gadgets) + public SoccerManager(HubManager hubManager, GadgetManager gadgetManager) { - super("Football Manager", manager.getPlugin()); + super("Football Manager", hubManager.getPlugin()); - Manager = manager; + _hubManager = hubManager; + + _cornerFieldPlayerA = new Location(hubManager.GetSpawn().getWorld(), 28.5,70,-27.5); + _cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 50.5,100,-65.5); - _cornerFieldPlayerA = new Location(Manager.GetSpawn().getWorld(), 28.5,70,-27.5); - _cornerFieldPlayerB = new Location(Manager.GetSpawn().getWorld(), 50.5,100,-65.5); + _cornerGoalPlayerA = new Location(hubManager.GetSpawn().getWorld(), 35.5,70,-24.5); + _cornerGoalPlayerB = new Location(hubManager.GetSpawn().getWorld(), 43.5,100,-68.5); - _cornerGoalPlayerA = new Location(Manager.GetSpawn().getWorld(), 35.5,70,-24.5); - _cornerGoalPlayerB = new Location(Manager.GetSpawn().getWorld(), 43.5,100,-68.5); + _cornerFieldA = new Location(hubManager.GetSpawn().getWorld(), 29.75,70,-28.75); + _cornerFieldB = new Location(hubManager.GetSpawn().getWorld(), 49.25,100,-64.25); - _cornerFieldA = new Location(Manager.GetSpawn().getWorld(), 29.75,70,-28.75); - _cornerFieldB = new Location(Manager.GetSpawn().getWorld(), 49.25,100,-64.25); + _cornerRedGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-64.25); + _cornerRedGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-67.25); - _cornerRedGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-64.25); - _cornerRedGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-67.25); - - _cornerBlueGoalA = new Location(Manager.GetSpawn().getWorld(), 36.75,70,-25.75); - _cornerBlueGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-28.75); + _cornerBlueGoalA = new Location(hubManager.GetSpawn().getWorld(), 36.75,70,-25.75); + _cornerBlueGoalB = new Location(hubManager.GetSpawn().getWorld(), 42.25,73.5,-28.75); //Store Gadgets - for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME)) + for (Gadget gadget : gadgetManager.getGadgets(GadgetType.COSTUME)) { if (gadget instanceof OutfitTeam) { @@ -352,7 +355,7 @@ public class SoccerManager extends MiniPlugin return UtilAlg.inBoundingBox(entity.getLocation(), _cornerFieldPlayerA, _cornerFieldPlayerB) || UtilAlg.inBoundingBox(entity.getLocation(), _cornerGoalPlayerA, _cornerGoalPlayerB); } - + @EventHandler public void clean(UpdateEvent event) { @@ -470,9 +473,9 @@ public class SoccerManager extends MiniPlugin outfit.add("Team Pants"); outfit.add("Team Boots"); - Manager.GetGadget().disableAll(player, outfit); - Manager.GetMount().DisableAll(player); - Manager.getPetManager().DisableAll(player); + _hubManager.GetGadget().disableAll(player, outfit); + _hubManager.GetMount().DisableAll(player); + _hubManager.getPetManager().DisableAll(player); } else { @@ -481,11 +484,11 @@ public class SoccerManager extends MiniPlugin } } - public boolean isSoccerMode(Player player) + public boolean isSoccerMode(Entity entity) { - return _active.contains(player); + return _active.contains(entity); } - + @EventHandler public void disableGadgets(GadgetEnableEvent event) { @@ -510,6 +513,35 @@ public class SoccerManager extends MiniPlugin event.setCancelled(true); } + @EventHandler + public void disableStacker(StackerEvent event) + { + if (isSoccerMode(event.getEntity())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void disableGuardianLazer(GadgetSelectLocationEvent event) + { + if (UtilAlg.inBoundingBox(event.getLocation(), _cornerFieldA, _cornerFieldB)) + { + event.setCancelled(true); + } + } + + @EventHandler + public void disableVelocity(PlayerVelocityEvent event) + { + // Disable velocity but allow double jumping. + + if (isSoccerMode(event.getPlayer()) && !_hubManager.getJumpManager().hasDoubleJumped(event.getPlayer())) + { + event.setCancelled(true); + } + } + @EventHandler public void playerQuit(PlayerQuitEvent event) { From 67adb343113056531217216411ad278559efe84c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 6 Jul 2016 00:00:50 -0300 Subject: [PATCH 107/115] Fixes for the WinRooms Removed Freedom Chests from the menu --- .../mineplex/core/cosmetic/ui/page/Menu.java | 2 +- .../mineplex/core/gadget/GadgetManager.java | 6 +- .../core/gadget/types/WinEffectGadget.java | 196 +++++++++++------- .../core/treasure/gui/BuyChestButton.java | 13 ++ .../core/treasure/gui/TreasurePage.java | 14 +- .../arcade/wineffect/WinEffectManager.java | 13 +- 6 files changed, 161 insertions(+), 83 deletions(-) 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 c5d8df866..51ed4dd84 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 @@ -100,7 +100,7 @@ public class Menu extends ShopPageBase Mount mountActive = getPlugin().getMountManager().getActive(getPlayer()); for (Mount mount : getPlugin().getMountManager().getMounts()) { - if (mount.hasMount(getPlayer())) + if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName())) { mountOwned++; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index d143a6fb2..088f2fc21 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -661,10 +661,14 @@ public class GadgetManager extends MiniPlugin } } - public void disableAll(Player player, boolean callEvent) + public void disableAll(Player player, boolean winRooms) { for (GadgetType gadgetType : _gadgets.keySet()) { + if (gadgetType == GadgetType.WIN_EFFECT && winRooms) + { + continue; + } for (Gadget gadget : _gadgets.get(gadgetType)) { gadget.disable(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 f925bfd23..76b052693 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -5,6 +5,8 @@ import java.io.IOException; import java.util.*; import mineplex.core.common.util.*; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.*; import org.bukkit.Color; import org.bukkit.block.BlockFace; @@ -12,7 +14,10 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -24,6 +29,7 @@ import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; +import org.spigotmc.event.entity.EntityDismountEvent; /** * A wrapper for different win effects @@ -49,10 +55,8 @@ public abstract class WinEffectGadget extends Gadget protected List _nonTeam; /** All players on the team that didn't win + spectators which were not in the game at all. */ protected List _other; - /** All locked players */ - protected List _locked; - /** Player armor stands */ - private Map _armorStands = new HashMap<>(); + /** All the players that were teleported to the winroom */ + protected List _allPlayers; /** * @param manager The normal GadgetManager @@ -90,65 +94,10 @@ public abstract class WinEffectGadget extends Gadget this._finish = _start + 1000*12; play(); } - - /** - * Lock the player. Disabling any jump or walk movement - * @param p The player to lock in place - */ - public void lockPlayer(Player p, Location standLoc) - { - _locked.add(p); - //p.setWalkSpeed(0); - //p.setFlySpeed(0); - ArmorStand armorStand = standLoc.getWorld().spawn(standLoc, ArmorStand.class); - armorStand.setVisible(false); - armorStand.setGravity(false); - armorStand.setPassenger(p); - _armorStands.put(p, armorStand); - } - - /** - * Unlock the player, allowing the player to walk and jump as normal again. - * @param p The player to unlock - */ - public void unlockPlayer(Player p) - { - if (_locked.contains(p)) - _locked.remove(p); - //p.setWalkSpeed(0.2f); - //p.setFlySpeed(0.1f); - ArmorStand armorStand = _armorStands.get(p); - if (armorStand != null) - { - armorStand.remove(); - } - } - - @EventHandler - public void onMove(PlayerMoveEvent event) - { - for(PotionEffect p : event.getPlayer().getActivePotionEffects()) - { - if(p.getType().equals(PotionEffectType.JUMP)) - { - if(p.getAmplifier() == 250) - { - if(event.getTo().clone().subtract(event.getFrom()).lengthSquared() > 0) - { - Location loc = event.getPlayer().getLocation().getBlock().getLocation().add(0.5, 0, 0.5); - loc.setDirection(event.getTo().getDirection()); - event.setTo(loc); - } - return; - } - } - } - } - + public void runFinish() { finish(); - UtilServer.getPlayersCollection().forEach(p -> {unlockPlayer(p); UtilPlayer.showForAll(p); }); _player = null; _baseLocation = null; _team.clear(); @@ -157,8 +106,8 @@ public abstract class WinEffectGadget extends Gadget _nonTeam = null; _other.clear(); _other = null; - _locked.clear(); - _locked = null; + _allPlayers.clear(); + _allPlayers = null; // Loads gadgets back when players are teleported to the arcade hub, after the win effect for (Player player : UtilServer.getPlayers()) { @@ -231,7 +180,8 @@ public abstract class WinEffectGadget extends Gadget _other.remove(player); _other.removeAll(team); - _locked = new ArrayList<>(); + _allPlayers = new ArrayList<>(); + _allPlayers.addAll(UtilServer.getPlayersCollection()); this._start = System.currentTimeMillis(); this._baseLocation = loc.clone(); @@ -255,31 +205,64 @@ public abstract class WinEffectGadget extends Gadget */ public void teleport(Location loc) { - /*loc.getBlock().setType(Material.AIR); - loc.getBlock().getRelative(BlockFace.UP).setType(Material.AIR); - loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.BARRIER); - loc.getBlock().getRelative(BlockFace.EAST).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.getBlock().getRelative(BlockFace.WEST).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.getBlock().getRelative(BlockFace.NORTH).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.getBlock().getRelative(BlockFace.SOUTH).getRelative(BlockFace.UP).setType(Material.BARRIER); - loc.clone().add(0, 2, 0).getBlock().setType(Material.BARRIER);*/ + createBarriers(loc); BukkitRunnable bRunnable = new BukkitRunnable() { @Override public void run() { for(Player p : UtilServer.getPlayers()) { - lockPlayer(p, loc.clone().subtract(0, 1, 0)); UtilPlayer.hideFromAll(p); + p.teleport(loc); p.setGameMode(GameMode.ADVENTURE); + p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 10 * 20, 1, false, false)); p.getInventory().clear(); p.setAllowFlight(false); - Manager.disableAll(p, false); + p.setHealth(p.getMaxHealth()); + p.setFoodLevel(20); + Manager.disableAll(p, true); } } }; bRunnable.runTaskLater(UtilServer.getPlugin(), 10l); } - + + /** + * Updates players inventory + * @param event + */ + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!isRunning()) + return; + + for (Player player : _allPlayers) + { + player.getInventory().clear(); + } + } + + @EventHandler + public void onFoodLevelChange(FoodLevelChangeEvent event) + { + if (isRunning()) + { + event.setCancelled(true); + } + } + + @EventHandler + public void onPlayerDamage(EntityDamageEvent event) + { + if (isRunning()) + { + event.setCancelled(true); + } + } + /** * Build the win room, by default this will paste the scheamtic. Do any major setup here. This is called before the players are * teleported. @@ -366,4 +349,69 @@ public abstract class WinEffectGadget extends Gadget } } + private void createBarriers(Location baseLocation) + { + // FLOOR + Location floorBase = baseLocation.clone().subtract(0, 1, 0); + setBarrierBlock(floorBase); + setBarrierBlock(floorBase.clone().add(1, 0, 0)); + setBarrierBlock(floorBase.clone().add(0, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 0)); + setBarrierBlock(floorBase.clone().subtract(0, 0, 1)); + setBarrierBlock(floorBase.clone().add(1, 0, 1)); + setBarrierBlock(floorBase.clone().add(1, 0, -1)); + setBarrierBlock(floorBase.clone().add(-1, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 1)); + + // WALLS + floorBase.add(0, 2, 0); + setBarrierBlock(floorBase.clone().add(2, 0, 0)); + setBarrierBlock(floorBase.clone().add(2, 0, 1)); + setBarrierBlock(floorBase.clone().add(2, 0, -1)); + + setBarrierBlock(floorBase.clone().subtract(2, 0, 0)); + setBarrierBlock(floorBase.clone().subtract(2, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(2, 0, -1)); + + setBarrierBlock(floorBase.clone().add(0, 0, 2)); + setBarrierBlock(floorBase.clone().add(1, 0, 2)); + setBarrierBlock(floorBase.clone().add(-1, 0, 2)); + + setBarrierBlock(floorBase.clone().subtract(0, 0, 2)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 2)); + setBarrierBlock(floorBase.clone().subtract(-1, 0, 2)); + + // CEILING + floorBase.add(0, 2, 0); + setBarrierBlock(floorBase); + setBarrierBlock(floorBase.clone().add(1, 0, 0)); + setBarrierBlock(floorBase.clone().add(0, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 0)); + setBarrierBlock(floorBase.clone().subtract(0, 0, 1)); + setBarrierBlock(floorBase.clone().add(1, 0, 1)); + setBarrierBlock(floorBase.clone().add(1, 0, -1)); + setBarrierBlock(floorBase.clone().add(-1, 0, 1)); + setBarrierBlock(floorBase.clone().subtract(1, 0, 1)); + + // CHANGES MIDDLE TO AIR + floorBase.subtract(1, 3, 1); + for (int x = 0; x < 3; x++) + { + for (int y = 0; y < 3; y++) + { + for (int z = 0; z < 3; z++) + { + floorBase.clone().add(x, y, z).getBlock().setType(Material.AIR); + } + } + } + + } + + private void setBarrierBlock(Location blockLocation) + { + if (blockLocation.getBlock().getType() == Material.AIR) + blockLocation.getBlock().setType(Material.BARRIER); + } + } 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 21bc6b37e..f62bd83cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -40,6 +40,19 @@ public class BuyChestButton implements IButton @Override public void onClick(final Player player, ClickType clickType) { + if (_chestType == TreasureType.FREEDOM) + { + if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) + { + player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); + return; + } + else + { + player.sendMessage(F.main("Treasure", "This chest is no longer available for purchases!")); + return; + } + } if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player) && _chestType == TreasureType.ILLUMINATED) { 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 3b91b09f4..c05c9a774 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -13,6 +13,7 @@ import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; import org.bukkit.ChatColor; +import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -166,13 +167,11 @@ public class TreasurePage extends ShopPageBase 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) + if (freedomCount > 0 && !hasAllFreedomItems(getPlayer())) 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(C.cRed + "This item is no longer available!"); } freedomLore.add(" "); freedomLore.add(ChatColor.RESET + C.cGreen + getFreedomUnlockedAmount(getPlayer()) + "/7 Unlocked"); @@ -188,8 +187,13 @@ public class TreasurePage extends ShopPageBase addItem(40, shards); addChest(11, christmas, TreasureType.CHRISTMAS, christmasCount); - if (!hasAllFreedomItems(getPlayer())) + if (!hasAllFreedomItems(getPlayer()) && freedomCount >= 1) addChest(13, freedom, TreasureType.FREEDOM, freedomCount); + else + { + freedom = new ShopItem(Material.INK_SACK, DyeColor.SILVER.getData(), C.cRed + C.Bold + "Freedom " + C.cBlue + C.Bold + "Treasure", freedomLore.toArray(new String[0]), 0, true, false); + addChest(13, freedom, TreasureType.FREEDOM, freedomCount); + } addChest(15, illuminated, TreasureType.ILLUMINATED, illuminatedCount); addChest(20, basic, TreasureType.OLD, basicCount); addChest(22, heroic, TreasureType.ANCIENT, heroicCount); 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 922a164d7..e58c2d50c 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 @@ -74,9 +74,18 @@ public class WinEffectManager public WinEffectGadget getWinEffect() { GadgetManager manager = _game.getArcadeManager().getCosmeticManager().getGadgetManager(); - Gadget gadget = manager.getActive(_winner, GadgetType.WIN_EFFECT); + /*Gadget gadget = manager.getActive(_winner, GadgetType.WIN_EFFECT); if(gadget == null) gadget = manager.getGadget(WinEffectPodium.class); - return (WinEffectGadget) gadget; + return (WinEffectGadget) gadget;*/ + Gadget winEffect = manager.getGadget(WinEffectPodium.class); + for (Gadget gadget : manager.getGadgets(GadgetType.WIN_EFFECT)) + { + if (gadget.isActive(_winner)) + { + winEffect = gadget; + } + } + return (WinEffectGadget) winEffect; } } From 63500c19c9e4ac82f9fd2d917d249779fbbfda18 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 6 Jul 2016 14:45:05 -0300 Subject: [PATCH 108/115] Removed commented lines Added javadocs to GadgetChangeEvent --- .../mineplex/core/gadget/GadgetManager.java | 85 ------------------- .../core/gadget/event/GadgetChangeEvent.java | 5 ++ .../arcade/wineffect/WinEffectManager.java | 3 - 3 files changed, 5 insertions(+), 88 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 088f2fc21..f4f95e586 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -974,91 +974,6 @@ public class GadgetManager extends MiniPlugin } } -// private void saveGadgets(Player player) -// { -// if (player.getGameMode() == GameMode.SPECTATOR) -// return; -// Map cache = new HashMap<>(); -// for (Gadget gadget : getAllGadgets()) -// { -// GadgetType gadgetType = gadget.getGadgetType(); -// if (gadget.ownsGadget(player)) -// { -// switch (gadgetType) -// { -// case MUSIC_DISC: -// case ITEM: -// case MORPH: -// case BALLOON: -// 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 GAME_MODIFIER: -// 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(gadgetType.getDatabaseKey(), gadget.getName()); -// break; -// } -// } -// } -// cache = updateDefaultGadgets(cache); -// _userGadgetPersistence.save(player, cache); -// } - -// private Map updateDefaultGadgets(Map cache) -// { -// for (GadgetType gadgetType : GadgetType.values()) -// { -// if (gadgetType == GadgetType.MUSIC_DISC || gadgetType == GadgetType.ITEM -// || gadgetType == GadgetType.MORPH || gadgetType == GadgetType.BALLOON -// || gadgetType == GadgetType.GAME_MODIFIER) -// continue; -// if (!cache.containsKey(gadgetType.getDatabaseKey())) -// { -// String key = gadgetType.getDatabaseKey(); -// if (gadgetType.equals(GadgetType.COSTUME)) -// { -// for (ArmorSlot armorSlot : ArmorSlot.values()) -// { -// key = "activeCostume" + armorSlot.getDatabaseKey(); -// if (!cache.containsKey(key)) -// { -// cache.put(key, "disabled"); -// } -// } -// } -// else -// { -// cache.put(key, "disabled"); -// } -// } -// } -// return cache; -// } - public boolean isKitModifierActive(KitModifier kitModifier, Player player) { for (Gadget gadget : getGadgets(GadgetType.GAME_MODIFIER)) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java index 0cb01a1c1..d983cabe6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/GadgetChangeEvent.java @@ -5,6 +5,11 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +/** + * Called when a player enables or disables a gadget manually, + * allowing it to be saved when the player changes a gadget, instead of + * when they quit or join a server + */ public class GadgetChangeEvent extends Event { 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 e58c2d50c..35362f78f 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 @@ -74,9 +74,6 @@ public class WinEffectManager public WinEffectGadget getWinEffect() { GadgetManager manager = _game.getArcadeManager().getCosmeticManager().getGadgetManager(); - /*Gadget gadget = manager.getActive(_winner, GadgetType.WIN_EFFECT); - if(gadget == null) gadget = manager.getGadget(WinEffectPodium.class); - return (WinEffectGadget) gadget;*/ Gadget winEffect = manager.getGadget(WinEffectPodium.class); for (Gadget gadget : manager.getGadgets(GadgetType.WIN_EFFECT)) { From 8cf470cfd0aa558666a5e2bbdff09ff047fb7c5e Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 6 Jul 2016 13:39:56 -0500 Subject: [PATCH 109/115] Update fountain goals --- .../src/mineplex/core/brawl/fountain/FountainManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java index 802b81b5d..11e4cf821 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java @@ -51,7 +51,7 @@ public class FountainManager extends MiniPlugin World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5 - int goal = !new File("eu.dat").exists() ? 300000000 : 5000000; + int goal = !new File("eu.dat").exists() ? 200000000 : 20000000; _gemFountain = new Fountain(new Location(world, -32.5, 72, -23.5), new Location(world, -43.5, 67, -38.5), C.cGreen + "Gem Fountain", "GemFountain_01", goal, this, clientManager, donationManager, _hologramManager, _statsManager); } From 63b6158fe4a7ed730ec3e95eddd3ba01a4f11756 Mon Sep 17 00:00:00 2001 From: samczsun Date: Mon, 4 Jul 2016 21:07:02 -0400 Subject: [PATCH 110/115] More UHC Fixes Fixes: PC-137 PC-138 PC-497 PC-665 PC-710 PC-719 PC-754 Also fixes chunk synchronization issue, plugs potential memory leaks Fancy spectating Use enum priorities --- .../core/boosters/BoosterManager.java | 7 + .../boosters/event/BoosterItemGiveEvent.java | 48 + .../core/packethandler/PacketHandler.java | 161 ++- .../game/core/damage/DamageManager.java | 3 + .../nautilus/game/arcade/ArcadeManager.java | 8 +- .../src/nautilus/game/arcade/game/Game.java | 183 +-- .../nautilus/game/arcade/game/GameTeam.java | 7 +- .../game/games/build/modes/TeamBuild.java | 5 +- .../game/games/skywars/TeamSkywars.java | 6 +- .../game/games/smash/TeamSuperSmash.java | 4 +- .../survivalgames/TeamSurvivalGames.java | 4 +- .../game/arcade/game/games/uhc/UHC.java | 1184 ++++++----------- .../games/uhc/helpers/ChunkLoadingThread.java | 385 ++++++ .../games/uhc/helpers/WorldGenThread.java | 239 ++++ .../game/arcade/game/modules/Module.java | 29 + .../game/arcade/game/modules/TeamModule.java | 164 +++ .../spectatorMenu/button/SpectatorButton.java | 13 +- .../arcade/managers/GameCreationManager.java | 1 + .../arcade/managers/GameLobbyManager.java | 3 +- .../arcade/managers/GameSpectatorManager.java | 196 ++- 20 files changed, 1553 insertions(+), 1097 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterItemGiveEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamModule.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index a8b79473f..4254f6594 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -6,6 +6,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.boosters.command.BoosterCommand; import mineplex.core.boosters.event.BoosterActivateEvent; import mineplex.core.boosters.event.BoosterExpireEvent; +import mineplex.core.boosters.event.BoosterItemGiveEvent; import mineplex.core.boosters.event.BoosterUpdateEvent; import mineplex.core.boosters.gui.BoosterShop; import mineplex.core.boosters.redis.BoosterUpdateRepository; @@ -14,6 +15,7 @@ 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.common.util.UtilServer; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; @@ -361,6 +363,11 @@ public class BoosterManager extends MiniPlugin { if (_giveInterfaceItem && !UtilGear.isMat(player.getInventory().getItem(INTERFACE_SLOT), Material.EMERALD)) { + BoosterItemGiveEvent event = new BoosterItemGiveEvent(player); + UtilServer.CallEvent(event); + if (event.isCancelled()) + return; + player.getInventory().setItem(INTERFACE_SLOT, INTERFACE_ITEM); UtilInv.Update(player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterItemGiveEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterItemGiveEvent.java new file mode 100644 index 000000000..90636623b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/event/BoosterItemGiveEvent.java @@ -0,0 +1,48 @@ +package mineplex.core.boosters.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * Called when a player is about to receive a booster gem. If cancelled the player will not receive said gem + */ +public class BoosterItemGiveEvent extends Event implements Cancellable +{ + private Player _player; + private boolean _cancelled; + + public BoosterItemGiveEvent(Player player) + { + this._player = player; + } + + public Player getPlayer() + { + return this._player; + } + + public boolean isCancelled() + { + return this._cancelled; + } + + public void setCancelled(boolean cancelled) + { + this._cancelled = cancelled; + } + + 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/packethandler/PacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java index 3018daa85..d8076b1cf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java @@ -1,12 +1,8 @@ package mineplex.core.packethandler; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - +import com.mineplex.spigot.PacketProcessor; +import mineplex.core.MiniPlugin; import net.minecraft.server.v1_8_R3.Packet; - import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -15,16 +11,22 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -import com.mineplex.spigot.PacketProcessor; - -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.NautHashMap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; public class PacketHandler extends MiniPlugin { - private NautHashMap _playerVerifierMap = new NautHashMap(); - private HashMap> _forceMainThread = new HashMap>(); - private HashMap> _packetHandlers = new HashMap>(); + private Map _playerVerifierMap = new HashMap<>(); + + private Map, Set> _forceMainThread = new HashMap<>(); + private Map, Map>> _packetHandlers = new HashMap<>(); public PacketHandler(JavaPlugin plugin) { @@ -40,18 +42,6 @@ public class PacketHandler extends MiniPlugin .get(event.getPlayer())); } - public boolean handlePacket(Player player, Packet packet) - { - if (!_playerVerifierMap.containsKey(player)) - { - return true; - } - - PacketVerifier verifier = _playerVerifierMap.get(player); - - return handlePacket(new PacketInfo(player, packet, verifier)); - } - public boolean handlePacket(PacketInfo packetInfo) { if (!_packetHandlers.containsKey(packetInfo.getPacket().getClass())) @@ -60,15 +50,18 @@ public class PacketHandler extends MiniPlugin return true; } - for (IPacketHandler handler : _packetHandlers.get(packetInfo.getPacket().getClass())) + for (Entry> entry : _packetHandlers.get(packetInfo.getPacket().getClass()).entrySet()) { - try + for (IPacketHandler handler : entry.getValue()) { - handler.handle(packetInfo); - } - catch (Exception ex) - { - ex.printStackTrace(); + try + { + handler.handle(packetInfo); + } + catch (Exception ex) + { + ex.printStackTrace(); + } } } @@ -90,72 +83,106 @@ public class PacketHandler extends MiniPlugin @SafeVarargs public final void addPacketHandler(IPacketHandler packetHandler, Class... packetsToListen) { - if (packetsToListen.length == 0) - { - throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); - } - - addPacketHandler(packetHandler, false, packetsToListen); + addPacketHandler(packetHandler, ListenerPriority.NORMAL, false, packetsToListen); } - /** - * This should only be used for incoming packets - */ - public void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread, - Class... packetsToListen) + @SafeVarargs + public final void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread, Class... packetsToListen) { if (packetsToListen.length == 0) { throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); } - for (Class c : packetsToListen) + addPacketHandler(packetHandler, ListenerPriority.NORMAL, forceMainThread, packetsToListen); + } + + @SafeVarargs + public final void addPacketHandler(IPacketHandler packetHandler, ListenerPriority priority, Class... packetsToListen) + { + if (packetsToListen.length == 0) + { + throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); + } + + addPacketHandler(packetHandler, priority, false, packetsToListen); + } + + /** + * This should only be used for incoming packets + */ + @SafeVarargs + public final void addPacketHandler(IPacketHandler packetHandler, ListenerPriority priority, boolean forceMainThread, + Class... packetsToListen) + { + if (packetsToListen.length == 0) + { + throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to"); + } + + for (Class c : packetsToListen) { if (forceMainThread) { - if (!_forceMainThread.containsKey(c)) - { - _forceMainThread.put(c, new ArrayList()); - } - - _forceMainThread.get(c).add(packetHandler); + _forceMainThread + .computeIfAbsent(c, key -> new HashSet<>()) + .add(packetHandler); } - if (!_packetHandlers.containsKey(c)) - { - _packetHandlers.put(c, new ArrayList()); - } + _packetHandlers + .computeIfAbsent(c, key -> new TreeMap<>()) + .computeIfAbsent(priority, key -> new ArrayList<>()) + .add(packetHandler); - _packetHandlers.get(c).add(packetHandler); PacketProcessor.addPacket(c, forceMainThread || _forceMainThread.containsKey(c)); } } public void removePacketHandler(IPacketHandler packetHandler) { - Iterator>> itel = _packetHandlers.entrySet().iterator(); + Iterator, Map>>> itel = _packetHandlers.entrySet().iterator(); while (itel.hasNext()) { - Entry> entry = itel.next(); + Entry, Map>> entry = itel.next(); - if (entry.getValue().remove(packetHandler)) + Set removedFrom = new HashSet<>(); + + for (Entry> ent : entry.getValue().entrySet()) { - if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler)) + if (ent.getValue().remove(packetHandler)) { - if (_forceMainThread.get(entry.getKey()).isEmpty()) - { - _forceMainThread.remove(entry.getKey()); - PacketProcessor.addPacket(entry.getKey(), false); - } + removedFrom.add(ent.getKey()); } + } - if (entry.getValue().isEmpty()) + for (ListenerPriority priority : removedFrom) + { + if (entry.getValue().get(priority).isEmpty()) { - PacketProcessor.removePacket(entry.getKey()); - itel.remove(); + entry.getValue().remove(priority); } } + + if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler)) + { + if (_forceMainThread.get(entry.getKey()).isEmpty()) + { + _forceMainThread.remove(entry.getKey()); + PacketProcessor.addPacket(entry.getKey(), false); + } + } + + if (entry.getValue().isEmpty()) + { + PacketProcessor.removePacket(entry.getKey()); + itel.remove(); + } } } + + public enum ListenerPriority + { + HIGH, NORMAL, LOW + } } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index f19f26b67..b1276bdc9 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -231,6 +231,9 @@ public class DamageManager extends MiniPlugin @EventHandler public void onEntityCombust(EntityCombustByEntityEvent event) { + if (!_enabled) + return; + if (!(event.getCombuster() instanceof Player || event.getCombuster() instanceof Arrow)) return; 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 02245e363..75aea7dfa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -172,6 +172,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private KitProgressionManager _kitProgressionManager; private ProgressingKitManager _progressionKitManager; private BoosterManager _boosterManager; + private GameSpectatorManager _spectatorManager; private IncognitoManager _incognitoManager; @@ -290,7 +291,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation 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); + _spectatorManager = new GameSpectatorManager(this); _gameWorldManager = new GameWorldManager(this); new MiscManager(this); _hologramManager = hologramManager; @@ -1705,4 +1706,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation { return _kitProgressionManager; } + + public GameSpectatorManager getGameSpectatorManager() + { + return _spectatorManager; + } } 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 74f0ee8af..6926eb565 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 @@ -22,6 +22,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerGameRespawnEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.modules.Module; import nautilus.game.arcade.kit.*; import nautilus.game.arcade.managers.GameLobbyManager; import nautilus.game.arcade.managers.chat.ChatStatData; @@ -311,8 +312,6 @@ public abstract class Game implements Listener public boolean AllowEntitySpectate = true; - public boolean PlayerTeamSelection = false; - public boolean TeamMode = false; public boolean TeamPerSpawn = false; @@ -332,6 +331,8 @@ public abstract class Game implements Listener private NautHashMap _teamReqs = new NautHashMap(); public WinEffectManager WinEffectManager = new WinEffectManager(); + private Map, Module> _modules = new HashMap<>(); + public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc) { Manager = manager; @@ -418,6 +419,20 @@ public abstract class Game implements Listener System.out.println("Loading " + GetName() + "..."); } + public void registerModule(Module module) + { + if (!_modules.containsKey(module.getClass())) + { + module.initialize(this); + _modules.put(module.getClass(), module); + UtilServer.RegisterEvents(module); + } + else + { + throw new IllegalStateException("Module " + module.getClass() + " is already registered"); + } + } + public void setKits(Kit[] kits) { _kits = kits; @@ -1897,157 +1912,6 @@ public abstract class Game implements Listener } } - @EventHandler(priority = EventPriority.HIGH) - public void teamSelectInteract(PlayerInteractEntityEvent event) - { - if (!PlayerTeamSelection) - return; - - if (GetState() != GameState.Recruit) - return; - - if (event.getRightClicked() == null) - return; - - if (!(event.getRightClicked() instanceof Player)) - return; - - Player player = event.getPlayer(); - - //Observer - if (Manager.IsObserver(player)) - { - UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); - return; - } - - selectTeamMate(player, (Player) event.getRightClicked()); - } - - @EventHandler - public void teamSelectCommand(PlayerCommandPreprocessEvent event) - { - if (!PlayerTeamSelection) - return; - - if (GetState() != GameState.Recruit) - return; - - if (!event.getMessage().toLowerCase().startsWith("/team ")) - return; - - event.setCancelled(true); - - Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], - true); - if (target == null) - return; - - //Observer - if (Manager.IsObserver(event.getPlayer())) - { - UtilPlayer.message(event.getPlayer(), - F.main("Game", "Spectators cannot partake in games.")); - return; - } - - if (event.getPlayer().equals(target)) - return; - - selectTeamMate(event.getPlayer(), target); - } - - public void selectTeamMate(Player player, Player ally) - { - //Accept Invite - if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player)) - { - //Remove Prefs - _teamReqs.remove(player); - _teamReqs.remove(ally); - - //Inform - UtilPlayer.message(player, - F.main("Game", "You accepted " + ally.getName() + "'s Team Request!")); - UtilPlayer.message(ally, - F.main("Game", player.getName() + " accepted your Team Request!")); - - //Leave Old Teams - if (GetTeam(player) != null) - GetTeam(player).DisbandTeam(); - - if (GetTeam(ally) != null) - GetTeam(ally).DisbandTeam(); - - //Get Team - GameTeam team = getEmptyTeam(); - if (team == null) - return; - - //Join Team - SetPlayerTeam(player, team, true); - SetPlayerTeam(ally, team, true); - } - //Send Invite - else - { - //Already on Team with Target - if (GetTeam(player) != null) - if (GetTeam(player).HasPlayer(ally)) - return; - - //Inform Player - UtilPlayer.message(player, - F.main("Game", "You sent a Team Request to " + ally.getName() + "!")); - - //Inform Target - if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false)) - { - UtilPlayer.message(ally, - F.main("Game", player.getName() + " sent you a Team Request!")); - UtilPlayer.message(ally, F.main("Game", - "Type " + F.elem("/team " + player.getName()) + " to accept!")); - } - - //Add Pref - _teamReqs.put(player, ally); - } - } - - @EventHandler - public void teamQuit(PlayerQuitEvent event) - { - if (!PlayerTeamSelection) - return; - - if (GetState() != GameState.Recruit) - return; - - Player player = event.getPlayer(); - - if (GetTeam(player) != null) - GetTeam(player).DisbandTeam(); - - Iterator teamIter = _teamReqs.keySet().iterator(); - while (teamIter.hasNext()) - { - Player sender = teamIter.next(); - if (sender.equals(player) || _teamReqs.get(sender).equals(player)) - teamIter.remove(); - } - } - - public GameTeam getEmptyTeam() - { - for (GameTeam team : GetTeamList()) - { - if (team.GetPlayers(false).isEmpty()) - return team; - } - - return null; - } - @EventHandler public void CustomTeamGeneration(GameStateChangeEvent event) { @@ -2271,4 +2135,17 @@ public abstract class Game implements Listener { } + public void cleanupModules() + { + for (Module module : this._modules.values()) + { + module.cleanup(); + HandlerList.unregisterAll(module); + } + } + + public T getModule(Class clazz) + { + return clazz.cast(_modules.get(clazz)); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index 36bd685e2..701dfe0cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -24,6 +24,7 @@ import org.bukkit.Location; import org.bukkit.entity.Creature; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Team; public class GameTeam { @@ -192,7 +193,11 @@ public class GameTeam { for(Player other : UtilServer.getPlayers()) { - other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player); + Team team = other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()); + if (team != null) + { + team.removePlayer(player); + } other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player); } UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded.")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java index e2abb1537..0fb700e65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/TeamBuild.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import nautilus.game.arcade.game.modules.TeamModule; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Sound; @@ -40,7 +41,9 @@ public class TeamBuild extends Build super(manager, GameType.Brawl); TeamMode = true; - PlayerTeamSelection = true; + + registerModule(new TeamModule()); + TeamPerSpawn = true; FillTeamsInOrderToCount = 2; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java index ba2949dd2..2b470ce33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/TeamSkywars.java @@ -19,6 +19,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.stats.DeathBomberStatTracker; import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker; import nautilus.game.arcade.stats.SkywarsTNTStatTracker; @@ -78,10 +79,11 @@ public class TeamSkywars extends Skywars DamageTeamSelf = false; DontAllowOverfill = true; - - PlayerTeamSelection = true; + TeamMode = true; TeamPerSpawn = true; + + registerModule(new TeamModule()); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java index 3757bf8ee..3fb05c19c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/TeamSuperSmash.java @@ -15,6 +15,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.FreeKitWinStatTracker; import nautilus.game.arcade.stats.KillFastStatTracker; @@ -55,7 +56,8 @@ public class TeamSuperSmash extends SuperSmash DontAllowOverfill = true; TeamMode = true; - PlayerTeamSelection = true; + + registerModule(new TeamModule()); registerStatTrackers( new WinWithoutDyingStatTracker(this, "MLGPro"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java index 286426457..99d49393b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/TeamSurvivalGames.java @@ -17,6 +17,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.managers.chat.ChatStatData; import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker; import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker; @@ -59,7 +60,8 @@ public class TeamSurvivalGames extends SurvivalGames DontAllowOverfill = true; TeamMode = true; - PlayerTeamSelection = true; + + registerModule(new TeamModule()); registerStatTrackers(new WinWithoutWearingArmorStatTracker(this), new KillsWithinTimeLimitStatTracker(this, 3, 60, "Bloodlust"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index a6d564eea..e4af92f98 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -1,30 +1,15 @@ package nautilus.game.arcade.game.games.uhc; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - import com.mineplex.spigot.ChunkPreLoadEvent; import fr.neatmonster.nocheatplus.checks.CheckType; import fr.neatmonster.nocheatplus.checks.access.IViolationInfo; import fr.neatmonster.nocheatplus.hooks.NCPHook; import fr.neatmonster.nocheatplus.hooks.NCPHookManager; -import mineplex.core.common.Pair; +import mineplex.core.account.CoreClient; +import mineplex.core.boosters.event.BoosterItemGiveEvent; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -43,8 +28,6 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatLog; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import mineplex.serverdata.Utility; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GamePrepareCountdownCommence; @@ -53,16 +36,13 @@ import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.games.uhc.helpers.ChunkLoadingThread; +import nautilus.game.arcade.game.games.uhc.helpers.WorldGenThread; +import nautilus.game.arcade.game.modules.TeamModule; import nautilus.game.arcade.kit.Kit; - -import net.minecraft.server.v1_8_R3.BiomeCache; -import net.minecraft.server.v1_8_R3.ChunkProviderServer; -import net.minecraft.server.v1_8_R3.ChunkRegionLoader; -import net.minecraft.server.v1_8_R3.FileIOThread; -import net.minecraft.server.v1_8_R3.IChunkProvider; +import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.MinecraftServer; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.WorldChunkManager; import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -70,41 +50,39 @@ import org.bukkit.Difficulty; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.World; -import org.bukkit.WorldBorder; import org.bukkit.World.Environment; +import org.bukkit.WorldBorder; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.Ghast; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; -import org.bukkit.entity.Villager; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; -import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.event.entity.EntityTargetLivingEntityEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.event.player.PlayerKickEvent; -import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -120,42 +98,48 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; -import org.spigotmc.AsyncCatcher; +import org.spigotmc.ActivationRange; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; public class UHC extends TeamGame implements NCPHook { // The view distance of UHC. The amount of time and ram needed grows polynomially - private static final int VIEW_DISTANCE = 5; + public static final int VIEW_DISTANCE = 5; // The number of threads to use for reading chunks from disk - private static final int THREADS_FOR_CHUNK_LOADING = 4; + public static final int THREADS_FOR_CHUNK_LOADING = 4; - private NautHashMap _teamReqs = new NautHashMap(); + // The number of minutes after which PVP should be enabled + public static final int SAFE_TIME_IN_MINUTES = 11; - private NautHashMap _deathTime = new NautHashMap(); - // private NautHashMap _combatTime = new NautHashMap(); + // The thread responsible for generating the world + private final WorldGenThread _worldGenThread = new WorldGenThread(this); - private volatile boolean _mapLoaded = false; - private volatile double _mapLoadPercent = 0; - private volatile int _chunksPerTick = 1; - private volatile boolean stopGen = false; + // The thread responsible for loading and decorating the world + private final ChunkLoadingThread _chunkLoadingThread = new ChunkLoadingThread(this); - private int _chunkTotal; - private int _chunkX = 0; - private int _chunkZ = 0; - private int _chunksLoaded = 0; + // The number of minutes passed in this game + private int _minutesSinceStart = 0; - private int _gameMinutes = 0; - private int _safeTime = 11; - private long _lastMinute = System.currentTimeMillis(); + // The Objective representing the tab list health display + private Objective _healthObjective; - private Objective _scoreObj; + // The number of players which have been teleported + private int _teleportedPlayers = -1; + // The total number of players to teleport + private int _totalPlayers = 0; + // Whether players are teleporting currently + private volatile boolean _isTeleporting = false; - private long _createTime; - private long _serverTime; - - - private boolean xrayDebug = false; + private boolean xrayDebug; // Border private int _secondsSinceStart; @@ -164,14 +148,6 @@ public class UHC extends TeamGame implements NCPHook private double _previousBorder = 1000; private long _borderStartedMoving; - - private volatile boolean _isDecorating = false; - private volatile boolean _allowSpawning = true; - private int _teleportedPlayers = -1; - private int _totalPlayers = 0; - private AtomicInteger actual = new AtomicInteger(); - private AtomicInteger expected = new AtomicInteger(23000); // Most likely it'll be around 23000 - public UHC(ArcadeManager manager) { this(manager, GameType.UHC); @@ -252,6 +228,8 @@ public class UHC extends TeamGame implements NCPHook WorldTimeSet = -1; + this.WorldLeavesDecay = true; + CraftRecipes(); // Disable Custom Mob Drops (and EXP Disable) @@ -263,13 +241,12 @@ public class UHC extends TeamGame implements NCPHook // Damage Settings Manager.GetDamage().SetEnabled(false); - _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Health", "health"); - _scoreObj.setDisplaySlot(DisplaySlot.PLAYER_LIST); - - _createTime = System.currentTimeMillis(); - _serverTime = Utility.currentTimeMillis(); + _healthObjective = Scoreboard.GetScoreboard().registerNewObjective("Health", "health"); + _healthObjective.setDisplaySlot(DisplaySlot.PLAYER_LIST); NCPHookManager.addHook(CheckType.ALL, this); + + registerModule(new TeamModule()); } @Override @@ -277,10 +254,6 @@ public class UHC extends TeamGame implements NCPHook { WorldData.World.setDifficulty(Difficulty.HARD); - _chunkX = (int) -(_currentBorder / 16); - _chunkZ = (int) -(_currentBorder / 16); - _chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16)); - WorldData.MinX = -1000; WorldData.MinZ = -1000; WorldData.MaxX = 1000; @@ -499,323 +472,18 @@ public class UHC extends TeamGame implements NCPHook worldServer.spigotConfig.viewDistance = VIEW_DISTANCE; worldServer.getPlayerChunkMap().a(VIEW_DISTANCE); - if (Runtime.getRuntime().maxMemory() / 1024 / 1024 < 2048) + if (Runtime.getRuntime().maxMemory() / 1024 / 1024 < 1536) { Announce(C.cGreen + C.Bold + "Skipping spawn pregeneration", false); + // Allow game to start + _chunkLoadingThread.flagDone(); return; } // Ensures the server does not tick us worldServer.getMinecraftServer().worlds.remove(worldServer); - _allowSpawning = false; - - new Thread(() -> - { - try - { - TimingManager.start("UHC Chunk Loading"); - - ChunkProviderServer chunkProviderServer = worldServer.chunkProviderServer; - - Field chunkLoaderField = chunkProviderServer.getClass().getDeclaredField("chunkLoader"); - chunkLoaderField.setAccessible(true); - - ChunkRegionLoader loader = (ChunkRegionLoader) chunkLoaderField.get(chunkProviderServer); - - Map loaded = new ConcurrentHashMap<>(); - Map compounds = new ConcurrentHashMap<>(); - - // Step 1: Read all the required chunks from the disk - // We're going to read all the required chunks from disk async - { - Set> coordPairs = new HashSet<>(); - - // Special case for 0, 0 - { - int x = spawn.getBlockX() >> 4; - int z = spawn.getBlockZ() >> 4; - - for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) - { - for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) - { - coordPairs.add(Pair.create(x + dx, z + dz)); - } - } - } - - // All the team spawns - { - for (int i = 0; i < GetTeamList().size(); i++) - { - GameTeam team = GetTeamList().get(i); - for (Location l : team.GetSpawns()) - { - int x = l.getChunk().getX(); - int z = l.getChunk().getZ(); - - for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) - { - for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) - { - coordPairs.add(Pair.create(x + dx, z + dz)); - } - } - } - } - } - - // Sigh... I don't want this to be here but it needs to be set somewhere... - // Multiply by 3 because there are 3 stages - expected.set(coordPairs.size() * 3); - - // Load them now - ExecutorService chunkLoaders = Executors.newFixedThreadPool(THREADS_FOR_CHUNK_LOADING); - - for (Pair coords : coordPairs) - { - chunkLoaders.submit(() -> - { - try - { - Object[] data = loader.loadChunk(worldServer, coords.getLeft(), coords.getRight()); - if (data != null) - { - NBTTagCompound compound = (NBTTagCompound) data[1]; - net.minecraft.server.v1_8_R3.Chunk chunk = (net.minecraft.server.v1_8_R3.Chunk) data[0]; - loaded.put(LongHash.toLong(coords.getLeft(), coords.getRight()), chunk); - compounds.put(LongHash.toLong(coords.getLeft(), coords.getRight()), compound); - } - else - { - System.out.println("Failed to load chunk " + coords.getLeft() + "," + coords.getRight()); - } - } - catch (Throwable t) - { - t.printStackTrace(); - } - finally - { - actual.getAndIncrement(); - } - }); - } - - chunkLoaders.shutdown(); - - // We've got plenty of time to wait - System.out.println("Finished submitting tasks to executor, waiting..."); - chunkLoaders.awaitTermination(1, TimeUnit.DAYS); - - System.out.println("Loaded: " + loaded.size() + " and coords: " + coordPairs.size()); - } - - // Step 2: Recreate structures, update neighbors, load entities - // This step should be super quick so there's no point in scheduling it elsewhere - // Code is plain copypasted from ChunkIOProvider - { - for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) - { - NBTTagCompound compound = compounds.get(LongHash.toLong(chunk.locX, chunk.locZ)); - loader.loadEntities(chunk, compound.getCompound("Level"), worldServer); - chunk.setLastSaved(chunkProviderServer.world.getTime()); - if (chunkProviderServer.chunkProvider != null) - { - chunkProviderServer.chunkProvider.recreateStructures(chunk, chunk.locX, chunk.locZ); - } - for (int x = -2; x < 3; ++x) - { - for (int z = -2; z < 3; ++z) - { - if (x != 0 || z != 0) - { - net.minecraft.server.v1_8_R3.Chunk neighbor = loaded.get(LongHash.toLong(chunk.locX + x, chunk.locZ + z)); - if (neighbor != null) - { - neighbor.setNeighborLoaded(-x, -z); - chunk.setNeighborLoaded(x, z); - } - } - } - } - actual.getAndIncrement(); - } - } - - AtomicBoolean lockCompleted = new AtomicBoolean(false); - Object lock = new Object(); - - // Hop back onto the main thread - Manager.runSync(() -> - { - // We want to add all the chunks to the chunkmap so that the server is not out of sync - for (Map.Entry ent : loaded.entrySet()) - { - ent.getValue().addEntities(); - chunkProviderServer.chunks.put(ent.getKey(), ent.getValue()); - } - lockCompleted.set(true); - synchronized (lock) - { - lock.notifyAll(); - } - }); - - if (!lockCompleted.get()) - { - synchronized (lock) - { - lock.wait(); - } - } - if (!lockCompleted.get()) - { - throw new IllegalStateException("Lock was not completed"); - } - - - // Step 3: Decorate the chunks. This step must be performed async as otherwise the server lags way too hard - // Notes: Do not allow the server to tick the world. If this is allowed EntityTracker will raise CME - // NextTickList will also raise errors - // And worst case the server will crash - { - // Live life on the edge - AsyncCatcher.enabled = false; - _isDecorating = true; - int x = 0; - for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) - { - loadNearby(chunkProviderServer, chunkProviderServer, chunk.locX, chunk.locZ, worldServer, chunk); - x++; - if (x % 100 == 0) - { - System.out.println(x); - } - actual.getAndIncrement(); - } - TimingManager.stop("UHC Chunk Loading"); - _isDecorating = false; - AsyncCatcher.enabled = true; - - System.out.println("Expected: " + expected.get() + ", actual: " + actual.get()); - - Manager.runSync(() -> - { - World world = worldServer.getWorld(); - for (Entity entity : world.getLivingEntities()) - { - if (!(entity instanceof Player) && !(entity instanceof Villager)) - { - entity.remove(); - } - } - // You may tick again - worldServer.getMinecraftServer().worlds.add(worldServer); - - // Well, if they're not equal, not much we can do. We've hit the end - actual.set(expected.get()); - }); - } - } - catch (Throwable t) - { - t.printStackTrace(); - } - }, "Chunk Loader").start(); - } - - // Plain copypasted from Chunk, but modified so that it doesn't load surrounding chunks if they're nonexistant - // This decorates the chunks. Do not remove! - public void loadNearby(ChunkProviderServer ichunkprovider, ChunkProviderServer ichunkprovider1, int i, int j, net.minecraft.server.v1_8_R3.World world, net.minecraft.server.v1_8_R3.Chunk chunk1) - { - boolean flag = ichunkprovider.isChunkLoaded(i, j - 1); - boolean flag1 = ichunkprovider.isChunkLoaded(i + 1, j); - boolean flag2 = ichunkprovider.isChunkLoaded(i, j + 1); - boolean flag3 = ichunkprovider.isChunkLoaded(i - 1, j); - boolean flag4 = ichunkprovider.isChunkLoaded(i - 1, j - 1); - boolean flag5 = ichunkprovider.isChunkLoaded(i + 1, j + 1); - boolean flag6 = ichunkprovider.isChunkLoaded(i - 1, j + 1); - boolean flag7 = ichunkprovider.isChunkLoaded(i + 1, j - 1); - if (flag1 && flag2 && flag5) - { - if (!chunk1.isDone()) - { - ichunkprovider.getChunkAt(ichunkprovider1, i, j); - } - else - { - ichunkprovider.a(ichunkprovider1, chunk1, i, j); - } - } - - net.minecraft.server.v1_8_R3.Chunk chunk; - if (flag3 && flag2 && flag6) - { - chunk = ichunkprovider.getChunkIfLoaded(i - 1, j); - if (chunk != null) - { - if (!chunk.isDone()) - { - ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j); - } - else - { - ichunkprovider.a(ichunkprovider1, chunk, i - 1, j); - } - } - } - - if (flag && flag1 && flag7) - { - chunk = ichunkprovider.getChunkIfLoaded(i, j - 1); - if (chunk != null) - { - if (!chunk.isDone()) - { - ichunkprovider.getChunkAt(ichunkprovider1, i, j - 1); - } - else - { - ichunkprovider.a(ichunkprovider1, chunk, i, j - 1); - } - } - } - - if (flag4 && flag && flag3) - { - chunk = ichunkprovider.getChunkIfLoaded(i - 1, j - 1); - if (chunk != null) - { - if (!chunk.isDone()) - { - ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1); - } - else - { - ichunkprovider.a(ichunkprovider1, chunk, i - 1, j - 1); - } - } - } - } - - @EventHandler - public void on(EntitySpawnEvent event) - { - // Don't allow entity spawns while decorating, period - if (_isDecorating || !_allowSpawning) - { - if (event.getLocation().getWorld().getUID() == WorldData.World.getUID()) - { - event.setCancelled(true); - } - } - } - - private boolean areSpawnsGenerated() - { - return actual.get() == expected.get(); + _chunkLoadingThread.start(); } @EventHandler @@ -831,20 +499,16 @@ public class UHC extends TeamGame implements NCPHook if (!IsLive()) return; - if (event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.MIN_01) return; - if (!UtilTime.elapsed(_lastMinute, 60000)) - return; + _minutesSinceStart++; - _gameMinutes++; - _lastMinute = System.currentTimeMillis(); - - if (_gameMinutes < _safeTime) + if (_minutesSinceStart < SAFE_TIME_IN_MINUTES) { - UtilTextMiddle.display(null, "PvP enabled in " + (_safeTime - _gameMinutes) + " minutes.", 5, 80, 5); + UtilTextMiddle.display(null, "PvP enabled in " + (SAFE_TIME_IN_MINUTES - _minutesSinceStart) + " minutes.", 5, 80, 5); } - else if (_gameMinutes == _safeTime) + else if (_minutesSinceStart == SAFE_TIME_IN_MINUTES) { UtilTextMiddle.display(null, "PvP has been enabled!", 5, 80, 5); @@ -909,7 +573,14 @@ public class UHC extends TeamGame implements NCPHook { if (event.GetState() == GameState.Dead) { - stopGen = true; + _worldGenThread.flagStop(); + _chunkLoadingThread.flagStop(); + if (!_chunkLoadingThread.isDone()) + { + MinecraftServer.getServer().worlds.add(((CraftWorld) WorldData.World).getHandle()); + } + HandlerList.unregisterAll(_chunkLoadingThread); + NCPHookManager.removeHook(this); return; } @@ -918,180 +589,22 @@ public class UHC extends TeamGame implements NCPHook return; } - new Thread(() -> - { - try - { - Field fileIOThreadB = FileIOThread.class.getDeclaredField("b"); - fileIOThreadB.setAccessible(true); - - // This list is the list of chunks to be saved on the File IO Thread - List list = (List) fileIOThreadB.get(FileIOThread.a()); - - net.minecraft.server.v1_8_R3.WorldServer worldServer = ((CraftWorld) WorldData.World).getHandle(); - - WorldChunkManager manager = worldServer.getWorldChunkManager(); - - Field biomeCacheField = manager.getClass().getDeclaredField("d"); - biomeCacheField.setAccessible(true); - - // A thread safe BiomeCache - // The implementation is literally a copy/paste from the original BiomeCache, but with some synchronization - // Reason being while the server is ticking the world (for some reason, if you want to dig through the entire Arcade codebase go for it) - // it stores stuff in the BiomeCache, and chunk gen needs that BiomeCache info too - // Causing desynchronization in the cache - biomeCacheField.set(manager, new BiomeCache(manager) - { - private final Object _lock = new Object(); - - private long _lastCleanTime; // b -> _lastCleanTime - private Map _blockByCoord = new HashMap<>(); // LongHashMap -> HashMap, c -> _blockByCoord - private List _blocks = new ArrayList<>(); // d -> _blocks - - @Override - public BiomeCache.BiomeCacheBlock a(int x, int z) - { - x >>= 4; - z >>= 4; - long var3 = hash(x, z); - BiomeCache.BiomeCacheBlock var5 = this._blockByCoord.get(var3); - if (var5 == null) - { - var5 = new BiomeCache.BiomeCacheBlock(x, z); - synchronized (_lock) - { - this._blockByCoord.put(var3, var5); - this._blocks.add(var5); - } - } - - var5.e = MinecraftServer.az(); - return var5; - } - - @Override - public void a() - { - long currentTime = MinecraftServer.az(); - long deltaTime = currentTime - this._lastCleanTime; - if (deltaTime > 7500L || deltaTime < 0L) - { - this._lastCleanTime = currentTime; - - synchronized (_lock) - { - for (int i = 0; i < this._blocks.size(); ++i) - { - BiomeCache.BiomeCacheBlock biomeCacheBlock = (BiomeCache.BiomeCacheBlock) this._blocks.get(i); - long var7 = currentTime - biomeCacheBlock.e; - if (var7 > 30000L || var7 < 0L) - { - this._blocks.remove(i--); - this._blockByCoord.remove(hash(biomeCacheBlock.c, biomeCacheBlock.d)); - } - } - } - } - } - - private long hash(int x, int z) - { - return (long) x & 4294967295L | ((long) z & 4294967295L) << 32; - } - }); - - ChunkProviderServer cps = worldServer.chunkProviderServer; - IChunkProvider icp = cps.chunkProvider; - System.out.println("Using chunk provider " + icp.getClass()); - - TimingManager.start("Map Generation"); - - long start = System.currentTimeMillis(); - long last = start; - - while (!stopGen) - { - long now = System.currentTimeMillis(); - if ((now - last) >= 10 * 1000) - { - Announce(C.cGreen + C.Bold + "Generating Map: " + C.cWhite + getMapLoadETA() + " Remaining...", false); - last = now; - } - - long hash = LongHash.toLong(_chunkX, _chunkZ); - - // This is just a shortcut to how the Minecraft server would have generated a chunk if it doesn't exist. - // This should always create a chunk because we're not loading any chunks beforehand... - // /me looks at new maintainer - net.minecraft.server.v1_8_R3.Chunk chunk = icp.getOrCreateChunk(_chunkX, _chunkZ); - - // Run the copypasted code for chunk saving. - cps.saveChunk(chunk); - cps.saveChunkNOP(chunk); - cps.unloadQueue.remove(_chunkX, _chunkZ); - cps.chunks.remove(hash); - - if (_chunkX < _currentBorder / 16) - { - _chunkX++; - } - else if (_chunkZ < _currentBorder / 16) - { - _chunkX = (int) -(_currentBorder / 16); - _chunkZ++; - } - else - { - _mapLoaded = true; - System.out.println("Map Loading Finished! Took " + TimeUnit.MILLISECONDS.toSeconds(now - start) + " seconds"); - break; - } - - _chunksLoaded++; - - // Clamp it so we don't get 101% - _mapLoadPercent = UtilMath.clamp((double) _chunksLoaded / (double) _chunkTotal, 0.0, 1.0); - _chunksPerTick = (int) (_chunksLoaded / ((now - start) / 50.0)); - } - - TimingManager.stop("Map Generation"); - - if (stopGen) - { - return; - } - - TimingManager.start("Map Saving"); - - // Wait for all the chunks to save (but do we need this?) - while (!list.isEmpty()) - { - Thread.sleep(100); - } - - TimingManager.stop("Map Saving"); - - getArcadeManager().runSync(this::generateSpawns); - } - catch (Throwable t) - { - // todo proper exception handling - // maybe force shutdown? - t.printStackTrace(); - } - }, "WorldGen Thread").start(); + _worldGenThread.start(); } - @EventHandler + @EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = false) public void on(ChunkUnloadEvent event) { if (IsLive()) - return; - event.setCancelled(true); + { + event.setCancelled(false); + } + else + { + event.setCancelled(true); + } } - private volatile boolean _isTeleporting = false; - @EventHandler public void on(ChunkPreLoadEvent event) { @@ -1119,6 +632,9 @@ public class UHC extends TeamGame implements NCPHook if (event.GetState() != GameState.Prepare) return; + + Manager.GetChat().Silence(1000 * 120, false); + _isTeleporting = true; List players = game.GetPlayers(true); @@ -1128,6 +644,7 @@ public class UHC extends TeamGame implements NCPHook for (Player player : players) { player.teleport(zero); + player.hidePlayer(player); // Heal player.setHealth(player.getMaxHealth()); @@ -1136,7 +653,7 @@ public class UHC extends TeamGame implements NCPHook player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); } - Announce(C.cGreen + C.Bold + "Please wait while you are teleported to your spawn", false); + Announce(C.cGreen + C.Bold + "Please wait, you will be teleported soon", false); _totalPlayers = players.size(); @@ -1148,6 +665,7 @@ public class UHC extends TeamGame implements NCPHook _teleportedPlayers++; if (_teleportedPlayers >= players.size()) { + Announce(C.cGreen + C.Bold + "The game will start in 5 seconds", false); Manager.runSyncLater(() -> { try @@ -1169,6 +687,8 @@ public class UHC extends TeamGame implements NCPHook player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30 * 20, 128), true); player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 30 * 20, 128), true); } + + teleportedLocations.clear(); } finally { @@ -1188,14 +708,20 @@ public class UHC extends TeamGame implements NCPHook player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); player.removePotionEffect(PotionEffectType.REGENERATION); } - }, 10 * 20L); - // Yes, right now they're both set to 10 seconds, but this may change in the future - Manager.runSyncLater(() -> - { - _allowSpawning = true; + + WorldData.World.setAutoSave(true); + + int x = 0; + for (org.bukkit.Chunk chunk : WorldData.World.getLoadedChunks()) + { + if (WorldData.World.unloadChunkRequest(chunk.getX(), chunk.getZ())) + { + System.out.println("Requesting unload of chunk #" + (++x) + " " + chunk.getX() + " " + chunk.getZ()); + } + } }, 10 * 20L); } - }, 3 * 20L); + }, 5 * 20L); Bukkit.getServer().getScheduler().cancelTask(id.get()); return; } @@ -1211,7 +737,7 @@ public class UHC extends TeamGame implements NCPHook teleportedLocations.put(player.getUniqueId(), team.SpawnTeleport(player)); // Update scoreboard - _scoreObj.getScore(player).setScore((int) player.getMaxHealth()); + _healthObjective.getScore(player).setScore((int) player.getMaxHealth()); game.addPlayerInTime(player); @@ -1234,7 +760,7 @@ public class UHC extends TeamGame implements NCPHook PlayerPrepareTeleportEvent playerStateEvent = new PlayerPrepareTeleportEvent(game, player); UtilServer.getServer().getPluginManager().callEvent(playerStateEvent); } - }, 4 * 20L, 4L).getTaskId()); + }, 5 * 20L, 5L).getTaskId()); //Spectators Move for (Player player : UtilServer.getPlayers()) @@ -1246,6 +772,55 @@ public class UHC extends TeamGame implements NCPHook } } + @Override + public Location GetSpectatorLocation() + { + if (SpectatorSpawn != null) + { + return SpectatorSpawn; + } + + SpectatorSpawn = WorldData.World.getSpawnLocation(); + + // Move Up - Out Of Blocks + while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock()) + || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + } + + int Up = 0; + + // Move Up - Through Air + for (int i = 0; i < 15; i++) + { + if (UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.add(0, 1, 0); + Up++; + } + else + { + break; + } + } + + // Move Down - Out Of Blocks + while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock()) + || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP))) + { + SpectatorSpawn.subtract(0, 1, 0); + Up--; + } + + SpectatorSpawn = SpectatorSpawn.getBlock().getLocation().add(0.5, 0.1, 0.5); + + while (SpectatorSpawn.getBlock().getTypeId() != 0 || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getTypeId() != 0) + SpectatorSpawn.add(0, 1, 0); + + return SpectatorSpawn; + } + @EventHandler public void WorldBoundaryYLimit(BlockPlaceEvent event) { @@ -1291,7 +866,7 @@ public class UHC extends TeamGame implements NCPHook if (block.getRelative(BlockFace.DOWN).isLiquid()) continue; - if (block.getRelative(BlockFace.DOWN).getType() == Material.AIR) + if (!block.getRelative(BlockFace.DOWN).getType().isSolid()) continue; // Suffocated @@ -1373,9 +948,6 @@ public class UHC extends TeamGame implements NCPHook long timeAlive = System.currentTimeMillis() - GetStateTime(); AddGems(player, timeAlive / 60000d, "Survived " + UtilTime.MakeStr(timeAlive), false, false); } - - // Time - _deathTime.put(player.getName(), System.currentTimeMillis()); } @EventHandler(priority = EventPriority.HIGH) @@ -1414,21 +986,21 @@ public class UHC extends TeamGame implements NCPHook } @EventHandler - public void PlayerDeathTimeKick(UpdateEvent event) + public void on(EntityTargetLivingEntityEvent event) { - if (event.getType() != UpdateType.SEC) - return; - - for (Player player : UtilServer.getPlayers()) + if (event.getEntity() instanceof ExperienceOrb) { - if (!_deathTime.containsKey(player.getName())) - continue; + if (event.getTarget() instanceof Player) + { + Player player = (Player) event.getTarget(); - if (!UtilTime.elapsed(_deathTime.get(player.getName()), 20000)) - continue; + Game game = Manager.GetGame(); - _deathTime.remove(player.getName()); - // XXX Need this ? Manager.GetPortal().SendPlayerToServer(player, "Lobby"); + if (game == null || !game.IsAlive(player) || game.GetState() != GameState.Live) + { + event.setCancelled(true); + } + } } } @@ -1644,6 +1216,21 @@ public class UHC extends TeamGame implements NCPHook event.setCancelled(true); } + @EventHandler + public void on(InventoryClickEvent event) + { + Player clicker = (Player) event.getWhoClicked(); + if (!IsAlive(clicker)) + event.setCancelled(true); + } + + @EventHandler + public void on(BoosterItemGiveEvent event) + { + if (IsAlive(event.getPlayer())) + event.setCancelled(true); + } + @EventHandler(priority = EventPriority.LOWEST) public void clearCreeperExplode(EntityExplodeEvent event) { @@ -1713,8 +1300,8 @@ public class UHC extends TeamGame implements NCPHook long ingameTime = getPlayerIngameTime(player); if (ingameTime == 0) ingameTime = GetStateTime(); - - int gems = Math.round((System.currentTimeMillis() - ingameTime)/1000); + + int gems = Math.round((System.currentTimeMillis() - ingameTime) / 1000); AddGems(player, gems, "Winning Team", false, false); } } @@ -1803,19 +1390,7 @@ public class UHC extends TeamGame implements NCPHook public int GetHealth(Player player) { - int health = (int) player.getHealth(); - - if (player.getHealth() % 1d != 0) - { - health += 1; - } - - return health; - } - - public long getServerTime() - { - return _serverTime + (System.currentTimeMillis() - _createTime); + return (int) Math.ceil(player.getHealth()); } @Override @@ -1946,15 +1521,221 @@ public class UHC extends TeamGame implements NCPHook return ChatColor.YELLOW + "In Progress"; } - // Not Loaded (but still joinable) - if (!_mapLoaded) + if (!_worldGenThread.isMapLoaded()) { - return ChatColor.GREEN + "Generating Map (" + C.cWhite + getMapLoadETA() + C.cGreen + ")"; + return ChatColor.GREEN + "Generating Map (" + C.cWhite + _worldGenThread.getProgress() + C.cGreen + ")"; + } + + if (!_chunkLoadingThread.isDone()) + { + return ChatColor.GREEN + "Generating Spawns (" + C.cWhite + _chunkLoadingThread.getProgress() + C.cGreen + ")"; } return ChatColor.GREEN + "Recruiting"; } + public boolean isMapLoaded() + { + return _worldGenThread.isMapLoaded() && _chunkLoadingThread.isDone(); + } + + public String getObjectiveName(boolean _colorTick) + { + if (!_worldGenThread.isMapLoaded()) + { + return _worldGenThread.getProgress() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Map"; + } + else + { + return _chunkLoadingThread.getProgress() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Spawns"; + } + } + + @Override + public String getHookName() + { + return "UHC Hook"; + } + + @Override + public String getHookVersion() + { + return "0.0.1"; + } + + @Override + public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo iViolationInfo) + { + if (GetState() == GameState.Prepare) + { + return false; + } + return true; + } + + @EventHandler + public void on(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().equals("/uhcentities")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + for (Entity entity : event.getPlayer().getNearbyEntities(5.0, 5.0, 5.0)) + { + net.minecraft.server.v1_8_R3.Entity nms = ((CraftEntity) entity).getHandle(); + String debug = "Entity: " + entity.getType() + " id:" + nms.getId() + " inac:" + ActivationRange.checkIfActive(nms); + debug += " at:" + nms.activatedTick + " dac:" + nms.defaultActivationState; + + int x = MathHelper.floor(nms.locX); + int z = MathHelper.floor(nms.locZ); + + net.minecraft.server.v1_8_R3.Chunk chunk = nms.world.getChunkIfLoaded(x >> 4, z >> 4); + debug += " c:" + chunk + " il:" + (chunk != null ? chunk.areNeighborsLoaded(1) : "null"); + event.getPlayer().sendMessage(debug); + } + event.setCancelled(true); + } + } + else if (event.getMessage().equals("/uhcchunk")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + net.minecraft.server.v1_8_R3.Chunk chunk = ((CraftChunk) event.getPlayer().getLocation().getChunk()).getHandle(); + try + { + Field neighbors = chunk.getClass().getDeclaredField("neighbors"); + neighbors.setAccessible(true); + int n = neighbors.getInt(chunk); + + for (int x = -1; x < 2; x++) + { + for (int z = -1; z < 2; z++) + { + if (x == 0 && z == 0) + { + continue; + } + + int mask = 0x1 << (x * 5 + z + 12); + + boolean should = chunk.world.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z) != null; + boolean is = (n & mask) == mask; + if (is && should) + { + event.getPlayer().sendMessage(ChatColor.GREEN + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is a neighbor"); + } + else if (is && !should) + { + event.getPlayer().sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is a neighbor but should not be"); + } + else if (!is && should) + { + event.getPlayer().sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is not a neighbor but should be"); + } + else if (!is && !should) + { + event.getPlayer().sendMessage(ChatColor.GREEN + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") is not a neighbor"); + } + } + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + event.setCancelled(true); + } + } + else if (event.getMessage().equals("/uhcgc")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + System.gc(); + event.getPlayer().sendMessage("Cleaned up"); + event.setCancelled(true); + } + } + else if (event.getMessage().equals("/uhcallchunks")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + for (Chunk chunk : ((CraftWorld) event.getPlayer().getWorld()).getHandle().chunkProviderServer.chunks.values()) + { + try + { + Field neighbors = chunk.getClass().getDeclaredField("neighbors"); + neighbors.setAccessible(true); + int n = neighbors.getInt(chunk); + + for (int x = -1; x < 2; x++) + { + for (int z = -1; z < 2; z++) + { + if (x == 0 && z == 0) + { + continue; + } + + int mask = 0x1 << (x * 5 + z + 12); + + boolean should = chunk.world.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z) != null; + boolean is = (n & mask) == mask; + if (is && !should) + { + event.getPlayer().sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") relative to " + (chunk.locX) + "," + chunk.locZ + " is a neighbor but should not be"); + } + else if (!is && should) + { + event.getPlayer().sendMessage(ChatColor.RED + "Chunk " + (chunk.locX + x) + "," + (chunk.locZ + z) + " (" + x + "," + z + ") relative to " + (chunk.locX) + "," + chunk.locZ + " is not a neighbor but should be"); + } + } + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + event.getPlayer().sendMessage("Done"); + event.setCancelled(true); + } + } + else if (event.getMessage().equals("/uhcworlds")) + { + CoreClient client = getArcadeManager().GetClients().Get(event.getPlayer()); + if (client.GetRank().has(Rank.DEVELOPER)) + { + MinecraftServer minecraftServer = MinecraftServer.getServer(); + + int nms = minecraftServer.worlds.size(); + int bukkit = Bukkit.getWorlds().size(); + + if (nms != bukkit) + { + event.getPlayer().sendMessage(ChatColor.RED + "Bukkit and NMS world counts don't match: " + nms + " vs " + bukkit); + } + + for (org.bukkit.World world : Bukkit.getWorlds()) + { + WorldServer worldServer = ((CraftWorld) world).getHandle(); + event.getPlayer().sendMessage("Bukkit world: " + worldServer.getWorldData().getName() + " loaded chunks: " + worldServer.chunkProviderServer.chunks.size() + " saving: " + worldServer.savingDisabled + " unload queue: " + worldServer.chunkProviderServer.unloadQueue.size()); + } + + for (WorldServer worldServer : minecraftServer.worlds) + { + event.getPlayer().sendMessage("NMS world: " + worldServer.getWorldData().getName() + " loaded chunks: " + worldServer.chunkProviderServer.chunks.size() + " saving: " + worldServer.savingDisabled + " unload queue: " + worldServer.chunkProviderServer.unloadQueue.size()); + } + + event.setCancelled(true); + } + } + } + @EventHandler(priority = EventPriority.MONITOR) public void xrayBlockBreak(BlockBreakEvent event) { @@ -2132,197 +1913,4 @@ public class UHC extends TeamGame implements NCPHook { } - - public boolean isMapLoaded() - { - return _mapLoaded && areSpawnsGenerated(); - } - - public String getMapLoadPercent() - { - return (int) (_mapLoadPercent * 100) + "%"; - } - - public String getSpawnGenPercent() - { - return UtilMath.clamp((int) ((actual.get() * 1.0 / expected.get()) * 100), 0, 100) + "%"; - } - - public String getObjectiveName(boolean _colorTick) - { - if (!getMapLoadPercent().equals("100%")) - { - return getMapLoadPercent() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Map"; - } - else - { - return getSpawnGenPercent() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Spawns"; - } - } - - public String getMapLoadETA() - { - int chunksToGo = _chunkTotal - _chunksLoaded; - - return UtilTime.MakeStr((long) ((double) chunksToGo / (double) (_chunksPerTick * 20) * 1000d), 1); - } - - @EventHandler(priority = EventPriority.HIGH) - public void teamSelectInteract(PlayerInteractEntityEvent event) - { - if (GetState() != GameState.Recruit) - return; - - if (event.getRightClicked() == null) - return; - - if (!(event.getRightClicked() instanceof Player)) - return; - - Player player = event.getPlayer(); - - //Observer - if (Manager.IsObserver(player)) - { - UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); - return; - } - - selectTeamMate(player, (Player) event.getRightClicked()); - } - - @EventHandler - public void teamSelectCommand(PlayerCommandPreprocessEvent event) - { - if (GetState() != GameState.Recruit) - return; - - if (!event.getMessage().toLowerCase().startsWith("/team ")) - return; - - event.setCancelled(true); - - Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true); - if (target == null) - return; - - //Observer - if (Manager.IsObserver(event.getPlayer())) - { - UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games.")); - return; - } - - if (event.getPlayer().equals(target)) - return; - - selectTeamMate(event.getPlayer(), target); - } - - public void selectTeamMate(Player player, Player ally) - { - //Accept Invite - if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player)) - { - //Remove Prefs - _teamReqs.remove(player); - _teamReqs.remove(ally); - - //Inform - UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!")); - UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!")); - - //Leave Old Teams - if (GetTeam(player) != null) - GetTeam(player).DisbandTeam(); - - if (GetTeam(ally) != null) - GetTeam(ally).DisbandTeam(); - - //Get Team - GameTeam team = getEmptyTeam(); - if (team == null) - return; - - team.setDisplayName(player.getName() + " & " + ally.getName()); - - //Join Team - SetPlayerTeam(player, team, true); - SetPlayerTeam(ally, team, true); - } - //Send Invite - else - { - //Already on Team with Target - if (GetTeam(player) != null) - if (GetTeam(player).HasPlayer(ally)) - return; - - //Inform Player - UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!")); - - //Inform Target - if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false)) - { - UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!")); - UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!")); - } - - //Add Pref - _teamReqs.put(player, ally); - } - } - - @EventHandler - public void teamQuit(PlayerQuitEvent event) - { - if (GetState() != GameState.Recruit) - return; - - Player player = event.getPlayer(); - - if (GetTeam(player) != null) - GetTeam(player).DisbandTeam(); - - Iterator teamIter = _teamReqs.keySet().iterator(); - while (teamIter.hasNext()) - { - Player sender = teamIter.next(); - if (sender.equals(player) || _teamReqs.get(sender).equals(player)) - teamIter.remove(); - } - } - - public GameTeam getEmptyTeam() - { - for (GameTeam team : GetTeamList()) - { - if (team.GetPlayers(false).isEmpty()) - return team; - } - - return null; - } - - @Override - public String getHookName() - { - return "UHC Hook"; - } - - @Override - public String getHookVersion() - { - return "0.0.1"; - } - - @Override - public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo iViolationInfo) - { - if (GetState() == GameState.Prepare) - { - return false; - } - return true; - } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java new file mode 100644 index 000000000..7521c0360 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/ChunkLoadingThread.java @@ -0,0 +1,385 @@ +package nautilus.game.arcade.game.games.uhc.helpers; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.timing.TimingManager; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.uhc.UHC; +import net.minecraft.server.v1_8_R3.Chunk; +import net.minecraft.server.v1_8_R3.ChunkProviderServer; +import net.minecraft.server.v1_8_R3.ChunkRegionLoader; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.WorldServer; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.spigotmc.AsyncCatcher; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import static nautilus.game.arcade.game.games.uhc.UHC.VIEW_DISTANCE; + +public class ChunkLoadingThread extends Thread implements Listener +{ + private Game _game; + + private volatile boolean _isDecorating = false; + private AtomicInteger _actual = new AtomicInteger(); + private AtomicInteger _expected = new AtomicInteger(23000); // Most likely it'll be around 23000 + + private Set _entities = new HashSet<>(); + + public ChunkLoadingThread(Game game) + { + super("Chunk Loader"); + this._game = game; + UtilServer.RegisterEvents(this); + } + + public void run() + { + WorldServer worldServer = ((CraftWorld) _game.WorldData.World).getHandle(); + Location spawn = _game.WorldData.World.getSpawnLocation(); + + Map loaded = new ConcurrentHashMap<>(); + Map compounds = new ConcurrentHashMap<>(); + + try + { + TimingManager.start("UHC Chunk Loading"); + + ChunkProviderServer chunkProviderServer = worldServer.chunkProviderServer; + + Field chunkLoaderField = chunkProviderServer.getClass().getDeclaredField("chunkLoader"); + chunkLoaderField.setAccessible(true); + + ChunkRegionLoader loader = (ChunkRegionLoader) chunkLoaderField.get(chunkProviderServer); + + // Step 1: Read all the required chunks from the disk + // We're going to read all the required chunks from disk async + { + Set coordPairs = new HashSet<>(); + + // Special case for 0, 0 + { + int x = spawn.getBlockX() >> 4; + int z = spawn.getBlockZ() >> 4; + + for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) + { + for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) + { + coordPairs.add(LongHash.toLong(x + dx, z + dz)); + } + } + } + + // All the team spawns + { + for (int i = 0; i < _game.GetTeamList().size(); i++) + { + GameTeam team = _game.GetTeamList().get(i); + for (Location l : team.GetSpawns()) + { + int x = l.getChunk().getX(); + int z = l.getChunk().getZ(); + + for (int dx = -VIEW_DISTANCE; dx <= VIEW_DISTANCE; dx++) + { + for (int dz = -VIEW_DISTANCE; dz <= VIEW_DISTANCE; dz++) + { + coordPairs.add(LongHash.toLong(x + dx, z + dz)); + } + } + } + } + } + + AtomicBoolean lockCompleted = new AtomicBoolean(false); + Object lock = new Object(); + + // Hop back onto the main thread + _game.getArcadeManager().runSync(() -> + { + for (Chunk chunk : new ArrayList<>(chunkProviderServer.chunks.values())) + { + chunk.bukkitChunk.unload(true, false); + } + lockCompleted.set(true); + synchronized(lock) + { + lock.notifyAll(); + } + }); + if (!lockCompleted.get()) + { + synchronized (lock) + { + lock.wait(); + } + } + if (!lockCompleted.get()) + { + throw new IllegalStateException("Lock was not completed"); + } + + + // Sigh... I don't want this to be here but it needs to be set somewhere... + // Multiply by 3 because there are 3 stages + _expected.set(coordPairs.size() * 3); + + // Load them now + ExecutorService chunkLoaders = Executors.newFixedThreadPool(UHC.THREADS_FOR_CHUNK_LOADING); + + for (long coord : coordPairs) + { + chunkLoaders.submit(() -> + { + int x = LongHash.msw(coord); + int z = LongHash.lsw(coord); + try + { + Object[] data = loader.loadChunk(worldServer, x, z); + if (data != null) + { + NBTTagCompound compound = (NBTTagCompound) data[1]; + net.minecraft.server.v1_8_R3.Chunk chunk = (net.minecraft.server.v1_8_R3.Chunk) data[0]; + loaded.put(coord, chunk); + compounds.put(coord, compound); + } + else + { + System.out.println("Failed to load chunk " + x + "," + z); + } + } + catch (Throwable t) + { + t.printStackTrace(); + } + finally + { + _actual.getAndIncrement(); + } + }); + } + + chunkLoaders.shutdown(); + + // We've got plenty of time to wait + System.out.println("Finished submitting tasks to executor, waiting..."); + chunkLoaders.awaitTermination(1, TimeUnit.DAYS); + + System.out.println("Loaded: " + loaded.size() + " and coords: " + coordPairs.size()); + coordPairs.clear(); + } + + // Step 2: Recreate structures, update neighbors, load entities + // This step should be super quick so there's no point in scheduling it elsewhere + // Code is plain copypasted from ChunkIOProvider + { + for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) + { + NBTTagCompound compound = compounds.get(LongHash.toLong(chunk.locX, chunk.locZ)); + loader.loadEntities(chunk, compound.getCompound("Level"), worldServer); + chunk.setLastSaved(chunkProviderServer.world.getTime()); + if (chunkProviderServer.chunkProvider != null) + { + chunkProviderServer.chunkProvider.recreateStructures(chunk, chunk.locX, chunk.locZ); + } + + for (int x = -2; x < 3; ++x) + { + for (int z = -2; z < 3; ++z) + { + if (x != 0 || z != 0) + { + net.minecraft.server.v1_8_R3.Chunk neighbor = loaded.get(LongHash.toLong(chunk.locX + x, chunk.locZ + z)); + if (neighbor != null) + { + neighbor.setNeighborLoaded(-x, -z); + chunk.setNeighborLoaded(x, z); + } + } + } + } + _actual.getAndIncrement(); + } + } + + AtomicBoolean lockCompleted = new AtomicBoolean(false); + Object lock = new Object(); + + // Hop back onto the main thread + _game.getArcadeManager().runSync(() -> + { + // We want to add all the chunks to the chunkmap so that the server is not out of sync + for (Map.Entry ent : loaded.entrySet()) + { + ent.getValue().addEntities(); + chunkProviderServer.chunks.put(ent.getKey(), ent.getValue()); + ChunkLoadEvent event = new ChunkLoadEvent(ent.getValue().bukkitChunk, true); + UtilServer.CallEvent(event); + } + lockCompleted.set(true); + synchronized (lock) + { + lock.notifyAll(); + } + }); + + if (!lockCompleted.get()) + { + synchronized (lock) + { + lock.wait(); + } + } + if (!lockCompleted.get()) + { + throw new IllegalStateException("Lock was not completed"); + } + + + // Step 3: Decorate the chunks. This step must be performed async as otherwise the server lags way too hard + // Notes: Do not allow the server to tick the world. If this is allowed EntityTracker will raise CME + // NextTickList will also raise errors + // And worst case the server will crash + { + // Live life on the edge + AsyncCatcher.enabled = false; + _isDecorating = true; + int ct = 0; + for (net.minecraft.server.v1_8_R3.Chunk chunk : loaded.values()) + { + chunk.loadNearby(chunkProviderServer, chunkProviderServer, chunk.locX, chunk.locZ); + ct++; + if (ct % 100 == 0) + { + System.out.println(ct); + } + _actual.getAndIncrement(); + } + + TimingManager.stop("UHC Chunk Loading"); + _isDecorating = false; + AsyncCatcher.enabled = true; + + System.out.println("Expected: " + _expected.get() + ", actual: " + _actual.get()); + + _game.getArcadeManager().runSync(() -> + { + + for (Chunk chunk : chunkProviderServer.chunks.values()) + { + // Clear + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { + if (x == 0 && z == 0) { + continue; + } + chunk.setNeighborUnloaded(x, z); + } + } + } + + for (Chunk chunk : chunkProviderServer.chunks.values()) + { + // Refresh + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { + if (x == 0 && z == 0) { + continue; + } + + Chunk neighbor = chunkProviderServer.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z); + if (neighbor != null) { + neighbor.setNeighborLoaded(-x, -z); + chunk.setNeighborLoaded(x, z); + } + } + } + } + + for (net.minecraft.server.v1_8_R3.Entity entity : _entities) + { + entity.dead = false; + worldServer.addEntity(entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN); + } + + _entities.clear(); + + // You may tick again + worldServer.getMinecraftServer().worlds.add(worldServer); + + // Well, if they're not equal, not much we can do. We've hit the end + _actual.set(_expected.get()); + }); + } + + loaded.clear(); + compounds.clear(); + + UtilServer.Unregister(this); + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + + @EventHandler + public void on(EntitySpawnEvent event) + { + // Don't allow entity spawns while decorating, period + if (_isDecorating) + { + if (event.getLocation().getWorld().getUID() == _game.WorldData.World.getUID()) + { + _entities.add(((CraftEntity) event.getEntity()).getHandle()); + event.setCancelled(true); + } + } + } + + public void flagDone() + { + _actual.set(_expected.get()); + } + + public boolean isDone() + { + return _actual.get() == _expected.get(); + } + + public int getPercentageComplete() + { + return UtilMath.clamp((int) ((_actual.get() * 1.0 / _expected.get()) * 100), 0, 100); + } + + public String getProgress() + { + return getPercentageComplete() + "%"; + } + + public void flagStop() + { + this.interrupt(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java new file mode 100644 index 000000000..39012869c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/helpers/WorldGenThread.java @@ -0,0 +1,239 @@ +package nautilus.game.arcade.game.games.uhc.helpers; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.timing.TimingManager; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.uhc.UHC; +import net.minecraft.server.v1_8_R3.BiomeCache; +import net.minecraft.server.v1_8_R3.ChunkProviderServer; +import net.minecraft.server.v1_8_R3.FileIOThread; +import net.minecraft.server.v1_8_R3.IChunkProvider; +import net.minecraft.server.v1_8_R3.MinecraftServer; +import net.minecraft.server.v1_8_R3.WorldChunkManager; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.util.LongHash; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +public class WorldGenThread extends Thread +{ + private UHC _game; + + private volatile boolean _mapLoaded = false; + private volatile int _chunksPerTick = 1; + private volatile boolean _stopGen = false; + + private int _chunkTotal; + private int _chunkX = 0; + private int _chunkZ = 0; + private int _chunksLoaded = 0; + + private int _currentBorder = 1000; + + + public WorldGenThread(UHC game) + { + super("WorldGen Thread"); + this._game = game; + + + _chunkX = (int) -(_currentBorder / 16); + _chunkZ = (int) -(_currentBorder / 16); + _chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16)); + } + + public void run() + { + try + { + Field fileIOThreadB = FileIOThread.class.getDeclaredField("b"); + fileIOThreadB.setAccessible(true); + + // This list is the list of chunks to be saved on the File IO Thread + List list = (List) fileIOThreadB.get(FileIOThread.a()); + + net.minecraft.server.v1_8_R3.WorldServer worldServer = ((CraftWorld) _game.WorldData.World).getHandle(); + + WorldChunkManager manager = worldServer.getWorldChunkManager(); + + Field biomeCacheField = manager.getClass().getDeclaredField("d"); + biomeCacheField.setAccessible(true); + + // A thread safe BiomeCache + // The implementation is literally a copy/paste from the original BiomeCache, but with some synchronization + // Reason being while the server is ticking the world (for some reason, if you want to dig through the entire Arcade codebase go for it) + // it stores stuff in the BiomeCache, and chunk gen needs that BiomeCache info too + // Causing desynchronization in the cache + biomeCacheField.set(manager, new BiomeCache(manager) + { + private final Object _lock = new Object(); + + private long _lastCleanTime; // b -> _lastCleanTime + private Map _blockByCoord = new HashMap<>(); // LongHashMap -> HashMap, c -> _blockByCoord + private List _blocks = new ArrayList<>(); // d -> _blocks + + @Override + public BiomeCache.BiomeCacheBlock a(int x, int z) + { + x >>= 4; + z >>= 4; + long var3 = hash(x, z); + BiomeCache.BiomeCacheBlock var5 = this._blockByCoord.get(var3); + if (var5 == null) + { + var5 = new BiomeCache.BiomeCacheBlock(x, z); + synchronized (_lock) + { + this._blockByCoord.put(var3, var5); + this._blocks.add(var5); + } + } + + var5.e = MinecraftServer.az(); + return var5; + } + + @Override + public void a() + { + long currentTime = MinecraftServer.az(); + long deltaTime = currentTime - this._lastCleanTime; + if (deltaTime > 7500L || deltaTime < 0L) + { + this._lastCleanTime = currentTime; + + synchronized (_lock) + { + for (int i = 0; i < this._blocks.size(); ++i) + { + BiomeCache.BiomeCacheBlock biomeCacheBlock = (BiomeCache.BiomeCacheBlock) this._blocks.get(i); + long var7 = currentTime - biomeCacheBlock.e; + if (var7 > 30000L || var7 < 0L) + { + this._blocks.remove(i--); + this._blockByCoord.remove(hash(biomeCacheBlock.c, biomeCacheBlock.d)); + } + } + } + } + } + + private long hash(int x, int z) + { + return (long) x & 4294967295L | ((long) z & 4294967295L) << 32; + } + }); + + ChunkProviderServer cps = worldServer.chunkProviderServer; + IChunkProvider icp = cps.chunkProvider; + System.out.println("Using chunk provider " + icp.getClass()); + + TimingManager.start("Map Generation"); + + long start = System.currentTimeMillis(); + long last = start; + + while (!_stopGen) + { + long now = System.currentTimeMillis(); + if ((now - last) >= 10 * 1000) + { + _game.Announce(C.cGreen + C.Bold + "Generating Map: " + C.cWhite + getMapLoadETA() + " Remaining...", false); + last = now; + } + + long hash = LongHash.toLong(_chunkX, _chunkZ); + + // This is just a shortcut to how the Minecraft server would have generated a chunk if it doesn't exist. + // This should always create a chunk because we're not loading any chunks beforehand... + // /me looks at new maintainer + net.minecraft.server.v1_8_R3.Chunk chunk = icp.getOrCreateChunk(_chunkX, _chunkZ); + + // Run the copypasted code for chunk saving. + cps.saveChunk(chunk); + cps.saveChunkNOP(chunk); + cps.unloadQueue.remove(_chunkX, _chunkZ); + cps.chunks.remove(hash); + + if (_chunkX < _currentBorder / 16) + { + _chunkX++; + } + else if (_chunkZ < _currentBorder / 16) + { + _chunkX = (int) -(_currentBorder / 16); + _chunkZ++; + } + else + { + _mapLoaded = true; + System.out.println("Map Loading Finished! Took " + TimeUnit.MILLISECONDS.toSeconds(now - start) + " seconds"); + break; + } + + _chunksLoaded++; + + _chunksPerTick = (int) (_chunksLoaded / ((now - start) / 50.0)); + } + + TimingManager.stop("Map Generation"); + + if (_stopGen) + { + return; + } + + TimingManager.start("Map Saving"); + + // Wait for all the chunks to save (but do we need this?) + while (!list.isEmpty()) + { + Thread.sleep(100); + } + + TimingManager.stop("Map Saving"); + + _game.getArcadeManager().runSync(_game::generateSpawns); + } + catch (Throwable t) + { + // todo proper exception handling + // maybe force shutdown? + t.printStackTrace(); + } + } + + public void flagStop() + { + this._stopGen = true; + } + + public String getMapLoadETA() + { + int chunksToGo = _chunkTotal - _chunksLoaded; + + return UtilTime.MakeStr((long) ((double) chunksToGo / (double) (_chunksPerTick * 20) * 1000d), 1); + } + + public boolean isMapLoaded() + { + return this._mapLoaded; + } + + public int getPercentageComplete() + { + return UtilMath.clamp((int) ((_chunksLoaded * 1.0 / _chunkTotal) * 100), 0, 100); + } + + public String getProgress() + { + return getPercentageComplete() + "%"; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java new file mode 100644 index 000000000..0279e0da6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/Module.java @@ -0,0 +1,29 @@ +package nautilus.game.arcade.game.modules; + +import nautilus.game.arcade.game.Game; +import org.bukkit.event.Listener; + +public abstract class Module implements Listener +{ + // The game this module belongs to + private Game _game; + + public void initialize(Game game) + { + if (_game != null) + { + throw new IllegalArgumentException("Attempting to initialize module which has already been initialized for " + _game); + } + this._game = game; + } + + public void cleanup() + { + + } + + public Game getGame() + { + return this._game; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamModule.java new file mode 100644 index 000000000..60fb19d7d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/TeamModule.java @@ -0,0 +1,164 @@ +package nautilus.game.arcade.game.modules; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.GameTeam; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import java.util.UUID; + +public class TeamModule extends Module +{ + private BiMap _teamReqs = HashBiMap.create(); + + @EventHandler(priority = EventPriority.HIGH) + public void teamSelectInteract(PlayerInteractEntityEvent event) + { + if (getGame().GetState() != Game.GameState.Recruit) + return; + + if (event.getRightClicked() == null) + return; + + if (!(event.getRightClicked() instanceof Player)) + return; + + Player player = event.getPlayer(); + + //Observer + if (getGame().getArcadeManager().IsObserver(player)) + { + UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); + return; + } + + selectTeamMate(player, (Player) event.getRightClicked()); + } + + @EventHandler + public void teamSelectCommand(PlayerCommandPreprocessEvent event) + { + if (!event.getMessage().toLowerCase().startsWith("/team ")) + return; + + event.setCancelled(true); + + if (getGame().GetState() != Game.GameState.Recruit) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot send team requests while the game is live")); + return; + } + + //Observer + if (getGame().getArcadeManager().IsObserver(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games.")); + return; + } + + Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true); + + if (target == null) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "That player is not online")); + return; + } + + if (event.getPlayer().equals(target)) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You can't team with yourself!")); + return; + } + + selectTeamMate(event.getPlayer(), target); + } + + private void selectTeamMate(Player player, Player ally) + { + //Accept Invite + if (_teamReqs.containsKey(ally.getUniqueId()) && _teamReqs.get(ally.getUniqueId()).equals(player.getUniqueId())) + { + //Remove Prefs + _teamReqs.remove(player.getUniqueId()); + _teamReqs.remove(ally.getUniqueId()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!")); + UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!")); + + //Leave Old Teams + if (getGame().GetTeam(player) != null) + getGame().GetTeam(player).DisbandTeam(); + + if (getGame().GetTeam(ally) != null) + getGame().GetTeam(ally).DisbandTeam(); + + //Get Team + GameTeam team = getEmptyTeam(); + if (team == null) + return; + + team.setDisplayName(player.getName() + " & " + ally.getName()); + + //Join Team + getGame().SetPlayerTeam(player, team, true); + getGame().SetPlayerTeam(ally, team, true); + } + //Send Invite + else + { + //Already on Team with Target + if (getGame().GetTeam(player) != null) + if (getGame().GetTeam(player).HasPlayer(ally)) + return; + + //Inform Player + UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!")); + + //Inform Target + if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false)) + { + UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!")); + UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!")); + } + + //Add Pref + _teamReqs.put(player.getUniqueId(), ally.getUniqueId()); + } + } + + @EventHandler + public void teamQuit(PlayerQuitEvent event) + { + if (getGame().GetState() != Game.GameState.Recruit) + return; + + Player player = event.getPlayer(); + + if (getGame().GetTeam(player) != null) + getGame().GetTeam(player).DisbandTeam(); + + _teamReqs.remove(player.getUniqueId()); + _teamReqs.inverse().remove(player.getUniqueId()); + } + + private GameTeam getEmptyTeam() + { + for (GameTeam team : getGame().GetTeamList()) + { + if (team.GetPlayers(false).isEmpty()) + return team; + } + + return null; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java index d2f170f5f..c1f189998 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java @@ -41,18 +41,7 @@ public class SpectatorButton implements IButton if(clickType == ClickType.RIGHT) { _player.closeInventory(); - _player.teleport(_target.getLocation().add(0, 1, 0)); - _arcadeManager.runSyncLater(new Runnable() - { - @Override - public void run() - { - _player.setGameMode(GameMode.SPECTATOR); - _player.setSpectatorTarget(_target); - UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(_target.getName()), player); - UtilPlayer.message(_player, F.main("Game", "Sneak to stop spectating")); - } - }, 3); + _arcadeManager.getGameSpectatorManager().setSpectating(_player, _target); } else { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index 2de25542c..8a80e2dcf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -105,6 +105,7 @@ public class GameCreationManager implements Listener { Game game = gameIterator.next(); + game.cleanupModules(); game.disable(); HandlerList.unregisterAll(game); 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 ae8e4157e..87c345881 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 @@ -948,7 +948,8 @@ public class GameLobbyManager implements Listener public void Combust(EntityCombustEvent event) { for (LobbyEnt ent : _kits.values()) - if (event.getEntity().equals(ent.GetEnt())) + if (event.getEntity().getWorld().getUID().equals(ent.GetEnt().getWorld().getUID()) && + event.getEntity().equals(ent.GetEnt())) { event.setCancelled(true); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java index b067a806d..defc9f325 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java @@ -1,8 +1,22 @@ package nautilus.game.arcade.managers; +import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import java.util.UUID; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketInfo; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.NetworkManager; +import net.minecraft.server.v1_8_R3.PacketPlayOutCamera; +import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.WorldSettings; import org.bukkit.GameMode; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -10,6 +24,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; @@ -26,8 +41,10 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; -public class GameSpectatorManager implements Listener +public class GameSpectatorManager implements Listener, IPacketHandler { + private Set _pendingSpectate = Collections.synchronizedSet(new HashSet<>()); + ArcadeManager Manager; public GameSpectatorManager(ArcadeManager manager) @@ -35,11 +52,13 @@ public class GameSpectatorManager implements Listener Manager = manager; Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); + + Manager.getPacketHandler().addPacketHandler(this, PacketHandler.ListenerPriority.HIGH, PacketPlayOutNamedEntitySpawn.class); } - + @EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) public void interactCancel(PlayerInteractEvent event) - { + { if (Manager.GetGame() == null) return; @@ -47,30 +66,30 @@ public class GameSpectatorManager implements Listener if (!Manager.GetGame().IsAlive(player)) event.setCancelled(true); - + processClick(player, event.getAction()); } - + public void processClick(Player player, Action action) { if (Manager.GetGame() == null) return; - + if(!Manager.GetGame().AllowEntitySpectate) return; - + if(!Manager.GetGame().IsLive()) return; - + if(player.getGameMode() != GameMode.SPECTATOR) return; - + if(player.getSpectatorTarget() == null) return; - + if(!(player.getSpectatorTarget() instanceof Player)) return; - + List players = Manager.GetGame().GetPlayers(true); int currentPlayer = 0; for(Player otherPlayer : players) @@ -79,32 +98,32 @@ public class GameSpectatorManager implements Listener if(((Player) player.getSpectatorTarget()) == otherPlayer) break; } - + if(action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) currentPlayer = currentPlayer - 2; else return; - + if(currentPlayer < 0) currentPlayer = players.size() - 1; - + if(currentPlayer >= players.size()) currentPlayer = 0; - + if(players.get(currentPlayer) == null) return; - + Player specPlayer = players.get(currentPlayer); - + setSpectating(player, specPlayer); } - + @EventHandler(priority = EventPriority.LOW) public void interactEntityCancel(PlayerInteractEntityEvent event) { if (Manager.GetGame() == null) return; - + Player player = event.getPlayer(); if (Manager.GetGame().GetState() == GameState.Recruit) @@ -114,7 +133,7 @@ public class GameSpectatorManager implements Listener return; } } - + if (!Manager.GetGame().IsAlive(player)) { event.setCancelled(true); @@ -127,7 +146,7 @@ public class GameSpectatorManager implements Listener } } } - + @EventHandler public void updateSpecEntitys(UpdateEvent event) { @@ -136,7 +155,7 @@ public class GameSpectatorManager implements Listener if(Manager.GetGame() == null) return; - + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) { if(Manager.GetGame().AllowEntitySpectate) @@ -158,13 +177,13 @@ public class GameSpectatorManager implements Listener } } } - + @EventHandler(priority = EventPriority.LOW) public void spectatedEntityDeath(PlayerDeathEvent event) { if(Manager.GetGame() == null) return; - + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) { if(Manager.GetGame().AllowEntitySpectate) @@ -191,13 +210,13 @@ public class GameSpectatorManager implements Listener } } } - + @EventHandler(priority = EventPriority.LOW) public void dismountEntity(PlayerToggleSneakEvent event) { if(Manager.GetGame() == null) return; - + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) { if(Manager.GetGame().AllowEntitySpectate) @@ -213,41 +232,53 @@ public class GameSpectatorManager implements Listener } } } - - private void setSpectating(Player player, Entity target) - { - player.setGameMode(GameMode.SURVIVAL); - player.teleport(target.getLocation().add(0, 1, 0)); - player.getInventory().setHeldItemSlot(5); - Manager.runSyncLater(new Runnable() - { - @Override - public void run() - { - if (Manager.GetGame().IsAlive(player)) - return; - Player ptarget = null; - if (target instanceof Player) - ptarget = (Player) target; - - if (ptarget != null) - { - if (!Manager.GetGame().IsAlive(ptarget)) - return; - } - - player.setGameMode(GameMode.SPECTATOR); - player.setSpectatorTarget(target); - - if (ptarget != null) - UtilTextBottom.display(C.cGray + "You are spectating " + F.elem(Manager.GetGame().GetTeam(ptarget).GetColor() + ptarget.getName()) + ".", player); - - UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating.")); + public void setSpectating(Player player, Entity target) + { + if (Manager.GetGame().IsAlive(player)) + { + return; + } + + Player playerTarget = null; + + if (target instanceof Player) + { + playerTarget = (Player) target; + if (!Manager.GetGame().IsAlive(playerTarget)) + { + return; } - }, 1); + } + + _pendingSpectate.add(target.getUniqueId()); + + player.teleport(target.getLocation().add(0, 1, 0)); + + // If the player already has the entity loaded, we have to set it now + + // todo + // In the future, we could do some really cool stuff where we listen to all incoming and outgoing + // spawn/destroy packets and track whether the client has loaded the entity in memory + // However, that approach has the risk of desynchronization at which point we're screwed + player.setGameMode(GameMode.SPECTATOR); + player.setSpectatorTarget(target); + + if (playerTarget != null) + UtilTextBottom.display(C.cGray + "You are spectating " + F.elem(Manager.GetGame().GetTeam(playerTarget).GetColor() + playerTarget.getName()) + ".", player); + + UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating.")); + + // And if the player did have the entity loaded, we also need to clean up after ourselves + // 20 ticks should be more than enough time considering we're just waiting for the server to attempt to + // send the packet + // and even if the server was lagging, the scheduler should be lagging too + Manager.runSyncLater(() -> + { + _pendingSpectate.remove(target.getUniqueId()); + }, 20L); } - + @EventHandler(priority = EventPriority.LOW) public void vehicleDamage(VehicleDamageEvent event) { @@ -256,10 +287,57 @@ public class GameSpectatorManager implements Listener if (!(event.getAttacker() instanceof Player)) return; - + Player player = (Player)event.getAttacker(); if (!Manager.GetGame().IsAlive(player)) event.setCancelled(true); } + + @Override + public void handle(PacketInfo packetInfo) + { + if (packetInfo.getPacket() instanceof PacketPlayOutNamedEntitySpawn) + { + PacketPlayOutNamedEntitySpawn packet = (PacketPlayOutNamedEntitySpawn) packetInfo.getPacket(); + if (_pendingSpectate.remove(packet.b)) + { + // Handle Minestrike spam race condition + if (Manager.GetGame().IsAlive(packetInfo.getPlayer())) + { + return; + } + + packetInfo.setCancelled(true); + + EntityPlayer ep = ((CraftPlayer) packetInfo.getPlayer()).getHandle(); + NetworkManager manager = ep.playerConnection.networkManager; + + manager.a(packet, future -> + { + Manager.runSync(() -> + { + PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(packetInfo.getPlayer(), GameMode.SPECTATOR); + UtilServer.CallEvent(event); + if(event.isCancelled()) { + return; + } + + ep.playerInteractManager.setGameMode(WorldSettings.EnumGamemode.getById(GameMode.SPECTATOR.getValue())); + ep.fallDistance = 0.0F; + manager.a(new PacketPlayOutCamera(ep), future1 -> + { + manager.a(new PacketPlayOutGameStateChange(3, (float)GameMode.SPECTATOR.getValue()), future2 -> + { + PacketPlayOutCamera p1 = new PacketPlayOutCamera(); + p1.a = packet.a; + manager.handle(p1); + }); + + }); + }); + }); + } + } + } } From 443576ba1a6ec933ab46e5d9e8b9875ff5a7b257 Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 6 Jul 2016 20:15:41 -0500 Subject: [PATCH 111/115] Update YouTube link and send shard reward message --- .../core/bonuses/gui/buttons/YoutubeButton.java | 2 +- .../src/mineplex/core/youtube/YoutubeManager.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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 index 475871234..bddc4081b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java @@ -71,7 +71,7 @@ public class YoutubeButton implements GuiItem message = "Click here to visit our YouTube page!"; } - new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/mineplexgamesofficial").sendToPlayer(_player); + new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/embed/RW3sOmkiEG-A?list=UU1MtBclG_aHPd0nLmUupCKg&controls=0&showinfo=0").sendToPlayer(_player); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java index 01dc0f954..5683c4b20 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/youtube/YoutubeManager.java @@ -2,7 +2,10 @@ package mineplex.core.youtube; import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.donation.DonationManager; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -14,6 +17,7 @@ import java.time.ZonedDateTime; public class YoutubeManager extends MiniDbClientPlugin { + private static final int REWARD_MESSAGE_DELAY_SECONDS = 30; private final YoutubeRepository _repository; private final DonationManager _donationManager; @@ -48,7 +52,11 @@ public class YoutubeManager extends MiniDbClientPlugin } YoutubeClient client = Get(player); client.setClickDate(ZonedDateTime.now(ZoneOffset.UTC).toLocalDate()); - _repository.attemptYoutube(player, client, () -> _donationManager.RewardCoinsLater("YouTube", player, 250)); + _repository.attemptYoutube(player, client, () -> + { + _donationManager.RewardCoinsLater("YouTube", player, 250); + Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the YouTube video")), REWARD_MESSAGE_DELAY_SECONDS * 20L); + }); } @Override From e8a1c9bcba240c69868613d8ca6ea1d0cc648b49 Mon Sep 17 00:00:00 2001 From: Alex-The-Coder Date: Fri, 8 Jul 2016 07:42:00 -0400 Subject: [PATCH 112/115] Add damage check to the Enchantment Handler... ...to avoid performing calculations where it is not necessary --- .../mineplex/minecraft/game/core/damage/DamageManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index b1276bdc9..dbd552deb 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -378,6 +378,10 @@ public class DamageManager extends MiniPlugin Player damagee = event.GetDamageePlayer(); if (damagee != null) { + if (event.GetDamage() <= 0) + { + return; + } if (getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()) > 0) { event.AddMult("Ench Prot", damagee.getName(), getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()), false); From 5b98bfddce07e04533e1e4b403a57028b2259cc4 Mon Sep 17 00:00:00 2001 From: cnr Date: Fri, 8 Jul 2016 15:09:48 -0500 Subject: [PATCH 113/115] Update YouTube link to landing + sub confirmation --- .../src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index bddc4081b..dd741b450 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/YoutubeButton.java @@ -71,7 +71,7 @@ public class YoutubeButton implements GuiItem message = "Click here to visit our YouTube page!"; } - new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/embed/RW3sOmkiEG-A?list=UU1MtBclG_aHPd0nLmUupCKg&controls=0&showinfo=0").sendToPlayer(_player); + new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player); } @Override From 96d16be5b7365bec86189b7ace2454e0ecfca78c Mon Sep 17 00:00:00 2001 From: xGamingDudex Date: Mon, 27 Jun 2016 01:35:30 +0200 Subject: [PATCH 114/115] Fixed PC-706 Tweaked settings to reasonable values in local testing. --- .../game/core/damage/DamageManager.java | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index dbd552deb..6a8c7db09 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -8,24 +8,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.npc.NpcManager; -import mineplex.minecraft.game.core.combat.CombatManager; -import mineplex.minecraft.game.core.condition.ConditionManager; -import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; -import net.minecraft.server.v1_8_R3.DamageSource; -import net.minecraft.server.v1_8_R3.EntityHuman; -import net.minecraft.server.v1_8_R3.EntityLiving; - +import org.bukkit.Bukkit; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Location; @@ -48,6 +31,24 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.npc.NpcManager; +import mineplex.minecraft.game.core.combat.CombatManager; +import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; +import net.minecraft.server.v1_8_R3.DamageSource; +import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityLiving; + public class DamageManager extends MiniPlugin { private CombatManager _combatManager; @@ -517,14 +518,20 @@ public class DamageManager extends MiniPlugin origin = event.GetDamagerEntity(true).getLocation(); if (event.getKnockbackOrigin() != null) origin = event.getKnockbackOrigin(); - else if (event.GetProjectile() != null) - origin = event.GetProjectile().getLocation(); //Vec Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation()); trajectory.multiply(0.6 * knockback); trajectory.setY(Math.abs(trajectory.getY())); - + + if(event.GetProjectile() != null && event.getKnockbackOrigin() == null) + { + trajectory = event.GetProjectile().getVelocity(); + trajectory.setY(0); + trajectory.multiply(0.6 * knockback / trajectory.length()); + trajectory.setY(0.5); + } + //Apply double vel = 0.2 + trajectory.length() * 0.8; From b8650d741d9814e4b46c00b5a464fc7260619c9a Mon Sep 17 00:00:00 2001 From: xGamingDudex Date: Mon, 27 Jun 2016 22:38:37 +0200 Subject: [PATCH 115/115] Fixed PC-707 Fixed arrows damaging the shooter. Fixed all instances of arrows bouncing of targets. --- .../game/core/damage/CustomDamageEvent.java | 22 ++++++++ .../game/core/damage/DamageManager.java | 50 +++++++++++++++---- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java index 8f2788e66..ec3781d43 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -44,6 +44,7 @@ public class CustomDamageEvent extends Event implements Cancellable private boolean _damageeBrute = false; private boolean _damageToLevel = true; private boolean _arrowShow = true; + private boolean _projectileDamageSelf = false; public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, Location knockbackOrigin, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String initialSource, @@ -169,6 +170,27 @@ public class CustomDamageEvent extends Event implements Cancellable return _projectile; } + public boolean getProjectileDamageSelf() + { + return _projectileDamageSelf; + } + + public void setProjectileDamageSelf(boolean projectileDamageSelf) + { + _projectileDamageSelf = projectileDamageSelf; + if(!projectileDamageSelf) + { + _cancellers.remove("Self Projectile Damage"); + } + else + { + if(!_cancellers.contains("Self Projectile Damage")) + { + _cancellers.add("Self Projectile Damage"); + } + } + } + public void setShowArrows(boolean show) { _arrowShow = show; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index 6a8c7db09..304394625 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -8,7 +8,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import org.bukkit.Bukkit; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Location; @@ -241,18 +240,33 @@ public class DamageManager extends MiniPlugin event.setCancelled(true); } - @EventHandler(priority = EventPriority.HIGHEST) - public void removeDemArrowsCrazyMan(EntityDamageEvent event) + /** + * Removes arrows after hit, especially in cases where arrows may bounce, like if the damage was cancelled. + */ + @EventHandler(priority = EventPriority.MONITOR) + public void removeArrows(EntityDamageEvent event) { - if (event.isCancelled()) - { - Projectile projectile = GetProjectile(event); + Projectile projectile = GetProjectile(event); - if (projectile instanceof Arrow) - { - projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0)); - projectile.remove(); - } + if (projectile instanceof Arrow) + { + projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0)); + projectile.remove(); + } + } + + /** + * Removes arrows after hit, especially in cases where arrows may bounce, like if the damage was cancelled. + */ + @EventHandler(priority = EventPriority.MONITOR) + public void removeArrows(CustomDamageEvent event) + { + Projectile projectile = event.GetProjectile(); + + if (projectile instanceof Arrow) + { + projectile.teleport(new Location(projectile.getWorld(), 0, 0, 0)); + projectile.remove(); } } /* @@ -319,6 +333,12 @@ public class DamageManager extends MiniPlugin event.SetCancelled("0 Health"); return; } + + if (event.GetProjectile() != null && event.GetDamageeEntity().equals(event.GetProjectile().getShooter()) && !event.getProjectileDamageSelf()) + { + event.SetCancelled("Self Projectile Damage"); + return; + } if (event.GetDamageePlayer() != null) { @@ -440,6 +460,8 @@ public class DamageManager extends MiniPlugin Player player = event.GetDamagerPlayer(true); if (player != null) { + if (player.equals(event.GetDamageeEntity()) && !event.getProjectileDamageSelf()) return; + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 0.5f, 0.5f); } } @@ -464,6 +486,11 @@ public class DamageManager extends MiniPlugin if (event.GetDamageeEntity().getHealth() <= 0) return; + if (event.GetProjectile() != null && + event.GetDamageeEntity().equals(event.GetProjectile().getShooter()) && + !event.getProjectileDamageSelf()) + return; + //Player Conditions if (event.GetDamageePlayer() != null) { @@ -524,6 +551,7 @@ public class DamageManager extends MiniPlugin trajectory.multiply(0.6 * knockback); trajectory.setY(Math.abs(trajectory.getY())); + //Special handling for projectiles if(event.GetProjectile() != null && event.getKnockbackOrigin() == null) { trajectory = event.GetProjectile().getVelocity();