#1182: Consolidate Preconditions use and minor cleanup
By: Doc <nachito94@msn.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.event;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import java.net.InetAddress;
|
||||
@@ -1610,9 +1611,8 @@ public class CraftEventFactory {
|
||||
PotionEffect bukkitOldEffect = (oldEffect == null) ? null : CraftPotionUtil.toBukkit(oldEffect);
|
||||
PotionEffect bukkitNewEffect = (newEffect == null) ? null : CraftPotionUtil.toBukkit(newEffect);
|
||||
|
||||
if (bukkitOldEffect == null && bukkitNewEffect == null) {
|
||||
throw new IllegalStateException("Old and new potion effect are both null");
|
||||
}
|
||||
Preconditions.checkState(bukkitOldEffect != null, "Old and new potion is null");
|
||||
Preconditions.checkState(bukkitNewEffect != null, "New potion effect is null");
|
||||
|
||||
EntityPotionEffectEvent event = new EntityPotionEffectEvent((LivingEntity) entity.getBukkitEntity(), bukkitOldEffect, bukkitNewEffect, cause, action, willOverride);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user