Commit Graph

921 Commits

Author SHA1 Message Date
Andreas Troelsen
fe5571c75b Update changelog with change from 6a8c6a9. 2018-09-23 15:41:37 +02:00
Sait™
6a8c6a9741 Grant permission for /ma ready by default
This makes the ready command consistent with the rest of the sane defaults as well as with the ready block, which requires no permissions.
2018-08-31 19:46:36 +02:00
Andreas Troelsen
09d0b4772b Bump version to 0.103.1 2018-08-28 22:58:51 +02:00
Andreas Troelsen
7962842be1 Release 0.103. 2018-08-28 22:00:59 +02:00
Andreas Troelsen
c546641c7b Start the join-interrupt-timer from the spectator area.
Following the changes in 266104d0a1, this commit gathers the leave-then-join logic and handles it in one fell swoop when joining from the spectator area. This means that the timer will start, and when it runs out, the player leaves the current arena (if any), and then joins.

There should be no issues with overlapping timers or anything like that, since the lookup happens when the time is up, not before the timer is started.
2018-08-28 21:30:45 +02:00
Andreas Troelsen
d17b588647 Update Thanks in changelog.
Thanks, kitty!
2018-08-24 19:44:23 +02:00
Andreas Troelsen
266104d0a1 Re-allow joining from spectator areas.
Commit 924a419b47 made it impossible to join an arena from a spectator area because the playerLeave method call in JoinCommand was removed. The call is re-introduced in this commit along with similar logic in InvokesSignAction. This means that a spectating player can now join arenas as if they weren't spectating, rather than having to first leave the arena they are spectating.
2018-08-24 19:27:21 +02:00
Andreas Troelsen
934eb2d8cc Build against Bukkit API for Minecraft 1.13.
This very likely introduces a few bugs and breaks some functionality, but at least we're compiling...
2018-08-19 21:05:24 +02:00
Andreas Troelsen
754eb156d1 Make SheepBouncer logic cancellable.
Following the changes in 96c1f18517, this commit makes SheepBouncer cancellable for the same reasons as outlined in the MASpawnThread commit.
2018-08-19 20:48:04 +02:00
Andreas Troelsen
96c1f18517 Make MASpawnThread logic cancellable.
This commit changes how MASpawnThread is started. Instead of simply scheduling a task and letting it run whenever, we now explicitly tell it to stop when the arena ends. This matters, because if the scheduled task does not get cancelled, it will run at the scheduled time. MASpawnThread's run() method has an early return to stop whenever the arena isn't running, but with unlucky timing, it's possible to start a new arena session before the task runs again, meaning the same MASpawnThread keeps scheduling itself on the previous scheduling loop.

Instead of this whacky approach, we now specifically have MASpawnThread track its own BukkitTask. Upon arena start, we instantiate a new MASpawnThread and call its start() method, which in turn schedules itself and stores a reference to the associated BukkitTask. Upon arena end, we call the MASpawnThread's stop() method, which explicitly calls the BukkitTask's cancel() method, effectively stopping/unscheduling the task.

This fixes the (very) long-standing "double wave spawner" bug that we haven't been able to reproduce for so long. Hooray!
2018-08-19 20:47:25 +02:00
Andreas Troelsen
fc51c5eff5 Clean up IntelliJ's overzealous refactoring of the word "reload"...
The command we want people to type is /ma reload, not /ma load. This is likely splash damage from a Rename refactoring action in IntelliJ.
2018-08-19 11:06:17 +02:00
Andreas Troelsen
944efed3f0 Use JitPack to resolve MagicSpells.
This commit nukes the lib/MagicSpells.jar file and instead uses JitPack to resolve MagicSpells (finally!).

Thanks, TheComputerGeek2.
2018-08-19 11:06:17 +02:00
Andreas Troelsen
220197b5db Bring keep-exp per-arena setting back.
This setting was removed a long time ago, likely by "happy mistake" in a larger refactoring.

