Skip to content

Commit

Permalink
Fixed #365
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Jan 19, 2025
1 parent 743d3fe commit fe6000b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions modules/banner-api/src/main/java/org/bukkit/NamespacedKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,21 @@ public static NamespacedKey fromString(@NotNull String string, @Nullable Plugin
public static NamespacedKey fromString(@NotNull String key) {
return fromString(key, null);
}

// Paper start
@NotNull
public String namespace() {
return this.getNamespace();
}

@NotNull
public String value() {
return this.getKey();
}

@NotNull
public String asString() {
return this.namespace + ':' + this.key;
}
// Paper end
}
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public String getItemTranslationKey(Material material) {
@Override
public String getTranslationKey(EntityType entityType) {
Preconditions.checkArgument(entityType.getName() != null, "Invalid name of EntityType %s for translation key", entityType);
String mods = ServerAPI.entityTypeMap0.get(entityType).getDescriptionId();
String mods = ServerAPI.entityTypeMap0.containsKey(entityType) ? ServerAPI.entityTypeMap0.get(entityType).getDescriptionId() : entityType.getKey().asString();
return net.minecraft.world.entity.EntityType.byString(entityType.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElse(mods);
}

Expand Down

0 comments on commit fe6000b

Please sign in to comment.