Checks for the correct world
This commit is contained in:
parent
9e0424ea46
commit
5d3dbbb44b
@ -132,7 +132,7 @@ public class CastleManager extends MiniPlugin
|
|||||||
if (event.getEntity() instanceof Item)
|
if (event.getEntity() instanceof Item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (UtilAlg.inBoundingBox(event.getLocation(), _castleLocationA, _castleLocationB))
|
if (isInsideCastle(event.getLocation()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ public class CastleManager extends MiniPlugin
|
|||||||
if (!fromLocation.getWorld().equals(toLocation.getWorld())) return;
|
if (!fromLocation.getWorld().equals(toLocation.getWorld())) return;
|
||||||
|
|
||||||
// Cancels movement
|
// Cancels movement
|
||||||
if (UtilAlg.inBoundingBox(toLocation, _castleLocationA, _castleLocationB))
|
if (isInsideCastle(toLocation))
|
||||||
{
|
{
|
||||||
Entity target = player;
|
Entity target = player;
|
||||||
while (target.getVehicle() != null)
|
while (target.getVehicle() != null)
|
||||||
@ -393,7 +393,7 @@ public class CastleManager extends MiniPlugin
|
|||||||
if (oldKing != null && oldKing.getKing().isOnline())
|
if (oldKing != null && oldKing.getKing().isOnline())
|
||||||
{
|
{
|
||||||
// Removes old king from the throne
|
// Removes old king from the throne
|
||||||
if (UtilAlg.inBoundingBox(oldKing.getKing().getLocation(), _castleLocationA, _castleLocationB))
|
if (isInsideCastle(oldKing.getKing().getLocation()))
|
||||||
{
|
{
|
||||||
oldKing.getKing().teleport(new Location(UtilWorld.getWorld("world"), 0, 78, -31));
|
oldKing.getKing().teleport(new Location(UtilWorld.getWorld("world"), 0, 78, -31));
|
||||||
UtilPlayer.message(oldKing.getKing(), F.main("Kingdom", "You are no longer the king of that castle!"));
|
UtilPlayer.message(oldKing.getKing(), F.main("Kingdom", "You are no longer the king of that castle!"));
|
||||||
@ -634,6 +634,9 @@ public class CastleManager extends MiniPlugin
|
|||||||
if (!isHub())
|
if (!isHub())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!location.getWorld().equals(_castleLocationA.getWorld()))
|
||||||
|
return false;
|
||||||
|
|
||||||
return UtilAlg.inBoundingBox(location, _castleLocationA, _castleLocationB);
|
return UtilAlg.inBoundingBox(location, _castleLocationA, _castleLocationB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user