Check for active gadgets while playing the particle

This commit is contained in:
LCastr0 2017-04-26 16:22:24 -03:00
parent 5764a4bce3
commit 4dfd1b3d21
2 changed files with 14 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package mineplex.core.gadget.types;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import mineplex.core.gadget.GadgetManager;
@ -21,6 +22,6 @@ public abstract class KitSelectorGadget extends Gadget
* Plays the next particle for the selected entity
* @param entity
*/
public abstract void playParticle(Entity entity);
public abstract void playParticle(Entity entity, Player playTo);
}

View File

@ -11,6 +11,10 @@ import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.KitSelectorGadget;
import mineplex.core.progression.math.Calculations;
/**
@ -269,8 +273,15 @@ public interface ProgressiveKit
return getUpgradeLevel(player) >= upgradeLevel;
}
default void displaySelectedEffect(Entity kitHost, Player... displayTo)
default void displaySelectedEffect(Entity kitHost, GadgetManager gadgetManager, Player displayTo)
{
Gadget gadget = gadgetManager.getActive(displayTo, GadgetType.KIT_SELECTOR);
if (gadget != null)
{
KitSelectorGadget kitSelectorGadget = (KitSelectorGadget) gadget;
kitSelectorGadget.playParticle(kitHost, displayTo);
return;
}
for (int i = 0; i < 1; i++)
{
double lead = i * ((2d * Math.PI) / 2);