Cosmetic Menu Update
This commit is contained in:
parent
64fb2b11d8
commit
fe3431ba04
@ -4,10 +4,10 @@ import org.bukkit.Material;
|
||||
|
||||
public enum CurrencyType
|
||||
{
|
||||
Tokens(" Tokens", Material.EMERALD),
|
||||
Coins(" Coins", Material.DOUBLE_PLANT),
|
||||
Gems(" Gems", Material.EMERALD),
|
||||
Gold(" Gold", Material.GOLD_NUGGET);
|
||||
Tokens("Tokens", Material.EMERALD),
|
||||
Coins("Treasure Shards", Material.PRISMARINE_SHARD),
|
||||
Gems("Gems", Material.EMERALD),
|
||||
Gold("Gold", Material.GOLD_NUGGET);
|
||||
|
||||
private String _prefix;
|
||||
private Material _displayMaterial;
|
||||
|
@ -1,5 +1,8 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Creature;
|
||||
@ -11,6 +14,9 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
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.OpenArrowTrails;
|
||||
@ -29,6 +35,7 @@ import mineplex.core.donation.Donor;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.pet.Pet;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
@ -53,114 +60,189 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
// " "
|
||||
// }, 1, false));
|
||||
|
||||
addButton(1, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
|
||||
addButton(3, new ShopItem(Material.ARROW, "Arrow Trails", 1, false), new OpenArrowTrails(this));
|
||||
addButton(5, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", 1, false), new OpenDoubleJump(this));
|
||||
addButton(7, new ShopItem(Material.SKULL_ITEM, "Death Animations", 1, false), new OpenDeathAnimations(this));
|
||||
|
||||
addButton(19, new ShopItem(Material.MELON_BLOCK, "Gadgets", 1, false), new OpenGadgets(this));
|
||||
addButton(21, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
|
||||
addButton(23, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
|
||||
addButton(25, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this));
|
||||
|
||||
addButton(37, new ShopItem(Material.GOLD_HELMET, "Hats", 1, false), new OpenHats(this));
|
||||
addButton(39, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", 1, false), new OpenCostumes(this));
|
||||
addButton(41, new ShopItem(Material.GREEN_RECORD, "Music", 1, false), new OpenMusic(this));
|
||||
addButton(43, new ShopItem(Material.NAME_TAG, "Taunts", new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), new IButton()
|
||||
int[] slots = UtilUI.getIndicesFor(12, 1);
|
||||
int particleSlot = slots[0];
|
||||
int arrowSlot = slots[1];
|
||||
int jumpSlot = slots[2];
|
||||
int deathSlot = slots[3];
|
||||
int gadgetSlot = slots[4];
|
||||
int morphSlot = slots[5];
|
||||
int mountSlot = slots[6];
|
||||
int petSlot = slots[7];
|
||||
int hatSlot = slots[8];
|
||||
int costumeSlot = slots[9];
|
||||
int musicSlot = slots[10];
|
||||
int tauntSlot = slots[11];
|
||||
|
||||
EnumMap<GadgetType, Integer> ownedCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
|
||||
EnumMap<GadgetType, Integer> maxCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
|
||||
EnumMap<GadgetType, Gadget> enabled = new EnumMap<GadgetType, Gadget>(GadgetType.class);
|
||||
|
||||
for(GadgetType type : GadgetType.values())
|
||||
{
|
||||
ownedCount.put(type, 0);
|
||||
maxCount.put(type, 0);
|
||||
|
||||
List<Gadget> gadgets = getPlugin().getGadgetManager().getGadgets(type);
|
||||
if (gadgets != null)
|
||||
{
|
||||
for (Gadget gadget : gadgets)
|
||||
{
|
||||
if (gadget.ownsGadget(getPlayer()))
|
||||
{
|
||||
ownedCount.put(type, ownedCount.get(type) + 1);
|
||||
}
|
||||
|
||||
maxCount.put(type, maxCount.get(type) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), type);
|
||||
if(gadget != null) enabled.put(type, gadget);
|
||||
|
||||
// addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[0], 1, false, false),
|
||||
// new IButton()
|
||||
// {
|
||||
// public void onClick(Player player, ClickType clickType) {
|
||||
// playAcceptSound(player);
|
||||
// gadget.Disable(player);
|
||||
// refresh();
|
||||
// };
|
||||
// });
|
||||
}
|
||||
|
||||
int mountOwned = 0;
|
||||
int mountMax = 0;
|
||||
Mount<?> mountActive = getPlugin().getMountManager().getActive(getPlayer());
|
||||
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
|
||||
{
|
||||
if (mount.HasMount(getPlayer()))
|
||||
{
|
||||
mountOwned++;
|
||||
}
|
||||
|
||||
mountMax++;
|
||||
}
|
||||
|
||||
int petOwned = 0;
|
||||
int petMax = 0;
|
||||
for (Pet pet : getPlugin().getPetManager().GetFactory().GetPets())
|
||||
{
|
||||
if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
|
||||
{
|
||||
petOwned++;
|
||||
}
|
||||
|
||||
petMax++;
|
||||
}
|
||||
Creature petActive = getPlugin().getPetManager().GetPet(getPlayer());
|
||||
|
||||
GadgetType type = GadgetType.Particle;
|
||||
String[] lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
|
||||
addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this));
|
||||
if (enabled.containsKey(type)) addGlow(particleSlot);
|
||||
|
||||
type = GadgetType.ArrowTrail;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
|
||||
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Trails", lore, 1, false), new OpenArrowTrails(this));
|
||||
if (enabled.containsKey(type)) addGlow(arrowSlot);
|
||||
|
||||
type = GadgetType.DoubleJump;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
|
||||
addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this));
|
||||
if (enabled.containsKey(type)) addGlow(jumpSlot);
|
||||
|
||||
type = GadgetType.Death;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
|
||||
addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this));
|
||||
if (enabled.containsKey(type)) addGlow(deathSlot);
|
||||
|
||||
type = GadgetType.Item;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
|
||||
addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this));
|
||||
if (enabled.containsKey(type)) addGlow(gadgetSlot);
|
||||
|
||||
type = GadgetType.Morph;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
|
||||
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this));
|
||||
if (enabled.containsKey(type)) addGlow(morphSlot);
|
||||
|
||||
lore = getLore(mountOwned, mountMax, mountActive == null ? null : mountActive.GetName());
|
||||
addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this));
|
||||
if (mountActive != null) addGlow(mountSlot);
|
||||
|
||||
lore = getLore(petOwned, petMax, 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), enabled.get(type));
|
||||
addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this));
|
||||
if (enabled.containsKey(type)) addGlow(hatSlot);
|
||||
|
||||
type = GadgetType.Costume;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
|
||||
addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this));
|
||||
if (enabled.containsKey(type)) addGlow(costumeSlot);
|
||||
|
||||
type = GadgetType.MusicDisc;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
|
||||
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this));
|
||||
if (enabled.containsKey(type)) addGlow(musicSlot);
|
||||
|
||||
addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
player.sendMessage(F.main("Shop", "Comming soon!"));
|
||||
player.sendMessage(F.main("Shop", "Coming soon!"));
|
||||
}
|
||||
});
|
||||
|
||||
for(GadgetType type : GadgetType.values())
|
||||
|
||||
// if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()))
|
||||
// {
|
||||
// Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName());
|
||||
// String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName();
|
||||
// addButton(25 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), C.mItem + petName, new String[0], 1, false, false),
|
||||
// new IButton()
|
||||
// {
|
||||
// public void onClick(Player player, ClickType clickType)
|
||||
// {
|
||||
// playAcceptSound(player);
|
||||
// getPlugin().getPetManager().RemovePet(player, true);
|
||||
// refresh();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
private String[] getLore(int ownedCount, int maxCount, Gadget enabled)
|
||||
{
|
||||
return getLore(ownedCount, maxCount, enabled == null ? null : enabled.GetName());
|
||||
}
|
||||
|
||||
private String[] getLore(int ownedCount, int maxCount, String enabled)
|
||||
{
|
||||
if (enabled != null)
|
||||
{
|
||||
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), type);
|
||||
if(gadget == null) continue;
|
||||
|
||||
int slot = 10;
|
||||
switch (type)
|
||||
{
|
||||
case Particle:
|
||||
slot = 1;
|
||||
break;
|
||||
case ArrowTrail:
|
||||
slot = 3;
|
||||
break;
|
||||
case DoubleJump:
|
||||
slot = 5;
|
||||
break;
|
||||
case Death:
|
||||
slot = 7;
|
||||
break;
|
||||
case Item:
|
||||
slot = 19;
|
||||
break;
|
||||
case Morph:
|
||||
slot = 21;
|
||||
break;
|
||||
case Hat:
|
||||
slot = 37;
|
||||
break;
|
||||
case Costume:
|
||||
slot = 39;
|
||||
break;
|
||||
case MusicDisc:
|
||||
slot = 41;
|
||||
break;
|
||||
case Taunt:
|
||||
slot = 43;
|
||||
break;
|
||||
default:
|
||||
slot = 1;
|
||||
break;
|
||||
}
|
||||
slot += 9;
|
||||
|
||||
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[0], 1, false, false),
|
||||
new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType) {
|
||||
playAcceptSound(player);
|
||||
gadget.Disable(player);
|
||||
refresh();
|
||||
};
|
||||
});
|
||||
return UtilText.splitLinesToArray(new String[] {
|
||||
C.blankLine,
|
||||
C.cWhite + "You own " + C.cYellow + ownedCount + "/" + maxCount,
|
||||
C.blankLine,
|
||||
C.cWhite + "Active: " + C.cGreen + enabled,
|
||||
C.cWhite + "Right Click to Disable",
|
||||
C.blankLine,
|
||||
C.cWhite + "Left Click to View Category"
|
||||
}, LineFormat.LORE);
|
||||
}
|
||||
|
||||
if (getPlugin().getMountManager().getActive(getPlayer()) != null)
|
||||
else
|
||||
{
|
||||
final Mount<?> mount = getPlugin().getMountManager().getActive(getPlayer());
|
||||
|
||||
addButton(23 + 9,
|
||||
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), C.mItem + mount.GetName(), new String[0], 1, false, false),
|
||||
new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
playAcceptSound(player);
|
||||
mount.Disable(player);
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()))
|
||||
{
|
||||
Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName());
|
||||
String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName();
|
||||
addButton(25 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), C.mItem + petName, new String[0], 1, false, false),
|
||||
new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
playAcceptSound(player);
|
||||
getPlugin().getPetManager().RemovePet(player, true);
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
return UtilText.splitLinesToArray(new String[] {
|
||||
C.blankLine,
|
||||
C.cWhite + "You own " + C.cYellow + ownedCount + "/" + maxCount,
|
||||
C.blankLine,
|
||||
C.cWhite + "Left Click to View Category"
|
||||
}, LineFormat.LORE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
||||
buildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte) 0, ChatColor.GREEN + "OK", null, 1, false, true), okClicked);
|
||||
buildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte) 0, ChatColor.RED + "CANCEL", null, 1, false, true), cancelClicked);
|
||||
|
||||
this.getInventory().setItem(4, new ShopItem(getCurrencyType().GetDisplayMaterial(), (byte)0, getCurrencyType().toString(), new String[] { C.cGray + _salesItem.GetCost(getCurrencyType()) + " " + getCurrencyType().toString() + " will be", "deducted from your account balance." }, 1, false, true).getHandle());
|
||||
this.getInventory().setItem(4, new ShopItem(getCurrencyType().GetDisplayMaterial(), (byte)0, getCurrencyType().Prefix(), new String[] { C.cGray + _salesItem.GetCost(getCurrencyType()) + " " + getCurrencyType().Prefix() + " will be", C.cGray + "deducted from your account balance." }, 1, false, true).getHandle());
|
||||
}
|
||||
|
||||
protected void okClicked(Player player)
|
||||
|
@ -7,13 +7,13 @@ import mineplex.core.reward.RewardType;
|
||||
|
||||
public enum TreasureType
|
||||
{
|
||||
OLD(C.cYellow + "Old Chest", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD),
|
||||
OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD),
|
||||
|
||||
ANCIENT(C.cGold + "Ancient Chest", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT),
|
||||
ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT),
|
||||
|
||||
MYTHICAL(C.cRed + "Mythical Chest", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL),
|
||||
MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL),
|
||||
|
||||
CHRISTMAS(C.cDGreen + "Winter Holiday Chest", "Winter Chest", "Christmas", RewardType.MythicalChest, Material.CHEST, TreasureStyle.CHRISTMAS);
|
||||
CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.MythicalChest, Material.CHEST, TreasureStyle.CHRISTMAS);
|
||||
|
||||
private final String _name;
|
||||
private final RewardType _rewardType;
|
||||
|
Loading…
Reference in New Issue
Block a user