Fix item being thrown from the throne
This commit is contained in:
parent
e6852d92f2
commit
28a5a438f5
@ -149,6 +149,22 @@ 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();
|
||||||
@ -411,6 +427,8 @@ public class CastleManager extends MiniPlugin
|
|||||||
removePeasant(player);
|
removePeasant(player);
|
||||||
|
|
||||||
_kings.put(player, new King(player));
|
_kings.put(player, new King(player));
|
||||||
|
|
||||||
|
updateLobbyKing();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -462,6 +480,7 @@ public class CastleManager extends MiniPlugin
|
|||||||
removeKing(player);
|
removeKing(player);
|
||||||
|
|
||||||
_peasants.put(player, new Peasant(player));
|
_peasants.put(player, new Peasant(player));
|
||||||
|
updateLobbyKing();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user