When enabled, players are granted any collected experience during the arena session as a reward when they die or reach the final wave of the arena. Note that deliberately leaving the arena is not included here, because "leaving" an arena is a highly ambiguous and conditional concept at the time of this commit. Figuring out when and how the experience reward should be added is complicated, and unless someone puts in a request for it, I think it's enough that the "legitimate" reasons for getting the experience (honorable death and reaching the final wave) are covered.

Closes #485
2018-08-19 11:06:17 +02:00
Andreas Troelsen
fbb5fe7c4a Include total experience in SetExperience step.
It turns out that experience in Minecraft is split out on a couple of different variables, and they are only loosely coupled.

Total experience, level, and level progress are three completely different variables that can be manipulated individually. This means that while 10 experience points from level 0 should bring you up to level 1 with a third of the experience bar full (level 0 to 1 takes 7 points, level 1 to 2 takes 9 points), simply setting the total points value to 10 won't automatically level you up. Using the Player#giveExp(int) method will, however, work this way.
2018-08-19 11:06:02 +02:00
Andreas Troelsen
95e2abdee9 Update changelog with /ma ready command. 2018-08-19 11:05:00 +02:00
Sait™
977df0b9f4 Add /ma ready
This commit adds a new command, /ma ready (/ma rdy for short), as an alternative to the iron block for readying up after picking a class.

Note that this conflicts with the shorthand for /ma notready, which no longer triggers on the word "ready", but only on "notready".
2018-08-19 11:00:19 +02:00
Andreas Troelsen
548d8c7e4f Allow armor stands in arenas and lobbies.
This commit adds an event handler for the PlayerArmorStandManipulateEvent and cancels it if the arena protection is on, we aren't in edit mode, and the region contains the armor stand. The same logic applies to the armor stand damage event.
2018-08-11 00:16:21 +02:00
Andreas Troelsen
51fa78acd9 Change the fallback command error message.
This is a little less panicky, and it doesn't reference IRC (which is basically dead).
2018-08-10 23:23:34 +02:00
Andreas Troelsen
1fc6c5b8b9 Use an alias instead of two separate commands in plugin.yml 2018-08-10 23:23:33 +02:00
Andreas Troelsen
170dc2b122 Remove trailing whitespaces in command handler. 2018-08-10 23:23:33 +02:00
Andreas Troelsen
8d91598b21 Remove trailing whitespaces in main plugin class. 2018-08-10 23:23:33 +02:00
Andreas Troelsen
a1e802c6f0 Minor cleanup in ArenaMaster.
Removes unused imports and fields, trailing whitespace.
2018-08-10 23:23:33 +02:00
Andreas Troelsen
2081405d3b Refactor startup logic.
This commit re-implements and rearranges a lot of the logic in the main plugin class. It also removes the ConfigCommand class and moves its functionality into the CommandHandler to allow for reloads to be a bit more special than normal commands.

In the refactoring of the main class, the startup logic is broken up into two phases, setup and (re)load:

- In the setup phase, we create the data folder, and the command handler, config serializer(s), plugin integrations, boss abilities, the global event listener, and metrics are initialized. The ArenaMaster is instantiated, but it isn't initialized. These are things that need to be set up just once and don't change on reloads.

- In the (re)load phase, the config-file is loaded from disk, the global messenger is instantiated, the arena master is initialized (loads settings, classes, and arenas), the announcements file is loaded from disk along with the sign data/templates. These are things that we want to be reloadable.

If anything goes wrong during these phases, we store the exception thrown. This puts MobArena into a state where it prints the exception message to anyone who types a non-reload MobArena command to bring attention to the error so it can be fixed.
2018-08-10 23:23:30 +02:00
Andreas Troelsen
dc25a38d98 Throw ConfigErrors when pet items are invalid. 2018-08-10 21:55:22 +02:00
Andreas Troelsen
beb4269525 Remove all of the obsolete and commented out code in WaveUtils. 2018-08-06 01:25:21 +02:00
Andreas Troelsen
13e3c180e5 Make the class items node consistent with the rest.
Supposedly, this doesn't actually do much, but the code now looks like the rest of the "string or string list" parsing.
2018-08-06 01:23:26 +02:00
Andreas Troelsen
951e83cc55 Rework some of the wave parsing logic.
This commit is a full sweep across the WaveParser. It introduces the ConfigError exception to the WaveParser and throws it whenever something isn't right. There's quite a lot of stuff going on, but in overall:

