Commit Graph

790 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Andreas Troelsen
2fcb20b2ae Lazy load Economy reference in MoneyThingParser.
The eager loading results in nothing but nulls because ThingManager (and, by proxy, MoneyThingParser) is instantiated on load, while the Economy provider from Vault is fetched on enable.

The bug was introduced with 4c34a183c7.

This fixes #451
2018-05-04 03:16:19 +02:00
Andreas Troelsen
8013be1724 Quote the project version in plugin.yml
MobArena has been on version 0.9x for so long that it just never was an issue that the version string was unquoted until now. Because SnakeYAML parses the string as a number, 0.100 becomes 0.1, which means the version string gets parsed into a 0 and a 1, which is less than 0 and 99 (previous version).

This should fix that problem for good.
2018-05-03 01:12:17 +02:00
Hailey Loralyn
780883fce7 Add boss wave on-kill announcements
This commit adds two new announcements for use in boss waves:

- wave-boss-killed to announce who killed the boss
- wave-boss-reward-earned to notify the killer of the boss reward, if any

Fixes #428
2018-05-02 18:10:56 +02:00
Andreas Troelsen
3f3d611731 Allow lobby players to warp in-region.
Historically, we've seen plugins try to "auto-correct" the falling-through-the-world bug in Minecraft when chunks load too slowly. The plugins often solve this by force-warping until the player is stable, and blocking those teleport events are going to cause heavy "not allowed" spam.
2018-05-02 00:48:33 +02:00
Andreas Troelsen
4d174993ff Remember to grant the boss reward.
This slipped through the cracks in the ItemStack -> Thing refactor.
2018-05-02 00:45:51 +02:00
Andreas Troelsen
b1c6b61827 Refactor the join/leave process.
Note that this commit makes breaking changes to the Arena interface and completely changes the responsibility of the InventoryManager.

The join/leave process is replaced with an implementation of the Command Pattern, where every step of the process (e.g. teleport to lobby, change gamemode to survival, reset health, etc.) is realized as an implementation of the new Step interface, which has "run" and "undo" operations. The "run" operation takes a snapshot of a specific part of the player's state and then resets it. The "undo" operation restores the snapshot.

Step groupings are arranged in two factory classes, PlayerJoinArena and PlayerSpecArena, which realize, respectively, the join and spectate processes. Each instance of ArenaImpl instantiates groupings for its own context, and a grouping is invoked as one unit when a player joins or spectates an arena, and rolled back when a player leaves.

As a result of a more stringent process, some things are now a little different than before:

- Setting spectate-on-death to true effectively results in /ma leave followed by /ma spec. This makes the player/arena state a little more predictable and well-defined.
- Using exit warps will result in the player leaving to their entry point and then being teleported to the exit warp. This means the exit warp doesn't have any effect on the rest of the restoration process, as it effectively happens "post leave".

This finally fixes #423.
2018-05-02 00:38:43 +02:00
Hailey Loralyn
aaafba1905 Ignore Case when looking up arenas by name.
This makes commands case insensitive, e.g. /ma join. Note that arenas with the same name but different casing are considered the same arena, and one of them will be ignored during config-file parsing.
2018-04-27 13:37:03 +02:00
Andreas Troelsen
8d9764d8e9 Take offhand into account with TNT auto-ignite.
It turns out that the Inventory#removeItem(ItemStack) method doesn't actually work for items held in the offhand. This commit changes the behavior so it simply decrements the ItemStack amount for the item held during the block place. Note that going from 1 to 0 will result in an air stack, which will just disappear from the inventory.

Fixes #429
2018-04-26 20:02:33 +02:00
Andreas Troelsen
4b0b40f9b1 Rewrite the tab finding logic.
Replaces the hideous StringBuilder code with a normal String, and the BufferedReader with a basic Java NIO readAllLines(), which also takes care of the eye sore that is the finally clause with a nested try-catch.
2018-04-26 19:40:02 +02:00
Andreas Troelsen
4c34a183c7 Move Economy logic out of main plugin class and into MoneyThing.
This means that MoneyThingParser now needs to pass along an Economy instance instead of a MobArena instance, which makes the dependency a little more focused and reasonable.

