Commit Graph

23 Commits

Author SHA1 Message Date
Florian CUNY
ecb630fac3 Fixed some code smells 2018-04-25 13:48:58 +02:00
Tastybento
b20fbd55a4 Cleaned up imports and unneeded exceptions 2018-03-11 15:59:03 -07: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
f648c936ad Continued working on the SettingsPanel. Did minor fixes in PanelItemBuilder 2018-02-26 20:18:09 +01:00
Tastybento
9db2602f78 Added FlagsManagerTest class to test the flags manager.
Added some code to the Flag, Flags and FlagManager classes to enable
passing the tests.
Realized that some flags had duplicate icons. This means that the
getFlagByIcon() method doesn't work because there could be more than
one. If we want to allow duplicate icons then we need to change the
manager. Also, do we need to getFlagByIcon method?
2018-02-25 19:48:01 -08:00
Tastybento
97491b1d89 Removed unused imports 2018-02-25 18:21:42 -08: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
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
ffbf938a32 WIP trying out moving flags into flag manager. 2018-02-05 14:30:35 -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
df0ecca217 Added dependency injection (DI) for flag listeners for plugin.
This is required for automated testing (can't use static getInstance). I
really need automated testing of the protection classes, so even though
this adds a parameter to the classes, it's important to have it right
now.
2018-02-03 11:54:33 -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
f1072e5984 Fixed flag optional aspect. 2018-01-28 09:47:51 -08:00
Florian CUNY
1d5b0ab8dd API Improvements on PanelItem and Flags
Their respective builders now have default values
Flags get automatically registered once built
Added some convenience methods
2018-01-28 13:31:07 +01: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
ae0dc7c538 Implemented basic Flags API
Removed Island's SettingsFlags
Fixed Island#toggleFlag()
2018-01-01 01:41:19 +01:00