Add null checks to potion removal and expiry event handlers, fixes #166
This commit is contained in:
@@ -52,7 +52,7 @@ public interface ISyncedPotion {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onPotionExpiryEvent(PotionEvent.PotionExpiryEvent event){
|
public static void onPotionExpiryEvent(PotionEvent.PotionExpiryEvent event){
|
||||||
|
|
||||||
if(event.getPotionEffect().getPotion() instanceof ISyncedPotion
|
if(event.getPotionEffect() != null && event.getPotionEffect().getPotion() instanceof ISyncedPotion
|
||||||
&& ((ISyncedPotion)event.getPotionEffect().getPotion()).shouldSync(event.getEntityLiving())){
|
&& ((ISyncedPotion)event.getPotionEffect().getPotion()).shouldSync(event.getEntityLiving())){
|
||||||
|
|
||||||
if(!event.getEntityLiving().world.isRemote){
|
if(!event.getEntityLiving().world.isRemote){
|
||||||
@@ -67,7 +67,7 @@ public interface ISyncedPotion {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onPotionRemoveEvent(PotionEvent.PotionRemoveEvent event){
|
public static void onPotionRemoveEvent(PotionEvent.PotionRemoveEvent event){
|
||||||
|
|
||||||
if(event.getPotionEffect().getPotion() instanceof ISyncedPotion
|
if(event.getPotionEffect() != null && event.getPotionEffect().getPotion() instanceof ISyncedPotion
|
||||||
&& ((ISyncedPotion)event.getPotionEffect().getPotion()).shouldSync(event.getEntityLiving())){
|
&& ((ISyncedPotion)event.getPotionEffect().getPotion()).shouldSync(event.getEntityLiving())){
|
||||||
|
|
||||||
if(!event.getEntityLiving().world.isRemote){
|
if(!event.getEntityLiving().world.isRemote){
|
||||||
|
|||||||
Reference in New Issue
Block a user