Also adds MoneyThingParser tests.
2018-04-26 19:07:15 +02:00
Andreas Troelsen
d87d6ad2e9 Remove obsolete economy methods in main plugin class.
These were made obsolete when the special ItemStack type ID of -29 was refactored away.
2018-04-26 18:37:18 +02:00
Andreas Troelsen
96af679237 Remove obsolete permissions checking on main plugin class.
Originally, the permissions checking was implemented with a dependency on various permissions plugins, but since the introduction of SuperPerms, it hasn't been needed, and this residue is safe to remove.
2018-04-26 18:31:51 +02:00
Andreas Troelsen
94d198c4d0 Use implicit permissions checks for classes and arenas.
Removes the dynamic registration of permissions for classes and arenas.

This means that it is no longer enough to just check whether a Player.hasPermission("mobarena.classes.Knight"), but we also need to check if the Player.isPermissionSet("mobarena.classes.Knight"), which it won't be by default.

To make the stringly typed parts of this dynamic permissions checking more focused, ArenaClass and Arena now both have hasPermission(Player) methods, so the actual permissions checking happens on the objects themselves, rather than from the caller of these methods.
2018-04-26 18:29:25 +02:00
Andreas Troelsen
31aa4c15a1 Guard against teleporting back to the arena on death.
The /back command in Essentials - and similar commands from other plugins that allow you to warp back to your location of death - makes it possible to re-enter the arena after dying.

This commit builds upon the "leaving players" of commit 02f75d0e7f and introduces a more general notion of players being "moved". The arena is "moving" a player if the player is being teleported somewhere by MobArena (to any arena warp), and in this case, all teleports of a player are permitted. This takes care of the cases where MobArena "might be doing it". The rest of the cases are due to commands, plugins, ender pearls, etc., and they are a little easier to deal with separately. The new logic is more straightforward and should prevent most exploits and permit most legit warp cases.

This (hopefully) fixes #313.
2018-04-24 14:15:10 +02:00
Andreas Troelsen
37de1e66e9 Use Things API for class armor.
Swaps out the hard dependecy on ItemStack for class armor, such that the ThingManager - and thus every ThingParser registered within - has a chance at providing "armor" for a class.

To distinguish armor from items, ArenaMasterImpl prepends "armor:" or slot-specific prefixes to these values before passing them to the ThingManager. This makes it possible to distinguish between items and armor on the thing parser end if applicable - it doesn't make sense for money and command parsers, but they will just end up skipping these values.

The ItemStackThingParser is given a bit of an overhaul. It now depends internally on ItemStack parsers, which can be registered via the ThingManager. This allows custom plugins to hook into the ItemStack-specific part of the ItemStackThingParser to avoid having to duplicate code. Plugins that just want to provide ItemStacks can use this parser approach, and plugins that want to provide more abstract Things can use the Thing parser approach.
2018-04-24 14:07:42 +02:00
Andreas Troelsen
8014420c1b Use Things API for class items.
Swaps out the hard dependecy on ItemStack for class items (not armor), such that the ThingManager - and thus every ThingParser registered within - has a chance at providing "items" for a class.

Armor is not handled in this commit, because it appears to be quite a bit of extra work, and the "equippable" nature of armor needs to be handled differently than regular inventory items.

The getLogo() method on ArenaClass is removed, because it is no longer used (internally at least). It is residue from the old Spout support.
2018-04-24 13:52:40 +02:00
Andreas Troelsen
5d2881383f Guard against exceptions when setting scoreboards for disconnecting players.
Turns out that a player who disconnects while in the arena is actually still online if you ask the Player object. The setScoreboard() javadoc specifically says it throws an IllegalStateException in that case, so we can just catch and swallow it.

It's unclear what the state of the player's scoreboard is when they rejoin the server, but a borken scoreboard is better than a rogue exception.
2018-04-23 11:53:24 +02:00
Andreas Troelsen
99f57b7128 Ban certain items from the "My Items" class.
This commit removes certain items from the in-arena inventories of players who choose the "My Items" class:

- Ender chests allow players to smuggle stuff out of arenas
- Ender pearls can be used to warp to unintended spots, and to build ender chests
- Shulker boxes can carry any items - including ender chests
- Shulker shells can be used to build shulker boxes

