Commit Graph
100 Commits
Author SHA1 Message Date
Andreas Troelsen 02f75d0e7f Prevent infinite loops due to PlayerDropItemEvent from /give command.
Apparently, the /give command will drop an item "as" the target player, resulting in the player picking up the item if there is room in their inventory. This triggers a PlayerDropItemEvent, which MobArena catches and tries to cancel if the target player is in an arena. Furthermore, if the player is a spectator outside of the arena region, MobArena will force the player to leave the arena. This triggers the reward granting logic, so using the /give command as a reward has the potential of causing an infinite loop.

This commit introduces the idea of "leaving players", i.e. players in the process of leaving the arena. In the event of a dropped item from a player who is currently leaving an arena, the PlayerDropItemEvent is ignored, because it is assumed to be from the /give command. Note that this doesn't actually prevent normal PlayerDropItemEvents from causing a forced leave, since the player won't be in the process of leaving at that specific point.
2018-04-23 00:51:14 +02:00
Andreas Troelsen e4d919cf3e Add caching and conditional saving to ConfigUtils.
This commit changes the naive behavior of the ConfigUtils methods addIfEmpty() and addMissingRemoveObsolete(). Instead of an almost guaranteed config-file write on every invocation of either method, writes only happen if the loaded configuration changes. The excessive writes result in long config reload times, and this change fixes that, effectively fixing the second part of #435.

To further the performance boost, the resource reads are cached in a map - this turns out to not be an issue for server plugin reloads, as a new ClassLoader instance is used to load the new set of plugins.
2018-04-22 22:20:20 +02:00
Andreas Troelsen b1634f9460 Return early from forceEnd() if there are no players in the arena.
This means that the cleanup code will only run if there are players in the lobby, arena, or spectator area. This fixes the first part of #435 where the cleanup code is taking too long for large/many arenas.

Originally, the force end command was meant as a way to circumvent any condition keeping players from leaving the arena and cleaning it up. In retrospect, the main reason for using force end is to "get people out of there", but since there's plenty of stuff that can go wrong when a player leaves, this isn't really that helpful, as exceptions will just cause the command to break at the same point anyway.
2018-04-22 20:12:31 +02:00
Andreas Troelsen a91c5e7a74 Build against Java 8.
Java 7 is EOL, and according to the metrics, this change affects less than 1% of MobArena servers.

Fixes #404, closes #410.
2018-04-17 18:18:05 +02:00
Andreas Troelsen 9ccb13773b Bump version to 0.99.1. 2017-11-19 23:02:46 +01:00
Andreas Troelsen 56e83bdaf3 Implement support for commands as things.
With CommandThing and its parser, it is now possible to use commands anywhere a thing can be used. Commands are invoked as the console/server, and they support a single variable, the name of the recipient player.

Commands are give-only, meaning they will fail to be "taken" from players, and they cannot be "held" either. The idea of commands as things basically only makes sense in the context of rewards.
2017-11-19 20:19:36 +01:00
Andreas Troelsen 6e57c018b5 Add a few tests for ThingManager. 2017-11-19 20:19:36 +01:00
Andreas Troelsen 99fc508e1f Remove the test/ folder from .gitignore.
Not quite sure why this was ever in here, but it basically prevents us from having tests, which is terrible.
2017-11-19 20:19:35 +01:00
Andreas Troelsen d1ad24b487 Use the Things API for entry fees and class prices.
While it doesn't really make sense to have class prices be a Thing (or maybe it does?), this does get rid of the dirty "ItemStacks wit ID -29" hack for economy money, which will eventually break, when the upstream int-based ID API breaks.
2017-11-19 20:19:35 +01:00
Andreas Troelsen 2c96122e7d Allow ThingParsers to throw exceptions on invalid input instead of expecting them to return null.
This allows for a much more well-defined, fail-fast process, where a parser can abort on valid prefix but invalid input.
2017-11-19 20:19:35 +01:00
Andreas Troelsen ea73256749 Implement the Things API for rewards (including boss wave rewards). 2017-11-19 20:19:25 +01:00
Andreas Troelsen aecdac7b39 Add Things API.
With this commit, the Things API is introduced to the code base, but it is not yet used. It introduces the building blocks for an extensible architecture that supports custom parsers and custom "things". This should allow other developers simple, yet powerful hooks into the way MobArena handles class "equipment" and rewards. The basic skeleton includes parsers for ItemStacks and economy money, so it should be interchangeable with the current inner workings of the plugin.

