Commit Graph

921 Commits

Author SHA1 Message Date
Andreas Troelsen
63d2c552a6 Make the bone-to-pet-wolf transformation item customizable.
A new section in global-settings called pet-items is used to define pet item transformation items. By default, bones are transformed into wolves, but the item type can now be changed to support using actual bones in classes.

This refactors the pet spawning into its own class to reduce some of the massive responsibility of ArenaImpl.

This closes #467
2018-07-03 18:13:36 +02:00
Andreas Troelsen
f4f74c5b87 Modernize default classes.
The default classes now use string IDs for all items, and a couple of them now have starting potion effects.
2018-07-03 15:05:03 +02:00
Andreas Troelsen
b5b4fdd30a Add support for named potion types and enchantments.
In this commit, the ItemParser's behavior changes from one that requires or encourages numeric IDs for everything to one that discourages it by logging a warning that suggests using a string instead of a numeric value.

While this doesn't actually make things that much better for updating to Minecraft 1.13, the "ID nagging" hopefully increases awareness about the upcoming breaking changes.

Fixes #382
2018-07-03 14:51:54 +02:00
Andreas Troelsen
fe35964b93 Remove unused import in ItemParser. 2018-07-03 01:31:28 +02:00
Andreas Troelsen
16f08ef9a0 Remove obsolete parseString methods in ItemParser.
This follows from the removal of the set class command being removed and the cascading removal of the methods in ArenaMasterImpl that referenced the parseString methods in ItemParser.
2018-07-03 01:30:59 +02:00
Andreas Troelsen
e572fc3dae Remove obsolete class methods in ArenaMaster.
Following the removal of set/remove class commands in 51b4b25094, these methods are now obsolete.
2018-07-03 01:28:38 +02:00
Andreas Troelsen
51b4b25094 Remove set/remove class commands.
Similar to a88556771f.

This specific change may stir the pot a bit, since some people may rely on the set command. However, class chests solve a lot of the problems that the initial command set out to tackle, and we can probably do better in a rewrite of the command if it's missed anyway.

The removed commands render a few methods in ArenaMaster obsolete.
2018-07-03 01:27:35 +02:00
Andreas Troelsen
baf709b446 Remove set class price command.
Similar to a88556771f.
2018-07-03 01:07:18 +02:00
Andreas Troelsen
691b608466 Remove obsolete class permission method in ArenaClass.
Following the removal of class permission commands in a88556771f, this method is now obsolete.
2018-07-03 01:03:32 +02:00
Andreas Troelsen
cf82a3a612 Remove obsolete class permission methods in ArenaMaster.
Following the removal of class permission commands in a88556771f, these methods are now obsolete.
2018-07-03 01:02:40 +02:00
Andreas Troelsen
a88556771f Remove class permission commands.
These commands solve a very, very specific problem that it's safe to assume nobody has. It's safe to assume that most config editing happens in the actual config-file, and changing class permissions is probably one of the last things people would expect to find a command for.

Removing these commands renders some methods in ArenaMaster and ArenaClass obsolete.
2018-07-03 01:00:00 +02:00
Andreas Troelsen
5699fafeb0 Add server version compatibility check.
Instead of the obscure error thrown from ArenaClass when the SHIELD enum value on Material isn't found, MobArena throws its own, more human-friendly error.

Fixes #469
2018-07-03 00:22:36 +02:00
Andreas Troelsen
650e7bbd44 Remove all players from boss bars when clearing the MonsterManager.
When the arena ends, the MonsterManager is cleared, which means that all references to health bars are lost. Before this, we remove all players from any boss bars to make sure that the boss bars don't stick to players upon dying.

Fixes #473
2018-06-25 10:30:14 +02:00
Andreas Troelsen
9d0cd8f967 Clean up the grantItems method in UpgradeWave.
The Arena parameter is no longer needed. Let's get rid of it.
2018-06-25 00:13:17 +02:00
Andreas Troelsen
0f34e1fdb7 Use Things API in upgrade waves.
This changes the upgrade waves from the local Upgrade interface to the Thing interface. This means that all Things can now be used in upgrade waves, including commands, money, potion effects, and permissions.

Unfortunately, the weapons upgrade/replace functionality has been gutted as a result of the Things API not supporting it. We could add it back in later down the road, but for now let's just see if it causes anyone any inconvenience.