At the end of the day, ender chests are the bad seed. The rest are just to prevent ender chests from making appearances.
2018-04-23 02:07:00 +02:00
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
Nathan Wolf
8b40f415be Use ItemStack display name when describing an ItemStackThing (#441)
Use ItemStack display name in ItemStackThing (if available).

This means that named items will appear in the rewards list with their name rather than the ItemStack type. This is useful for "tokens" type items.

Note that named items are still not supported by the built-in item parser, so this commit only affects ItemStackThings created by custom parsers (for now).
2018-04-17 03:10:15 +02: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
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
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
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
Nathan Wolf
d6ec23025a Ignore cancelled PlayerDropItemEvent events 2017-05-24 16:57:52 -07: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
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
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
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
11fb0ed573 Give strays a bow just like their normal skeleton friends. 2016-12-17 01:58:46 +01:00
garbagemule
60a173d447 Merge pull request #327 from slipcor/offhand-2
Ignore off-hand interact events in Setup Mode (since Minecraft/Spigot 1.9). Fixes #299
2016-12-17 01:44:43 +01:00
garbagemule
65f33ae1a4 Merge pull request #328 from slipcor/empty-inventory
Always check for both null stacks and "air stacks" (ItemStack ID 0) when checking for empty inventories. Fixes #302
2016-12-17 01:43:46 +01:00
garbagemule
bc7c321d28 Merge pull request #329 from slipcor/pets-2
Make pets (ocelots included) sit before teleporting players to the lobby. Fixes #247
2016-12-17 01:41:55 +01:00
slipcor
333a23ecdd fix skeletons only punching with the bow they already have by giving them a new one 2016-12-16 20:36:57 +01:00
slipcor
f81921efcd address github issue #247 (sit pets before teleporting) and include cats/ocelots as pets 2016-12-15 22:32:55 +01:00
slipcor
cbac56e199 address github issue #302 (joining with empty inventory) 2016-12-15 20:08:00 +01:00
slipcor
e6e4782de8 address github issue #299 (ignore offhand interact events thrown since Spigot 1.9) 2016-12-15 18:49:30 +01:00
slipcor
3b88b889d6 update to Spigot 1.11, fix entity spawning errors, remove redundant definitions 2016-12-15 13:13:21 +01:00
garbagemule
dbff678660 Add support for killer bunnies. 2015-09-16 18:51:43 +02:00
garbagemule
4d2b6927d4 Add support for elder guardians. 2015-08-23 15:34:22 +02:00
garbagemule
3a20be3db9 Make root-target find the nearest ground block to root to. 2015-07-28 20:25:08 +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
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
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
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
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
graywolf336
47f22f75ab If no duration provided, potion effects on bosses will last forever. 2014-11-27 22:05:38 -06:00
graywolf336
1090550a3b Add potion effects to bosses when they spawn.
With this feature you can add potions to the bosses when they spawn,
adding the ability to add strength to the boss for the first 30 seconds
making it harder for the first few seconds and once the effect wears
goes away the boss becomes easier. The syntax is in the same style as
potion items, except it uses either the potion effect enum name or the
potion effect id.

POTION_EFFECT:duration in seconds:amplifer

SLOW:360:4;INVISIBILITY:36000:0

If no duration is given, the plugin will default to sixty seconds. If
the amplifer was not provided, the plugin will default to zero. The
potion effect amplifcation starts at 0 being level 1.
2014-11-27 03:37:14 -06: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
garbagemule
4330885d46 Implement check for tabs in config-file. Fixes resets.
This commit creates a fail-fast exception-throwing guard inside the
method for handling config-reloading in the main plugin class.

If a config-file contains a tab, an exception will be thrown when
the plugin loads (as it did before), which means the plugin will not
load correctly. However, upon reloading with the reload command, an
exception is thrown before the current settings are overwritten.

This fixes a long-standing issue with config-files resetting upon
reload with invalid syntax. Verification is needed, as this commit
has only been tested on OS X where tabs and carriage returns are
injected via vim.
2014-06-05 18:14:04 +02:00
garbagemule
a02804a0e7 Fix NPEs when not using scoreboards. 2014-05-23 00:48:21 +02:00
garbagemule
ffa88cc545 Move scoreboard death() call for consistency. 2014-05-06 01:17:52 +02:00
garbagemule
8f95745b50 Add zero-score fix to the dead players on the scoreboards. 2014-05-06 01:16:47 +02:00
garbagemule
9e3848ce41 Disallow MA commands while conversing (guard for Setup Mode). 2014-05-06 01:13:02 +02:00
garbagemule
fb4bf3ad27 Guard against pressure plates in Setup Mode. 2014-05-06 01:12:16 +02:00
garbagemule
f633b77a9d Make mounts spawn as adults - sometimes ;) 2014-05-03 23:16:49 +02:00
garbagemule
2d4b6f20f2 Prevent mounted players from unmounting. 2014-05-03 22:32:24 +02:00
garbagemule
021b43179f Refactor weapon/armor checking, fix skulls resetting on damage. 2014-05-01 01:55:33 +02:00
garbagemule
0182132337 Keep dead players on scoreboards, but make them gray. 2014-05-01 01:34:10 +02:00
garbagemule
bd1e1b879e Remove dead players from scoreboards. 2014-04-27 00:00:53 +02:00
garbagemule
aa77255b18 Add option of showing both regions in Setup Mode. 2014-04-26 23:27:30 +02:00
garbagemule
9fb579b2ff Make start-delay stop auto-start. 2014-04-23 03:51:56 +02:00
garbagemule
2e366f4bee Prevent splash potions from hurting other players. 2014-04-23 03:42:17 +02:00
garbagemule
fec6debf8a Add ArenaPlayerReadyEvent. 2014-04-12 16:26:49 +02:00
garbagemule
fefb3f1c0d Stop start-delay-timer instead of auto-start-timer on empty lobby.
Due to the start-delay-timer holding a reference to the
auto-start-timer as its internal callback, the start-delay-timer
should be stopped, when both timers should be stopped.
2014-04-12 16:17:58 +02:00
garbagemule
df9c0c2704 Add explicit comment to denote idempotence of method call. 2014-04-12 16:13:48 +02:00
garbagemule
7de3e55d58 Guard against null messages. 2014-04-12 15:52:47 +02:00
garbagemule
4ce99aaa05 Return null before trying to add enchantments to null items. 2014-04-07 16:40:31 +02:00
garbagemule
f96eb5ac47 Manually copy arena container contents; fixes reduce-to-0 bug. 2014-04-07 00:55:17 +02:00
garbagemule
c954234229 Only show death messages to arena players. 2014-04-03 22:47:59 +02:00
garbagemule
71fe565316 Make Obsidian Bomb skip non-air blocks and look upwards for one. 2014-03-17 04:17:08 +01:00
garbagemule
515fbc6a22 Force monster targetting to be restricted to arena players. 2014-03-17 04:15:59 +01:00
garbagemule
ca6ee0ea3e Fix arrows not getting removed at arena end. 2014-03-03 16:38:54 +01:00
garbagemule
3e025ef8be Enforce English locale for decimal formatting in config-file. 2014-03-01 13:58:24 +01:00
garbagemule
8a17c72b4b Make sure to copy all the important bits of a wave... This system needs refactoring... 2014-02-26 08:32:19 +01:00
garbagemule
7d14b1b10a Implement start-delay-timer.
The StartDelayTimer wraps the AutoStartTimer and provides a means of
"locking" the lobby until a configurable time has passed. During this
time, it is possible for other players to join the lobby and ready up,
but the arena will not start until the StartDelayTimer has run out,
after which the AutoStartTimer is started (if applicable).

