-
-
Notifications
You must be signed in to change notification settings - Fork 103
/
EntityShouldBurn.java
44 lines (36 loc) · 1.33 KB
/
EntityShouldBurn.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.denizenscript.denizen.paper.properties;
import com.denizenscript.denizen.objects.EntityTag;
import com.denizenscript.denizen.objects.properties.entity.EntityProperty;
import com.denizenscript.denizencore.objects.Mechanism;
import com.denizenscript.denizencore.objects.core.ElementTag;
import org.bukkit.entity.Zombie;
public class EntityShouldBurn extends EntityProperty<ElementTag> {
// <--[property]
// @object EntityTag
// @name should_burn
// @input ElementTag(Boolean)
// @plugin Paper
// @description
// If the entity is a Zombie, controls whether it should burn in daylight.
// -->
public static boolean describes(EntityTag entity) {
return entity.getBukkitEntity() instanceof Zombie;
}
@Override
public ElementTag getPropertyValue() {
return new ElementTag(as(Zombie.class).shouldBurnInDay());
}
@Override
public String getPropertyId() {
return "should_burn";
}
@Override
public void setPropertyValue(ElementTag param, Mechanism mechanism) {
if (mechanism.requireBoolean()) {
as(Zombie.class).setShouldBurnInDay(param.asBoolean());
}
}
public static void register() {
autoRegister("should_burn", EntityShouldBurn.class, ElementTag.class, false);
}
}