Closes #468
2018-06-25 00:13:12 +02:00
Andreas Troelsen
a9d0ca0828 Use the Things API for per-class permissions.
This replaces the Map<String, Boolean> approach in ArenaClass with a List<Thing> approach. This greatly simplifies how per-class permissions are handled.
2018-06-24 13:05:47 +02:00
Andreas Troelsen
c1d1728144 Add support for permissions in the Things API.
This commit introduces the PermissionThing and associated parser. The parser determines the value (grant/revoke) of the permission by looking at the first character of the input string - if it is a minus (-) or caret (^), the value is false (revoke), otherwise it is true (grant). To distinguish permissions from other things, the parser requires a prefix of "perm:".
2018-06-24 13:05:38 +02:00
Andreas Troelsen
19fb748e0e Rework per-class permissions handling.
This removes the map of attachments in ArenaImpl and makes the permissions "replacement" happen via the Bukkit API's PermissionAttachmentInfo. Bukkit already keeps track of which attachments we've added to a player, so removing them is just a matter of looping through and finding those. This reduces the coupling between the Arena interface and UpgradeWave (which is the only interface that used the methods removed from the Arena interface).
2018-06-23 18:22:29 +02:00
Andreas Troelsen
96fa87a544 Remove potion effects when a player changes class via class chests.
This fixes #471
2018-06-23 17:37:42 +02:00
Andreas Troelsen
ae3b394b46 Reuse removePotionEffects() in ArenaImpl.
This commit also rearranges the method, placing it closer to the cleanup methods.
2018-06-23 17:14:25 +02:00
Andreas Troelsen
cbf18ff720 Guard against non-existent plugin folder.
If there isn't already a MobArena folder in the plugins folder, this line fails if we don't make sure to recurse on the folder creation.
2018-06-23 00:00:12 +02:00
Andreas Troelsen
b4e16c16b3 Add newline at the end of main plugin class. 2018-06-22 23:35:13 +02:00
Andreas Troelsen
cc15c2b8ca Add newline at the end of pom.xml. 2018-06-22 23:32:57 +02:00
Andreas Troelsen
519e1f9d4a Bump version to 0.101.1. 2018-06-22 23:32:36 +02:00
Andreas Troelsen
b2064bf33f Add more bStats metrics.
The goal with these specific metrics is to figure out if some of the arena settings can be removed. If everyone uses the same values for these settings, there is no point in having the added complexity in the code.
2018-06-22 23:03:05 +02:00
Andreas Troelsen
2aecea401d Add support for boss health bars.
Three different types of health bars are implemented behind a basic Strategy Pattern. A new per-arena setting, boss-health-bar, can be used to configure which one of the three types (if any) of health bar should be used for bosses in the given arena:

- `boss-bar` creates a boss bar at the top of the screen as if the players were fighting an ender dragon or a wither.
- `title` uses the Chapters/Titles API in Bukkit to display the health of the boss as a "subtitle" whenever it takes damage.
- `name` sets the entitiy's health along with an optional custom name above the entity's head.
2018-06-22 00:00:05 +02:00
Andreas Troelsen
c4362474a1 Rearrange methods.
This is just to group reloadAnnouncementsFile() with reloadSigns() for an attempt at better cohesion in the logical structure of the code.
2018-06-16 18:26:16 +02:00
Andreas Troelsen
2404bb478d Throw an exception if the announcements-file fails to load.
This makes errors in the announcements-file more visible, both during initial load and during reloads.
2018-06-16 18:26:16 +02:00
Andreas Troelsen
a834246cbd Reload announcements when reloading the config-file.
The announcements file loading method is renamed to indicate that it's also meant for re-loading, and the access modifier is changed from private to package-private to allow ArenaMasterImpl to call it.

Closes #462
2018-06-16 18:25:57 +02:00
Andreas Troelsen
61e9ac7635 Migrate to using multiple issue templates.
The existing issue template tries to cover everything, and as a result it is a bit overwhelming. Using multiple issue templates trims the noise when you know what kind of issue you're submitting.
2018-06-16 17:13:40 +02:00
Andreas Troelsen
322ee0f22b Remove unused totals.yml resource.
This file is residue from the old primitive stats system that wasn't being used.
2018-06-14 00:29:17 +02:00
Andreas Troelsen
18729f092e Remove unused keep-exp arena setting.
The setting is never bound to anything in the code, so no point in keeping it around in the default settings resource.
2018-06-14 00:29:17 +02:00
Andreas Troelsen
24aa3a428d Help Maven calm down.
It's just UTF-8, Maven. No need to throw warnings all over the place...

This commit fixes some of the source encoding warnings Maven would print during compilation.
2018-06-14 00:29:17 +02:00
Andreas Troelsen
2ca5e447c0 Add support for dedicated potion effect node in classes.
This makes it a little less awkward to add potion effects to a class, giving them their own node instead of having to "share" with the items node.
2018-06-14 00:29:17 +02:00
Andreas Troelsen
a2e235e77a Add support for potion effects in the Things API.
This commit introduces the PotionEffectThing and associated parser. The parser simply delegates to the existing PotionEffectParser utility class the same way the ItemStackThing parser does it. To distinguish potion effects from other things, the parser requires a prefix of "effect:".

As with the initial Thing API commit, this commit also adds an overload to the existing parser class to avoid spamming the console with meaningless warnings.
2018-06-14 00:29:17 +02:00
Andreas Troelsen
9594bd6126 Allow potion effects on all wave types.
Boss waves already support potion effects, but with this commit, the potions node moves up as a common node, so all waves that spawn monsters (all but upgrade waves) can now spawn those monsters with a list of potion effects applied to them. It's not possible to give certain potion effects to specific monster types. All monsters get all the effects listed in the node.