New per-arena setting: start-delay-timer: [seconds]
New announcement: arena-start-delay
2014-02-25 04:36:35 +01:00
garbagemule
5e83c4e7e9 Use correct announcement in AutoStartTimer. 2014-02-25 04:33:43 +01:00
garbagemule
4299353ded Get rid of unnecessary inner classes in AutoStartTimer. 2014-02-25 04:21:58 +01:00
garbagemule
066341ba30 Replace the old AutoStartTimer with the new one. 2014-02-25 03:41:32 +01:00
garbagemule
00060ad5a4 Add new AutoStartTimer using timer framework.
This commit only adds the new timer, but doesn't put it into use.
2014-02-25 03:34:35 +01:00
garbagemule
67535eed93 Null internal timer in CountdownTimer on finish. 2014-02-25 03:32:44 +01:00
garbagemule
bf8c244fce Add utility class for timer package. 2014-02-25 02:11:43 +01:00
garbagemule
937faea5e0 Add setDuration(long) method to CountdownTimer.
The purpose of this method is to allow initialization of the duration
post-construction for convenience.
2014-02-25 02:05:49 +01:00
garbagemule
f8460d5030 Add documentation to TimerCallback 2014-02-25 01:21:26 +01:00
garbagemule
a95ab27d5e Add Timer framework.
This framework consists of interfaces and classes for managing various
kinds of timers. The Timer interface models a timer with configurable
tick intervals. The TimerCallback interface provides a means of adding
logic to the following timer events: onStart, onStop, onFinish and
onTick.

