Fixed all ranks having all win effects

This commit is contained in:
LCastr0 2017-05-08 14:56:33 -03:00
parent 5c265cfd66
commit 00981cf846
7 changed files with 18 additions and 52 deletions

View File

@ -9,6 +9,7 @@ import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
@ -30,7 +31,22 @@ public class WinEffectPage extends GadgetPage
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WIN_EFFECT))
{
addGadget(gadget, slot);
if (gadget instanceof WinEffectRankBased)
{
WinEffectRankBased rankBased = (WinEffectRankBased) gadget;
if (getClientManager().Get(getPlayer()).GetRank().has(rankBased.getRank()))
{
addGadget(gadget, slot);
}
else
{
addGadget(gadget, slot, true);
}
}
else
{
addGadget(gadget, slot);
}
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WIN_EFFECT) == gadget)
addGlow(slot);

View File

@ -25,7 +25,7 @@ public abstract class WinEffectRankBased extends WinEffectGadget
*/
public WinEffectRankBased(GadgetManager manager, String name, String[] lore, Material material, byte data, Rank rank, WinEffectType winEffectType, String... alternativeSalepackageNames)
{
super(manager, name, lore, -2, material, data, true, alternativeSalepackageNames);
super(manager, name, lore, -1, material, data, true, alternativeSalepackageNames);
_rank = rank;
_winEffectType = winEffectType;
_schematicName = winEffectType.getSchematic().replace("%r%", rank.getRawTag());

View File

@ -10,7 +10,6 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.MaterialData;
@ -128,13 +127,4 @@ public class WinEffectRankEternal extends WinEffectRankBased
armorStand.setHealth(0);
}
@EventHandler
public void eternalOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.ETERNAL))
{
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
}
}
}

View File

@ -10,7 +10,6 @@ import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.FallingBlock;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.MaterialData;
@ -128,13 +127,4 @@ public class WinEffectRankHero extends WinEffectRankBased
armorStand.setHealth(0);
}
@EventHandler
public void heroOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.HERO))
{
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
}
}
}

View File

@ -10,7 +10,6 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Wither;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.MaterialData;
@ -126,13 +125,4 @@ public class WinEffectRankLegend extends WinEffectRankBased
armorStand.setHealth(0);
}
@EventHandler
public void legendOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.LEGEND))
{
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
}
}
}

View File

@ -10,7 +10,6 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Giant;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.common.MaterialData;
import mineplex.core.common.Rank;
@ -89,13 +88,4 @@ public class WinEffectRankTitan extends WinEffectRankBased
}
}
@EventHandler
public void titanOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.TITAN))
{
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
}
}
}

View File

@ -11,7 +11,6 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.common.MaterialData;
import mineplex.core.common.Rank;
@ -86,13 +85,4 @@ public class WinEffectRankUltra extends WinEffectRankBased
}
}
@EventHandler
public void ultraOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.ULTRA))
{
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
}
}
}