Cosmetic Menu Update

This commit is contained in:
Shaun Bennett 2015-12-14 00:28:28 -05:00
parent 7f9e5c4ec9
commit cdbcae7e3e
17 changed files with 184 additions and 152 deletions

View File

@ -20,7 +20,7 @@
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.Game.Clans.Core" /> <element id="module-output" name="Mineplex.Game.Clans.Core" />
<element id="module-output" name="Mineplex.PlayerCache" /> <element id="module-output" name="Mineplex.Cache" />
</root> </root>
</artifact> </artifact>
</component> </component>

View File

@ -20,8 +20,8 @@
<element id="module-output" name="Mineplex.Database" /> <element id="module-output" name="Mineplex.Database" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.PlayerCache" />
<element id="module-output" name="Mineplex.Game.Clans.Core" /> <element id="module-output" name="Mineplex.Game.Clans.Core" />
<element id="module-output" name="Mineplex.Cache" />
</root> </root>
</artifact> </artifact>
</component> </component>

View File

@ -19,7 +19,7 @@
<element id="module-output" name="Mineplex.Database" /> <element id="module-output" name="Mineplex.Database" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.PlayerCache" /> <element id="module-output" name="Mineplex.Cache" />
</root> </root>
</artifact> </artifact>
</component> </component>

View File

@ -5,19 +5,19 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.ArrowTrailPage; import mineplex.core.cosmetic.ui.page.ArrowTrailPage;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
public class OpenArrowTrails implements IButton public class OpenArrowTrails extends OpenPageButton
{ {
private Menu _page; public OpenArrowTrails(Menu menu, Gadget active)
public OpenArrowTrails(Menu page)
{ {
_page = page; super(menu, active);
} }
public void onClick(Player player, ClickType clickType) @Override
protected void leftClick(Player player)
{ {
_page.getShop().openPageForPlayer(player, new ArrowTrailPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Arrow Trails", player)); getMenu().getShop().openPageForPlayer(player, new ArrowTrailPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Arrow Trails", player));
} }
} }

View File

@ -1,23 +1,20 @@
package mineplex.core.cosmetic.ui.button; package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton; import mineplex.core.gadget.types.Gadget;
public class OpenCostumes implements IButton public class OpenCostumes extends OpenPageButton
{ {
private Menu _menu; public OpenCostumes(Menu menu, Gadget active)
public OpenCostumes(Menu menu)
{ {
_menu = menu; super(menu, active);
} }
@Override @Override
public void onClick(Player player, ClickType clickType) protected void leftClick(Player player)
{ {
_menu.openCostumes(player); getMenu().openCostumes(player);
} }
} }

View File

@ -5,19 +5,20 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.DeathEffectPage; import mineplex.core.cosmetic.ui.page.DeathEffectPage;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
public class OpenDeathAnimations implements IButton public class OpenDeathAnimations extends OpenPageButton
{ {
private Menu _page;
public OpenDeathAnimations(Menu page) public OpenDeathAnimations(Menu menu, Gadget active)
{ {
_page = page; super(menu, active);
} }
public void onClick(Player player, ClickType clickType) @Override
protected void leftClick(Player player)
{ {
_page.getShop().openPageForPlayer(player, new DeathEffectPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Death Animations", player)); getMenu().getShop().openPageForPlayer(player, new DeathEffectPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Death Animations", player));
} }
} }

View File

@ -5,19 +5,19 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.DoubleJumpPage; import mineplex.core.cosmetic.ui.page.DoubleJumpPage;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
public class OpenDoubleJump implements IButton public class OpenDoubleJump extends OpenPageButton
{ {
private Menu _page; public OpenDoubleJump(Menu menu, Gadget active)
public OpenDoubleJump(Menu page)
{ {
_page = page; super(menu, active);
} }
public void onClick(Player player, ClickType clickType) @Override
protected void leftClick(Player player)
{ {
_page.getShop().openPageForPlayer(player, new DoubleJumpPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Double Jump Effects", player)); getMenu().getShop().openPageForPlayer(player, new DoubleJumpPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Double Jump Effects", player));
} }
} }

