Added first kit selector

This commit is contained in:
LCastr0 2017-04-27 20:01:29 -03:00
parent 6bf1b6c1dc
commit e45e3be4e8
3 changed files with 125 additions and 13 deletions

View File

@ -3,6 +3,7 @@ package mineplex.core.common.shape;
import java.awt.Color;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilParticle;
@ -258,41 +259,111 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape
rotateOnXAxis(xRotation);
}
/**
* Displays the wing
* @param location The location to display the visual at
*/
@Override
public void display(Location loc)
public void display(Location location)
{
Shape clone = clone();
clone.rotateOnYAxis(Math.toRadians(loc.getYaw()));
clone.rotateOnYAxis(Math.toRadians(location.getYaw()));
for (Vector v : clone.getPoints())
{
Location ploc = loc.clone().add(v);
displayParticle(ploc);
Location particleLocation = location.clone().add(v);
displayParticle(particleLocation);
}
}
public void displayColored(Location loc, Color color)
/**
* Displays the wing for the given player
* @param location The location to display the visual at
* @param player The player
*/
public void display(Location location, Player player)
{
Shape clone = clone();
clone.rotateOnYAxis(Math.toRadians(loc.getYaw()));
clone.rotateOnYAxis(Math.toRadians(location.getYaw()));
for (Vector v : clone.getPoints())
{
Location ploc = loc.clone().add(v);
displayColoredParticle(ploc, color);
Location particleLocation = location.clone().add(v);
displayParticle(particleLocation, player);
}
}
/**
* Displays the colored wing
* @param location The location to display the visual at
* @param color The color of the particles
*/
public void displayColored(Location location, Color color)
{
Shape clone = clone();
clone.rotateOnYAxis(Math.toRadians(location.getYaw()));
for (Vector v : clone.getPoints())
{
Location particleLocation = location.clone().add(v);
displayColoredParticle(particleLocation, color);
}
}
/**
* Displays the colored wing for the given player
* @param location The location to display the visual at
* @param color The color of the particles
* @param player The player
*/
public void displayColored(Location location, Color color, Player player)
{
Shape clone = clone();
clone.rotateOnYAxis(Math.toRadians(location.getYaw()));
for (Vector v : clone.getPoints())
{
Location particleLocation = location.clone().add(v);
displayColoredParticle(particleLocation, color, player);
}
}
/**
* Display a single particle of the type provided to this shape at the given location.
* @param location The location
*/
public void displayParticle(Location loc)
public void displayParticle(Location location)
{
UtilParticle.PlayParticleToAll(_particle, loc, _offsetData, _speed, _count, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(_particle, location, _offsetData, _speed, _count, ViewDist.NORMAL);
}
public void displayColoredParticle(Location loc, Color color)
/**
* Display a single particle of the type provided to this shape at the given location for the given player
* @param location The location
* @param player The player
*/
public void displayParticle(Location location, Player player)
{
ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(color), loc);
UtilParticle.playParticleFor(player, _particle, location, _offsetData, _speed, _count, ViewDist.NORMAL);
}
/**
* Display a single colored particle of the type provided to this shape at the given location.
* @param location The location
* @param color The color
*/
public void displayColoredParticle(Location location, Color color)
{
ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(color), location);
coloredParticle.display(ViewDist.NORMAL);
}
/**
* Displays a single colored particle of the type provided to this shape at the given location for the given player
* @param location The location
* @param color The color
* @param player The player
*/
public void displayColoredParticle(Location location, Color color, Player player)
{
ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(color), location);
coloredParticle.display(ViewDist.NORMAL, player);
}
}

View File

@ -116,6 +116,7 @@ import mineplex.core.gadget.gadgets.item.ItemPaintbrush;
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
import mineplex.core.gadget.gadgets.item.ItemSnowball;
import mineplex.core.gadget.gadgets.item.ItemTNT;
import mineplex.core.gadget.gadgets.kitselector.WaterWingsKitSelector;
import mineplex.core.gadget.gadgets.morph.MorphAwkwardRabbit;
import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlaze;
@ -595,6 +596,9 @@ public class GadgetManager extends MiniPlugin
addGadget(new BlowAKissTaunt(this));
addGadget(new RainbowTaunt(this));
// Kit Selectors
addGadget(new WaterWingsKitSelector(this));
// Gem Hunters Mounts
for (MountType mount : MountType.values())
{

View File

@ -0,0 +1,37 @@
package mineplex.core.gadget.gadgets.kitselector;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.shape.ShapeWings;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.KitSelectorGadget;
public class WaterWingsKitSelector extends KitSelectorGadget
{
private ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.DRIP_WATER.particleName, new Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.ANGEL_WING_PATTERN);
private ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.DRIP_WATER.particleName, new Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.ANGEL_WING_PATTERN);
public WaterWingsKitSelector(GadgetManager manager)
{
super(manager, "Water Wings", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE),
0, Material.GLASS, (byte) 0);
}
@Override
public void playParticle(Entity entity, Player playTo)
{
Location loc = entity.getLocation().add(0, 1.2, 0).add(entity.getLocation().getDirection().multiply(-0.2));
_wings.display(loc, playTo);
_wingsEdge.display(loc, playTo);
}
}