Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Strays to the should_burn property #2638

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.denizenscript.denizencore.objects.core.ElementTag;
import org.bukkit.entity.Phantom;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Stray;
import org.bukkit.entity.Zombie;

public class EntityShouldBurn extends EntityProperty<ElementTag> {
Expand All @@ -16,12 +17,13 @@ public class EntityShouldBurn extends EntityProperty<ElementTag> {
// @input ElementTag(Boolean)
// @plugin Paper
// @description
// If the entity is a Zombie, Skeleton, or Phantom, controls whether it should burn in daylight.
// If the entity is a Zombie, Skeleton, Stray, or Phantom, controls whether it should burn in daylight.
// -->

public static boolean describes(EntityTag entity) {
return entity.getBukkitEntity() instanceof Zombie
|| entity.getBukkitEntity() instanceof Skeleton
|| entity.getBukkitEntity() instanceof Stray
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just be AbstractSkeleton (covering both Skeleton and Stray), which is the interface that the method is on anyway?

|| entity.getBukkitEntity() instanceof Phantom;
}

Expand All @@ -33,6 +35,9 @@ public ElementTag getPropertyValue() {
else if (getEntity() instanceof Skeleton skeleton) {
return new ElementTag(skeleton.shouldBurnInDay());
}
else if (getEntity() instanceof Stray stray) {
return new ElementTag(stray.shouldBurnInDay());
}
else { // phantom
return new ElementTag(as(Phantom.class).shouldBurnInDay());
}
Expand All @@ -52,6 +57,9 @@ public void setPropertyValue(ElementTag param, Mechanism mechanism) {
else if (getEntity() instanceof Skeleton skeleton) {
skeleton.setShouldBurnInDay(param.asBoolean());
}
else if (getEntity() instanceof Stray stray) {
stray.setShouldBurnInDay(param.asBoolean());
}
else { // phantom
as(Phantom.class).setShouldBurnInDay(param.asBoolean());
}
Expand Down