Commit Graph

1052 Commits

Author SHA1 Message Date
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
Andreas Troelsen dfeab96f22 Remove unused imports in various files.
Getting rid of warnings one unused import at a time...
2019-08-07 23:56:41 +02:00
Andreas Troelsen 081a653f56 Remove unused fields and imports in ArenaListener. 2019-08-07 23:46:42 +02:00
Andreas Troelsen e3a4b3b2a0 Add support for potion effect upgrades in Upgrade Waves.
It doesn't seem like there was any real reason to leave out potion effects as upgrades in Upgrade Waves previously, so they were likely just forgotten in the Things API overhaul.

Closes #565
2019-08-07 23:43:11 +02:00
Andreas Troelsen 127d273fd6 Keep track of Vexes summoned by Evokers.
This is a bit of an overhaul of how CreatureSpawnEvent is handled:

- Events happening outside the arena region are still ignored, as are armor stands placed in edit mode.
- Otherwise, if the arena isn't running, we blanket reject all entities.
- Player-mode iron golems and snowmen are still allowed.
- Anything that isn't spawned by a plugin is rejected, _unless_ it is a Vex spawned with "default" spawn reason, which is what the Evoker summon spell uses.

In the end we have a "custom" spawn reason inside the arena region while it's running, which is perfectly "legal". And because of the unfortunate use of Creature (instead of Mob) in MACreature, Slimes and Magma Cubes still need to be handled separately here.

Fixes #564
2019-08-07 23:41:02 +02:00
Andreas Troelsen b44b808d38 Make class pets aggro hostile mobs who attack their owners.
When a player takes damage from a hostile mob, the player's class pets will have their target set to that mob. This means that even zombies can function as "real" pets!
2019-08-05 16:16:18 +02:00
Andreas Troelsen ab031e3e63 Remove pets in case they die.
This technically can't happen because all pet damage is cancelled, but we never know, and we best be sure to clean up.
2019-08-05 16:04:44 +02:00
Andreas Troelsen cb8983b162 Drop support for auto-respawn.
This commit removes the `auto-respawn` arena setting and the logic associated with it.

MobArena's hacky implementation of auto-respawning is buggy and discouraged. To get true auto-respawn functionality we'd have to move to the Spigot API instead of the Bukkit API.
2019-08-05 16:00:01 +02:00
Andreas Troelsen bbd70d0692 Add names to class pets.
This commit adds custom names to class pets in the form `<player name>'s pet`. This should help players more easily distinguish between pets and hostile mobs.
2019-08-05 14:34:19 +02:00
Andreas Troelsen c6a695e2c3 Rework class pet parsing and handling.
This commit changes the pet parsing and handling such that it is a lot more dynamic. Rather than limiting pets to wolves and ocelots, any living entity is now a potential pet. This means that we can do away with the logic that specifically targets the Wolf and Ocelot interfaces and instead work with the more general Tameable interface. As a result, the discrepancies between Minecraft 1.13 and 1.14 in this regard are largely irrelevant, because server owners can just specify which entity they want to spawn given which item in their config-files.

MonsterManager's two Wolf- and Ocelot-specific addPet() methods are replaced with a generic addPet() method that takes an owner (Player) and a pet (Entity). This is technically a breaking API change, but MonsterManager is an internal component that is very unlikely to be used outside of MobArena.

The `global-settings` node in the config-file can no longer be forced into strict compliance via ConfigUtils, because the `pet-items` node is now dynamic rather than static.

The default `pet-items` node in the config-file no longer has `ocelot` in there to avoid confusion on 1.14. It now only contains `wolf` and people will have to add their own ocelot/cat in if they haven't added it already.

Fixes #563
2019-08-05 14:32:23 +02:00
Andreas Troelsen 9129a1d360 Remove unused sitPets method in MAUtils.
This method was superseded by the SitPets join/leave step.
2019-08-05 11:54:13 +02:00
Andreas Troelsen 942b4cd067 Switch to openjdk8 in .travis.yml. 2019-08-03 23:12:58 +02:00
Andreas Troelsen 3c533ea683 Explicitly make pig zombies angry when they spawn.
This commit changes the MACreature spawn logic such that any pig zombie spawned will be angered immediately.

Fixes #561
2019-08-03 20:33:16 +02:00
Andreas Troelsen ba41e51e48 Check if player is in arena on food level change.
This commit fixes a bug introduced in 88ddbe5ac6.

During a food level change event, if the arena is running and the food level lock is enabled, we just need to also make sure that the given player is actually in the arena, otherwise it affects everyone on the server.

Fixes #557
2019-07-28 11:11:25 +02:00
Andreas Troelsen 7f1c4b1b87 Don't assume implemented interfaces by EntityType in SitPets.
This commit changes how SitPets determines if a nearby entity is "pet material". Instead of assuming that wolves and ocelots are tameable, we check for the Tameable interface. This means that we get rid of the "concrete" types, Wolf and Ocelot, and also fixes a bug on Minecraft 1.14 servers where ocelots are no longer tameable, but cats are. It also kinda catches parrots, but they will not sit if they are flying or perching on the player's shoulder when joining.

Because ocelots are no longer tameable in 1.14, they shouldn't cause trouble here, but because they are tameable in 1.13, we need to rely on the Tameable interface to maintain both backwards and forwards compatibility.

Fixes #548 (kind of - no more exceptions thrown, but the pet ocelots from SuperLuckyBlock may misbehave, however that is a different issue).
2019-07-26 23:13:34 +02:00
Andreas Troelsen 81dfb71fe1 Add basic tab completion support.
This commit adds support for basic tab completion for most of the commands that take arguments. Some completions are somewhat intelligent, e.g. `/ma join` which only lists enabled and "functional" arenas that the given player is permitted to use. Others are just kinda dumb, e.g. `/ma enable` which indiscriminately lists all arenas.

Closes #405
2019-07-26 22:26:10 +02:00
Andreas Troelsen d5676b7b74 Fix check for arena monsters in monster damage logic.
This commit changes how the final "catch all" works for incoming monster damage. Instead of checking if the damager entity is a LivingEntity, we check if it is a monster of the arena and then proceed as normal.

Note that this change may make it possible for monsters in the arena to take damage from non-arena entities. The so-called "catch all" doesn't really catch everything, but it does catch the infighting that it was designed to catch.

One "not thought of" damage source is that of player-made golems, so coincidentally, this commit fixes #550.
2019-07-25 23:15:05 +02:00
Andreas Troelsen 054220a32e Add support for extended and/or upgraded potions in the item syntax.
This commit adds support for altering the data portion of a potion item by prefixing either `long_` or `strong_` to get extended duration or level II versions of the given potion, respectively.

Closes #520
2019-07-24 20:15:13 +02:00