The commit also adds an overload to the ItemParser that allows for a the method to fail silently. This is necessary to avoid false negatives in the log in case the ItemStackThingParser fails but a different parser succeeds.
2017-11-19 18:06:45 +01:00
Andreas Troelsen c83cc3ede9 Add MagicSpells to the lib/ folder.
MagicSpells is not available in the maven repositories, so we'll just include the jar file for now.
2017-11-19 17:07:00 +01:00
Andreas Troelsen 03273ae797 Remove the lib/ folder from .gitignore.
The purpose of this is to actually commit to version control the jar(s) necessary to compile. It's not a best practice whatsoever, but if we can commit gradle wrappers, we can commit hard-to-incorporate binary dependencies.

As a nice side effect, it should be possible to run some basic CI tooling on the repository.
2017-11-19 17:06:01 +01:00
Andreas Troelsen 3b82cf12a4 Grant 'after' rewards when the next wave is about to spawn. Fixes #393 2017-10-09 23:57:02 +02:00
Andreas Troelsen 5d1ec8eb56 Guard against null messages in Messenger. Fixes #391 2017-10-09 23:49:47 +02:00
Andreas Troelsen 228923dab6 Bump version to 0.98.2. 2017-06-05 00:28:37 +02:00
Andreas Troelsen 6bbc9b55cf Don't rely on the Obsidian Bomb explosion to clear the dropped block item. Fixes #379 2017-05-29 09:19:04 +02:00
Andreas Troelsen 9bb7bc1f11 Replace some deprecated API calls with non-deprecated alternatives.
This commit does not fix all deprecated API problems, but deals with some of the most straightforward ones.
2017-05-20 22:18:06 +02:00
Andreas Troelsen 574a4fdb5f Use Reader-based load() method on YamlConfiguration instead of the deprecated InputStream-based method. Fixes #374
This is necessary because the InputStream-based method is removed in 1.12.
2017-05-20 21:33:04 +02:00
Andreas Troelsen 1da7b564d1 Remove unnecessary access modifiers on interface methods. 2017-03-13 21:32:25 +01:00
Andreas Troelsen e988f5697c Remove unnecessary casts (and superfluous exceptions in throws clauses). 2017-03-13 21:31:16 +01:00
Andreas Troelsen 92e36da1f5 Remove unnecessary access modifiers on enum constructors. 2017-03-13 21:25:53 +01:00
Andreas Troelsen 0eeed4ff01 Embrace Java 7's diamond operator project-wide. 2017-03-13 21:23:24 +01:00
Andreas Troelsen 98d3cf0245 Only allows mobs to target each other if infighting is enabled. Fixes #364 2017-03-13 21:12:16 +01:00
Andreas Troelsen da094e0f57 Optimize imports on all project files.
Big commit, no functional changes ¯\_(ツ)_/¯
2017-03-13 20:47:48 +01:00
Andreas Troelsen a8b62623e8 Don't give pets and mounts to players who bring their own items.
Bringing a full stack of bones will no longer result in a full pack of wolves.
2017-03-12 21:42:57 +01:00
Andreas Troelsen 991a0ced67 Rewrite README. 2017-03-12 12:17:01 +01:00
Andreas Troelsen 50b929c4e4 Bump version to 0.98.1. 2017-03-11 16:39:37 +01:00
Andreas Troelsen ac806f967f Remove Metrics.
Turns out this thing isn't even online anymore. Let's get rid of it.
2017-03-11 15:42:11 +01:00
Andreas Troelsen 2fdfd64ddf Use == operator for comparing EquipmentSlot values. Fixes #361
Because the == operator is null safe, we don't need to worry about null checking.
2017-03-11 13:59:37 +01:00
Andreas Troelsen f212c657b0 Move Messenger announce() methods into Arena.
Since the announce() methods always required an Arena argument, and since the Messenger instance used was always acquired from an Arena instance, there really was no reason for the methods to exist on Messenger.
2017-03-10 23:40:56 +01:00
Andreas Troelsen 56dc504bec Refactor Messenger to allow for custom prefixes.
- Messenger no longer has a static nature and must be instantiated to be used. The prefix is provided in the constructor.
- MobArena instantiates a global Messenger in onEnable() with a prefix string from global-settings. This instance is used by anything that isn't arena-specific, as well as for arenas with no prefix.
- ArenaImpl instantiates a local Messenger in its constructor if, and only if, its arena-specific prefix setting is non-empty. Otherwise it uses the plugin's global instance.
2017-03-10 23:32:52 +01:00
Andreas Troelsen 5d6a7768e8 Refactor logging out of Messenger.
This removes the logging capabilities from Messenger and replaces all references to them with proper logging via Bukkit's PluginLogger that all plugins have.
2017-03-10 21:48:00 +01:00
Andreas Troelsen c979c0643f Bump version to 0.97.6. 2017-02-18 04:01:37 +01:00
Andreas Troelsen 9b1866e6cc Replace spaces in class names when toLowerCase'ing them. 2017-02-18 03:36:35 +01:00
Andreas Troelsen fbe80d7ee6 Use config-file names for classes in messages. 2017-02-18 03:34:28 +01:00
Andreas Troelsen 692d7f52dc Add support for a per-arena default class. 2017-02-18 03:27:50 +01:00
Andreas Troelsen d2fd8b4fc2 Add support for bringing your own items into the arena.
This implementation uses a sublcass of ArenaClass to make an implicit My Items class, which restores the player's inventory when granting items.
2017-02-18 03:27:10 +01:00
Andreas Troelsen 51f907218e Use a hardcoded potion map to deal with potion metas. Fixes #312 #343
Thanks slipcor!
2017-02-18 02:43:12 +01:00
Andreas Troelsen 48a85a7e85 Use a copy of the block list in BlockExplodeEvent for the fake EntityExplodeEvent. Fixes #356
The blockList() call returns the actual List<Block> object in the explode event, which means it'll be shared between the the fake event and the original event. As a result, the call to blockList().clear() will clear the shared list, and the following call to blockList().addAll(fake.blockList()) results in trying to add the empty list to itself.

