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.
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.
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.
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.
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)
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.
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.
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
it was due to the null value possibly returned by the LocalesManager#get(user, reference) method when nothing has been found, leading the variables replacement to cause a NPE.
User#getTranslation(reference, ...variables) now does the check and return the reference if the translation found equals null BEFORE trying to replace variables.
User#getTranslationOrNothing(reference, ...variables) works the same as before, it just checks if the returned translation is the same than the reference (therefore it returns the blank String), otherwise it sends the translation.
Renamed island multihome to start with "Custom" to make it clearer. This
class is as much an example as anything of how to override the default
help.
Renamed my author tag to be tastybento. :-)
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.
This is a first working version and can probably be improved.
Firstly, the plugin will save any BSkyBlock language files to the locale
folder from the BSkyBlock jar if and only if the locale folder does not
exist. It will then do the same for any addons as they are loaded. Addon
language files are prefixed with their addon name to keep them separate
and recongnizable.
Then the plugin loads the language files and merges common languages
together into a YAMLConfiguration that is held in memory. The combined
config is never saved out to the file system.
If a request is made for a particular reference to a language that does
not exist or if the reference does not exist, then the default language
is tried.
The original code did not allow addons to talk to each other in any way.
After trying loads of things with class path I studied the bukkit code
and saw that they override the findClass method in URLClassLoader. This
enables addons to find classes in other addons. All that was then needed
was a map in the AddonsManager of classes that this manager knows about
and a getter and setter method for them. After all that (3 hours) it
works.