Changed clocks to be behind player

This commit is contained in:
LCastr0 2016-12-14 00:09:02 -02:00 committed by cnr
parent 36801283d7
commit 651d0c5966

View File

@ -1,5 +1,6 @@
package mineplex.core.gadget.gadgets.taunts.eternal;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
@ -20,8 +21,9 @@ public class EternalClock
public void createStand()
{
_armorStand = _player.getWorld().spawn(_player.getLocation().clone().add(_clockPosition.getX(), .5,
_clockPosition.getZ()), ArmorStand.class);
Location clockLocation = _player.getLocation().clone().add(_player.getLocation().getDirection().multiply(-1))
.add(0, _clockPosition.getY(), 0);
_armorStand = _player.getWorld().spawn(clockLocation, ArmorStand.class);
_armorStand.setItemInHand(new ItemStack(Material.WATCH));
_armorStand.setVisible(false);
_armorStand.setGravity(false);
@ -43,7 +45,9 @@ public class EternalClock
case D:
_clockPosition = ClockPosition.A;
}
_armorStand.teleport(_player.getLocation().clone().add(_clockPosition.getX(), .5, _clockPosition.getZ()));
Location clockLocation = _player.getLocation().clone().add(_player.getLocation().getDirection().multiply(-1))
.add(0, _clockPosition.getY(), 0);
_armorStand.teleport(clockLocation);
}
public void removeStand()
@ -53,27 +57,21 @@ public class EternalClock
public enum ClockPosition
{
A(1, 0),
B(0, 1),
C(-1, 0),
D(0, -1);
A(0.5),
B(1),
C(1.5),
D(2);
private int _x, _z;
private double _y;
ClockPosition(int x, int z)
ClockPosition(double y)
{
_x = x;
_z = z;
_y = y;
}
public int getX()
public double getY()
{
return _x;
}
public int getZ()
{
return _z;
return _y;
}
}