mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-23 09:37:35 +01:00
Extra NPE check
This commit is contained in:
parent
99c7155a7a
commit
1505ccfeca
@ -367,12 +367,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity) instanceof NPCHolder ? ((NPCHolder) getHandle(entity)).getNPC() : null;
|
Entity handle = getHandle(entity);
|
||||||
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
||||||
return Lists.transform(NMSImpl.getHandle(entity).passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null || handle.passengers == null)
|
||||||
|
return Lists.newArrayList();
|
||||||
|
return Lists.transform(handle.passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity apply(Entity input) {
|
public org.bukkit.entity.Entity apply(Entity input) {
|
||||||
return input.getBukkitEntity();
|
return input.getBukkitEntity();
|
||||||
|
@ -386,12 +386,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity) instanceof NPCHolder ? ((NPCHolder) getHandle(entity)).getNPC() : null;
|
Entity handle = getHandle(entity);
|
||||||
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
||||||
return Lists.transform(NMSImpl.getHandle(entity).passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null || handle.passengers == null)
|
||||||
|
return Lists.newArrayList();
|
||||||
|
return Lists.transform(handle.passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity apply(Entity input) {
|
public org.bukkit.entity.Entity apply(Entity input) {
|
||||||
return input.getBukkitEntity();
|
return input.getBukkitEntity();
|
||||||
|
@ -390,12 +390,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity) instanceof NPCHolder ? ((NPCHolder) getHandle(entity)).getNPC() : null;
|
Entity handle = getHandle(entity);
|
||||||
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
||||||
return Lists.transform(NMSImpl.getHandle(entity).passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null || handle.passengers == null)
|
||||||
|
return Lists.newArrayList();
|
||||||
|
return Lists.transform(handle.passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity apply(Entity input) {
|
public org.bukkit.entity.Entity apply(Entity input) {
|
||||||
return input.getBukkitEntity();
|
return input.getBukkitEntity();
|
||||||
|
@ -412,12 +412,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity) instanceof NPCHolder ? ((NPCHolder) getHandle(entity)).getNPC() : null;
|
Entity handle = getHandle(entity);
|
||||||
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
||||||
return Lists.transform(NMSImpl.getHandle(entity).passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null || handle.passengers == null)
|
||||||
|
return Lists.newArrayList();
|
||||||
|
return Lists.transform(handle.passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity apply(Entity input) {
|
public org.bukkit.entity.Entity apply(Entity input) {
|
||||||
return input.getBukkitEntity();
|
return input.getBukkitEntity();
|
||||||
|
@ -448,12 +448,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity) instanceof NPCHolder ? ((NPCHolder) getHandle(entity)).getNPC() : null;
|
Entity handle = getHandle(entity);
|
||||||
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
||||||
return Lists.transform(NMSImpl.getHandle(entity).passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null || handle.passengers == null)
|
||||||
|
return Lists.newArrayList();
|
||||||
|
return Lists.transform(handle.passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity apply(Entity input) {
|
public org.bukkit.entity.Entity apply(Entity input) {
|
||||||
return input.getBukkitEntity();
|
return input.getBukkitEntity();
|
||||||
|
@ -455,12 +455,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity) instanceof NPCHolder ? ((NPCHolder) getHandle(entity)).getNPC() : null;
|
Entity handle = getHandle(entity);
|
||||||
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
||||||
return Lists.transform(NMSImpl.getHandle(entity).passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null || handle.passengers == null)
|
||||||
|
return Lists.newArrayList();
|
||||||
|
return Lists.transform(handle.passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity apply(Entity input) {
|
public org.bukkit.entity.Entity apply(Entity input) {
|
||||||
return input.getBukkitEntity();
|
return input.getBukkitEntity();
|
||||||
|
@ -461,12 +461,16 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity) instanceof NPCHolder ? ((NPCHolder) getHandle(entity)).getNPC() : null;
|
Entity handle = getHandle(entity);
|
||||||
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
public List<org.bukkit.entity.Entity> getPassengers(org.bukkit.entity.Entity entity) {
|
||||||
return Lists.transform(NMSImpl.getHandle(entity).passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null || handle.passengers == null)
|
||||||
|
return Lists.newArrayList();
|
||||||
|
return Lists.transform(handle.passengers, new Function<Entity, org.bukkit.entity.Entity>() {
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity apply(Entity input) {
|
public org.bukkit.entity.Entity apply(Entity input) {
|
||||||
return input.getBukkitEntity();
|
return input.getBukkitEntity();
|
||||||
|
@ -320,7 +320,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
public NPC getNPC(org.bukkit.entity.Entity entity) {
|
||||||
return getHandle(entity) instanceof NPCHolder ? ((NPCHolder) getHandle(entity)).getNPC() : null;
|
Entity handle = getHandle(entity);
|
||||||
|
return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user