Commit Graph

1069 Commits

Author SHA1 Message Date
Andreas Troelsen
84a7a2ed8a Don't kick players when spectate-on-death: true.
This commit forgoes some of the work done in the join/leave refactoring
of commit b1c6b61827.

The intent behind the original commit was to make the join/leave process
a very strictly defined set of steps that would work atomically to try
to ensure a stable, predictable process. As a result, the idea of making
spectators out of respawning players meant first kicking them out of the
arena and then re-joining as spectators, as if they had manually typed
`/ma leave` followed by `/ma spec`.

However, on some multi-world setups, this process causes people to get
thrown around a bit, which makes for a poor user experience. This commit
changes the behavior when `spectate-on-death: true` such that the player
isn't kicked, but is instead added to the spectator player pool when
they respawn. If the flag is false, players will still get sent to the
spectator area for one tick and then immediately kicked out as if they
had manually typed `/ma leave`. This does create a little bit of jumping
around, but because there is only one world change (as there would be
anyway), it is deemed acceptable at this point in time.

Closes #508
2020-08-19 22:51:27 +02:00
Andreas Troelsen
7fc0473a72 Guess Equippables from Material name suffix.
This commit changes the way Equippable wrappers are created, such that
they more closely match the way class chest armor pieces are "guessed".
That is, instead of looking directly at the Material value of the given
item, we instead look at the name _suffix_, i.e. the part after the last
underscore in the name, e.g. `BOOTS` in `IRON_BOOTS`.

The neat thing about this approach is that it is compatible with future
items that follow the same naming convention, such as Netherite armor
pieces.

The downside is that it is stringly typed and not particularly "pretty",
and if the naming convention breaks or new items are introduced (such as
the elytra), we will have to make modifications anyway.

Fixes #636
2020-08-09 12:42:44 +02:00
Andreas Troelsen
b0969c655c Prevent guardians from instantly retargeting.
The vanilla behavior for most mobs is that they just stop minding their
targets' business if aggro is lost. The same applies to guardians and
elder guardians.

To prevent the pace of gameplay from stagnating, MobArena compensates
for target loss by helping the mobs find a new target. The issue with
this in terms of guardians is that breaking line of sight is the only
way - besides killing it very quickly - to avoid taking damage from a
guardian due to its lock-on laser attack. This means that guardians and
elder guardians need to be excluded from the retargeting logic to make
sense in an arena setting.

This commit introduces a new EnumSet of EntityTypes to exclude from the
retargeting logic. It is not a particularly pretty solution, especially
not since ArenaListener is such a huge class already, but it does make
it easier to add more mobs later down the road, and it does a slightly
better job at giving way to a config setting at some point.

For the Mobs Rework, a per-monster flag like `auto-retarget` or similar
might be a much better solution, so it's possible to have encounters
like a small batch of guardians that _don't_ lose their targets but have
very little health, so the "race against time"-aspect can exist, but in
a much more configurable way.

Fixes #601
2020-07-28 09:45:18 +02:00
Andreas Troelsen
6de0a2fa83 Fix soft-restore for blocks broken by players.
This commit fixes the per-arena config setting `soft-restore`. Due to
commit 92c4ce1a8b, the soft restore logic
won't run on BlockBreakEvents, because to reach that specific part of
the event handler, the `protect` flag has to be set to `true`. However,
due to an early return in the soft restore logic if the `protect` flag
_is_ set to `true`, it is effectively impossible for it to run.

The fact that this functionality has been broken for over 6 years (!)
with almost no reports of it is perhaps a testament to how little it is
being used in the wild.
2020-07-21 16:32:59 +02:00
Andreas Troelsen
c682e45714 Remove MagicSpells integration.
The integration only works reliably with the `clear-wave-` settings set
to `true`, because it relies on there being only one "current" wave.
This is a fundamental issue with the way sessions run right now, and is
another good example of why the Sessions Rework is necessary.

It is possible to achieve the exact same functionality by just making a
couple of Upgrade Waves before and after the waves that need to have
limited skill sets (thanks Lucy). With just a couple of quality-of-life
features like wave "triggers", it's possible to make things just the way
they were with the integration, but by using some more general building
blocks.

Closes #609
2020-07-21 09:14:58 +02:00
Andreas Troelsen
962eb7aaba Improve config-file errors from /ma setting.
Catches ConfigError and prints its message rather than letting it bubble
up to the command handler as an uncaught exception. This means that
instead of seeing "An internal error occurred...", command senders now
see the underlying error message, as well as a short message telling
them to fix the error in the config-file and reload.

