Fixes podium not being enabled by default

This commit is contained in:
LCastr0 2016-05-15 21:33:36 -03:00
parent a27a618b2f
commit 42eef838b3
4 changed files with 37 additions and 4 deletions

View File

@ -28,7 +28,7 @@ public class WinEffectPodium extends WinEffectGadget
public WinEffectPodium(GadgetManager manager)
{
super(manager, "Podium", UtilText.splitLineToArray(C.cGray + "You are the wiener! I mean WINNER! Phew, glad that didnt make it into the release.", LineFormat.LORE),
0, Material.DIAMOND, (byte)0);
0, Material.DIAMOND, (byte)0, true);
}
@Override

View File

@ -29,6 +29,8 @@ public abstract class Gadget extends SalesPackageBase implements Listener
protected GadgetSet _set = null;
private String[] _alternativePackageNames;
private boolean _free;
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data)
{
@ -41,6 +43,7 @@ public abstract class Gadget extends SalesPackageBase implements Listener
_gadgetType = gadgetType;
KnownPackage = false;
_free = false;
_alternativePackageNames = alternativesalepackageNames;
if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; }
@ -49,6 +52,22 @@ public abstract class Gadget extends SalesPackageBase implements Listener
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
}
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, boolean free, String... alternativesalepackageNames)
{
super(name, mat, data, desc, cost, quantity);
_gadgetType = gadgetType;
KnownPackage = false;
_free = free;
_alternativePackageNames = alternativesalepackageNames;
if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; }
Manager = manager;
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
}
public GadgetType getGadgetType()
{
@ -116,7 +135,7 @@ public abstract class Gadget extends SalesPackageBase implements Listener
public boolean ownsGadget(Player player)
{
if(IsFree()) return true;
if(IsFree() || _free) return true;
if(Manager.getDonationManager().Get(player.getName()).OwnsUnknownPackage(GetName())) { return true; }
if(Manager.getInventoryManager().Get(player).getItemCount(GetName()) > 0) { return true; }

View File

@ -67,6 +67,22 @@ public abstract class WinEffectGadget extends Gadget
super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, alternativesalepackageNames);
}
/**
* @param manager The normal GadgetManager
* @param name The display name of the WinEffect
* @param desc The description of the WinEffect
* @param cost The shard cost of the WinEffect
* @param mat The display material of the WinEffect
* @param data The display data of the WinEffect
* @param free Sets the gadget to be free for all the players by default
* @param alternativesalepackageNames Alternative packet names used to check if the player owns this WinEffect
*/
public WinEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data,
boolean free, String... alternativesalepackageNames)
{
super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, free, alternativesalepackageNames);
}
@Override
public void EnableCustom(Player player)
{

View File

@ -1,8 +1,6 @@
package mineplex.core.shop.item;
import java.util.ArrayList;
import org.bukkit.Material;
import org.bukkit.entity.Player;