Commit Graph

11 Commits

Author SHA1 Message Date
tastybento
1e920825ef Added context to raw stack trace dump after exception. 2018-02-06 15:55:31 -08:00
tastybento
812594783e Made Adapter its own annotation. 2018-02-05 11:35:50 -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
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
Tastybento
2d447afa88 Added annotation handling to the flatfile database handler.
Currently it handles the @ConfigEntry path and specificTo fields.

Experimental: There is a class called Setting2.java. It has an
annotation that defines its filename as config.yml. Currently, it is
using the database folder as its location, but it could be the plugin's
datafolder in the future. By placing the config.yml file in the database
folder, it will be read. See the code in BSkyBlock onEnable() for how
that is done.

The main differences between Settings2.java and Settings.java are that
all fields are NOT static and therefore it is an object and uses getters
and setters. This is because it is a JavaBean. In other code, settings
should be queried using this config object.
2018-01-05 19:58:08 -08:00
Tastybento
478968dac7 Extended the config api annotations.
Added the concept of an adapter class that would convert the YAML input
to the setting type and value.
I included an example adapter class for Enum.

I fixed a number of the settings to match the config/yml or the other
way around.

After compiling and running, do /bsb reload to see the result.

This is a WIP and obviously not finished.
2018-01-04 19:58:04 -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