View File

@ -2,23 +2,23 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
public class OpenGadgets implements IButton public class OpenGadgets extends OpenPageButton
{ {
private Menu _page;
public OpenGadgets(Menu page) public OpenGadgets(Menu menu, Gadget active)
{ {
_page = page; super(menu, active);
} }
@Override @Override
public void onClick(Player player, ClickType clickType) protected void leftClick(Player player)
{ {
_page.getShop().openPageForPlayer(player, new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", player)); getMenu().getShop().openPageForPlayer(player, new GadgetPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Gadgets", player));
} }
} }

View File

@ -1,23 +1,21 @@
package mineplex.core.cosmetic.ui.button; package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.HatPage; import mineplex.core.cosmetic.ui.page.HatPage;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton; import mineplex.core.gadget.types.Gadget;
public class OpenHats implements IButton public class OpenHats extends OpenPageButton
{ {
private Menu _page; public OpenHats(Menu menu, Gadget active)
public OpenHats(Menu page)
{ {
_page = page; super(menu, active);
} }
public void onClick(Player player, ClickType clickType) @Override
protected void leftClick(Player player)
{ {
_page.getShop().openPageForPlayer(player, new HatPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Hats", player)); getMenu().getShop().openPageForPlayer(player, new HatPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Hats", player));
} }
} }

View File

@ -2,22 +2,21 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MorphPage; import mineplex.core.cosmetic.ui.page.MorphPage;
import mineplex.core.shop.item.IButton; import mineplex.core.gadget.types.Gadget;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class OpenMorphs implements IButton public class OpenMorphs extends OpenPageButton
{ {
private Menu _page;
public OpenMorphs(Menu page) public OpenMorphs(Menu menu, Gadget active)
{ {
_page = page; super(menu, active);
} }
public void onClick(Player player, ClickType clickType) @Override
protected void leftClick(Player player)
{ {
_page.getShop().openPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Morphs", player)); getMenu().getShop().openPageForPlayer(player, new MorphPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Morphs", player));
} }
} }

View File

@ -2,6 +2,8 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MountPage; import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -9,15 +11,28 @@ import org.bukkit.event.inventory.ClickType;
public class OpenMounts implements IButton public class OpenMounts implements IButton
{ {
private Menu _page; private Menu _menu;
private Mount<?> _active;
public OpenMounts(Menu page) public OpenMounts(Menu menu, Mount<?> active)
{ {
_page = page; _menu = menu;
_active = active;
} }
@Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
_page.getShop().openPageForPlayer(player, new MountPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player)); if (clickType.isLeftClick())
_menu.getShop().openPageForPlayer(player, new MountPage(_menu.getPlugin(), _menu.getShop(), _menu.getClientManager(), _menu.getDonationManager(), "Mounts", player));
else
{
if (_active != null)
{
_menu.playAcceptSound(player);
_active.Disable(player);
_menu.refresh();
}
}
} }
} }

View File

@ -4,22 +4,19 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
/** public class OpenMusic extends OpenPageButton
* Created by shaun on 14-09-15.
*/
public class OpenMusic implements IButton
{ {
private Menu _menu; public OpenMusic(Menu menu, Gadget active)
public OpenMusic(Menu menu)
{ {
_menu = menu; super(menu, active);
} }
public void onClick(Player player, ClickType clickType) @Override
protected void leftClick(Player player)
{ {
_menu.openMusic(player); getMenu().openMusic(player);
} }
} }

View File

@ -0,0 +1,48 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
public abstract class OpenPageButton implements IButton
{
private Menu _menu;
private Gadget _active;
public OpenPageButton(Menu menu, Gadget active)
{
_active = active;
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
if (clickType.isLeftClick())
leftClick(player);
else
{
if (_active != null)
{
_menu.playAcceptSound(player);
_active.Disable(player);
_menu.refresh();
}
}
}
protected Menu getMenu()
{
return _menu;
}
protected Gadget getActive()
{
return _active;
}
protected abstract void leftClick(Player player);
}

