mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 06:05:17 +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
|
||||
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (handle == null) {
|
||||
return null;
|
||||
}
|
||||
Entity e = handle.getVehicle();
|
||||
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
||||
}
|
||||
|
@ -547,6 +547,9 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (handle == null) {
|
||||
return null;
|
||||
}
|
||||
Entity e = handle.getVehicle();
|
||||
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
||||
}
|
||||
|
@ -84,9 +84,10 @@ public class OcelotController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect d(DamageSource damagesource) {
|
||||
@ -188,9 +189,10 @@ public class OcelotController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
|
@ -551,6 +551,9 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (handle == null) {
|
||||
return null;
|
||||
}
|
||||
Entity e = handle.getVehicle();
|
||||
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user