Commit Graph

872 Commits

Author SHA1 Message Date
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
Andreas Troelsen
dd31a11b60 Make items in the Setup Mode toolbox unbreakable.
This makes it unnecessary to set the item durability, which was being done via deprecated API anyway.

Partial fix for #406
2019-07-22 01:03:32 +02:00
Andreas Troelsen
0fa11eb84f Explicitly set a display name for the scoreboard objective.
Omitting the display name is deprecated.

Partial fix for #406
2019-07-22 01:03:32 +02:00
Andreas Troelsen
fa2016acb5 Drop support for getting potion effect types by magic number IDs.
getById() is deprecated, and while this does break existing functionality, it is a good kind of breakage because it forces people over to the name-based IDs, which they will eventually be happier with.

Partial fix for #406
2019-07-22 01:03:17 +02:00
Andreas Troelsen
0009e6363a Use GENERIC_MAX_HEALTH in MASpawnThread.
setMaxHealth() and getMaxHealth() are deprecated.

Partial fix for #406
2019-07-21 23:45:50 +02:00
Andreas Troelsen
d633583f9e Use GENERIC_MAX_HEALTH when setting and getting boss max health.
setMaxHealth() and getMaxHealth() are deprecated.

Partial fix for #406
2019-07-21 23:42:15 +02:00
Andreas Troelsen
a970bac85a Remove unused BlockFromToEvent handler in ArenaListener.
This is dead code and contains calls to deprecated API.
2019-07-21 23:38:25 +02:00
Andreas Troelsen
e62b361766 Use GENERIC_MAX_HEALTH attribute when setting mount health.
getMaxHealth() is deprecated.

Partial fix for #406
2019-07-21 23:36:39 +02:00
Andreas Troelsen
6c6e979b9e Use addPassenger() when mounting players on horses.
setPassenger() is deprecated.

Partial fix for #406
2019-07-21 23:35:39 +02:00
Andreas Troelsen
cd1f7ff797 Use new BlockData API for non-linked class chests.
Similar to the previous commit about leaderboards, this commit fixes the crash caused by using the MaterialData API on Minecraft 1.14 servers.

Fixes #546
2019-07-20 22:56:40 +02:00
Andreas Troelsen
cc0a2f30b4 Use new BlockData API for Leaderboards.
This commit fixes a bug on Minecraft 1.14 servers where leaderboards would cause a NullPointerException due to the MaterialData API being broken. Instead, we now use the new BlockData API, and everything is back to normal.

Fixes #536
2019-07-20 22:55:49 +02:00
Andreas Troelsen
996a592023 Make all "damageable" items unbreakable.
This commit changes how the unbreakable setting works by just assuming that everything that is "damageable" (implements the Damageable interface) needs to be set as unbreakable. This means that the entire weapons/armor collection in ArenaClass is obsolete, and all of the checking is contained in ArenaImpl.

Fixes #544
2019-07-20 22:47:00 +02:00
Andreas Troelsen
a3004d6403 Give stone swords to wither skeletons on spawn.
Fixes #538
2019-07-20 22:39:22 +02:00
Andreas Troelsen
7317c64678 Use max health value instead of base value in SetHealth step.
This commit changes the SetHealth step such that it uses the player's own value for max health rather than the generic base value. As a result, players who join holding items that lower their max health will be missing health as soon as they join the lobby. But because food levels are maxed and locked, the health will quickly regenerate.

Unfortunately, players who join with a higher health value than the base max health value will have their health capped to the base max health value on the way out of the arena. This was also the case before this commit, but it is worth mentioning again for completeness.

These odd side effects are currently "necessary" because the effects of items that change max health values for players don't take immediate effect in the same tick as they are added/removed, so because MobArena's join sequence is synchronous, we can't feasibly "get it right".

Fixes #545
2019-07-20 22:37:23 +02:00
Andreas Troelsen
88ddbe5ac6 Lock food level for players in the lobby or spectator area.
There is no reason why food should be a thing in the lobby or spectator area. This commit effectively disables it for players in those places/states, while retaining the in-arena conditional logic based on the config-file setting.

Fixes #514
2019-07-20 21:40:24 +02:00
Andreas Troelsen
672e038ba7 Bump version to 0.103.3 2019-04-23 12:42:17 +02:00
Andreas Troelsen
d287a35137 Release 0.103.2. 2019-04-23 11:21:44 +02:00
Andreas Troelsen
4f548e08a6 Use a blacklist for the server version check.
The whitelisting approach works well for the legacy builds, because the
version landscape doesn't change with those. However, the main build on
the master branch will not run on a server version other than 1.13, so
come 1.14, MobArena will be broken.

This commit fixes this problem by changing to a blacklisting approach
for the main build on the master branch. Checking for versions that the
build *can't* run on brings back MobArena's old resilience to version
changes on the Minecraft side of things.
2019-04-16 12:38:19 +02:00
Andreas Troelsen
93af93d5a0 Use attribute base value instead of 20 when setting player health.
The previous hardcoded value of `20.0` works in most cases, but if a server uses a base health higher than 20, players don't get a full heal. Worse, if the base health is lower than 20, MobArena crashes when it tries to set the health to 20, which is now out of range.

