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

Persistent entities should never be removed. #1608

Merged
merged 2 commits into from
Dec 19, 2020

Conversation

BONNe
Copy link
Member

@BONNe BONNe commented Dec 18, 2020

There is no valid reason why BentoBox should remove the Persistent entity. Otherwise, what is the point of being persistent if someone can just remove it?

There is no valid reason why BentoBox should remove the Persistent entity. Otherwise, what is the point of being persistent if someone can just remove it?
@BONNe
Copy link
Member Author

BONNe commented Dec 18, 2020

This change will not remove Pufferfish if someone takes them out of a bucket, or if they rename any hostile entity.

But I think it should not do it... Otherwise, if someone creates a peaceful raider or any other hostile entity, they could be removed on teleport... and it is just wrong.

Also, GeoLimitMobsListener should be reworked, but adding just a persistence check would include all animals, as they by default are persistent. So if the point of that listener is to include all passive mobs, then it should check for persistence on hostile entities, fishes from a bucket, and all entities with a custom name.

Protect renamed and persistent entities from being removed if they wander outside island bounds.
Except for animals, as they cannot be removed only if they are renamed.
@tastybento tastybento merged commit 0e4b3b4 into BentoBoxWorld:develop Dec 19, 2020
@tastybento
Copy link
Member

Thanks!

@@ -1374,7 +1374,8 @@ public void clearArea(Location loc) {
loc.getWorld().getNearbyEntities(loc, plugin.getSettings().getClearRadius(),
plugin.getSettings().getClearRadius(),
plugin.getSettings().getClearRadius()).stream()
.filter(en -> Util.isHostileEntity(en)
.filter(en -> !en.isPersistent()
Copy link
Member

Choose a reason for hiding this comment

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

This caused a regression. By default (per JavaDocs) all entities are persistent. So actually, this is already false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants