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

Changed CreatureSpawnEvent to be EntitySpawnEvent and attempted to ed… #1635

Closed

Conversation

Zorua162
Copy link

@Zorua162 Zorua162 commented Jan 7, 2021

Simple change in an attempt to make TNT be geo limitable.

(Based on chat with tastybento in discord it sounds like this isn't the change you are looking for as many of the entities added do not have getRemoveWhenFarAway(), and I do not currently know a clean way to implement a toggle for this that would be safe from the configs).

Also has the added bonus of being able to geo limit armour stands, falling blocks, fire charges #973 and I assume a number of other entities that weren't caught by CreatureSpawnEvent.

In addition I attempted to change the GUI to match this new ability of geo limit, however this seems to have caused errors in the automated tests and I'm unsure why that is.
In addition I tested every entity that is now available in the geo limit tab and got these results (A number of entities may
need removing from this GUI marked as Needs removing in testing, but I could not come up with a clean way to do this)

(In addition a small addon hack that I made when I was originally testing which makes the same changes can be found here:
https://github.com/Zorua162/GeoLimitEntitesTest)

  geo-limit-settings:
  - ARMOR_STAND works
  - PLAYER doesn't work (probably for the best)
  - WITHER works
  - WITHER_SKELETON works
  - WITHER_SKULL (couldn't test in a short time frame)
  - AREA_EFFECT_CLOUD (Needs removing from GUI)
  - ARROW works
  - BAT works as before
  - BEE works
  - BLAZE works
  - BOAT Works with #7473507b
  - CAT works
  - CAVE_SPIDER works
  - CHICKEN works
  - COW works
  - COD works
  - CREEPER works
  - DONKEY works
  - DOLPHIN works
  - DRAGON_FIREBALL (Can't figure out how to test either sorry)
  - DROPPED_ITEM works
  - DROWNED works
  - EGG works
  - ELDER_GUARDIAN works
  - ENDERMAN works
  - ENDERMITE works
  - ENDER_CRYSTAL works
  - ENDER_DRAGON doesn't seem to work, but needs more testing
  - ENDER_PEARL works
  - ENDER_SIGNAL not entirely sure what this is 
  - EVOKER works
  - EVOKER_FANGS works
  - EXPERIENCE_ORB works
  - FALLING_BLOCK works including anvils and sand: extremely useful for grief prevention
  - FIREBALL works
  - FIREWORK works
  - FISHING_HOOK works
  - FOX works
  - GHAST works 
  - GUARDIAN works
  - HOGLIN works
  - HORSE works 
  - HUSK works
  - ILLUSIONER Not sure what this is NEEDS REMOVING?
  - IRON_GOLEM works
  - ITEM_FRAME NEEDS REMOVING
  - LEASH_HITCH NEEDS REMOVING
  - LIGHTNING NEEDS REMOVING
  - LLAMA works
  - LLAMA_SPIT NEEDS REMOVING?
  - MAGMA_CUBE works
  - MINECART works with #7473507b
  - MINECART_CHEST works with #7473507b
  - MINECART_COMMAND works with #7473507b
  - MINECART_FURNACE works with #7473507b
  - MINECART_HOPPER works with #7473507b
  - MINECART_TNT works with #7473507b
  - MINECART_MOB_SPAWNER works with #7473507b
  - MULE works
  - PIGLIN_BRUTE works
  - PIGLIN works
  - PIG works
  - PHANTOM works
  - PARROT works
  - PANDA works
  - PAINTING not sure how to test (NEEDS REMOVING)
  - OCELOT works
  - MUSHROOM_COW works
  - PILLAGER works
  - POLAR_BEAR works
  - PRIMED_TNT works!!
  - PUFFERFISH works
  - RABBIT works
  - RAVAGER works
  - SALMON works
  - SHEEP works
  - SHULKER works
  - SHULKER_BULLET works
  - SILVERFISH works
  - SKELETON works
  - SKELETON_HORSE works
  - SLIME works
  - SMALL_FIREBALL works
  - SNOWBALL works
  - SNOWMAN works
  - SPECTRAL_ARROW works
  - SPIDER works
  - SPLASH_POTION works
  - SQUID works
  - STRAY works
  - STRIDER works
  - THROWN_EXP_BOTTLE works
  - TRADER_LLAMA works
  - TRIDENT works
  - TROPICAL_FISH works
  - TURTLE works
  - UNKNOWN works
  - VEX works
  - VILLAGER works
  - VINDICATOR works
  - WANDERING_TRADER works
  - WITCH works
  - WOLF works
  - ZOGLIN works
  - ZOMBIE works
  - ZOMBIE_HORSE works
  - ZOMBIE_VILLAGER works
  - ZOMBIFIED_PIGLIN works

@Zorua162
Copy link
Author

Zorua162 commented Jan 7, 2021

Although looping back to my original idea, would this be more suitable as an addon that would not be compatible with addons that required getRemoveWhenFarAway()?

@BONNe
Copy link
Member

BONNe commented Jan 7, 2021

For testing you can summon all entities....
However... I completely disagree that withers and dragons.. or any persistent entity (except animals), should be ever removed from world....

F.e. if you have enables dragons for your island. But they have a large flying arch. As soon as he flies outside protection range, he is removed from world... That is just wrong.
The same for either boss, and entities you have renamed. Why they should be removed?

Also, be aware that every pet will be removed as soon as player goes to spawn or visits other players islands.

@Zorua162
Copy link
Author

Zorua162 commented Jan 7, 2021

I disagree that no persistent entities should be removed, those such as Armour stands, Falling blocks and to some extent primed Tnt should never be leaving the bounds of an island as for this to happen would generally be done by a player and usually is in a griefing attempt which it seems the plugin cannot stop at the moment as far as I'm aware.

However I do very much agree that dragons should never be removed, I assume that what you are requesting is that the entire functionality of that entity being deleted be removed. However as I feel it could still have some use being toggleable by the config, so just removing it from the GUI could be useful therefore leaving it as a feature that can be accessed by the few that need it, however will not affect those who do not know what they are doing that could break things.

@Zorua162
Copy link
Author

Zorua162 commented Jan 7, 2021

However an idea that could possibly suit all needs is setting the velocity of the entity in the direction that it is trying to leave to 0 and hence create a sort of wall, but again I'm not sure of a very clean way to do this.

@lekro
Copy link

lekro commented Jan 7, 2021

I'm wondering what the goals of the geo limit feature are supposed to be and what problems it is supposed to solve. If only entities with getRemoveWhenFarAway() is true are allowed to be geo-limited, then it seems that the feature does not completely protect against island tampering via entity catapulting. For example, one could catapult a large number of cows to a neighboring island and they would be immune to removal. Similarly (to use the ender dragon example), an island owner could be attacked by an ender dragon or wither spawned on a neighbor's island.

The BentoBox documentation itself states:

Geo-Limiting of mobs - Some mobs, especially flying mobs can be spawned on one island and then potentially move outside of that island and enter other player's islands. For destructive mobs like the Wither, this is undesirable. This setting prevents the specified mobs from exiting the island. If they do, they are removed from the game.

I guess the documentation doesn't include the case of geo-limiting non-living entities like TNT or armorstands, but those can also be used to create clutter on neighboring plots.

I do agree that there is probably a better solution than to simply kill ender dragons, phantoms, and other flying entities that move between islands without being moved by players, but if this worries server admins, one can simply disable geo-limiting for these entities. For pets, maybe we could check Tameable#isTamed to make sure that pets don't get removed?

To provide a little background for this patch, on our server, people have used slimeblock catapults or TNT cannons to send boats, minecarts, and other unwanted entities to neighboring islands, as a sort of mischief. For this reason, we made sure that TNT would not explode at all as a workaround. But that still doesn't preclude the use of slimeblock catapults to send things over. Now, we want to let people use TNT for farming but not to tamper with others' plots. In the current state, it looks like geo limit can't handle this use-case.

@BONNe
Copy link
Member

BONNe commented Jan 7, 2021

Ok, what I think can be implemented:

  • Implement an ability to limit all entities when they are moving out of island bounds.
  • By default limit only entities that are currently in the list, and add tnt, firecharges and etc...
  • Do not add any else living entities by default.

If someone will like to limit all entities, they will be able to do it, but by default it should not be enabled.

@tastybento tastybento marked this pull request as draft January 29, 2022 02:44
@tastybento tastybento closed this May 11, 2024
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.

None yet

4 participants