garbagemule / MobArena

MobArena plugin for Minecraft
GNU General Public License v3.0
194 stars 151 forks source link

[Feature/Issue] Add removal-support for more NLEs #667

Open Ghmmy opened 3 years ago

Ghmmy commented 3 years ago

Feature request

Short description

Currently endercrystals wont be removed from the arena after ending, as well as the console outputting a warning regarding those entities not being supported. Would be nice if those NLEs could be supported, so we can have, for example, dragon fights without having to worry about crystals not disappearing after end and having to find a workaround for it.

Implementation details

Add other NLE such as ender_crystals to the non-living-entity remova snippetl: https://github.com/garbagemule/MobArena/blob/master/src/main/java/com/garbagemule/MobArena/ArenaImpl.java#L1375-L1395

garbagemule commented 3 years ago

Ness brought up the potential issue of end crystals being used for decoration. How do they even spawn in the first place?

It looks like the CreatureSpawnEvent that MobArena listens for has a new supertype, EntitySpawnEvent, in a later version of the Bukkit API, which likely covers all entities and not just living entities. I wonder if the reason the end crystals can spawn in the first place is because they aren't actually checked by MobArena. Perhaps there's a way to replace that heavy duty "entity scan" in ArenaImpl with the EntitySpawnEvent and some bookkeeping code - if we can catch all entities spawned during the session, we can also remove them all again. If the event is "complete" in that sense, it would be possible to write code that is completely agnostic in terms of the entity types and just "remove whatever is still around". That might actually also make it entirely possible to just natively admit NPCs in the arena, since they would be "pre-spawned" and thus not part of the bookkeeping of the actual session. Perhaps!

The reasoning behind the above thought process is the ambiguity of "other NLE such as ender_crystals". What "other" non-living entities should be added? Is there a well-defined set of entity types for this particular aspect of the plugin? I recall the arrows, minecarts, etc. being part of a "junk is left when the arena ends" bug report very, very early on in MobArena's life, which probably also explains why the list is so short. Perhaps it's worth just completely ditching the hardcoded switch statement in favor of something more flexible or well-defined?

Ghmmy commented 3 years ago

The crystals are spawned in by a mythicmob. They arent "entirely" part of the arena, but as they are a child of that boss, and thus are in some ways part of the arena (like evokers and vexes), they should be registered by mobarena as well.

Not sure if there are other NLEs out there by heart, but I remember players placing painting that werent removed after the arena ended. Not sure if they are also NLEs or a different type of entity.

Either way, I can already remove those crystals when a dragon dies, but there is no way to define, without introducing any hacky methods, to remove those crystals when an arena force-ends like all players dying or the server restarting. Would be nice to see those entities being registered by MA as well, as long as it isnt diffocult to add.

Ghmmy commented 3 years ago

solved with the new addition of mobarena labs. ill leave it open in case you still need to do something with this issue