null pointers with siege weaponl oading
This commit is contained in:
parent
8507bb1bd8
commit
24b834370b
@ -223,6 +223,9 @@ public class Cannon extends SiegeWeapon
|
||||
.filter(entity -> entity.getType().equals(EntityType.ARMOR_STAND))
|
||||
.filter(entity -> entity.hasMetadata("WeaponId"))
|
||||
.filter(entity -> entity.getMetadata("WeaponId").get(0).asInt() == _uniqueId)
|
||||
.filter(entity -> entity.getPassenger() != null)
|
||||
.filter(entity -> entity.getPassenger().getPassenger() != null)
|
||||
.limit(1l)
|
||||
.forEach(entity -> {
|
||||
|
||||
addEntity(entity, "WEAPON");
|
||||
@ -230,6 +233,11 @@ public class Cannon extends SiegeWeapon
|
||||
addEntity(entity.getPassenger().getPassenger(), "PLAYERMOUNT");
|
||||
|
||||
});
|
||||
|
||||
if (getEntity("WEAPON") == null || getEntity("Filler_1") == null || getEntity("PLAYERMOUNT") == null)
|
||||
{
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -227,17 +227,25 @@ public class Catapult extends SiegeWeapon
|
||||
public void FindEntities()
|
||||
{
|
||||
Lists.newArrayList(_location.getChunk().getEntities())
|
||||
.stream()
|
||||
.filter(entity -> entity.getType().equals(EntityType.ARMOR_STAND))
|
||||
.filter(entity -> entity.hasMetadata("WeaponId"))
|
||||
.filter(entity -> entity.getMetadata("WeaponId").get(0).asInt() == _uniqueId)
|
||||
.forEach(entity -> {
|
||||
|
||||
addEntity(entity, "WEAPON");
|
||||
addEntity(entity.getPassenger(), "Filler_1");
|
||||
addEntity(entity.getPassenger().getPassenger(), "PLAYERMOUNT");
|
||||
|
||||
});
|
||||
.stream()
|
||||
.filter(entity -> entity.getType().equals(EntityType.ARMOR_STAND))
|
||||
.filter(entity -> entity.hasMetadata("WeaponId"))
|
||||
.filter(entity -> entity.getMetadata("WeaponId").get(0).asInt() == _uniqueId)
|
||||
.filter(entity -> entity.getPassenger() != null)
|
||||
.filter(entity -> entity.getPassenger().getPassenger() != null)
|
||||
.limit(1l)
|
||||
.forEach(entity -> {
|
||||
|
||||
addEntity(entity, "WEAPON");
|
||||
addEntity(entity.getPassenger(), "Filler_1");
|
||||
addEntity(entity.getPassenger().getPassenger(), "PLAYERMOUNT");
|
||||
|
||||
});
|
||||
|
||||
if (getEntity("WEAPON") == null || getEntity("Filler_1") == null || getEntity("PLAYERMOUNT") == null)
|
||||
{
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -256,15 +256,16 @@ public abstract class SiegeWeapon implements Listener
|
||||
checkInv();
|
||||
}
|
||||
|
||||
_rider = (Player) getEntity("PLAYERMOUNT").getPassenger();
|
||||
if (getEntity("PLAYERMOUNT").getPassenger() != null)
|
||||
{
|
||||
_rider = (Player) getEntity("PLAYERMOUNT").getPassenger();
|
||||
}
|
||||
|
||||
if (!getNextState().equals(_currentState))
|
||||
{
|
||||
setState(getNextState());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (_projectile != null)
|
||||
{
|
||||
if (_projectile.hasDied())
|
||||
|
Loading…
Reference in New Issue
Block a user