- Errors are thrown rather than null values being returned
- Defaults are picked in lieu of explicit values when they "make sense"
- Most list-type values can now be either the default comma-separated string or a string list

Common nodes:
- Spawnpoints can now be a string list

Default waves:
- Missing or empty monsters map throws an error
- Missing wave growth defaults to medium
- Invalid wave growth throws an error

Special waves:
- Missing or empty monsters map throws an error

Swarm waves:
- Missing or empty monster node throws an error
- Missing swarm amount defaults to low
- Invalid swarm amount throws an error

Supply waves:
- Missing or empty monsters map throws an error
- Missing or empty drops node throws an error
- Invalid drop throws an error
- Drops can now be a string list

Upgrade waves:
- Missing or empty upgrades map throws an error

Boss waves:
- Missing or empty monster node throws an error
- Missing or empty boss health defaults to medium
- Invalid boss health throws an error
- Invalid ability throws an error
- Invalid drop throws an error
- Abilities and drops can now be string lists
2018-08-06 01:22:27 +02:00
Andreas Troelsen
060a395213 Guard against non-living entities in MACreature.
This should prevent runtime errors where MobArena tries to spawn non-living entities, causing arenas to get locked up.

Fixes #438
2018-08-05 23:30:03 +02:00
Andreas Troelsen
cd82a89626 Rewrite ThingParser usages.
This commit changes how the ThingParser is used throughout the code base. Instead of blindly filtering out null values, we're now throwing a new InvalidThingInputString exception. This exception is caught in an outer scope that has more context. The exception is then unwrapped and rethrown as a ConfigError with the additional context. In the outermost scope of (re)loading the config-file, the ConfigError is caught and printed, and then (re)loading stops gracefully.

We still need a proper way to handle loads/reloads consistently to get rid of the default command usage message, but this is a good step towards better usability in the face of user errors.

Fixes #478
2018-08-05 23:14:01 +02:00
Andreas Troelsen
924a419b47 Add join-interrupt-timer per-arena setting.
This commit adds a new per-arena setting, join-interrupt-timer, which, when set to a positive number, will introduce a delay to the join and spec commands. During this delay, if the player takes damage or moves more than one block's distance, the command will be interrupted.

Closes #482
2018-08-05 21:17:05 +02:00
Andreas Troelsen
c1375a31f5 Add changelog.
This, along with a (currently not committed) script to generate github releases and Spigot/DBO formatted release notes from this changelog, should reduce some of the friction associated with new releases.
2018-08-05 20:47:06 +02:00
Andreas Troelsen
7a9b2f601f Add next-wave-delay per-arena setting.
This commit adds a new per-arena config-file setting, next-wave-delay. When a new wave is about to spawn, a positive next-wave-delay value will cause the spawning of the wave to be delayed by that amount of seconds, similar to how first-wave-delay delays the spawning of the first wave.

By moving all of the actual spawning logic into a new method and simply referencing that as a Runnable, we can avoid having to set weird boolean flags and re-scheduling the MASpawnThread itself.

Closes #449
2018-07-29 21:23:29 +02:00
Andreas Troelsen
6f077359c6 Add a dedicated field for wave-interval in MASpawnThread.
All of the calls to getSettings() are now contained in the constructor and reset() method. Neat.
2018-07-29 15:55:39 +02:00
Andreas Troelsen
3b024235dc Remove support for undoing autogenerated arenas.
The autogenerated arenas are backed up in a file that isn't valid in 1.13. It's also buggy, inducing a false sense of safety. Instead of trying to hack it together for 1.13, let's remove it and see if we can't live without it.
2018-07-23 01:18:05 +02:00
Andreas Troelsen
5937eb0631 Deny use of held items in the lobby.
This semi-reverts part of the change in e484583b7e.

