mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Add a NPE check to getVehicle
This commit is contained in:
parent
d14119bc38
commit
bf13181bd1
@ -505,6 +505,9 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = NMSImpl.getHandle(entity);
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Entity e = handle.getVehicle();
|
Entity e = handle.getVehicle();
|
||||||
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -547,6 +547,9 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = NMSImpl.getHandle(entity);
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Entity e = handle.getVehicle();
|
Entity e = handle.getVehicle();
|
||||||
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,9 @@ public class OcelotController extends MobEntityController {
|
|||||||
// this method is called by both the entities involved - cancelling
|
// this method is called by both the entities involved - cancelling
|
||||||
// it will not stop the NPC from moving.
|
// it will not stop the NPC from moving.
|
||||||
super.collide(entity);
|
super.collide(entity);
|
||||||
if (npc != null)
|
if (npc != null) {
|
||||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -188,8 +189,9 @@ public class OcelotController extends MobEntityController {
|
|||||||
@Override
|
@Override
|
||||||
public void M() {
|
public void M() {
|
||||||
super.M();
|
super.M();
|
||||||
if (npc != null)
|
if (npc != null) {
|
||||||
npc.update();
|
npc.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -551,6 +551,9 @@ public class NMSImpl implements NMSBridge {
|
|||||||
@Override
|
@Override
|
||||||
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
||||||
Entity handle = NMSImpl.getHandle(entity);
|
Entity handle = NMSImpl.getHandle(entity);
|
||||||
|
if (handle == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Entity e = handle.getVehicle();
|
Entity e = handle.getVehicle();
|
||||||
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user