Commit Graph

1238 Commits

Author SHA1 Message Date
Christian Koop
796d71fb9c
perf: Lazily pre-populates cache for CompatibleMaterial#getFurnaceResult
The previous implementation would not cache the result for Materials without a furnace result.
So it would always check all recepies before return null.

We now just populate the whole cache instead of populating each Material<->Result combination one-by-one.
We are already iterating all the recepies anyways and EpicFurnaces should be the only plugin to use this method.
So there's actually not even a memory-consumtion trade-off right now because over time it would be
like this anyway – Just with worse performance
2024-02-25 18:01:29 +01:00
Christian Koop
0592bf4abf
Fix DependencyLoader if the ClassLoader is URLClassLoader 2024-02-21 21:54:42 +01:00
ceze88
8289dae0f8 Fix DependencyLoader if ClassLoader is a AppClassLoader 2024-02-20 11:44:59 +01:00
ceze88
b2e842c805 Revert "Remove unnecessary cast"
This reverts commit bc1b613983.
2024-02-20 11:18:58 +01:00
ceze88
bc1b613983 Remove unnecessary cast 2024-02-19 11:23:46 +01:00
Christian Koop
4b738fdf78
fix: Prevent data loss on server shutdown in DataManager
We should wait for the async pool to cleanly exit and finish all running tasks.
30 seconds is a lot but we don't want any data loss – If 30 seconds are exceeded there might just be something
fundamentally broken in the (plugin) implementation (or a huge bulk action?)
2024-02-10 19:26:44 +01:00
ceze88
c59884b87c Update Adveture releated methods
- Fix incompatible types when setting item name and lore.
- Fix replaceLegacy method replacing characters that should not be replaced.
- Add methods to convert shaded Adventure library to the non shaded form if the server is above 1.18.2
2024-02-09 12:32:33 +01:00
ceze88
cc59a825be Fix dependency loading, use a ClassLoader instance which shared among all the plugins 2024-02-07 14:46:51 +01:00
Christian Koop
66a2abda32
feat: Adds support for CMI and Sainttx's Holograms plugin in new hooks 2024-02-02 23:12:08 +01:00
Christian Koop
c9a93d3a08
fix: Relocation path for reactivestreams contains . instead of ; 2024-02-02 23:09:43 +01:00
Christian Koop
fcb613e3d6
refactor: Slight refactoring of DependencyLoader class
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
2024-02-02 18:54:34 +01:00
Christian Koop
193af915e9
Don't catch and log exceptions in DependencyLoader
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
2024-02-02 18:26:26 +01:00
Christian Koop
c027ab8b4c
fix: Diag-Command throws exception because of invalid String#format
The dependencyVersion accidentally got put as an arg into Player#sendMessage instead of the String#format
2024-02-02 18:16:40 +01:00
Christian Koop
f7e46be0d9
Make DependencyLoader implementations non-static and use #getDataFolder
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
2024-02-02 18:16:40 +01:00
Christian Koop
7441a1e9e8
chore(deps): Updates org.jetbrains:annotations to v24.1.0 2024-02-02 18:16:40 +01:00
Christian Koop
92ff9cebd5
feat: Rework how the Core-Logger works and is used
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).
2024-02-02 18:10:03 +01:00
Christian Koop
e0dd19e91a
style: Reformat/Auto-format DependencyLoader class
Also gets rid of some unused imports
2024-02-02 17:02:09 +01:00
ceze88
78bcb38a48 Merge branch 'development' of https://github.com/craftaro/CraftaroCore into development 2024-02-02 16:27:57 +01:00
ceze88
1ec750cacf Move dependency folder, add dependency version info 2024-02-02 16:27:52 +01:00
ceze88
eeb2724e04 Update dependencies 2024-02-02 16:04:14 +01:00
dependabot[bot]
b1178b4aec
Bump actions/cache from 3 to 4 (#91)
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-02 08:24:32 +01:00
ceze88
3233c92679 Update AdventureUtils.java 2024-02-01 13:03:31 +01:00
Christian Koop
638b793040
Introduce a new hook system (right now only with Hologram support)
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, ...).
2024-01-30 19:43:30 +01:00
Christian Koop
d8564d1c1c
docs: Deprecates all current/soon old hook classes 2024-01-30 17:51:22 +01:00
Christian Koop
50dfbf8dad
! Renames Hook Interface to OutdatedHookInterface for the new hooks
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.
2024-01-30 17:51:22 +01:00
Christian Koop
29f2d0b643
Disables the update checker of the nbt-api library 2024-01-30 17:51:22 +01:00
ceze88
a4b7e2d28d Add minimessage and utility class for it 2024-01-30 17:14:58 +01:00
ceze88
b610b98547 Fix java 8 support for dependency loader 2024-01-29 16:31:03 +01:00
ceze88
82c7c49e41 Remove removed method 2024-01-24 19:05:06 +01:00
ceze88
52b93e873c Fix LinkageError in rare cases 2024-01-23 19:17:29 +01:00
Christian Koop
5850e1a0ec
Downgrade HikariCP to v4.0.3 to properly support Java 8 2024-01-15 21:08:45 +01:00
Christian Koop
0e8f52b1be
Implement workaround for migrated SQLite databases applying migrations
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)
2024-01-15 21:07:54 +01:00
Christian Koop
adcf8619ec
Slight refactoring of dependency/Dependency.java class
* Re-uses constructors to reduce duplicate code
* Makes sure the constructor with relocate-argument actually sets `this.relocate`
* Use `this.` for accessing class variables
2024-01-13 18:43:01 +01:00
Christian Koop
21bf900448
Make SongodaPlugin#getDependencies non-abstract and return empty Set
Most plugins don't have additional dependencies so this should make migrating existing plugins a bit easier.
2024-01-13 18:40:22 +01:00
ceze88
d4de86f6a5 Fix asm version again 2024-01-13 18:25:45 +01:00
Christian Koop
2f1f814d43
Do not directly modify dependency Set provided by the plugin
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.
2024-01-13 17:36:42 +01:00
ceze88
3f62b36b26 Fix asm dependency 2024-01-12 17:01:40 +01:00
ceze88
cd3acd87f5 Shade asm into the core, not all java versions contains it. Fix shading for reactivestreams. 2024-01-12 16:27:02 +01:00
ceze88
dcf9fa4a29 Fix shading for LibraryLoader 2024-01-11 11:44:33 +01:00
ceze88
0a76ad4943 Use jitpack for libraryloader 2024-01-07 14:59:13 +01:00
ceze88
bbb980655d Add LibraryLoader repository 2024-01-07 14:26:14 +01:00
ceze88
16e419b537 Fix pom.xml 2024-01-04 12:44:54 +01:00
ceze88
ad7b703282 Implementing runtime lib loading 2024-01-01 15:04:23 +01:00
dependabot[bot]
02ad1645bf
Bump actions/upload-artifact from 3 to 4 (#90)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 14:04:04 +01:00
dependabot[bot]
f893864fae
Bump github/codeql-action from 2 to 3 (#89)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 14:03:49 +01:00
Christian Koop
56d46f4de0
chore: Updates XSeries to v9.8.0 for Spigot 1.20.4 compatibility 2023-12-12 14:27:33 +01:00
Christian Koop
12c22c29fc
Compile v1_20_R3 nms module with Spigot 1.20.4 2023-12-10 17:45:57 +01:00
Christian Koop
a17252b805
chore: Updates item-nbt-api to v2.12.2 for Spigot 1.20.4 support 2023-12-10 17:08:52 +01:00
Christian Koop
3da2a106ff
feat: Implements v1_20_R3 nms module for Spigot 1.20.3 compatibility 2023-12-06 16:54:46 +01:00
ceze88
d69510cae7 Fix casting errors 2023-11-18 16:47:06 +01:00