This commit introduces the Attribute enum to MobArena's code base and uses it to get the base value for player max health. This should fix the aforementioned issues.

Fixes #513
2019-02-16 17:41:55 +01:00
Andreas Troelsen
afcc526a71 Relocate mobarena.admin.teleport permission check.
Instead of explicitly ALLOW'ing a teleport if a player has the permission, we let the teleport handler logic run its course. If an arena explicitly REJECTs the teleport, we need to cancel the event, but the permission now overrides that behavior. This means that only in the case of an impending event cancellation, the permission kicks in.

This is important, because the permission is supposed to override the decision to cancel, rather than drive the decision to uncancel. With this change, MobArena never uncancels something it wouldn't have uncancelled otherwise, meaning it won't interfere with teleports outside of its own context, and thus won't interfere with other plugins.

Fixes #515, closes #516

Thanks to @minoneer for the bug report and pull request that this code
was based upon!
2019-02-16 17:40:45 +01:00
Andreas Troelsen
fc8debca29 Clone ItemStack before adding to player inventory.
Spigot is at it again with another breaking change to the API where the
JavaDocs have been retrofitted to match the new, ancient way of writing
software.

The addItem and removeItem methods originally just added or removed
whatever they could when called, and returned a map of items that failed
due to lack of space/items. Now, with the breaking API change, these
methods actually *mutate their arguments* - a practice that has been
heavily discouraged for decades in modern software development, and
something you usually only see in C these days. This change, like many
others in the same vein, show the complete recklessness, incompetence,
and lack of awareness from an otherwise talented team of developers.
Hopefully, they will continue to hone their skills so that we can
eventually have a stable API again.
2019-02-03 14:34:37 +01:00
Andreas Troelsen
0e037b2f72 Don't change player flySpeed on join/spec.
From a purist standpoint, the flySpeed tag should never be messed with
in MobArena, because simply turning off flight should be enough. It is
likely that the flySpeed tag was originally included to cull "cheaters"
who somehow managed to activate flight in the arena anyway, but this
isn't really MobArena's responsibility and can very probably be handled
by other means of cheat prevention in WorldGuard regions or the like.

By not touching the flySpeed tag, it makes it much easier for server
owners to recover from crashes where the leave steps aren't executed,
leaving players "locked in the air" when they try to fly.

Closes #509 since this "fix" was the reason that feature request was made.
2019-02-03 14:32:28 +01:00
Justin W. Flory
eb67ec77b9 Update Commands documentation (#413)
* Update Commands documentation (see full commit)

This commit updates the Commands documentation.

* Follows RST document style guide
* Uses active voice / minor edits
* Reorganize structure, use tables

* Address feedback by @garbagemule in #413
2019-01-01 15:03:31 +01:00
Andreas Troelsen
e40ab31437 Bump version to 0.103.2 2018-12-31 15:39:33 +01:00
Andreas Troelsen
2f64783649 Release 0.103.1. 2018-12-31 15:33:06 +01:00
Andreas Troelsen
7bc6cf2800 Make commands case insensitive.
Note that this doesn't make the arguments for commands case insensitive. Each command is still responsible for lowercasing their arguments if it makes sense for them to do so.

This closes #446.
2018-12-31 14:50:19 +01:00
Andreas Troelsen
74a7388701 Make enchantments case insensitive.
Lowercasing the enchantment string before feeding it to the Bukkit API makes the enchantments a little more "copy/paste proof" when grabbing the uppercased names from the JavaDocs/Minecraft wiki.
2018-12-31 14:40:54 +01:00
Andreas Troelsen
5e7cb2a82b Allow class pets to teleport to their owners.
This closes #497.
2018-12-31 14:20:27 +01:00
Andreas Troelsen
624b87f4d3 Prevent spectators from taking damage at all times.
Spectating is possible both during and before/after arena sessions. This means that an early return from the entity damage cancellation logic when the arena isn't running is going to allow damage to go through to spectators of non-running arenas, which means they can die. By simply removing the early return (and placing it in the one branch that actually requires it explicitly), spectators should no longer be able to take damage.

This fixes #502.
2018-12-30 14:05:02 +01:00
Andreas Troelsen
399b228999 Use unbreakable item meta flag for unbreakable weapons and armor.
This changes how unbreakable items work in MobArena. It removes the legacy "repair logic" and replaces it with the item meta unbreakable flag. This approach should work all the same, except now if weapons and armor in class chests have special durability values, these are preserved in the cloning.

This should make MobArena compatible with plugins that depend on special durability values, such as QualityArmory.
2018-11-18 16:36:19 +01:00
Andreas Troelsen
d9b9b2493c Update README with new Discord invite.
Also removes the IRC links - sorry old pal.
2018-09-23 16:21:43 +02:00