fix: glow import for znpcs

This commit is contained in:
D3v1s0m 2024-12-27 18:26:45 +05:30
parent b8dda22154
commit 218c4e48cc
No known key found for this signature in database
GPG key ID: FA1F770C7B1D40C1
2 changed files with 12 additions and 5 deletions

View file

@ -189,12 +189,15 @@ public class ZNpcImporter implements DataImporter {
if (toggleValues.containsKey("mirror")) {
npc.setProperty(propertyRegistry.getByName("skin", SkinDescriptor.class), new MirrorDescriptor(skinCache));
}
if (toggleValues.containsKey("glow")) {
try {
npc.setProperty(propertyRegistry.getByName("glow", DyeColor.class), DyeColor.valueOf((String) toggleValues.get("glow")));
} catch (IllegalArgumentException e) {
if (toggleValues.containsKey("glow") && (boolean) toggleValues.get("glow")) {
if (!model.getGlowName().isEmpty())
try {
npc.setProperty(propertyRegistry.getByName("glow", DyeColor.class), DyeColor.valueOf(model.getGlowName()));
} catch (IllegalArgumentException e) {
npc.setProperty(propertyRegistry.getByName("glow", DyeColor.class), DyeColor.WHITE);
}
else
npc.setProperty(propertyRegistry.getByName("glow", DyeColor.class), DyeColor.WHITE);
}
}
}

View file

@ -84,4 +84,8 @@ public class ZNpcsModel {
public String getSignature() {
return signature;
}
public String getGlowName() {
return glowName;
}
}