Commit Graph

4 Commits

Author SHA1 Message Date
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
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