Timer implementations include a CountdownTimer (kitchen timer), and a
StopwatchTimer, which should both be self-explanatory.

The purpose of this framework is to add a means of creating a very
generalized approach to timers, in hopes of abstracting away some of
the Bukkit scheduling for easy maintenance and increased portability.

Future work:
- Port auto-start-timer
- Port boss abilities
- Port spawner
- Create 'delay-timer' as per DBO ticket request.
- Create various types of cooldowns, delays, etc.
2014-02-25 01:09:03 +01:00
garbagemule
f85f9e20d7 Add copy() method to Wave interface.
When the WaveManager is queried for the next wave to be spawned via
the next() method, it now returns a copy of the wave instead of the
wave itself. This is because waves (boss waves in particular) have
state, and this state is transferred to the next occurrence of the
given wave. This caused recurrent boss waves to inconsistently share
state, which resulted in the BossAbilityThread bailing early after
the first occurrence of the boss wave it belonged to. By copying
the initial wave state in the WaveManager, the issue is fixed.

Fixes: http://dev.bukkit.org/bukkit-plugins/mobarena/tickets/1220/
2014-02-24 17:22:20 +01:00
garbagemule
92c4ce1a8b Fix per-arena protect flag. 2014-02-11 17:27:37 +01:00
garbagemule
ea497e42c2 Fix typo in join-arena-is-running announcement. 2014-02-10 01:10:38 +01:00
garbagemule
a527c4a842 Remove obsolete item storing for RepairableContainer. 2014-02-06 04:41:21 +01:00
garbagemule
96870e826b Fix NPE in upgrade map parsing. 2014-02-06 01:07:29 +01:00
garbagemule
7b51fb678c Add command for picking classes in the lobby. 2014-02-02 00:49:59 +01:00
garbagemule
e02f437c2a Fix per-wave spawnpoints-node. 2014-01-27 23:36:48 +01:00
garbagemule
fd7a9c0d0b Empty announcements should be the empty string, not a space. 2014-01-25 15:51:42 +01:00
garbagemule
3223de641f Add setclassprice command. 2014-01-25 15:43:55 +01:00
garbagemule
d0bb31b53d Fix item parser economy regex. 2014-01-25 15:43:16 +01:00
garbagemule
619f07f11b Add per-class option 'price'. 2014-01-25 15:42:38 +01:00
garbagemule
97e5dd0b63 Fix NPE on missing, but expected, monster maps. 2014-01-25 13:56:31 +01:00
garbagemule
d866ec50af Fix checkdata command. 2014-01-23 20:24:11 +01:00
garbagemule
2d3ba801d5 Bring version checker back up to par. 2014-01-22 15:34:48 +01:00
garbagemule
cf41a6add2 Add per-arena setting: show-death-messages 2014-01-22 13:59:17 +01:00
garbagemule
9b161cb1c2 Simplify Setup Mode listener unregistration. 2014-01-22 13:49:39 +01:00
garbagemule
9c4c42bc81 Use Curse/Bukkit API for version checking. 2014-01-22 00:03:44 +01:00
garbagemule
6d93dfa660 Fix entry-fee issue. 2014-01-20 02:59:03 +01:00
garbagemule
b14f665af0 Fix incorrect parsing of final-wave. 2013-12-17 03:55:14 +01:00
garbagemule
5ff41d20fe Use Material instead of item ID. 2013-11-28 02:12:51 +01:00
garbagemule
7d01d613be Fix entry fee issue. 2013-11-28 02:10:57 +01:00
garbagemule
93798a3e51 Remove health strategies. 2013-10-19 16:40:29 +02:00
garbagemule
41e910ad69 More help on arena-not-found with setup command. 2013-10-18 21:16:42 +02:00
garbagemule
3763b877aa Clear spectator drops on death. Fixes #210 2013-10-16 11:37:12 +02:00
garbagemule
bf30185534 Add horse variants as monster types. 2013-10-07 11:55:50 +02:00
garbagemule
56a616ee76 Implement mounts. 2013-10-07 02:05:59 +02:00
garbagemule
24caeab24f Health updates for 1.6 2013-10-07 00:35:47 +02:00
garbagemule
5b2b64d8de Revert "Rip in peace, Metrics, you magnificent bastard."
This reverts commit 096c4d4367.
2013-09-26 13:29:33 +02:00
garbagemule
451e39e3b7 Make spec warp mandatory.
This is necessary to ensure a robust /ma spec command. If no spectator
warp is set, the command will throw an NPE - it is much more safe and
sane to require the warp.
2013-09-21 15:27:41 +02:00
garbagemule
096c4d4367 Rip in peace, Metrics, you magnificent bastard. 2013-09-20 23:27:46 +02:00
garbagemule
42d656863f Attempt to fix auto-start-timer issues. 2013-09-20 23:25:38 +02:00
garbagemule
349172b3b6 Make showBlock(s) thread-safe. 2013-09-09 09:05:54 +02:00
garbagemule
acd441dd2e Try to fix flight exception with Setup Mode. 2013-09-09 09:04:52 +02:00
garbagemule
8a1e74a1a4 LinkedList -> ArrayList 2013-09-08 00:00:17 +02:00
garbagemule
80abcf5f24 Allow the items-node to have a list-value.
The items-node in the classes section now supports list values instead
of strictly string-values. This should make it easier to see exactly
which items a class has, and it should alleviate some of the problems
associated with apostrophes and such. The string-valued setup is still
supported to preserve some backwards compatibility.

