c5802faefc
This commit changes the "source" of the explosions from `obsidian-bomb` to _something_ that isn't the boss itself. Originally, these explosions were block explosions, but without a "source" from the damage caused to other mobs, the `monster-infight` flag was largely ignored. By switching to "entity explosions" with the boss as the "source", the flag was now respected, and mobs would no longer take damage from these explosions if the `monster-infight` flag was set to `false`. However, the handler for "entity explosions" now started reacting to the explosions caused by the `obsidian-bomb` ability as if they were normal entity explosions, e.g. those caused by creepers, and because entities that explode usually "die" (although without an EntityDeathEvent), the handler removes the entity from the monster manager, which effectively "unregisters" the boss, leaving the entity itself just hanging around in the arena as a normal mob (with a huge health pool). The "obvious" solution is to change back to "block explosions", and that could perhaps have worked if the API had consistent interplay between an "explode event" and the resulting "damage event". It turns out that the EntityExplodeEvent results in an EntityDamageByEntityEvent, and the same can be said for BlockExplodeEvent and EntityDamageByBlockEvent, except the latter will have a `null` block in it, so even if we were to attach some metadata to the block, we wouldn't be able to retrieve it in the damage handler. So we're sticking with "entity explosions"... The hacky solution: We just spawn a new entity and pin the explosion on it instead of the boss. That way the new entity is removed by the entity explosion handler (which is a no-op, because the entity isn't an arena monster) instead of the boss. It technically doesn't matter which entity we spawn, but by spawning a primed TNT block, we can naturally stick a source on it, and the damage handler will treat it as if the boss placed a TNT block and detonated it, which is an apt analogy after all. Just to make sure we don't forget the dual responsibility, we've added a little comment in the damage handler. An alternative solution would have been to spawn any other entity and stick the boss entity ID on it, then look up the entity by that ID in the damage handler if the damager had metadata on it. This is just a bit more streamlined and likely a lot more performant. Fixes #789 |
||
---|---|---|
.github | ||
gradle/wrapper | ||
scripts | ||
src | ||
.gitignore | ||
build.gradle.kts | ||
changelog.md | ||
gradlew | ||
gradlew.bat | ||
LICENSE | ||
README.md | ||
settings.gradle.kts |
MobArena
MobArena is an arena-style minigame for Spigot-based Minecraft servers
Getting Started
If you don't want to compile the plugin yourself, grab a release artifact from one of these two sites:
The wiki here on Github should have all the information you need to get started using the plugin.
Getting Help
If you run into problems or need help with something, feel free to hop on the MobArena Discord server to have a chat: Instant Invite
Remember, though, that this communication channel is idle chat, which means you likely won't get a response immediately. It could take anything from a couple of seconds to a day, but your message will be seen.
Contributing
Found a bug, got a suggestion, or want to dig into the code base? There are many ways to contribute to the project!
Get started here: Contributing