View File

@ -2,22 +2,23 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.ParticlePage; import mineplex.core.cosmetic.ui.page.ParticlePage;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
public class OpenParticles implements IButton public class OpenParticles extends OpenPageButton
{ {
private Menu _page; public OpenParticles(Menu menu, Gadget active)
public OpenParticles(Menu page)
{ {
_page = page; super(menu, active);
} }
public void onClick(Player player, ClickType clickType) @Override
protected void leftClick(Player player)
{ {
_page.getShop().openPageForPlayer(player, new ParticlePage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player)); getMenu().getShop().openPageForPlayer(player, new ParticlePage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Particles", player));
} }
} }

View File

@ -1,7 +1,9 @@
package mineplex.core.cosmetic.ui.button; package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.cosmetic.ui.page.PetPage; import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.pet.Pet;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -9,16 +11,23 @@ import org.bukkit.event.inventory.ClickType;
public class OpenPets implements IButton public class OpenPets implements IButton
{ {
private Menu _page; private Menu _menu;
public OpenPets(Menu page) public OpenPets(Menu menu)
{ {
_page = page; _menu = menu;
} }
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
_page.getShop().openPageForPlayer(player, new PetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player)); if (clickType.isLeftClick())
_menu.getShop().openPageForPlayer(player, new PetPage(_menu.getPlugin(), _menu.getShop(), _menu.getClientManager(), _menu.getDonationManager(), "Pets", player));
else
{
_menu.playAcceptSound(player);
_menu.getPlugin().getPetManager().RemovePet(player, true);
_menu.refresh();
}
} }
} }

View File