The armor-node remains untouched, but it will probably be updated to
the same system later.
2013-09-07 23:56:43 +02:00
garbagemule
70060e7dc8 Fix spacing. 2013-09-02 21:22:24 +02:00
garbagemule
354784269e Fix NPE in setclass command. 2013-08-31 05:58:55 +02:00
garbagemule
8ea4799b42 Permissions cleanup. 2013-08-29 02:29:24 +02:00
garbagemule
cd62f040c0 Remove obsolete commands, remove "selected arena"
The notion of a "selected arena" disappears with this commit. All
commands that previously did not require an arena name in the case
of multiple arenas now do, i.e. it is no longer possible to "set"
an arena to be the target of commands. This should not be an issue,
however, since Setup Mode replaces all the commands that previously
were the main reason for the notion of a selected arena.
2013-08-29 02:01:36 +02:00
garbagemule
95fc5eeb6e Create setup command.
The /ma setup <arena> command is the first step in the process of
making the setup procedure more intuitive. The command consists of
the actual command handling, as well as a multi-role inner class,
and together they constitute Setup Mode.

- Toolbox; a set of tools are provided to the user, and a handler
  for the interact event will react to the usage of these tools,
  providing the primary, interactive element of Setup Mode. The
  tools are used to set regions, warps and points.
- Text input; by typing 'exp', the user can expand a given region
  in the typical directions (up, down, out), and by typing 'show',
  the user can request red wool blocks to be displayed in place of
  region frames, warps and points.

Whilst in Setup Mode, the user cannot type any commands, because
the input is intercepted due to the Conversations API - this is
by design, and may prevent some inconsistencies.

The next step in the process will be to fully remove the commands
that Setup Mode renders obsolete. The commands include, but are
not limited to:
- set(lobby)region
- expand(lobby)region
- setwarp
- addspawn
- delspawn
- addchest
- delchest
2013-08-29 01:09:19 +02:00
garbagemule
9f7c009d85 Add more show methods to ArenaRegion. 2013-08-29 00:41:04 +02:00
garbagemule
a4218ae18c Remove debug printouts. 2013-08-29 00:40:23 +02:00