Skip to content

Commit

Permalink
Fix null
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Dec 16, 2024
1 parent 8edec91 commit 73a60e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ public static String getConfigNodeByEntity(Entity e) {
public static Component getEntityCustomNameComponent(Entity e) {
final String rawName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(e));

return Util.convertFromLegacy(rawName);
return Util.convertFromLegacy(rawName != null ? rawName : "");
}

public static String getEntityCustomName(Entity e) {
final String rawName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(e));

return PlainTextComponentSerializer.plainText().serialize(Util.convertFromLegacy(rawName));
return PlainTextComponentSerializer.plainText().serialize(Util.convertFromLegacy(rawName != null ? rawName : ""));
}

// Reduce directly detect hasOwner as few as possible just makes it looks better
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ public static String getConfigNodeByEntity(Entity e) {
public static Component getEntityCustomNameComponent(Entity e) {
final String rawName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(e));

return Util.convertFromLegacy(rawName);
return Util.convertFromLegacy(rawName != null ? rawName : "");
}

public static String getEntityCustomName(Entity e) {
final String rawName = Messages.getInstance().getConfig().getString("Mobs." + EntityUtil.getConfigNodeByEntity(e));

return PlainTextComponentSerializer.plainText().serialize(Util.convertFromLegacy(rawName));
return PlainTextComponentSerializer.plainText().serialize(Util.convertFromLegacy(rawName != null ? rawName : ""));
}

// Reduce directly detect hasOwner as few as possible just makes it looks better
Expand Down

0 comments on commit 73a60e8

Please sign in to comment.