Skip to content

Commit

Permalink
Fix converting potion effect type to NMS
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinCodes committed Jul 8, 2022
1 parent 469c22f commit fa17ab9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/gg/projecteden/nexus/utils/ItemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import java.util.function.Predicate;
import java.util.stream.Collectors;

import static gg.projecteden.api.common.utils.StringUtils.listLast;
import static gg.projecteden.nexus.utils.Nullables.isNullOrAir;
import static gg.projecteden.nexus.utils.StringUtils.stripColor;

Expand Down Expand Up @@ -620,9 +619,9 @@ public static MobEffectInstance toNMS(PotionEffect effect) {

@NotNull
public static MobEffect toNMS(PotionEffectType effect) {
for (MobEffect nmsEffect : Registry.MOB_EFFECT)
if (effect.getName().toLowerCase().equals(listLast(nmsEffect.getDescriptionId(), ".")))
return nmsEffect;
final MobEffect nmsEffect = MobEffect.byId(effect.getId());
if (nmsEffect != null)
return nmsEffect;

throw new InvalidInputException("Unknown potion type " + effect);
}
Expand Down

0 comments on commit fa17ab9

Please sign in to comment.