Closes #599
2020-05-31 21:12:47 +02:00
Andreas Troelsen
684116918a Remove nexus.hc.to repository from pom.xml.
Jitpack is the recommended Vault repository now, and we've actually
already updated the comment for Jitpack to include Vault previously, so
let's just get rid of the HeroCraft repo now.
2020-05-31 21:09:13 +02:00
Andreas Troelsen
62496127d7 Use toUpperCase() in SetPlayerTime step.
This commit fixes the `player-time-in-arena` per-arena setting by switching to `toUpperCase()` on the string value, which means that the values can actually result in something meaningful, rather than always throwing an exception.

The feature was broken in commit b1c6b61827, and it appears to be the only such instance to sneak through.

Fixes #621

Co-authored-by: Bobcat00 <Bobcat00@users.noreply.github.com>
Co-authored-by: Chew <chew@chew.pw>
2020-05-17 08:22:56 +02:00
Andreas Troelsen
58cb29ae97 Remove obsolete class comment in Root Target.
For some reason, this is the only ability that has such a comment, and
it doesn't really provide any value, so yeet.
2020-05-04 07:59:57 +02:00
Nesseley
7e37d93a0e Rework Root Target.
This commit completely reworks the Root Target ability implementation by
replacing the repeated teleportation code with potion effects.

The old implementation relied on teleporting the target every tick for a
given duration, but because teleporting also involves pitch and yaw, the
result was a constant "snapping back in place" experience.

The new implementation works by applying the following potion effects
with a very large amplification:

- Slowness, to prevent the player from moving out of place.
- Slow falling, to negate fall damage.
- Negative jump boost, to prevent the player from jumping around.

Note that the jump boost uses a _negative_ amplification to make it have
the inverse effect, i.e. a much worse jump ability. It is still possible
to jump an arguably negligible amount away from the root location.

Fixes #490
2020-05-04 07:57:43 +02:00
Nesseley
e8cce8e620 Add support for color codes in boss names.
Translates color codes for the boss name string right before setting it
in the BossWave object.

Closes #610
2020-04-27 11:21:05 +02:00
Andreas Troelsen
ce9f07e6b5 Remove docs folder.
This commit nukes the readthedocs documentation from the repository, but
it is kept as a local backup.

The RTD effort was a valiant one, but it fell by the way side, mostly
due to a lack of attention from my part. At this point in time, the wiki
and RTD have diverged too much, and I would rather have just one place
for documentation than two that are out of sync.

If we ever pick up RTD again, it's probably going to be with a complete
documentation rework in mind.
2020-04-25 21:59:23 +02:00
Andreas Troelsen
787f1120d1 Remove readthedocs status from README. 2020-04-25 21:57:05 +02:00
Nesseley
5e7485682a Add support for Elytra as chest pieces in class chests.
Makes the class chest armor guessing logic pair `"ELYTRA"` up with the
chest piece slot. This specific matching works, because there are no
underscores in the `"ELYTRA"` item name.

Fixes #616
2020-04-25 21:20:07 +02:00
Andreas Troelsen
8426be46fb Tidy up SheepBouncer.
This was getting on my nerves.
2020-04-09 11:39:23 +02:00
Andreas Troelsen
9245e53509 Mark constants in abilities static.
No need to have instance-local constants.
2020-04-09 11:37:30 +02:00
Andreas Troelsen
c9b0f85bee Remove unused fields, imports, warning suppressions.
Just a bit of spring cleaning!
2020-04-09 11:31:46 +02:00
Andreas Troelsen
299a16ca8c Remove old, unused Updater class.
This was superseded by the PluginVersionCheck class and hasn't been in
use since the beginning of 2020.
2020-04-09 11:28:59 +02:00
Chew
c9b36f4993 Allow non-existent pet-items nodes.
If someone spins up MobArena with a really old config-file or simply
removes the `pet-items` section, the plugin throws an NPE. This commit
fixes that by allowing the section to not exist.

It might be a good idea to log some helpful information, but let's wait
and see if this isn't good enough.

Fixes #606, closes #608.

