From 5bd7a2c89ea8c4e197e871f78437589551625683 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 30 Apr 2018 01:53:30 +0100 Subject: [PATCH] Fix a couple more bugs --- .../core/cosmetic/ui/page/GadgetPage.java | 4 +-- .../cosmetic/ui/page/PowerPlayClubPage.java | 15 +++++++++ .../outfit/windup/OutfitWindupHelmet.java | 5 +++ .../outfit/windup/OutfitWindupSuit.java | 1 - .../core/gadget/set/suits/SetWindup.java | 7 ++-- .../kits/perk/PerkPassiveWoolGain.java | 33 ++++++++++--------- 6 files changed, 43 insertions(+), 22 deletions(-) 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 55fe02078..fc3388c4d 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 @@ -421,7 +421,7 @@ public class GadgetPage extends ShopPageBase ); } - private void toggleGadget(Player player, Gadget gadget) + protected void toggleGadget(Player player, Gadget gadget) { playAcceptSound(player); @@ -435,7 +435,7 @@ public class GadgetPage extends ShopPageBase } } - private void toggleSet(Player player, Gadget gadget) + protected void toggleSet(Player player, Gadget gadget) { GadgetSet set = gadget.getSet(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PowerPlayClubPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PowerPlayClubPage.java index 6c7f97ca2..a0d0188f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PowerPlayClubPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PowerPlayClubPage.java @@ -9,6 +9,7 @@ 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.OutfitGadget; public class PowerPlayClubPage extends GadgetPage { @@ -20,6 +21,20 @@ public class PowerPlayClubPage extends GadgetPage buildPage(); } + @Override + protected void toggleGadget(Player player, Gadget gadget) + { + // This allows us to have one item for the entire suit in the PowerPlayClubPage + if (gadget instanceof OutfitGadget) + { + toggleSet(player, gadget); + } + else + { + super.toggleGadget(player, gadget); + } + } + @Override protected List getGadgetsToDisplay() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windup/OutfitWindupHelmet.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windup/OutfitWindupHelmet.java index 55c1e9de8..5f4f36d24 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windup/OutfitWindupHelmet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windup/OutfitWindupHelmet.java @@ -1,5 +1,8 @@ package mineplex.core.gadget.gadgets.outfit.windup; +import java.time.Month; +import java.time.YearMonth; + import org.bukkit.Material; import mineplex.core.gadget.GadgetManager; @@ -10,5 +13,7 @@ public class OutfitWindupHelmet extends OutfitWindupSuit public OutfitWindupHelmet(GadgetManager manager) { super(manager, "Helmet", ArmorSlot.HELMET, Material.LEATHER_HELMET); + + setPPCYearMonth(YearMonth.of(2018, Month.MAY)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windup/OutfitWindupSuit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windup/OutfitWindupSuit.java index 45ac3eb89..738647347 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windup/OutfitWindupSuit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windup/OutfitWindupSuit.java @@ -28,7 +28,6 @@ class OutfitWindupSuit extends OutfitGadget setDisplayItem(new ItemBuilder(mat) .setColor(SetWindup.COLOUR) .build()); - setPPCYearMonth(YearMonth.of(2018, Month.MAY)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetWindup.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetWindup.java index 654ad7b4b..924d7d4e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetWindup.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/suits/SetWindup.java @@ -172,8 +172,8 @@ public class SetWindup extends GadgetSet Location location = player.getLocation(); data.EffectStart = System.currentTimeMillis(); - player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, EFFECT_TICKS, 9, false, false)); - player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, EFFECT_TICKS, 4, false, false)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, EFFECT_TICKS, 12, false, false)); + player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, EFFECT_TICKS, 6, false, false)); UtilPlayer.removeWorldBorder(player); for (int i = 0; i < 2; i++) @@ -204,9 +204,8 @@ public class SetWindup extends GadgetSet } charge = Math.max(0, charge); - data.Charge = charge; - charge = Math.min(charge, 0.999F); + charge = Math.min(0.999F, charge); if (charge == 0) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/kits/perk/PerkPassiveWoolGain.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/kits/perk/PerkPassiveWoolGain.java index 7ec49f61e..63b72627d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/kits/perk/PerkPassiveWoolGain.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/kits/perk/PerkPassiveWoolGain.java @@ -48,27 +48,30 @@ public class PerkPassiveWoolGain extends Perk return; } - for (Player player : Manager.GetGame().GetPlayers(true)) + for (GameTeam team: Manager.GetGame().GetTeamList()) { - if (UtilPlayer.isSpectator(player) || !hasPerk(player)) + for (Player player : team.GetPlayers(true)) { - continue; - } + if (UtilPlayer.isSpectator(player) || !hasPerk(player)) + { + continue; + } - if (!player.getInventory().contains(Material.WOOL, MAX_WOOL) && Recharge.Instance.use(player, WOOL_NAME, WOOL_RECHARGE, false, false)) - { - ItemStack itemStack = new ItemStack(Material.WOOL, 1, (short) 0, Manager.GetGame().GetTeam(player).GetColorData()); + if (!player.getInventory().contains(Material.WOOL, MAX_WOOL) && Recharge.Instance.use(player, WOOL_NAME, WOOL_RECHARGE, false, false)) + { + ItemStack itemStack = new ItemStack(Material.WOOL, 1, (short) 0, Manager.GetGame().GetTeam(player).GetColorData()); - player.getInventory().addItem(itemStack); - } + player.getInventory().addItem(itemStack); + } - if (!player.getInventory().contains(Material.INK_SACK, MAX_PLATFORMS) && Recharge.Instance.use(player, PLATFORM_NAME, PLATFORM_RECHARGE, false, false)) - { - ItemStack itemStack = new ItemBuilder(PLATFORM_ITEM) - .setData(Manager.GetGame().GetTeam(player).getDyeColor().getDyeData()) - .build(); + if (!UtilInv.contains(player, PLATFORM_ITEM.getType(), team.getDyeColor().getDyeData(), MAX_PLATFORMS) && Recharge.Instance.use(player, PLATFORM_NAME, PLATFORM_RECHARGE, false, false)) + { + ItemStack itemStack = new ItemBuilder(PLATFORM_ITEM) + .setData(team.getDyeColor().getDyeData()) + .build(); - player.getInventory().addItem(itemStack); + player.getInventory().addItem(itemStack); + } } } }