I am too scared on touching too much logic and breaking something as I didn't work on this class
or with that library much yet.
So I'm just refactoring it a bit not changing a lot of logic
This way whatever uses the DependencyLoader actually knows if something fails and can react to it
instead of just the JVM erroring because something is unexpectedly missing in the class path
The data directory location for plugins might be configured to another path, so instead we the
plugin's *DataFolder* as a basis for our Core's data directory
Implement own logger to prefix message with plugin name (if available) and CraftaroCore.
We prefix with both because the Core is shaded and this way it is clearly logged "which" Core is logging what.
This is also the reason why the Logger's name is now `CoreLogger.class.getCanonicalName()`
instead of CraftaroCore to uniquely identify each logger. (similar to what Bukkit's PluginLogger does).
My plans with this hook system are to make it easier to understand and maintain – Hopefully it is also more flexible
Hooks now have a dedicated activation-life-cycle – I think this allows it to contain all the logic to do what
it needs to do but also provide some helper methods like `#canBeActivated`.
The activation should be used by the hooks to reduce the memory and performancec impact when not used.
The de-activation also allows hooks to clean up themselves and not rely on the plugins used by the hook or
the plugin using the hook to clean up.
For example:
You can see that the `DecentHologramsHook` has few class variables and they are kept as
small as possible and reasonable when not activated.
In `#deactivate` I call `#removeAll` to remove all holograms that still exist and I call `ArrayList#trimToSize` to reduce it's size again.
This has a similar effect to setting the class varaible null or to a new List but with this I can make that field *final*.
The exact implementation details and capabilities vary on the third-party plugins being supported by hooks,
so it needs to be flexible and easy to understand, so we can easily add support for more plugins and especially
new plugin categories like Maps (dynmap, BlueMap, PlexMap, ...).
The interface is used/imported in two other Craftaro plugins (FabledSkyBlock and UltimateStacker).
I've worked on a new hook system which is easier to understand and maintain and hopefully also
allows for some more flexibility.
To introduce the new hooks without breaking changes (or as little as possible), this interface had to move.
The migration version -1 is already written into the new database before the old one has been converted.
This causes the migration to be run on the converted database because in addition to the migrated
version (e.g. 8) the -1 is already written to the table.
And now you just need to be kind of lucky to not retrieve that wrong version.
Just a hacky workaround (I know)
* Re-uses constructors to reduce duplicate code
* Makes sure the constructor with relocate-argument actually sets `this.relocate`
* Use `this.` for accessing class variables
Modifying the Set directory makes assumptions about the created Set.
About it's type/implementation (maybe it is immutable/read-only?) and about
it's usage/way-of-use that does not break the plugin by adding stuff a Set that might be used differently too etc.
Catching the exception here circumvents the error handing in `SongodaPlugin#onEnable()`.
+ catching the errors without throwing a new one leads to plugins continuing their initialization
before being disabled.
Poluting the server log with additional exceptions and everything because something is broken but surpressed
The Deprecations need to be taken care of at a later point in time.
Most methods do have a strong use-case in relation to commands and should be placed
in a more appropriate class.
This a modified version of the original commit b2180b0c73.
I changed/removed:
* project version bump (a lot of unrealated file changes, wrong version in regards to breaking changes)
* Hacky changes to the NMS class
* Reverted changes to SSpawner (We want to keep the class variables final
and there doesn't seem to be a big advantage in overwriting basically the whole classe's content
when you could just create a new instance instead, as intended)
* Commit name (old name was `(changes will be in next commit)`)
It is used for mutation testing but realistically we don't even write that many tests.
Just adds complexity and because it is not often used, causes trouble when it hasn't been touched for months/years
The goal here is to keep the plugin enabled and initialize the Core.
This is needed for the `/craftaro license` command to work etc.
Sadly this also means other plugins checking for the plugin being the
(including the `/plugins` command), report the plugin as enabled
and seemingly ready (Although the plugin's API is not).
I'm creating this release to push the GitHub Actions and Dependabot changes to the main branch.
Dependabot should find at least 2 outdated actions dependencies and create a PR for them.
Please check #47 for a list of *most* changes.
Revert "Ensures usage of UTF-8 in SongodaYamlConfig"
This reverts commit 339a4d6f6c.
Revert "Improve test coverage + stability of configuration.yaml/songoda classes"
This reverts commit ef6c37b80c.
Revert "Adds ConfigEntry#withDefaultValue for easier chaining"
This reverts commit 88e28689f7.
Revert "Code cleanup (rename e->ex in catch; better type for #withUpgradeStep)"
This reverts commit 7eff3c86ec.
Revert "Rename constant into upper case to match code conventions"
This reverts commit 4d194ed92b.
Revert "Fix typo in JavaDoc"
This reverts commit 0b2a253014.
Revert "Makes SongodaYamlConfig#cannotCreateBackupCopyExceptionPrefix static"
This reverts commit 8e91cc18eb.
Revert "Make unit tests in LocaleFileManagerTest deterministic"
This reverts commit 67a69e34e8.
Revert "Add unit test for SongodaYamlConfig persisting comments on key-upgrades"
This reverts commit d710b2d2d5.
Revert "Improve temporary file deletion in YamlConfig and FileManager tests"
This reverts commit 02330b5ca7.
Revert "Adds hyphen before timestamp in file name, when creating backup YamlCfg"
This reverts commit f8b3942de2.
Revert "Fix YamlConfiguration not dumping comments"
This reverts commit e7da328dc6.
Revert "Provisional first implementation of the new localization system"
This reverts commit b168ad0738.
Revert "Fix error handling of SongodaYamlConfig#load(Reader)"
This reverts commit 163e4d9eaf.
Partially reverts "Adds some deprecation notices to configuration.editor classes"
This partially reverts commit eea951ecc6.
Revert "Redo ConfigEntry abstraction"
This reverts commit 20b44327e0.
Revert "Migrate CustomizableGui from old Config to SongodaYamlConfig"
This reverts commit d5ddde3e08.
Revert "Adds SongodaYamlConfig#getAsEntry(String) for convenience"
This reverts commit 20b7a353b8.
Revert "Add contract to `ConfigEntry#getString(String)` for non-null-argument"
This reverts commit 78b6039d39.
Revert "Adds getter to ConfigEntry for List<String>"
This reverts commit 3a09c19dbb.
Revert "Remove usage of Locale classes"
This reverts commit da3c89450e.
Revert "Mark overwritten and empty config methods in SongodaPlugin as deprecated"
This reverts commit 73685b62dd.
Revert "Adjust log levels in SongodaYamlConfig"
This reverts commit 7ef00bb8f9.
Revert "Fix SongodaYamlConfig not creating parent directory when saving"
This reverts commit b0f006aed0.
Revert "Fix SongodaYamlConfigTest leaving created backup files in tmp dir"
This reverts commit c9a48387de.
Revert "Remove Config related methods in SongodaPlugin"
This reverts commit fce5c5c6a1.
Revert "Introduce new SongodaYamlConfig and ConfigEntry classes"
This reverts commit eb10b3f70a.
Revert "Fix YamlConfiguration dumping null values and empty tree nodes"
This reverts commit 02ab8d4bb2.
Revert "Fix `YamlConfiruration#getKeys("")` not returning root node keys"
This reverts commit 885cc9a87e.
Revert "Fix exception on loading empty file in YamlConfiguration"
This reverts commit 2683bc12c0.
Revert "Make YamlConfiguration insertion-sorted"
This reverts commit 2262652577.
Revert "Rename `IConfiguration#getOrDefault` to `#getOr`"
This reverts commit f6e207cdda.
Revert "Adds Enum support to YamlConfiguration class (#41)"
This reverts commit 41bd5c633a.
Revert "Removes the default implementations for #save(File) and #load(File)"
This reverts commit 8f15df3601.
Revert "Replace Songoda's YAML Configuration wrapper with an own implementation"
This reverts commit 6d6fa7210a.
The implementation broke in 1.19.4 mid-version.
Fixes `java.lang.NoSuchMethodException: org.bukkit.craftbukkit.v1_19_R3.CraftChunk.getHandle()`
Related commit: a3e73be1aa
Not having the actuall command change allows of other plugins *finding* that command
in that way means not introducing a breaking change by accident ^^
+ It's very hacky the way I did it but tbh... Core v3 is somewhat around the corner anyways
This should make reading the version information displayed easier.
No more confusing the plugin version vs. the core version.
Additionally fixed `Mb` to `MiB`.