Commit Graph

4024 Commits

Author SHA1 Message Date
tastybento
d2098c3dbe Check if Optional click handler exists before getting it. 2018-02-06 13:59:23 -08:00
tastybento
2c1d52761f Cast operand to double. 2018-02-06 13:54:23 -08:00
tastybento
06e61d858c Fixed a lot of unclosed prepared statements, connections and resultset 2018-02-06 13:52:25 -08:00
tastybento
84d36a1a24 Simplified some logic. 2018-02-06 13:35:17 -08:00
tastybento
f7c4e5a988 Added null checks. 2018-02-06 13:33:08 -08:00
tastybento
1ddf706c68 Bug fixes to avoid NPE's and Optional gets without isPresent 2018-02-06 13:21:08 -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
812594783e Made Adapter its own annotation. 2018-02-05 11:35:50 -08:00
Tastybento
26956d8386 Fixed missing locale text for invites.
Fixed config settings for teams.
2018-02-04 21:48:34 -08:00
Tastybento
fa1ccd0c99 Fixed bugs with MySQL saving and loading.
Added the adapter annotation to MySQL and fixed issues with empty
hashmaps causing null errors.

Added a flag serializer adapter for the protection flags so that flags
are saved and loaded correctly.

Renamed the Adapter notation class to be clearer about what it is doing.
2018-02-04 12:53:17 -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
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
1427f16bec Merge branch 'ranks' of https://github.com/tastybento/bskyblock.git into ranks 2018-02-02 08:22:00 -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
Florian CUNY
3d7b1bc647 Renamed PVP and Item Drop/pickup related flags
Also assigned the ItemDropPickUpListener() to the related events
2018-02-02 15:29:24 +01:00
Florian CUNY
5293d647c0 Removed duplicate listeners in Flags 2018-02-02 15:22:37 +01:00
Florian CUNY
f930504dab And remove another IDEA junk file 2018-02-02 07:50:17 +01:00
Florian CUNY
b19cfb5152 Removed IDEA junk files and added a .gitignore 2018-02-02 07:46:53 +01:00
Tastybento
72c99656cc Added the protection listeners. Took all day!
Generally these are very easy to understand. They use an abstract class
for common code.

I have not tested these in-game. I would like to see if I can create
some test classes but it may not be possible because of the static
BSkyBlock calls.
2018-02-01 20:30:57 -08:00
tastybento
4fe94bee3b Finished up the place and break block listeners.
There's a lot more that needs to be checked in these listeners! I moved
some common methods into the abstract class because they will be used
again and again by other listeners.

Added an anvil listener.

Added the flags. They were from ASkyBlock so may have name changes.
2018-01-31 15:46:38 -08:00
tastybento
5b087c83e7 Fixed comment. 2018-01-30 17:00:09 -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
085db6cb21 Added in config and locale settings for ranks. 2018-01-28 20:52:06 -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
417f767705 Added a Ranks Manager 2018-01-28 12:47:17 -08:00
Tastybento
eec4e99172 Added ranks to island members. More to do! 2018-01-28 11:48:54 -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
2b434bf93a Added ability for panel description to be just a string. 2018-01-27 15:58:15 -08:00
Tastybento
970711ca63 Merge branch 'develop' of https://github.com/tastybento/bskyblock.git into develop 2018-01-27 15:48:53 -08:00
Tastybento
67e05955f8 Made skyblock sky again. The sea water level was being set. 2018-01-27 15:48:44 -08:00
Florian CUNY
72c862c0d5 Starting to implement some Flags to test the API 2018-01-27 17:04:08 +01:00
Florian CUNY
6c08763cbb Made PanelItemBuilder methods' name suit the Builder style 2018-01-27 17:03:30 +01:00
Florian CUNY
9cc9518bc3 Fixed new-island.signs.line* locale entries 2018-01-27 16:47:30 +01:00
Florian CUNY
8b636a8ee3 Minor code quality fixes 2018-01-27 16:39:02 +01:00
Tastybento
475f9b1416 Made changes to fix events and support the FAWE addon. 2018-01-25 22:19:33 -08:00
Tastybento
9ce1dbf592 Added team kick and leave commands. Need full testing. 2018-01-24 20:49:08 -08:00
Tastybento
f6ca7f7866 Fixed subcommand aliases. Added admin tp command.
While writing the admin tp command, I realized that subcommand aliases
were not working. Also, it was not possible to tell what alias had been
used for a command. I added that capability. i.e., if the alias is used,
then the label of that command is set to the alias.
2018-01-21 12:58:35 -08:00
Tastybento
c3c0a87dbb Added block search when making a new island. Fixed sign text.
When finding a spot for a new island, the algorithm will ensure the
island location is on the grid and check around for any blocks that may
be there already. If they exist, then they will be added as unowned
islands to the database.
The sign text was not using the correct locale tags.
2018-01-20 10:30:26 -08:00
tastybento
1b1e30c125
Merge pull request #125 from tastybento/config-api-v2
Submitting a modular and automatic Config API
2018-01-08 11:27:01 -08:00
Tastybento
09b9d4dd49 Now uses the official config.yml in the BSkyBlock data folder.
Saves a backup of the config after validation in the database so it can
be checked.

To Be Done: Validation of the config when it is loaded against the
database version.
2018-01-07 14:43:37 -08:00
Tastybento
16bcb90127 Added saveSettings and loadSettings methods.
These methods are used specifically for loading and saving settings
classes (those use the ISettings interface). The saving saves a copy of
any settings class in the database for future reference. The loading
loads a copy from the database if it exists and checks if any fields are
different from the config file. If they are different and some action
needs to be taken, the action is taken. This is still be to be coded.

In other news, the saving of arrays is unsupported and currently should
be avoided. Use Lists or Sets instead.
2018-01-07 11:56:43 -08:00
Tastybento
2765e5f3ab Fixed code according to comments on last commit.
Reworked locales so they use a nice and pretty folder structure.

Added the ability to define adapters to serialize certain data
structures. Added the PotionType list adapter.

Saving and loading of configs basically works. Known issues:

1. The config.yml is saved and loaded to/from the database folder
2. More error handling is required for the config loading. e.g., a list
value with only one value in it is not read as a list. This could get
tricky.
3. Comments are not saved (yet)
2018-01-06 19:40:25 -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