Add H2 database support, use indexes to optimize queries, add maria-specific schema, bump adventure-fabric (#465)

* Add support for H2, bundle Maria driver, bump fabric adventure

* Bundle and download H2 drivers

* Fixup H2 schema, add indexes to DBs, add maria-specific schema

* docs: Add database type documentation

* Check plugin isn't disabled before task schedule, close #463

* Bump Annotaml to 2.0.4

* docs: Mention Maria in README and Setup
This commit is contained in:
William authored and GitHub committed 2023-07-18 15:03:31 +01:00
1 parent 8d2424a7ef
commit beed438c16
28 files changed
+1443 -50

No files matched your search

@@ -43,6 +43,7 @@ import net.william278.huskhomes.config.Server;
import net.william278.huskhomes.config.Settings;
import net.william278.huskhomes.config.Spawn;
import net.william278.huskhomes.database.Database;
import net.william278.huskhomes.database.H2Database;
import net.william278.huskhomes.database.MySqlDatabase;
import net.william278.huskhomes.database.SqLiteDatabase;
import net.william278.huskhomes.event.FabricEventDispatcher;
@@ -139,17 +140,12 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes
// Create adventure audience
this.audiences = FabricServerAudiences.of(minecraftServer);
// Temporarily log about sounds being disabled - todo: Remove when adventure-platform-fabric is updated
if (getSettings().doPlaySoundEffects()) {
log(Level.WARNING, "Sound effects are currently disabled for HuskHomes v" + getVersion()
+ " on Fabric servers running Minecraft " + getMinecraftServer().getVersion());
}
// Initialize the database
initialize(getSettings().getDatabaseType().getDisplayName() + " database connection", (plugin) -> {
this.database = switch (getSettings().getDatabaseType()) {
case MYSQL, MARIADB -> new MySqlDatabase(this);
case SQLITE -> new SqLiteDatabase(this);
case H2 -> new H2Database(this);
};
database.initialize();
@@ -124,11 +124,6 @@ public class FabricUser extends OnlineUser {
return player;
}
@Override
public void playSound(@NotNull String soundEffect) throws IllegalArgumentException {
// Do nothing - todo: Fix sounds when adventure-platform-fabric is updated.
}
@Override
public void teleportLocally(@NotNull Location location, boolean async) throws TeleportationException {
final MinecraftServer server = player.getServer();