Cleaned up some GUI stuff, mostly lores on items

This commit is contained in:
xGamingDudex 2016-04-18 22:16:10 +02:00
parent e45f800519
commit 591d3cadc9
7 changed files with 56 additions and 9 deletions

View File

@ -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<String> 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)

View File

@ -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;

View File

@ -203,7 +203,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
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);
}

View File

@ -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<String> _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<String> getDesc()
{
return _desc;
}
public int getData()
{
return _data;
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}