set display in gui

This commit is contained in:
Cheese 2015-12-11 20:01:54 +11:00
parent d8a5edf9e9
commit a6f664006f
9 changed files with 330 additions and 210 deletions

View File

@ -81,51 +81,67 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(gadget.GetDescription()));
if (gadget.GetCost(CurrencyType.Coins) == -1)
if (!gadget.ownsGadget(getPlayer()))
{
//Nothing
if (gadget.GetCost(CurrencyType.Coins) == -1)
{
//Nothing
}
//Chest Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -2 || gadget.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (gadget.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (gadget.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (gadget.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
}
//Chest Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -2)
else
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (gadget.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (gadget.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (gadget.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (gadget.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
if (gadget.getSet() != null)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGray + "Set Cosmetics;");
for (Gadget cur : gadget.getSet())
{
itemLore.add(" "+ (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName());
}
}
}
if (gadget instanceof ItemGadget)

View File

@ -24,134 +24,137 @@ import mineplex.core.shop.page.ShopPageBase;
public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
buildPage();
}
protected void buildPage()
{
int slot = 19;
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
{
addMount(mount, slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
buildPage();
}
protected void buildPage()
{
int slot = 19;
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
{
addMount(mount, slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
protected void addMount(Mount<?> mount, int slot)
{
List<String> itemLore = new ArrayList<String>();
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(mount.GetDescription()));
if (mount.GetCost(CurrencyType.Coins) == -1)
{
//Nothing
}
//Chest Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -2)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (mount.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (mount.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (mount.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
}
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetActive().containsKey(getPlayer()))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this));
}
else
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this));
}
}
else
{
if (mount.GetCost(CurrencyType.Coins) > 0)
protected void addMount(Mount<?> mount, int slot)
{
List<String> itemLore = new ArrayList<String>();
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(mount.GetDescription()));
if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetCost(CurrencyType.Coins) == -1)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.GetCost(CurrencyType.Coins) + " Treasure Shards");
//Nothing
}
if (mount.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
}
else if (mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
else
{
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}
}
//Chest Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -2 || mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (mount.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (mount.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (mount.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (mount.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
}
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetActive().containsKey(getPlayer()))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this));
}
else
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this));
}
}
else
{
if (mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.GetCost(CurrencyType.Coins) + " Treasure Shards");
}
if (mount.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
}
else if (mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
else
{
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}
}
}

View File

@ -64,52 +64,57 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!");
if (pet.GetCost(CurrencyType.Coins) == -1)
{
//Nothing
}
//Chest Unlocks
else if (pet.GetCost(CurrencyType.Coins) == -2)
if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (pet.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (pet.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (pet.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (pet.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
if (pet.GetCost(CurrencyType.Coins) == -1)
{
//Nothing
}
else if (pet.GetCost(CurrencyType.Coins) == -2 || pet.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (pet.GetCost(CurrencyType.Coins) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (pet.GetCost(CurrencyType.Coins) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (pet.GetCost(CurrencyType.Coins) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (pet.GetCost(CurrencyType.Coins) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (pet.GetCost(CurrencyType.Coins) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
}
}
//Owned
if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))

View File

@ -90,7 +90,9 @@ import mineplex.core.gadget.gadgets.particle.ParticleHelix;
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
import mineplex.core.gadget.gadgets.particle.ParticleRain;
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
import mineplex.core.gadget.set.SetCandyCane;
import mineplex.core.gadget.set.SetFrostLord;
import mineplex.core.gadget.set.SetTitan;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetSet;
import mineplex.core.gadget.types.GadgetType;
@ -154,6 +156,8 @@ public class GadgetManager extends MiniPlugin
private void createSets()
{
addSet(new SetFrostLord(this));
addSet(new SetCandyCane(this));
addSet(new SetTitan(this));
}
private void CreateGadgets()

View File

@ -12,7 +12,7 @@ public class HatGrinch extends HatGadget
public HatGrinch(GadgetManager manager)
{
super(manager, "The Grinch",
UtilText.splitLineToArray(C.cGray + "Grinchtastic", LineFormat.LORE),
UtilText.splitLineToArray(C.cGray + "Great! Now wheres the Roast Beast?!", LineFormat.LORE),
-3,
"christmasgift");
}

View File

@ -0,0 +1,38 @@
package mineplex.core.gadget.set;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
import mineplex.core.gadget.gadgets.death.DeathCandyCane;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
import mineplex.core.gadget.types.GadgetSet;
public class SetCandyCane extends GadgetSet
{
public SetCandyCane(GadgetManager manager)
{
super(manager,
manager.getGadget(ArrowTrailCandyCane.class),
manager.getGadget(DeathCandyCane.class),
manager.getGadget(DoubleJumpCandyCane.class),
manager.getGadget(ParticleCandyCane.class));
}
@Override
public void customEnable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Enabled full set of " + F.elem("Candy Cane")));
}
@Override
public void customDisable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Disabled full set of " + F.elem("Candy Cane")));
}
}

View File

@ -0,0 +1,38 @@
package mineplex.core.gadget.set;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan;
import mineplex.core.gadget.gadgets.death.DeathTitan;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan;
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
import mineplex.core.gadget.types.GadgetSet;
public class SetTitan extends GadgetSet
{
public SetTitan(GadgetManager manager)
{
super(manager,
manager.getGadget(ArrowTrailTitan.class),
manager.getGadget(DeathTitan.class),
manager.getGadget(DoubleJumpTitan.class),
manager.getGadget(ParticleTitan.class));
}
@Override
public void customEnable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Enabled full set of " + F.elem("Titan")));
}
@Override
public void customDisable(Player player)
{
player.sendMessage(F.main("GadgetSet", "Disabled full set of " + F.elem("Titan")));
}
}

View File

@ -1,5 +1,6 @@
package mineplex.core.gadget.types;
import java.util.ArrayList;
import java.util.HashSet;
import mineplex.core.common.CurrencyType;
@ -26,6 +27,8 @@ public abstract class Gadget extends SalesPackageBase implements Listener
protected HashSet<Player> _active = new HashSet<Player>();
protected Gadget[] _set = null;
private String[] _alternativePackageNames;
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data)
@ -36,7 +39,7 @@ public abstract class Gadget extends SalesPackageBase implements Listener
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, String... alternativesalepackageNames)
{
super(name, mat, data, desc, cost, quantity);
_gadgetType = gadgetType;
KnownPackage = false;
@ -128,5 +131,13 @@ public abstract class Gadget extends SalesPackageBase implements Listener
return false;
}
public void setSet(Gadget[] gadgets)
{
_set = gadgets;
}
public Gadget[] getSet()
{
return _set;
}
}

View File

@ -25,6 +25,11 @@ public abstract class GadgetSet implements Listener
Manager = manager;
_gadgets = gadgets;
for (Gadget gadget : gadgets)
{
gadget.setSet(gadgets);
}
Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin());
}