MobArena plugin for Minecraft
Go to file
Andreas Troelsen c5802faefc Refactor obsidian-bomb explosions.
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
2024-07-23 03:49:13 +02:00
.github Add 1.21 to supported game versions. 2024-07-23 02:22:48 +02:00
gradle/wrapper Convert to Gradle. 2023-12-09 21:08:09 +01:00
scripts Add hangar format to release note script. 2023-12-31 15:14:25 +01:00
src Refactor obsidian-bomb explosions. 2024-07-23 03:49:13 +02:00
.gitignore Convert to Gradle. 2023-12-09 21:08:09 +01:00
build.gradle.kts Bump version to 0.108.1. 2024-06-24 23:30:08 +02:00
changelog.md Refactor obsidian-bomb explosions. 2024-07-23 03:49:13 +02:00
gradlew Convert to Gradle. 2023-12-09 21:08:09 +01:00
gradlew.bat Convert to Gradle. 2023-12-09 21:08:09 +01:00
LICENSE Add LICENSE 2018-04-27 16:32:02 +02:00
README.md Add Hangar link to README. 2023-11-13 12:21:40 +01:00
settings.gradle.kts Convert to Gradle. 2023-12-09 21:08:09 +01:00

MobArena Build Status

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