From 45d4e5ce6efea03b64ae80a778728306ea4bdba6 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 25 Dec 2016 16:01:49 -0200 Subject: [PATCH] Added Balloons to the cosmetics menu --- .../mineplex/core/cosmetic/ui/page/Menu.java | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 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 ef27ea645..d05ba05d6 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 @@ -14,9 +14,11 @@ import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilUI; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.button.open.OpenArrowTrails; +import mineplex.core.cosmetic.ui.button.open.OpenBalloons; import mineplex.core.cosmetic.ui.button.open.OpenCostumes; import mineplex.core.cosmetic.ui.button.open.OpenDeathAnimations; import mineplex.core.cosmetic.ui.button.open.OpenDoubleJump; @@ -40,6 +42,11 @@ import mineplex.core.shop.page.ShopPageBase; public class Menu extends ShopPageBase { + + private static final String VISIBILITY_HUB = "Usable in Lobbies"; + private static final String VISIBILITY_EVERYWHERE = "Visible Everywhere"; + private static final String VISIBILITY_GAMES = "Visible in Games"; + public Menu(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { super(plugin, shop, clientManager, donationManager, "Inventory", player); @@ -62,11 +69,11 @@ public class Menu extends ShopPageBase addItem(4, shards); // Cosmetic Items -// int[] slots = UtilUI.getIndicesFor(12, 2); - int particleSlot = 10;//slots[0]; - int arrowSlot = 12;//slots[1]; - int jumpSlot = 14;//slots[2]; - int deathSlot = 16;//slots[3]; + int[] slots = UtilUI.getIndicesFor(15, 2); + /*int particleSlot = 9;//slots[0]; + int arrowSlot = 11;//slots[1]; + int jumpSlot = 13;//slots[2]; + int deathSlot = 15;//slots[3]; int gadgetSlot = 27;//slots[4]; int morphSlot = 29;//slots[5]; int mountSlot = 31;//slots[6]; @@ -76,7 +83,12 @@ public class Menu extends ShopPageBase int musicSlot = 47;//slots[10]; int tauntSlot = 49;//slots[11]; int winEffectSlot = 51; - int gameModifierSlot = 53; + int gameModifierSlot = 53;*/ + int particleSlot = slots[0], arrowSlot = slots[1], jumpSlot = slots[2], + deathSlot = slots[3], gadgetSlot = slots[4], morphSlot = slots[5], + mountSlot = slots[6], petSlot = slots[7], hatSlot = slots[8], + costumeSlot = slots[9], musicSlot = slots[10], tauntSlot = slots[11], + winEffectSlot = slots[12], gameModifierSlot = slots[13], balloonsSlot = slots[14]; EnumMap ownedCount = new EnumMap(GadgetType.class); EnumMap maxCount = new EnumMap(GadgetType.class); @@ -133,74 +145,79 @@ public class Menu extends ShopPageBase 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)); + String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", VISIBILITY_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.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)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", VISIBILITY_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.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)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", VISIBILITY_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; - 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)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", VISIBILITY_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; - 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)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", VISIBILITY_HUB, 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; - 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)); + 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!", VISIBILITY_HUB, 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); - 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.", VISIBILITY_HUB, 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); - lore = getLore(petOwned, petMax, "Life on a server can get lonely sometimes. Summon an adorable pet to follow you around and cheer you up!", "Usable in Lobbies", petActive == null ? null : petActive.getCustomName()); + lore = getLore(petOwned, petMax, "Life on a server can get lonely sometimes. Summon an adorable pet to follow you around and cheer you up!", VISIBILITY_HUB, petActive == null ? null : petActive.getCustomName()); addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this)); if (petActive != null) addGlow(petSlot); 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)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", VISIBILITY_HUB, 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; - // 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)); + // -4 Fixes more than the real costumes being counted (Happens because of the hub games costumes + lore = getLore(ownedCount.get(type) - 4, maxCount.get(type) - 4, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", VISIBILITY_HUB, 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.MUSIC_DISC; - lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", VISIBILITY_HUB, 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); type = GadgetType.TAUNT; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Taunt your enemies or just show off. Use /taunt to have a good time!", "Visible in Games", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Taunt your enemies or just show off. Use /taunt to have a good time!", VISIBILITY_GAMES, enabled.get(type)); addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", lore, 1, false), new OpenTaunts(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(tauntSlot); 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)); + 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!", VISIBILITY_GAMES, 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.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)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", VISIBILITY_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", VISIBILITY_HUB, enabled.get(type)); + addButton(balloonsSlot, new ShopItem(Material.GLASS, "Balloons", lore, 1, false), new OpenBalloons(this, enabled.get(type))); + if (enabled.containsKey(type)) addGlow(balloonsSlot); } private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled)