From 591d3cadc9c651261810175b65379910170ef159 Mon Sep 17 00:00:00 2001 From: xGamingDudex Date: Mon, 18 Apr 2016 22:16:10 +0200 Subject: [PATCH] Cleaned up some GUI stuff, mostly lores on items --- .../cosmetic/ui/page/GameModifierPage.java | 28 ++++++++++++++++++- .../cosmetic/ui/page/GameModifierSubPage.java | 1 - .../mineplex/core/cosmetic/ui/page/Menu.java | 2 +- .../types/gamemodifiers/GameModifierType.java | 25 +++++++++++++++-- .../minestrike/MineStrikeSkinAK47Torch.java | 3 +- .../MineStrikeSkinDesertEagleSand.java | 3 +- .../MineStrikeSkinDesertEagleStick.java | 3 +- 7 files changed, 56 insertions(+), 9 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java index e73fdde22..0bd5b418e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GameModifierPage.java @@ -1,15 +1,20 @@ package mineplex.core.cosmetic.ui.page; +import java.util.List; + import org.bukkit.Bukkit; 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.ItemMeta; 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.GadgetGameModifier; import mineplex.core.gadget.types.gamemodifiers.GameModifierType; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; @@ -30,7 +35,28 @@ public class GameModifierPage extends GadgetPage for (GameModifierType type : GameModifierType.values()) { - addButton(slot, type.getItemStack(), new IButton() + int own = 0; + int total = 0; + for(GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(type)) { + if(g.ownsGadget(getPlayer())) own++; + total++; + } + ItemStack item = type.getItemStack(); + ItemMeta meta = item.getItemMeta(); + + List lore = meta.getLore(); + lore.add(0, " "); + lore.add(" "); + lore.add(C.cWhite + "You own " + own + "/" + total); + lore.add(" "); + lore.add(C.cGreen + "Left-click to view Sub-Category"); + + meta.setLore(lore); + item.setItemMeta(meta); + + Bukkit.broadcastMessage("Open page"); + + addButton(slot, item, new IButton() { @Override public void onClick(Player player, ClickType clickType) 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 20c6e5e30..d47f516a7 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 @@ -1,6 +1,5 @@ package mineplex.core.cosmetic.ui.page; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; 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 a114d9221..765dd8411 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 @@ -203,7 +203,7 @@ public class Menu extends ShopPageBase type = GadgetType.GameModifier; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Usable in Lobbies", enabled.get(type)); + 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(winEffectSlot); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/GameModifierType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/GameModifierType.java index 554cfe2d5..fc21be0dd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/GameModifierType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/GameModifierType.java @@ -1,35 +1,54 @@ package mineplex.core.gadget.types.gamemodifiers; +import java.util.List; + 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.itemstack.ItemStackFactory; public enum GameModifierType { - MineStrike("MineStrike", Material.TNT, 0); + MineStrike("MineStrike", new String[]{"Apply custom gun moddels and skin to use ingame"}, Material.TNT, 0); private String _name; + private List _desc; private Material _mat; private int _data; - GameModifierType(String name, Material mat, int data) + GameModifierType(String name, String[] desc, Material mat, int data) { _name = name; _mat = mat; + + _desc = UtilText.splitLines(desc, LineFormat.LORE); + for(int i = 0; i < _desc.size(); i++) if(!_desc.get(i).contains("ยง.")) _desc.set(i, C.cGray + _desc.get(i)); + _data = data; } public ItemStack getItemStack() { - return ItemStackFactory.Instance.CreateStack(_mat, (byte) _data, 1, C.cYellow + _name); + return ItemStackFactory.Instance.CreateStack(_mat, (byte) _data, 1, C.cGreen + C.Bold + _name, _desc); } public String getName() { return _name; } + + public List getDesc() + { + return _desc; + } + + public int getData() + { + return _data; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinAK47Torch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinAK47Torch.java index 0dbe1e19f..435fcc473 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinAK47Torch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinAK47Torch.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.types.gamemodifiers.minestrike; import org.bukkit.Material; +import mineplex.core.common.util.C; import mineplex.core.gadget.GadgetManager; public class MineStrikeSkinAK47Torch extends GameModifierMineStrikeSkin @@ -9,7 +10,7 @@ public class MineStrikeSkinAK47Torch extends GameModifierMineStrikeSkin public MineStrikeSkinAK47Torch(GadgetManager manager) { - super(manager, "AK-47 Torch", new String[] {"Your gun is shooting so fast that it seems to glow"}, + super(manager, "AK-47 Torch", new String[] {C.cGray + "Your gun is shooting so fast that it seems to glow"}, "AK-47", Material.TORCH, 1, Material.TORCH, 0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinDesertEagleSand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinDesertEagleSand.java index 8944e9025..9377da099 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinDesertEagleSand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinDesertEagleSand.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.types.gamemodifiers.minestrike; import org.bukkit.Material; +import mineplex.core.common.util.C; import mineplex.core.gadget.GadgetManager; public class MineStrikeSkinDesertEagleSand extends GameModifierMineStrikeSkin @@ -9,7 +10,7 @@ public class MineStrikeSkinDesertEagleSand extends GameModifierMineStrikeSkin public MineStrikeSkinDesertEagleSand(GadgetManager manager) { - super(manager, "Desert Sand", new String[] {"You know what is better than Desert Eagle?", " ", "Desert Sand"}, + super(manager, "Desert Sand", new String[] {C.cGray + "You know what is better than Desert Eagle?", " ", C.cGray + "Desert Sand"}, "Desert Eagle", Material.SAND, 1, Material.SAND, 0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinDesertEagleStick.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinDesertEagleStick.java index c426d516e..1008f6ac4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinDesertEagleStick.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/gamemodifiers/minestrike/MineStrikeSkinDesertEagleStick.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.types.gamemodifiers.minestrike; import org.bukkit.Material; +import mineplex.core.common.util.C; import mineplex.core.gadget.GadgetManager; public class MineStrikeSkinDesertEagleStick extends GameModifierMineStrikeSkin @@ -9,7 +10,7 @@ public class MineStrikeSkinDesertEagleStick extends GameModifierMineStrikeSkin public MineStrikeSkinDesertEagleStick(GadgetManager manager) { - super(manager, "Desert Stick", new String[] {"You thought Desert Eagle was badass. You haven't seen my stick yet..."}, + super(manager, "Desert Stick", new String[] {C.cGray + "You thought Desert Eagle was badass. You haven't seen my stick yet..."}, "Desert Eagle", Material.STICK, 1, Material.STICK, 0); }