Skip to content

Commit

Permalink
Add new metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Apr 15, 2024
1 parent 8e11ad5 commit eed3fd2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/net/citizensnpcs/api/npc/NPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.citizensnpcs.api.trait.TraitFactory;
import net.citizensnpcs.api.util.BoundingBox;
import net.citizensnpcs.api.util.DataKey;
import net.kyori.adventure.text.Component;

/**
* Represents an NPC with optional {@link Trait}s.
Expand Down Expand Up @@ -583,6 +584,7 @@ public enum Metadata {
* Whether to prevent NPC being targeted by hostile mobs.
*/
TARGETABLE("protected-target", Boolean.class),
TEXT_DISPLAY_COMPONENT("text-display-component", Component.class),
/**
* The tracking distance for packets. Defaults to the default tracking distance defined by the server
*/
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/net/citizensnpcs/api/util/SpigotUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ public static int[] getVersion() {
String version = Bukkit.getBukkitVersion();

if (version == null || version.isEmpty())
return BUKKIT_VERSION = new int[] { 1, 8 };
return BUKKIT_VERSION = new int[] { 1, 8, 8 };

String[] parts = version.split("\\.");
if (parts[1].contains("-")) {
parts[1] = parts[1].split("-")[0];
}
if (parts.length == 3) {
return BUKKIT_VERSION = new int[] { Integer.parseInt(parts[0]), Integer.parseInt(parts[1]),
Integer.parseInt(parts[2]) };
}
return BUKKIT_VERSION = new int[] { Integer.parseInt(parts[0]), Integer.parseInt(parts[1]) };
}
return BUKKIT_VERSION;
Expand Down

0 comments on commit eed3fd2

Please sign in to comment.