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,12 +81,14 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(gadget.GetDescription())); itemLore.addAll(Arrays.asList(gadget.GetDescription()));
if (!gadget.ownsGadget(getPlayer()))
{
if (gadget.GetCost(CurrencyType.Coins) == -1) if (gadget.GetCost(CurrencyType.Coins) == -1)
{ {
//Nothing //Nothing
} }
//Chest Unlocks //Chest Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -2) else if (gadget.GetCost(CurrencyType.Coins) == -2 || gadget.GetCost(CurrencyType.Coins) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests"); itemLore.add(C.cBlue + "Found in Treasure Chests");
@ -127,6 +129,20 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank"); itemLore.add(C.cRed + "Unlocked with Titan Rank");
} }
}
else
{
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) if (gadget instanceof ItemGadget)
{ {

View File

@ -60,12 +60,14 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(mount.GetDescription())); itemLore.addAll(Arrays.asList(mount.GetDescription()));
if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetCost(CurrencyType.Coins) == -1) if (mount.GetCost(CurrencyType.Coins) == -1)
{ {
//Nothing //Nothing
} }
//Chest Unlocks //Chest Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -2) else if (mount.GetCost(CurrencyType.Coins) == -2 || mount.GetCost(CurrencyType.Coins) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests"); itemLore.add(C.cBlue + "Found in Treasure Chests");
@ -106,6 +108,7 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank"); itemLore.add(C.cRed + "Unlocked with Titan Rank");
} }
}
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))

View File

@ -64,12 +64,15 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!"); itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!");
//Chest Unlocks
if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
{
if (pet.GetCost(CurrencyType.Coins) == -1) if (pet.GetCost(CurrencyType.Coins) == -1)
{ {
//Nothing //Nothing
} }
//Chest Unlocks
else if (pet.GetCost(CurrencyType.Coins) == -2) else if (pet.GetCost(CurrencyType.Coins) == -2 || pet.GetCost(CurrencyType.Coins) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests"); itemLore.add(C.cBlue + "Found in Treasure Chests");
@ -89,6 +92,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
} }
//Rank Unlocks //Rank Unlocks
else if (pet.GetCost(CurrencyType.Coins) == -10) else if (pet.GetCost(CurrencyType.Coins) == -10)
{ {
@ -110,6 +114,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank"); itemLore.add(C.cRed + "Unlocked with Titan Rank");
} }
}
//Owned //Owned
if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) 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.ParticleLegend;
import mineplex.core.gadget.gadgets.particle.ParticleRain; import mineplex.core.gadget.gadgets.particle.ParticleRain;
import mineplex.core.gadget.gadgets.particle.ParticleTitan; import mineplex.core.gadget.gadgets.particle.ParticleTitan;
import mineplex.core.gadget.set.SetCandyCane;
import mineplex.core.gadget.set.SetFrostLord; import mineplex.core.gadget.set.SetFrostLord;
import mineplex.core.gadget.set.SetTitan;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetSet; import mineplex.core.gadget.types.GadgetSet;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
@ -154,6 +156,8 @@ public class GadgetManager extends MiniPlugin
private void createSets() private void createSets()
{ {
addSet(new SetFrostLord(this)); addSet(new SetFrostLord(this));
addSet(new SetCandyCane(this));
addSet(new SetTitan(this));
} }
private void CreateGadgets() private void CreateGadgets()

View File

@ -12,7 +12,7 @@ public class HatGrinch extends HatGadget
public HatGrinch(GadgetManager manager) public HatGrinch(GadgetManager manager)
{ {
super(manager, "The Grinch", super(manager, "The Grinch",
UtilText.splitLineToArray(C.cGray + "Grinchtastic", LineFormat.LORE), UtilText.splitLineToArray(C.cGray + "Great! Now wheres the Roast Beast?!", LineFormat.LORE),
-3, -3,
"christmasgift"); "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; package mineplex.core.gadget.types;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import mineplex.core.common.CurrencyType; 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 HashSet<Player> _active = new HashSet<Player>();
protected Gadget[] _set = null;
private String[] _alternativePackageNames; private String[] _alternativePackageNames;
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data) public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data)
@ -128,5 +131,13 @@ public abstract class Gadget extends SalesPackageBase implements Listener
return false; 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; Manager = manager;
_gadgets = gadgets; _gadgets = gadgets;
for (Gadget gadget : gadgets)
{
gadget.setSet(gadgets);
}
Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin()); Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin());
} }