Commit Graph

76 Commits

Author SHA1 Message Date
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
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
f7b6898559 Added protection methods. 2018-01-28 20:44:57 -08:00
Tastybento
417f767705 Added a Ranks Manager 2018-01-28 12:47:17 -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
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
30fb087777 Implemented locales that include addons.
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.
2018-01-01 18:32:59 -08:00
Florian CUNY
ae0dc7c538 Implemented basic Flags API
Removed Island's SettingsFlags
Fixed Island#toggleFlag()
2018-01-01 01:41:19 +01:00
Tastybento
b03d4552fd Added addons manager to BSKyBlock.class 2017-12-31 15:31:08 -08:00
Tastybento
4289a24c56 Improved the panel API.
I'm working on addons and realized it would be a better approach to be
able to register the listener for a panel explicitly for each panel.
This is optional. Also, added the ability to open the panel immediately
for a player.
2017-12-29 09:11:14 -08: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
Florian CUNY
86ad00acab AddonsAPI - Polishing the API
Temporarily remove api/addons folder to rename files
2017-12-28 14:49:27 +01:00
Tastybento
687a71876d Completed the addons additions.
Everything seems to work okay.
2017-12-27 19:16:13 -08:00
Tastybento
a198c1a44a Renamed some classes to BSB... 2017-12-24 09:51:41 -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
Florian CUNY
a3db6e9b5d AddonsAPI - Made overriden BSModule methods final, so they cannot be over-overriden 2017-12-22 13:39:00 +01:00
Florian CUNY
1c3b3a2c56 AddonsAPI - Added #getFolder() in BSModule 2017-12-22 13:37:28 +01:00
Florian CUNY
6178b768bb L10nAPI - Fixed compilation errors by...
...
- Removing NetherPortals listener
- Adding a #getTranslation(reference, ...variables) in User
2017-12-22 13:31:27 +01:00
Florian CUNY
29dfc313fc L10nAPI - Reworking API - WIP
Removed the old localization system
Started implementation of the new one

For build reasons, removed protection listeners - they were requiring too much work to update them, and they need to be reworked due to the boilerplate code.
2017-12-22 13:22:33 +01:00
Florian CUNY
4fcd6174ad Removed Vault dependency 2017-12-16 18:29:12 +01:00
Florian CUNY
fe07c8ef45 No longer using Vault for perms, only economy 2017-12-16 16:07:00 +01:00
Florian CUNY
c9e22d5849 Refactoring configuration
Removed current config "API"
Removed a few unused or duplicate settings
Removed OfflineHistoryMessages
Removed visitor blocked commands (should be an addon)
2017-12-16 15:29:17 +01:00
Florian CUNY
40b56843e7 AddonsAPI - Added #isAddon() in BSModule 2017-12-12 14:14:38 +01:00
Florian CUNY
b8a5b0151f Made use of BSModule and CommandsManager in BSAddon and BSkyBlock main class 2017-12-11 21:55:42 +01:00
Florian CUNY
756b7eaff2 Small adjustments in BSkyBlock main class 2017-12-11 20:15:48 +01:00
Florian CUNY
46910dd851 Introducing the new Commands API - WIP 2017-12-10 11:46:59 +01:00
Florian CUNY
2dff568cb9 Bring back NMS 2017-12-10 09:19:20 +01:00
Tastybento
323720598a Removed schematics. 2017-12-09 10:44:09 -08:00
Florian CUNY
1e4dd979ae Revert "New Locale system - it breaks everything"
This reverts commit 9a3c900ac5.
2017-12-03 17:34:31 +01:00
Florian CUNY
9a3c900ac5 New Locale system - it breaks everything
The locales are not being loaded
Needs a few more methods to have a convenient way of using it
Needs to be fixed
2017-12-03 17:19:22 +01:00
Florian CUNY
dd40faa3b6 Implemented Panels API - still need some work, but it is functionnal 2017-11-29 16:54:24 +01:00
Tastybento
792d1f8ec3 Fixed a lot of bugs
Changed events to be builder types.

Refactored island cache.

Fixed island deletion.

Made island distance chunk (16 blocks) based.
2017-11-20 16:05:52 -08:00
tastybento
0dfc32a5b9 Improved sub-command registration for add-ins. 2017-10-22 19:08:34 -07:00
tastybento
8ee876eac4 Reworked some classes to enable easier API usage. 2017-10-21 19:53:07 -07:00
tastybento
7804c4a867 Enabled subcommand addition to BSkyBlock /island command.
This is a bit of a hack. The AbstractCommand class had to be pulled
apart to enable the ArgumentHandler to be imported by another plugin
without the other plugin having to extend AbstractCommand, which is
something it does not want to do because it is not defining a new
command, but just adding arguments. 

There's too much passing of arguments in this implementation, but it
works. I'll see if I can simplify it.
2017-10-09 22:52:57 -07:00
Poslovitch
4943c89c42 Code cleanup. Made use of some Java8 features. Renamed PlayerManager#isAKnownPlayer() to PlayerManager#isKnown() 2017-08-18 16:05:35 +02:00
tastybento
55101f7ff2 Lots of changes to get teams to work.
I had a lot of problems finding a bug so I put a lot of debug in.
2017-08-12 18:51:48 -07:00
Poslovitch
bf90cb7f31 Now it's the correct refactoring 2017-07-30 19:59:56 +02:00
Poslovitch
158c7b3465 Started a refactoring for the commands 2017-07-30 19:57:49 +02:00
tastybento
87ab500706 Removed unused imports.
Added configs.
2017-07-07 17:12:14 -07:00
tastybento
cce5828ac0 Added protection for islands. 2017-07-06 22:00:21 -07:00
tastybento
f31dcb5ce1 Hooked in grid database to track where islands are.
Added Nether events and portal function.
Added default /island command operation.
2017-07-06 16:51:40 -07:00
tastybento
3a6a1eae6d Added more database functions.
Added ability to check if a uniqueId exists without creating it - used
to check if a player is known or not.
Added join/quit listener.
2017-07-06 10:21:38 -07:00
tastybento
3d74c4a427 Added object deletion to the database.
This is required when islands are reset or players deleted, for example.
The deletion is done based on the uniqueId of the object. Tested and
working for flat file and MySQL.

To make an island do /is create. To reset do /is reset.
2017-06-17 18:46:16 -07:00