We're now specifically denying the use of items if there are any. This doesn't cancel the interact event, but just prevents stuff like potion consumption.
2018-07-19 15:07:23 +02:00
Andreas Troelsen
85687c86b5 Prevent snow and ice from melting in arenas.
The block fade event is called when a block fades from one state to another, such as when snow melts and becomes air, or ice melts and becomes water. Cancelling it solves the issue of snow and ice melting in arenas.

Fixes #249.
2018-07-19 02:01:41 +02:00
Andreas Troelsen
e484583b7e Allow right click actions in the lobby.
Originally, the right click ban was introduced to prevent issues with people blowing themselves and each other up in the lobby. The right click ban only solves this issue sometimes, so it isn't really very effective.

By removing the right click ban, it becomes possible to activate redstone stuff like buttons and levers in the lobby.

Fixes #431.
2018-07-19 00:59:34 +02:00
Andreas Troelsen
359a04c548 Bump version to 0.102.1 2018-07-05 23:06:07 +02:00
Andreas Troelsen
1371a90871 Remove the give-all-items flag for Upgrade waves.
The flag is almost always set to true, and when it isn't, it's either because people don't know that they have to set it, or because they only give one upgrade per class and thus don't feel the effect of it.
2018-07-05 11:29:23 +02:00
Andreas Troelsen
b58964dce9 Grant class potion effects separately to make sure class chests aren't forgotten about.
This is not the proper way to solve this issue, but the refactoring needed to move the responsibility of class chest search somewhere else is a bit too much for a bug hunt.
2018-07-05 11:19:28 +02:00
Andreas Troelsen
335e3e81a6 Replace deprecated matcher in MoneyThingParserTest. 2018-07-04 02:09:54 +02:00
Andreas Troelsen
35f114959f Replace deprecated ItemStack constructor in ArenaImpl. 2018-07-04 02:05:29 +02:00
Andreas Troelsen
25dc6b577b Replace deprecated getItemInHand() calls in SetupCommand. 2018-07-04 01:57:30 +02:00
Andreas Troelsen
d0eb1cc487 Remove unused InventoryUtils class.
No clue what this was for. Possibly entry fees?
2018-07-04 01:50:24 +02:00
Andreas Troelsen
c21d7e9e96 Remove unused RegionSerializer class.
No idea when this was last used. Possibly before force-restore was removed.
2018-07-04 01:47:37 +02:00
Andreas Troelsen
623bfae308 Update ScoreboardManager to Java 8 lambdas and method references.
Just makes things a little bit neater.
2018-07-04 01:42:52 +02:00
Andreas Troelsen
dbd04294a4 Replace deprecated calls in ScoreboardManager with proper ones.
Fixes a small portion of #406
2018-07-04 01:35:08 +02:00
Andreas Troelsen
9809e9ebc9 Remember and restore existing player scoreboards.
This introduces state in the ScoreboardManager for keeping track of the scoreboards that players have before the arena session starts, if any. Upon leaving, the scoreboards are restored.

Ideally, this change should be re-implemented as a Step of the join/leave process, but that would require opening up Arena or ScoreboardManager in ways that would probably be best handled in a rewrite of the scoreboards, so we'll leave it in ScoreboardManager for now.

Fixes #366
2018-07-04 01:25:38 +02:00
Andreas Troelsen
bacfe291bf Remove obsolete hellhounds setting.
Bye bye, flaming puppies.
2018-07-03 18:22:30 +02:00
Andreas Troelsen
ccf6cda59a Add support for ocelot pets.
By default, a raw fish will turn into a pet ocelot, but the item type is configurable.
2018-07-03 18:13:42 +02:00