diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java index e3cfb9d22a..5ebb069631 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java @@ -127,6 +127,7 @@ public static void registerMainProperties() { PropertyParser.registerProperty(EntityMaterial.class, EntityTag.class); PropertyParser.registerProperty(EntityMaxFuseTicks.class, EntityTag.class); if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_19)) { + PropertyParser.registerProperty(EntityOnBack.class, EntityTag.class); PropertyParser.registerProperty(EntityOpacity.class, EntityTag.class); } PropertyParser.registerProperty(EntityPainting.class, EntityTag.class); @@ -146,6 +147,7 @@ public static void registerMainProperties() { PropertyParser.registerProperty(EntityRiptide.class, EntityTag.class); if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_19)) { PropertyParser.registerProperty(EntityRightRotation.class, EntityTag.class); + PropertyParser.registerProperty(EntityRolling.class, EntityTag.class); } PropertyParser.registerProperty(EntityRotation.class, EntityTag.class); if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_19)) { @@ -164,6 +166,9 @@ public static void registerMainProperties() { PropertyParser.registerProperty(EntitySitting.class, EntityTag.class); PropertyParser.registerProperty(EntitySize.class, EntityTag.class); PropertyParser.registerProperty(EntitySmall.class, EntityTag.class); + if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_19)) { + PropertyParser.registerProperty(EntitySneezing.class, EntityTag.class); + } PropertyParser.registerProperty(EntitySpeed.class, EntityTag.class); PropertyParser.registerProperty(EntitySpell.class, EntityTag.class); if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_19)) { diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityOnBack.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityOnBack.java new file mode 100644 index 0000000000..211495ee09 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityOnBack.java @@ -0,0 +1,47 @@ +package com.denizenscript.denizen.objects.properties.entity; + +import com.denizenscript.denizen.objects.EntityTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.core.ElementTag; +import org.bukkit.entity.Panda; + +public class EntityOnBack extends EntityProperty { + + // <--[property] + // @object EntityTag + // @name on_back + // @input ElementTag(Boolean) + // @description + // Controls whether a panda is on its back. + // --> + + public static boolean describes(EntityTag entity) { + return entity.getBukkitEntity() instanceof Panda; + } + + @Override + public boolean isDefaultValue(ElementTag val) { + return !val.asBoolean(); + } + + @Override + public ElementTag getPropertyValue() { + return new ElementTag(as(Panda.class).isOnBack()); + } + + @Override + public void setPropertyValue(ElementTag param, Mechanism mechanism) { + if (mechanism.requireBoolean()) { + as(Panda.class).setOnBack(param.asBoolean()); + } + } + + @Override + public String getPropertyId() { + return "on_back"; + } + + public static void register() { + autoRegister("on_back", EntityOnBack.class, ElementTag.class, false); + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityRolling.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityRolling.java new file mode 100644 index 0000000000..4e964eea32 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityRolling.java @@ -0,0 +1,47 @@ +package com.denizenscript.denizen.objects.properties.entity; + +import com.denizenscript.denizen.objects.EntityTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.core.ElementTag; +import org.bukkit.entity.Panda; + +public class EntityRolling extends EntityProperty { + + // <--[property] + // @object EntityTag + // @name rolling + // @input ElementTag(Boolean) + // @description + // Controls whether a panda is rolling on the ground. + // --> + + public static boolean describes(EntityTag entity) { + return entity.getBukkitEntity() instanceof Panda; + } + + @Override + public boolean isDefaultValue(ElementTag val) { + return !val.asBoolean(); + } + + @Override + public ElementTag getPropertyValue() { + return new ElementTag(as(Panda.class).isRolling()); + } + + @Override + public void setPropertyValue(ElementTag param, Mechanism mechanism) { + if (mechanism.requireBoolean()) { + as(Panda.class).setRolling(param.asBoolean()); + } + } + + @Override + public String getPropertyId() { + return "rolling"; + } + + public static void register() { + autoRegister("rolling", EntityRolling.class, ElementTag.class, false); + } +} diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntitySneezing.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntitySneezing.java new file mode 100644 index 0000000000..8450cb6045 --- /dev/null +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntitySneezing.java @@ -0,0 +1,47 @@ +package com.denizenscript.denizen.objects.properties.entity; + +import com.denizenscript.denizen.objects.EntityTag; +import com.denizenscript.denizencore.objects.Mechanism; +import com.denizenscript.denizencore.objects.core.ElementTag; +import org.bukkit.entity.Panda; + +public class EntitySneezing extends EntityProperty { + + // <--[property] + // @object EntityTag + // @name sneezing + // @input ElementTag(Boolean) + // @description + // Controls whether a panda is sneezing. + // --> + + public static boolean describes(EntityTag entity) { + return entity.getBukkitEntity() instanceof Panda; + } + + @Override + public boolean isDefaultValue(ElementTag val) { + return !val.asBoolean(); + } + + @Override + public ElementTag getPropertyValue() { + return new ElementTag(as(Panda.class).isSneezing()); + } + + @Override + public void setPropertyValue(ElementTag param, Mechanism mechanism) { + if (mechanism.requireBoolean()) { + as(Panda.class).setSneezing(param.asBoolean()); + } + } + + @Override + public String getPropertyId() { + return "sneezing"; + } + + public static void register() { + autoRegister("sneezing", EntitySneezing.class, ElementTag.class, false); + } +}