This commit makes sure to copy the original event's block list before sending it to the fake event.
2017-02-14 17:26:20 +01:00
Andreas Troelsen c66321ec78 Remove over-dramatic warning about harmless state inconsistency in start timers. Fixes #317
Okay, "Fixes" would be lying, and that's terrible, but here's something to help you shrug it off: The timer module is a bit of a mess, and since there isn't actually anything "dangerous" about this, let's just calm our tits and focus on other stuff.
2017-02-10 21:47:41 +01:00
Andreas Troelsen f40e54f8bb Minor refactoring of class chests handling. Fixes #318 2017-02-10 21:40:02 +01:00
Andreas Troelsen acbeb3d77f Guard against null scores for players who manage to die in the lobby. Fixes #319 2017-02-10 21:32:56 +01:00
Andreas Troelsen 7e049cdae6 Ignore off-hand interactions for class signs and ready blocks. Fixes #340 2017-02-10 15:52:44 +01:00
Andreas Troelsen b7472dbc94 Prevent mobs from picking up dropped items and blocks. Fixes #344 2017-02-10 15:45:12 +01:00
Andreas Troelsen 2de5fbf296 Bump version to 0.97.5. 2016-12-30 01:43:53 +01:00
Andreas Troelsen 788cfefa00 Give all mounts saddles - not just the normal horses. 2016-12-30 01:32:16 +01:00
Andreas Troelsen fb1a87f71b Make sure all mounts are invincible, not just normal horses. 2016-12-30 01:11:56 +01:00
Andreas Troelsen b40b73ea25 Remove support for llamas as mounts (they can't be controlled so no point yet). 2016-12-30 00:34:56 +01:00
Andreas Troelsen 41f0a892c4 Refactor mount spawning due to API changes; fixes an exception thrown when trying to use barding on non-normal horses.
This commit adds support for llamas and removes barding and saddles from non-horse mounts.
2016-12-29 21:56:29 +01:00
garbagemule df43712964 Remove Shulker bullets on session cleanup. 2016-12-29 17:56:43 +01:00
garbagemule 8705b5c9f7 Add support for off-hand items. 2016-12-29 17:56:32 +01:00
garbagemule 558681a2f2 Remove redundant setContents() calls from class chest handlers.
Before, these redundant calls didn't really do anything. Now they mess everything up, because setContents() doesn't set inventory contents only, but the entire inventory instead, because that's so super useful. Well done, boys!

#notsalty
2016-12-29 17:55:46 +01:00
garbagemule 93ce8b9667 Fix Spigot's semi-breaking inventory change.
Because it is clearly impossible to change JavaDocs to correctly describe what a method does, the method setContents() has now been changed to a useless, over-aggressive, inventory-wiping piece of junk that must be invoked before anything else. This commit ensures that armor contents are set after the setContents() method is called, overwriting the nulls that the setContents() method creates.
2016-12-29 17:55:30 +01:00
Andreas Troelsen 847726a29a Bump version to 0.97.4. 2016-12-17 02:39:15 +01:00
Andreas Troelsen 11fb0ed573 Give strays a bow just like their normal skeleton friends. 2016-12-17 01:58:46 +01:00
Andreas Troelsen 98e4c03085 Bump version to 0.97.3. 2016-12-15 21:36:32 +01:00
garbagemule dbff678660 Add support for killer bunnies. 2015-09-16 18:51:43 +02:00
garbagemule 23eeff69a3 Update pom.xml towards next release. 2015-08-23 15:35:49 +02:00
garbagemule e4ddc653b6 Version 0.97.1 2015-08-23 15:35:16 +02:00
garbagemule 4d2b6927d4 Add support for elder guardians. 2015-08-23 15:34:22 +02:00
garbagemule 6d29f265a1 Update pom.xml towards next release. 2015-08-19 15:56:30 +02:00
garbagemule f83e1b20fb Version 0.97 2015-08-19 15:54:24 +02:00
garbagemule 3a20be3db9 Make root-target find the nearest ground block to root to. 2015-07-28 20:25:08 +02:00
garbagemule f49fe0e33b Add Mockito to POM. 2015-07-27 22:23:32 +02:00
garbagemule 119d92686a Add JUnit and Hamcrest to POM, add linebreaks. 2015-07-21 15:55:02 +02:00
garbagemule 39196c7b61 Unwrap potential Player proxies in commands. 2015-07-17 17:50:51 +02:00
garbagemule 79ca18aa41 Fix default boss health value. 2015-07-17 16:41:58 +02:00
garbagemule 3e01070e9a Use Spigot's Bukkit API instead of the Spigot API. 2015-07-17 16:28:44 +02:00
garbagemule d32cd22a98 Make monster types case-insensitive. 2015-07-17 16:12:23 +02:00
garbagemule a9eab13842 Fix Spigot block explosion issue. 2015-07-17 16:11:00 +02:00
garbagemule 95aebcf333 Merge branch 'ma-creature' 2015-07-17 04:45:57 +02:00
garbagemule d3c5535f61 Cast null instead of creating a new set. 2015-07-17 04:45:48 +02:00
garbagemule eda6e6e1f3 Static map initializer before constants. 2015-07-17 04:44:59 +02:00
garbagemule 0e814b9c0f Convert MACreature to class. 2015-07-17 04:25:24 +02:00
garbagemule aafeb93d38 Update for Spigot and mavenize. 2015-07-17 03:38:41 +02:00
garbagemule 91d426a74b Update plugin.yml towards next release. 2014-12-13 20:43:53 +01:00
garbagemule a9bf65c780 Version 0.96.9 2014-12-13 20:43:35 +01:00
garbagemule e663a10a2a Fix Spigot issue with skeleton/wolf targetting. 2014-12-13 20:29:02 +01:00
garbagemule 2e397fd123 Really fix the Spigot health issue (with a twist). 2014-12-13 20:28:14 +01:00
garbagemule 4f46064bcf Update plugin.yml towards next release. 2014-12-08 20:18:49 +01:00
garbagemule c7f71b7c59 Version 0.96.8 2014-12-08 20:18:20 +01:00
garbagemule a8755ea496 Add a guard for ridiculous Spigot health issue. 2014-12-08 19:37:11 +01:00
garbagemule 246c05e7a9 Initial work on fix for water not removing properly. NOT ACTIVATED. 2014-12-08 19:23:21 +01:00
garbagemule 03fad84ece Merge branch 'graywolf336-bleeding' into bleeding 2014-12-08 17:03:54 +01:00
garbagemule bca1d387a4 Allow for spaces between comma-separated potion effects. 2014-12-08 16:48:53 +01:00
garbagemule 243c5ea6ea Make numeric regexes require at least one number to match. 2014-12-08 16:45:05 +01:00
garbagemule 55e0500bae Allow for lower case potion effect names. 2014-12-08 16:43:15 +01:00
garbagemule 409c3f6c14 Swap amplifier and duration parameters in effect parser.
This changes the format from:

  <effect>:<duration>:<amplifier>

to a (pressumably) more user-friendly format of:

  <effect>:<amplifier>:<duration>

The reason for this swap is that the duration is more likely to be
wanted left at default than the amplifier. From previous user input
on the matter, it sounds like users generally want the bosses to have
"permanent" or "infinite duration" effects, and this change makes it
a little easier on them, not having to specify a duration.
2014-12-08 16:38:33 +01:00
garbagemule 7648338047 Update plugin.yml towards next release. 2014-08-02 08:22:00 +02:00
garbagemule 0649d1ba1f Version 0.96.7 2014-08-02 07:34:04 +02:00
garbagemule ea2cb4baf2 Fix auto-ignite-tnt not working with protect: false 2014-08-02 07:01:56 +02:00
garbagemule d6c1f97415 Implement boss drops. 2014-08-01 21:26:00 +02:00
garbagemule 7766260154 Switch boss health from ints to doubles - fixes "Health must be between" bugs for bosses. 2014-08-01 20:01:52 +02:00
garbagemule ebbc069128 Clear all monster equipment on spawn to prevent unexpected tank zombies. 2014-07-31 17:51:45 +02:00
garbagemule 11714ad2ab Merge branch 'bleeding' of github.com:garbagemule/MobArena into bleeding 2014-07-24 05:00:05 +02:00
garbagemule f269b07998 Actually fix the config-reset bug.
Some of the config-file resets were fixed in a previous commit:
4330885d46

The resets fixed previously were ones where snakeyaml would throw a fit
due to tabs. Because an exception is thrown, the call to saveConfig()
is never reached, which means the config-file is never reset.

However, errors resulting from other illegal characters were not caught
because the built-in reloadConfig() method catches, prints and then
simply does nothing about any exceptions thrown, which means the actual
YamlConfiguration would be empty. Saving this empty file would result
in a reset, because MobArena, during initialization, sees missing bits
and pieces and tries to insert them. Thus, the resets were not an issue
with MobArena's attempt to keep the config-file tidy, but the reckless
handling of errors in the built-in config methods in JavaPlugin.

This commit completely overrides the methods in JavaPlugin that would
result in these resets, and the MobArena plugin class stores its own
reference to the config file and an associated FileConfiguration. When
the reloadConfig() and saveConfig() methods are called, the checked
exceptions are caught and rethrown as unchecked exceptions, causing the
plugin to crash when it needs to do so.
2014-07-24 04:59:08 +02:00
garbagemule 460cec0fb8 Add max health guard for players. 2014-07-11 00:17:30 -04:00
garbagemule 5dc35728c1 Make potion splash handling witch-aware. 2014-07-10 22:33:37 -04:00