@ -1,5 +1,6 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.List; import java.util.List;
@ -41,6 +42,7 @@ import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureKey; import mineplex.core.treasure.TreasureKey;
import mineplex.core.treasure.TreasureType;
public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop> public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
@ -54,13 +56,19 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
@Override @Override
protected void buildPage() protected void buildPage()
{ {
// Donor donor = getDonationManager().Get(getPlayer()); // Treasure Shards
int treasureShards = getDonationManager().Get(getPlayer()).getCoins();
// addItem(2, new ShopItem(CurrencyType.Gems.GetDisplayMaterial(), donor.GetGems() + " Gems", new String[] { List<String> shardLore = new ArrayList<String>();
// " " shardLore.add(" ");
// }, 1, false)); shardLore.add(C.cGray + "This seems like it might come in");
shardLore.add(C.cGray + "handy. Maybe I can collect more!");
int[] slots = UtilUI.getIndicesFor(12, 1); ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);
addItem(4, shards);
// Cosmetic Items
int[] slots = UtilUI.getIndicesFor(12, 2);
int particleSlot = slots[0]; int particleSlot = slots[0];
int arrowSlot = slots[1]; int arrowSlot = slots[1];
int jumpSlot = slots[2]; int jumpSlot = slots[2];
@ -99,16 +107,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), type); final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), type);
if(gadget != null) enabled.put(type, gadget); 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 mountOwned = 0;
@ -139,36 +137,36 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
GadgetType type = GadgetType.Particle; GadgetType type = GadgetType.Particle;
String[] lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); 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)); addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(particleSlot); if (enabled.containsKey(type)) addGlow(particleSlot);
type = GadgetType.ArrowTrail; type = GadgetType.ArrowTrail;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); 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)); addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Trails", lore, 1, false), new OpenArrowTrails(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(arrowSlot); if (enabled.containsKey(type)) addGlow(arrowSlot);
type = GadgetType.DoubleJump; type = GadgetType.DoubleJump;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); 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)); 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); if (enabled.containsKey(type)) addGlow(jumpSlot);
type = GadgetType.Death; type = GadgetType.Death;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); 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)); addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(deathSlot); if (enabled.containsKey(type)) addGlow(deathSlot);
type = GadgetType.Item; type = GadgetType.Item;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); 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)); addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(gadgetSlot); if (enabled.containsKey(type)) addGlow(gadgetSlot);
type = GadgetType.Morph; type = GadgetType.Morph;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type));
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this)); addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(morphSlot); if (enabled.containsKey(type)) addGlow(morphSlot);
lore = getLore(mountOwned, mountMax, mountActive == null ? null : mountActive.GetName()); lore = getLore(mountOwned, mountMax, mountActive == null ? null : mountActive.GetName());
addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this)); addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive));
if (mountActive != null) addGlow(mountSlot); if (mountActive != null) addGlow(mountSlot);
lore = getLore(petOwned, petMax, petActive == null ? null : petActive.getCustomName()); lore = getLore(petOwned, petMax, petActive == null ? null : petActive.getCustomName());
@ -177,17 +175,17 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
type = GadgetType.Hat; type = GadgetType.Hat;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); 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)); addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(hatSlot); if (enabled.containsKey(type)) addGlow(hatSlot);
type = GadgetType.Costume; type = GadgetType.Costume;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); 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)); addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(costumeSlot); if (enabled.containsKey(type)) addGlow(costumeSlot);
type = GadgetType.MusicDisc; type = GadgetType.MusicDisc;
lore = getLore(ownedCount.get(type), maxCount.get(type), enabled.get(type)); 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)); addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(musicSlot); 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() addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), new IButton()
@ -198,22 +196,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
player.sendMessage(F.main("Shop", "Coming soon!")); player.sendMessage(F.main("Shop", "Coming soon!"));
} }
}); });
// 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) private String[] getLore(int ownedCount, int maxCount, Gadget enabled)
@ -227,21 +209,21 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
return UtilText.splitLinesToArray(new String[] { return UtilText.splitLinesToArray(new String[] {
C.blankLine, C.blankLine,
C.cWhite + "You own " + C.cYellow + ownedCount + "/" + maxCount, C.cWhite + "You own " + ownedCount + "/" + maxCount,
C.blankLine, C.blankLine,
C.cWhite + "Active: " + C.cGreen + enabled, C.cWhite + "Active: " + C.cYellow + enabled,
C.cWhite + "Right Click to Disable", C.cGreen + "Right-Click to Disable",
C.blankLine, C.blankLine,
C.cWhite + "Left Click to View Category" C.cGreen + "Left-Click to View Category"
}, LineFormat.LORE); }, LineFormat.LORE);
} }
else else
{ {
return UtilText.splitLinesToArray(new String[] { return UtilText.splitLinesToArray(new String[] {
C.blankLine, C.blankLine,
C.cWhite + "You own " + C.cYellow + ownedCount + "/" + maxCount, C.cWhite + "You own " + ownedCount + "/" + maxCount,
C.blankLine, C.blankLine,
C.cWhite + "Left Click to View Category" C.cGreen + "Left-Click to View Category"
}, LineFormat.LORE); }, LineFormat.LORE);
} }
} }
@ -255,16 +237,4 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player)); getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player));
} }
public void attemptPurchaseKey(Player player)
{
getShop().openPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
{
public void run()
{
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure Key", 1);
refresh();
}
}, this, new TreasureKey(), CurrencyType.Coins, getPlayer()));
}
} }

View File

@ -47,11 +47,8 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
List<String> shardLore = new ArrayList<String>(); List<String> shardLore = new ArrayList<String>();
shardLore.add(" "); shardLore.add(" ");
shardLore.add(F.value("Treasure Shards", "" + treasureShards)); shardLore.add(C.cGray + "This seems like it might come in");
shardLore.add(" "); shardLore.add(C.cGray + "handy. Maybe I can collect more!");
shardLore.add(C.cGray + "Useless by itself, Treasure Shards");
shardLore.add(C.cGray + "can be combined to forge new");
shardLore.add(C.cGray + "and undiscovered treasures.");
List<String> basicLore = new ArrayList<String>(); List<String> basicLore = new ArrayList<String>();
basicLore.add(" "); basicLore.add(" ");
@ -130,7 +127,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
christmasLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); christmasLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + "Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false); ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false); ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false);