Commit Graph

46 Commits

Author SHA1 Message Date
tastybento
6d17d48bde Removed AbstractIslandTeamCommand
This was using static data structure that would not work well when other
addons use the command.
2018-05-26 11:43:22 -07:00
tastybento
6a18cc4ccc More multi-world work.
This handles multiworld operation. Test with AcidIsland addon.
2018-05-25 12:19:46 -07:00
tastybento
82ee6d746e Added an Island World Manager that handles worlds
Still a WIP but it's gradually coming along.
2018-05-20 16:09:57 -07:00
tastybento
df696fb4a0 Reworked world checking.
Worlds are checked by the IslandWord class. Additional worlds can be
added to the list of worlds covered by BSB by Addons.
2018-05-18 23:08:18 -07:00
tastybento
060549b5ec Switched to List from LinkedList for tab complete.
Added FlyingMobs test.
2018-05-11 21:05:19 -07:00
Tastybento
6e810747f4 Added island lock class and test class
Island lock is combined with island ban in terms of the Listener. It is
LockAndBanListener. It is a flag because after thinking about it, it
made sense to be just like any other island setting. Also, island owners
can now (in theory) lock out others by rank.

Although the test class says everything works, the Settings GUI needs to
enable toggling so that players can lock the island.

Enjoy banning players!
2018-04-30 01:12:32 -07:00
Tastybento
b20fbd55a4 Cleaned up imports and unneeded exceptions 2018-03-11 15:59:03 -07:00
tastybento
8e97186caf Fixed merge conflicts. 2018-03-12 05:11:02 +09:00
tastybento
cf792779f9 Now using JSON-based data for MySQL
Large number of changes to improve database functions.
2018-03-12 04:08:19 +09:00
Florian CUNY
f511e54429 Unit testing is working greatly, fixed CompositeCommand 2018-03-01 15:12:31 +01:00
Florian CUNY
e4cedb58d0 Removed useless constructor in CompositeCommand + updated unit tests 2018-03-01 14:43:33 +01:00
Florian CUNY
6ba27eef4e Moved User to its own package + added Notifier to avoid massive "Island protected" spam 2018-03-01 14:25:09 +01:00
Florian CUNY
c6c7e0b4ee Removed FlagsManager#getFlagByIcon() as it is useless 2018-02-26 10:07:25 +01:00
Florian CUNY
a885247c85 Implemented basic SettingsPanel + MAJOR changes in Panel/Flag API
It currently just displays a panel with all the flags in it. And throws exception when clicking on an item :P

Flag no longer have a PanelItem but Material instead as the icon.
Added a toPanelItem() method in Flag
Made the Panel(Builder) not using the Optional as fields anymore
2018-02-25 17:09:46 +01:00
Florian CUNY
6edc9555ad Renamed FlagType -> Flag and Flag -> Flags
Don't know when nor why it has been changed. Flag means the object, the flag itself, while Flags means the list of pre-defined Flag(s).
2018-02-25 16:01:30 +01:00
Tastybento
b25d17fa78 Renamed flags to Flag because it was confusing.
Had to rename the class to FlagType as a result.

Rewrote FireListener to be simpler.

Wrote test case for fire listener.
2018-02-20 14:06:09 -08:00
Tastybento
6c4a7d6f97 Added test case for MobSpawnListener
Rewrote MobSpawnListener to be testable and to improve the code.
2018-02-19 22:32:00 -08:00
Tastybento
382f195015 Added tests to PanelItemBuilder and fixed bugs.
Cleared up the description settings methods. Using these will add to the
description of the item.

Temporarily removed JavaDoc and Source jar creation from the POM to save
time when compiling. Will put it back when we need it.

Also, I worked out how to run the Bukkit server setup for tests. See the
setUp method in the tests. This works (at last).
2018-02-19 09:57:19 -08:00
Tastybento
c916bbf827 Automated code cleanup.
Removes spaces, adds {} to if statements, etc.
2018-02-08 20:08:46 -08:00
Tastybento
ace6294e23 Came full circle - kept Flags as final statics
This approach simulates an enum, but one that can be extended by others
to add custom flags. I added a handy values() method that uses
reflection to provide a list of all the flags in the class.

See TestBSkyBlock.java test classes for the tests of the default flag
registration and the custom flag registration.
2018-02-05 23:53:07 -08:00
tastybento
be5404e9c2 Added Setting type to flags.
Flags can be Protection type or Setting Type.

Still needs testing for PVP.
2018-02-05 17:39:04 -08:00
tastybento
645b4eb610 Implements flags as enum so flags are protected. 2018-02-05 14:51:03 -08:00
Tastybento
83d0848429 Fixed bugs with protection.
Added serializer adapter for the Flags hashmap in Island.

