Allow string entry to CustomDisguise
This commit is contained in:
parent
e50c9fc99f
commit
001064adf0
@ -3,6 +3,7 @@ package me.libraryaddict.disguise.disguisetypes;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.CustomWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.CustomWatcher;
|
||||||
import me.libraryaddict.disguise.utilities.modded.CustomEntity;
|
import me.libraryaddict.disguise.utilities.modded.CustomEntity;
|
||||||
|
import me.libraryaddict.disguise.utilities.modded.ModdedManager;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -15,6 +16,10 @@ public class CustomDisguise extends TargetedDisguise {
|
|||||||
@Getter
|
@Getter
|
||||||
private CustomEntity customEntity;
|
private CustomEntity customEntity;
|
||||||
|
|
||||||
|
public CustomDisguise(String moddedEntityName) {
|
||||||
|
this(ModdedManager.getCustomEntity(moddedEntityName));
|
||||||
|
}
|
||||||
|
|
||||||
public CustomDisguise(CustomEntity customEntity) {
|
public CustomDisguise(CustomEntity customEntity) {
|
||||||
super(customEntity.isLiving() ? DisguiseType.CUSTOM_LIVING : DisguiseType.CUSTOM_MISC);
|
super(customEntity.isLiving() ? DisguiseType.CUSTOM_LIVING : DisguiseType.CUSTOM_MISC);
|
||||||
|
|
||||||
|
@ -99,7 +99,8 @@ public class ModdedManager implements PluginMessageListener {
|
|||||||
|
|
||||||
public static CustomEntity getCustomEntity(String name) {
|
public static CustomEntity getCustomEntity(String name) {
|
||||||
for (CustomEntity entity : entities.values()) {
|
for (CustomEntity entity : entities.values()) {
|
||||||
if (!entity.getName().equalsIgnoreCase(name)) {
|
if (!name.contains(":") ? entity.getName().split(":")[1].equalsIgnoreCase(name) :
|
||||||
|
!entity.getName().equalsIgnoreCase(name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user