Thanks Chew!
2020-03-29 05:32:08 +02:00
Andreas Troelsen
5369b1fbfa Update Mockito version. 2020-03-28 16:52:50 +01:00
Andreas Troelsen
0237dcdbd7 Update maven-jar-plugin version. 2020-03-28 16:52:50 +01:00
Andreas Troelsen
c2cd5ae219 Update maven-compiler-plugin version. 2020-03-28 16:52:50 +01:00
Andreas Troelsen
a9d39fe345 Update bStats metrics version.
Apparently in 1.7 we now have to specify the plugin ID in the
constructor. So mote it be.
2020-03-28 16:52:50 +01:00
Andreas Troelsen
9fcfad3748 Update MagicSpells version.
The old artifact ID doesn't appear to be working anymore, but if we can
depend on a real version number, all the better...
2020-03-28 16:52:50 +01:00
Andreas Troelsen
7547e74278 Update Vault repo and version.
Apparently we're on JitPack now and v1.7.
2020-03-28 16:52:48 +01:00
Andreas Troelsen
15736fcaa0 Add missing bStats comments in pom.xml.
Not that it's necessary, it's just nice to be consistent :)
2020-03-28 16:51:51 +01:00
Andreas Troelsen
86be8bdfbd Add changelog entry for 90d1f211fa.
Adds a changelog entry for the changes made in 90d1f211fa.
2020-01-13 11:07:33 +01:00
Bobcat00
90d1f211fa Add ready state to sign templates.
Adds support for a new `ready` state in the template engine for arena signs.

A sign is in the `ready` state when there are players in the lobby and all of them have readied up. This is only relevant in arenas with start delay timers, as the arena session automatically starts when all players are ready otherwise.

The new state is completely optional, even when no base state is provided, and it inherits from the `joining` state when not defined.

Closes #593
2020-01-13 11:03:19 +01:00
Andreas Troelsen
5f7be69f0f Add changelog entry for 6e8a3e1626.
Adds a changelog entry for the changes made in 6e8a3e1626.
2020-01-11 01:37:08 +01:00
Andreas Troelsen
01b253d304 Add list entry variable test case to RendersTemplate.
Adds test cases that cover a some of what was changed in 6e8a3e1626.
2020-01-11 01:31:49 +01:00
Bobcat00
6e8a3e1626 Add support for list entries in sign templates.
This commit adds support for listing arena players on arena signs by
introducing the following _dynamic variables_:

- `<arena-n>` the _nth_ live arena player
- `<lobby-n>` the _nth_ player in the lobby
- `<ready-n>` the _nth_ ready player in the lobby
- `<notready-n>` the _nth_ player in the lobby who hasn't readied up

Each variable points to a list of players (sorted by name), and the `n`
is the index into that list (1-indexed). This means that putting the
variable `<notready-1>` in a template will result in the name of the
first player in the list of lobby players who haven't readied up, sorted
by player name.

Implements #592
2020-01-11 01:05:06 +01:00
Andreas Troelsen
8f9664670f Bump version to 0.104.3. 2020-01-03 22:00:33 +01:00
Andreas Troelsen
5c30164ba7 Release 0.104.2. 2020-01-03 21:28:44 +01:00
Andreas Troelsen
14ad15b15d Cross check arena/lobby regions in intersects().
This commit changes how the ArenaRegion `intersects()` method works:

- The implicit null checks in the `setup` and `lobbySetup` flags have been replaced with actual null checks inside the auxiliary `intersects()` function. Not only does this make the auxiliary method more robust for potential future use, it also helps tidy up the code a bit. So neat!
- The semantics have changed, since `setup` depends on more than just the `p1` and `p2` points. This fixes an (unreported) bug where the check would report a false negative in case an overlapping arena region was defined, but e.g. the arena warp was missing.
- Instead of only checking arena vs. arena and lobby vs. lobby, we now also check arena vs. lobby and lobby vs. arena. That is, if the arena region is defined, we check it against both the arena region and lobby region of the other ArenaRegion (if they are defined). Same deal with the lobby region. This should ensure that no combination of overlaps pass through the check.
2020-01-03 02:05:24 +01:00
Andreas Troelsen
3a017b179d Fix NPE in region overlap check.
This commit fixes an issue with the new `intersects()` method on ArenaRegion. Instead of blindly assuming that the region points `p1` and `p2` are set when the method is called, we first make sure both regions are properly set.

Fixes #590
2020-01-03 01:28:33 +01:00
Andreas Troelsen
b9e1e07a15 Bump version to 0.104.2. 2020-01-01 00:03:36 +01:00
Andreas Troelsen
62dd39c28a Release 0.104.1. 2019-12-31 23:27:49 +01:00
Andreas Troelsen
77ead3de5c Report overlapping arena regions on load.
This commit introduces an `intersects()` method on ArenaRegion that
allows us to check whether two regions intersect.

The new method is employed in ArenaMasterImpl during arena load. If an
arena's region intersects with any other arena's region (in the same
world), we print a warning to the server log.