Teams don't work. Need to work out why.
PVP doesn't work correctly. It allows members to hit visitors anytime,
but visitors can only hit others if PVP is off. This isn't how it is
supposed to work!
2018-02-03 20:42:12 -08:00
Tastybento
6c2078fbec Added event tests.
Fixed bug with user being retained after a checkIsland.
2018-02-03 19:25:53 -08:00
Tastybento
c648409858 Reworked code so it can be tested using automated unit tests.
See TestBSkyBlock.java class for protection tests.

More to come!
2018-02-03 15:26:13 -08:00
Tastybento
0d645600fc Fixed bugs with start up and flag registration.
Protection does not work yet. Still need more debugging.
2018-02-02 08:18:56 -08:00
tastybento
177023f314 Added code to support protection flag listeners.
Made getIslandsAt() Optional to enable better code structures in the
listeners.

Created an abstract class to simplify flag protection listeners.

Added default setting for flags that will be able to be set by config.
This default is used for any space in the worlds not occupied by an
island.
2018-01-30 16:59:10 -08:00
Tastybento
f7b6898559 Added protection methods. 2018-01-28 20:44:57 -08:00
Tastybento
ba62989788 Shifted some constants around. 2018-01-28 18:13:45 -08:00
Tastybento
eec4e99172 Added ranks to island members. More to do! 2018-01-28 11:48:54 -08:00
Tastybento
92af75e602 Converted to using the Settings loaded by the database handler.
Removed a lot of static references.

Constants have their own class.
2018-01-06 15:23:01 -08:00
Florian CUNY
1430eda5ce ConfigAPI - Implementing the basic functionnalities
a lot of unused/useless Settings has been removed
Settings class has been moved to the main package, because the config package would then only contain it

I need feedback about it
2018-01-04 16:57:12 +01:00
Tastybento
6ef6416c5a Fixed test class to not assert on /test. 2018-01-03 08:24:50 -08:00
Florian CUNY
44742d8946 Made use of "commands.help.syntax" for help
This is a more flexible and natural way to provide the display for the help, especially for the colors.

I had to remove the "/" from the usage though. If you think it should be there, re-add it but remove it from the locale then.
2018-01-03 16:11:45 +01:00
Tastybento
452311fb69 Boom! NMS is gone! (Again) Will it come back?
Used reflection to get the command map from the server instead of using
the NMS call.

Also, more importantly, this commit enables CompositeCommands to
auto-register their top-level command in the constructor. No need to
separately obtain the command manager object. Yes, easy API. :-)
2017-12-28 20:36:04 -08:00
Florian CUNY
390d58cc8b AddonsAPI & Events changes
Moved PremadeEvent to api/events
Made use of PremadeEvent for all existing events
Renamed TeamReason to Reason in TeamEvent
Made the addon events follow the used builder pattern
Renamed #loadAddons() to #enableAddons() in AddonsManager
Added #disableAddons() in AddonsManager
2017-12-28 15:29:32 +01:00
Tastybento
2825f9535e Command API and Help done.
Commands now require a setup to define their permission, player/console
status, description and any parameters they have. This is also where any
subcommands are created if they exist.

Each command automatically has a help subcommand. This is used to
display help. This will also recursively go to any other sub commands
and get help from them. 

Note that getUsage() now *only* shows the command and any sub commands.
It turns out that Bukkit requires this to start with a / because it
actually uses this in its own help system and the server will not start
if it is not in the right format. Therefore I split off parameters into
their own string. This also enables them to be translatable. 

Everything should work at this point. It's just waiting on the locale
system to work to display the strings in the locale files.
2017-12-27 12:09:08 -08:00
Tastybento
f22065fd2c Fixed help and usage descriptions.
Known issue - the help shown when doing a parent help is not using the
child's custom help class for usage/description.
2017-12-26 11:09:00 -08:00
Tastybento
2effa48c8f Made Test class cleaner. 2017-12-24 10:12:04 -08:00
Tastybento
5a5aff32c0 Removed unused import. 2017-12-23 22:02:15 -08:00
Tastybento
9b5a7c887c Made parent Optional in CompositeCommand to avoid null checks. 2017-12-23 21:58:32 -08:00
Tastybento
f8ac04a779 Implemented the auto command help.
The help command is a default subcommand of every command. It will
display the usage info for the command and any subcommands.
2017-12-23 21:35:10 -08:00
Tastybento
eeb4e2a9ee Lots of work done on the command API.
Sub commands work, tab complete works. See the TestIslandCommand.java
test command for how to use the API and unit tests.

Still need to do the auto-help.
2017-12-23 19:14:35 -08:00
Tastybento
c5262e8faa Commands API implemented. Still a WIP.
Commands work and tab complete works somewhat. 
Help still needs to be done. Added in NotSetup And PluginConfig to just
make the plugin work. It's fine to remove them when there is a working
alternative.
2017-12-22 17:26:05 -08:00
Tastybento
18ad604b7b Changed TeamEvent to fire off class-specific events. 2017-12-17 12:38:52 -08:00
Tastybento
323720598a Removed schematics. 2017-12-09 10:44:09 -08:00