Rainbow taunt now uses sides of player as locations

This commit is contained in:
LCastr0 2017-03-07 21:51:06 -03:00
parent 1ffac1dd31
commit 3469b890d4
2 changed files with 11 additions and 8 deletions

View File

@ -3,10 +3,10 @@ package mineplex.core.gadget.gadgets.taunts;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.TauntGadget; import mineplex.core.gadget.types.TauntGadget;
@ -35,11 +35,15 @@ public class RainbowTaunt extends TauntGadget
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
return; return;
double randX = UtilMath.random(3.5, 15), randZ = UtilMath.random(3.5, 15); Vector dir = player.getLocation().getDirection();
Location target = player.getLocation().clone().add(randX, 0, randZ); Vector sideA = dir.clone().setX(-dir.getZ()).setZ(dir.getX());
Vector sideB = dir.clone().setX(dir.getZ()).setZ(-dir.getX());
RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(player, Manager.getPlugin()); Location start = player.getLocation().clone().add(sideA.multiply(4).toLocation(player.getWorld()));
rainbowTauntEffect.setTargetLocation(new EffectLocation(target)); Location end = player.getLocation().clone().add(sideB.multiply(4).toLocation(player.getWorld()));
RainbowTauntEffect rainbowTauntEffect = new RainbowTauntEffect(start, Manager.getPlugin());
rainbowTauntEffect.setTargetLocation(new EffectLocation(end));
rainbowTauntEffect.start(); rainbowTauntEffect.start();
} }

View File

@ -3,7 +3,6 @@ package mineplex.core.particleeffects;
import java.awt.Color; import java.awt.Color;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -25,9 +24,9 @@ public class RainbowTauntEffect extends Effect
private static final Color INDIGO = new Color(75, 0, 130); private static final Color INDIGO = new Color(75, 0, 130);
private static final Color VIOLET = new Color(143, 0, 255); private static final Color VIOLET = new Color(143, 0, 255);
public RainbowTauntEffect(Player player, JavaPlugin javaPlugin) public RainbowTauntEffect(Location start, JavaPlugin javaPlugin)
{ {
super(16, new EffectLocation(player), javaPlugin, 5); super(16, new EffectLocation(start), javaPlugin, 5);
} }
@Override @Override