Fixes #367
2019-12-31 23:24:30 +01:00
Andreas Troelsen
57c26b2faf Embrace diamond operator (again).
Not sure how these dodged the bullet of commit
0eeed4ff01, but here we go!
2019-12-31 23:20:31 +01:00
Andreas Troelsen
eed5117454 Fail fast if world is null when parsing locations.
This commit introduces a null check in the ConfigUtils `parseLocation`
method. If the world of a location string does not exist, the method now
throws an IllegalArgumentException, which allows callers to fail more
gracefully instead of having to resort to null checks.

Additionally, the parsing of exit warps, leaderboards, or linked class
chests is wrapped in try-catch statements that re-throw ConfigErrors
for better error reporting.

Fixes #421
2019-12-31 20:40:51 +01:00
Andreas Troelsen
01c56fdd6a Rewrite plugin version checker.
This commit removes the old version checker that used the DBO resource
page and replaces it with a custom checker that uses the "legacy" Spigot
resource API. The Spigot API is much more lightweight and doesn't
require any sort of parsing.

The new version checker uses a simple cache, keeping version checks
fresh for up to one hour, reducing the need to go fishing on every op
login. The cache resets on restarts, though, but this is acceptable.

Note that no attempt has been made to ensure correctness on multiple,
consecutive invocations when the cache is stale. If a cache refresh is
initiated, all update checks invoked before the cache refresh has ended
will behave as if no update is available. This is acceptable, because
update checks are non-essential, the time frame is extremely narrow, and
the most common result of an update check is "no updates available",
since the amount of update checks made is vastly greater than the amount
of updates released.
2019-12-31 16:10:43 +01:00
Andreas Troelsen
ab2fefd3d3 Use regular player name when tab completing /ma kick and /ma restore.
Since the actual execution of these commands use the regular player name
instead of the display name, the tab completion is useless if it doesn't
also use the regular player name.

Fixes #589
2019-12-29 17:52:34 +01:00
Andreas Troelsen
9890c13391 Rewrite EntityTargetEvent handling.
This commit is a complete rewrite of the target event handling logic in
the ArenaListener class.

Instead of the complex, inconsistent code structure with too many line
breaks between control flow branches, we just have a thin logic wrapper
that delegates the event handling to smaller, more focused functions
that handle arena pets, arena monsters, and foreign entities on their
own.

A couple of auxiliary methods are introduced to try to limit the amount
of warnings produced by checking set membership with `contains()` when
the entity/target is an Entity and the collection is a sub type.

Fixes #572
2019-12-29 17:34:56 +01:00
Andreas Troelsen
7b99c8cbae Refactor EntityTargetEvent handler.
Just a bit of cleanup.
2019-12-21 19:30:32 +01:00
Andreas Troelsen
c573fd60eb Update to bStats 1.5.
Seems like there's some neat logging options for server owners in the new version, so that's wonderful. Let's get on that.
2019-10-26 22:40:43 +02:00
Andreas Troelsen
51dde339e1 Switch to CodeMC repo for bStats.
The old bStats repository has been shut down, but we can find it on CodeMC, so yay.

Fixes #578
2019-10-26 22:36:39 +02:00
Andreas Troelsen
a59a4f911d Don't check for recurrent waves on join.
This commit removes a condition in ArenaImpl#canJoin(Player) that checks to see if the arena's WaveManager has any recurrent waves.

Removing this condition is safe, because the WaveManager already makes sure to have a "catch all" default wave at hand for when no wave definitions match a given wave number. As such, the condition in ArenaImpl is completely unnecessary, and was in fact the root cause of a bug.

Fixes #566
2019-08-16 00:46:01 +02:00
Andreas Troelsen
677ae6c454 Bump version to 0.104.1. 2019-08-09 02:36:06 +02:00
Andreas Troelsen
57ce1e3970 Release 0.104. 2019-08-09 00:04:06 +02:00
Andreas Troelsen
fb13eac16f Call pet spawning logic in Upgrade Waves.
Due to the package structure and location of MASpawnThread, SpawnsPets doesn't need to be opened up for this to work.

This change opens up for quite a few different upgrade strategies, since pet items obtained outside of Upgrade Waves are transformed as well. It is technically a breaking change, because it breaks the invariant that "after arena start, no items are transformed to pets". However, since pet items are customizable, it is possible to just change the `bone` to `sponge` in the config-file if bones carry some sort of implicit meaning in an existing setup.

Closes #524
2019-08-08 00:23:51 +02:00