Skip to content

Commit 8b64f9c

Browse files
committed
update Citizens version link and targetable
1 parent 28fed13 commit 8b64f9c

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

paper/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<dependency>
3232
<groupId>net.citizensnpcs</groupId>
3333
<artifactId>citizens-main</artifactId>
34-
<version>2.0.35-SNAPSHOT</version>
34+
<version>2.0.37-SNAPSHOT</version>
3535
<type>jar</type>
3636
<scope>provided</scope>
3737
<exclusions>

plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<dependency>
4545
<groupId>net.citizensnpcs</groupId>
4646
<artifactId>citizens-main</artifactId>
47-
<version>2.0.35-SNAPSHOT</version>
47+
<version>2.0.37-SNAPSHOT</version>
4848
<type>jar</type>
4949
<scope>provided</scope>
5050
<exclusions>

plugin/src/main/java/com/denizenscript/denizen/objects/NPCTag.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,11 @@ else if (attribute.startsWith("list", 2)) {
985985
// Returns whether the NPC is targetable.
986986
// -->
987987
tagProcessor.registerTag(ElementTag.class, "targetable", (attribute, object) -> {
988-
boolean targetable = object.getCitizen().data().get(NPC.Metadata.TARGETABLE, object.getCitizen().data().get(NPC.Metadata.DEFAULT_PROTECTED, true));
989-
return new ElementTag(targetable);
988+
TargetableTrait trait = object.getCitizen().getTraitNullable(TargetableTrait.class);
989+
if (trait != null) {
990+
return new ElementTag(trait.isTargetable());
991+
}
992+
return new ElementTag(object.getCitizen().data().get(NPC.Metadata.DEFAULT_PROTECTED, true));
990993
});
991994

992995
// <--[tag]
@@ -1879,7 +1882,7 @@ else if (!trait.isSneaking() && mechanism.getValue().asBoolean()) {
18791882
// <NPCTag.targetable>
18801883
// -->
18811884
if (mechanism.matches("targetable") && mechanism.requireBoolean()) {
1882-
getCitizen().data().setPersistent(NPC.Metadata.TARGETABLE, mechanism.getValue().asBoolean());
1885+
getCitizen().getOrAddTrait(TargetableTrait.class).setTargetable(mechanism.getValue().asBoolean());
18831886
}
18841887

18851888
// <--[mechanism]

0 commit comments

Comments
 (0)