Because we aren't actually giving potions but potion effects, the node is renamed from "potions" to "effects". However, to preserve backwards compatibility, both names are supported in this commit.

Closes #453
2018-06-14 00:29:17 +02:00
Andreas Troelsen
84249640d1 Add support for join, leave, and info signs.
The ability to execute commands by hitting signs is already implemented by other plugins, but by creating built-in support for such signs, it's possible to leverage information about the plugin and its current state. This implementation allows for displaying live information about player counts, waves, etc. on the signs in addition to tying actions to them.

Customizable templates defined in the new signs.yml config-file can be bound to signs during the in-game sign creation, and users can define state-specific templates that change based on whether an arena is completely idle, has players in the lobby, or is running and in full swing.

Sign data is stored in data/signs.data as a YAML-formatted file that shouldn't be modified directly, effectively separating configuration (templates in signs.yml) and data (coordinates and parameters in signs.data).

Closes #385
2018-06-14 00:29:11 +02:00
Andreas Troelsen
42416cab2f Allow for dismounting and remounting.
This commit makes it possible for mounted players to dismount. Upon dismounting, the horse AI is set to false to prevent it from moving around. Players attempting to mount an available horse will be thrown off unless they actually own the horse. The owners are free to remount when they want.
2018-05-27 20:08:59 +02:00
Andreas Troelsen
c325317153 Add bStats metrics.
Metrics will greatly help the development process in terms of finding out which server versions people are running, as well as which features they are using. For now, we check to see how widespread Vault is, and how many arenas and classes people have.

Advanced bar charts are, at the time of this commit, not supported in the bStats dashboard. When they are supported again, we can look into usage statistics for specific settings and features.
2018-05-14 21:42:33 +02:00
Andreas Troelsen
94c1000d73 Add scope to dependencies in pom.xml.
This allows Maven's shade plugin to shade compile-scoped dependencies and leave out all of the current, "implicitly provided-scoped" dependencies.
2018-05-14 21:39:50 +02:00
Andreas Troelsen
784efdd8be Bump version to 0.100.3. 2018-05-13 18:47:00 +02:00
Andreas Troelsen
cc015f4e9a Log missing Vault/economy plugin during parsing of money things.
Changes the "Vault was not found" message in Vault setup to INFO instead of WARNING, because this configuration isn't actually necessarily a warning sign. Parsing a money thing with no economy is, however. MoneyThingParser logs at ERROR level if Vault or an economy plugin isn't found, but a money thing is parsed.
2018-05-13 17:43:13 +02:00
Andreas Troelsen
3d7a9ff9d2 Update to Mockito 2.18.3.
This also swaps out the dependency on mockito-all with mockito-core, which is actually maintained. The purpose of updating is to allow for new Mockito features, such as mocking final methods, which happens due to the test resource org.mockito.plugins.MockMaker.
2018-05-13 16:44:53 +02:00
Andreas Troelsen
ce392bddc3 Don't depend directly on Vault in MoneyThingParser.
It turns out that the method reference on MobArena#getEconomy() in ThingManager is a tight enough dependency on Vault's Economy interface that it results in a NoClassDefFoundError if Vault isn't present.

By resorting to a more "naive" approach of resolving the Economy instance from the main plugin class on every parse call in MoneyThingParser, the NoClassDefFoundError is avoided along with the load/enable ordering issue that was fixed with the lazy-fetching in commit 2fcb20b2ae.

This reverts 2fcb20b2ae and partly 4c34a183c7.

Fixes #463
2018-05-12 13:06:15 +02:00
Andreas Troelsen
8dbee5d4b5 Bump version to 0.100.2. 2018-05-04 21:16:38 +02:00
Andreas Troelsen
e0b6cc8992 Limit refunds to lobby players.
If the arena has already started, there is no reason why a leaver should have a refund. It's also a douchey move because your buddies in the arena will have a harder time after you leave them for dead.
2018-05-04 20:58:30 +02:00
Andreas Troelsen
5ac83b6898 Move entry fee refund to after join/leave rollback.
This moves the refunding of the entry fee to after the join/leave process for the player has been rolled back, i.e. after the inventory is restored. Before this change, the refund would happen before restoring the player's inventory, which resulted in the refund getting overwritten.
2018-05-04 20:54:12 +02:00
Andreas Troelsen
7aad81e33f Remove logging of successful join/leave steps.
This was mainly left in for debugging purposes, but it creates a bit too much spam that isn't really informative or helpful in any way, since the exception reveals the failed step anyway.
2018-05-04 03:53:09 +02:00
Andreas Troelsen
dd95e16881 Refactor entry fee logic.
This commit swaps out the naive call to takeFee with a more robust approach that actually checks the result. If it fails, the player doesn't join.

It also refactors takeFee so that it will refund any already taken parts of the entry fee if one of the parts fails.
2018-05-04 03:52:07 +02:00
Andreas Troelsen
866c928b0b Remember to take the entry fee.
The takeFee call was accidentally left out in the join/leave refactor (this commit: b1c6b61827).
2018-05-04 03:49:30 +02:00