Allow string entry to CustomDisguise

This commit is contained in:
libraryaddict 2020-04-19 07:17:58 +12:00
parent e50c9fc99f
commit 001064adf0
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
2 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package me.libraryaddict.disguise.disguisetypes;
import lombok.Getter;
import me.libraryaddict.disguise.disguisetypes.watchers.CustomWatcher;
import me.libraryaddict.disguise.utilities.modded.CustomEntity;
import me.libraryaddict.disguise.utilities.modded.ModdedManager;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -15,6 +16,10 @@ public class CustomDisguise extends TargetedDisguise {
@Getter
private CustomEntity customEntity;
public CustomDisguise(String moddedEntityName) {
this(ModdedManager.getCustomEntity(moddedEntityName));
}
public CustomDisguise(CustomEntity customEntity) {
super(customEntity.isLiving() ? DisguiseType.CUSTOM_LIVING : DisguiseType.CUSTOM_MISC);

View File

@ -99,7 +99,8 @@ public class ModdedManager implements PluginMessageListener {
public static CustomEntity getCustomEntity(String name) {
for (CustomEntity entity : entities.values()) {
if (!entity.getName().equalsIgnoreCase(name)) {
if (!name.contains(":") ? entity.getName().split(":")[1].equalsIgnoreCase(name) :
!entity.getName().equalsIgnoreCase(name)) {
continue;
}