Fixed item and king not resetting after disabling

This commit is contained in:
LCastr0 2017-04-30 12:52:00 -03:00
parent 3268a49f82
commit 49fd8d3941

View File

@ -149,22 +149,6 @@ public class CastleManager extends MiniPlugin
Player player = event.getPlayer(); Player player = event.getPlayer();
if (_item != null && event.getFrom().distanceSquared(event.getTo()) >= 2)
{
if (_item.getPassenger() != null)
{
if (_item.getPassenger().equals(player))
{
event.setCancelled(true);
Location loc = _throneLocations[0].clone().add(0.5, 0.75, 0.5);
loc.setYaw(90);
loc.setPitch(0);
_item.teleport(loc);
_item.setPassenger(player);
}
}
}
if (_king != null) if (_king != null)
{ {
Player king = _king.getKing(); Player king = _king.getKing();
@ -282,13 +266,13 @@ public class CastleManager extends MiniPlugin
if (!isThrone) if (!isThrone)
return; return;
Location loc = _throneLocations[0].clone().add(0.5, 0.75, 0.5); Location loc = _throneLocations[0].clone().add(0.5, 1, 0.5);
loc.setYaw(90); loc.setYaw(90);
loc.setPitch(0); loc.setPitch(0);
Item item = loc.getWorld().dropItem(loc, new ItemStack(Material.WOOL, 1, (byte) 14)); Item item = loc.getWorld().dropItem(loc, new ItemStack(Material.WOOL, 1, (byte) 14));
item.setPickupDelay(Integer.MAX_VALUE); item.setPickupDelay(Integer.MAX_VALUE);
item.teleport(loc);
item.setVelocity(new Vector(0, 0, 0)); item.setVelocity(new Vector(0, 0, 0));
item.teleport(loc);
item.setPassenger(player); item.setPassenger(player);
_item = item; _item = item;
} }