Update paper module to 1.19, fix db issues

This commit is contained in:
Draycia committed 2022-06-15 20:43:26 -07:00
1 parent c4ebaf9877
commit c20128c086
5 files changed
+27 -15

No files matched your search

@@ -29,6 +29,7 @@ import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import javax.sql.DataSource;
import net.draycia.carbon.api.CarbonChat;
import net.draycia.carbon.api.CarbonChatProvider;
import net.draycia.carbon.api.users.ComponentPlayerResult;
import net.draycia.carbon.api.users.UserManager;
@@ -85,7 +86,7 @@ public final class MySQLUserManager implements UserManager<CarbonPlayerCommon>,
final DataSource dataSource = new HikariDataSource(hikariConfig);
final Flyway flyway = Flyway.configure(Thread.currentThread().getContextClassLoader())
final Flyway flyway = Flyway.configure(CarbonChat.class.getClassLoader())
.baselineVersion("0")
.baselineOnMigrate(true)
.locations("queries/migrations/mysql")
@@ -123,13 +124,24 @@ public final class MySQLUserManager implements UserManager<CarbonPlayerCommon>,
.mapTo(CarbonPlayerCommon.class)
.first();
if (carbonPlayerCommon != null) {
handle.createQuery(this.locator.query("select-ignores"))
.bind("id", uuid)
.mapTo(UUID.class)
.forEach(ignoredPlayer -> carbonPlayerCommon.ignoring(ignoredPlayer, true));
if (carbonPlayerCommon == null) {
// Player doesn't exist in the DB, create them!
final String name = Objects.requireNonNull(
CarbonChatProvider.carbonChat().server().resolveName(uuid).join());
final CarbonPlayerCommon player = new CarbonPlayerCommon(name, uuid);
this.bindPlayerArguments(handle.createUpdate(this.locator.query("insert-player")), player)
.execute();
return new ComponentPlayerResult<>(player, text(""));
}
handle.createQuery(this.locator.query("select-ignores"))
.bind("id", uuid)
.mapTo(UUID.class)
.forEach(ignoredPlayer -> carbonPlayerCommon.ignoring(ignoredPlayer, true));
return new ComponentPlayerResult<>(carbonPlayerCommon, empty());
} catch (final IllegalStateException exception) {
// Player doesn't exist in the DB, create them!
@@ -141,7 +153,7 @@ public final class MySQLUserManager implements UserManager<CarbonPlayerCommon>,
this.bindPlayerArguments(handle.createUpdate(this.locator.query("insert-player")), player)
.execute();
return new ComponentPlayerResult<CarbonPlayerCommon>(null, text(""));
return new ComponentPlayerResult<>(player, text(""));
}
});
}).completeOnTimeout(new ComponentPlayerResult<>(null, text("Timed out loading data of UUID [" + uuid + " ]")), 30, TimeUnit.SECONDS);
@@ -137,7 +137,7 @@ public final class PostgreSQLUserManager implements UserManager<CarbonPlayerComm
this.bindPlayerArguments(handle.createUpdate(this.locator.query("insert-player")), player)
.execute();
return new ComponentPlayerResult<CarbonPlayerCommon>(null, text(""));
return new ComponentPlayerResult<>(player, text(""));
}
});
}).completeOnTimeout(new ComponentPlayerResult<>(null, text("Timed out loading data of UUID [" + uuid + " ]")), 30, TimeUnit.SECONDS);
+3 -3
View File
@@ -13,8 +13,8 @@ versions:
indra: 2.1.1
licenser: 0.6.1
shadow: 7.1.2
adventure: 4.10.1
cloud: 1.7.0+1.18.2-SNAPSHOT
adventure: 4.11.0
cloud: 1.7.0-SNAPSHOT
configurate: 4.1.2
typesafeConfig: 1.4.1
checkerQual: 3.22.0
@@ -22,7 +22,7 @@ versions:
gson: 2.8.0
guava: 30.1-jre
bstats: 3.0.0
paperApi: 1.18.2-R0.1-SNAPSHOT
paperApi: 1.19-R0.1-SNAPSHOT
paperLib: 1.0.8-SNAPSHOT
kyoriEventApi: 5.0.0-SNAPSHOT
kyoriRegistry: 1.0.0-SNAPSHOT
+2 -2
View File
@@ -33,7 +33,7 @@ tasks {
relocateDependency("io.leangen.geantyref")
}
runServer {
minecraftVersion("1.18.2")
minecraftVersion("1.19")
}
}
@@ -42,7 +42,7 @@ bukkit {
name = rootProject.name
version = project.version as String
main = "net.draycia.carbon.paper.CarbonChatPaper"
apiVersion = "1.18"
apiVersion = "1.19"
author = "Draycia"
depend = listOf("LuckPerms")
softDepend = listOf("PlaceholderAPI", "EssentialsDiscord", "DiscordSRV")
+2 -2
View File
@@ -74,8 +74,8 @@ sequenceOf(
"api",
"common",
"paper",
"sponge",
"fabric",
//"sponge",
//"fabric",
"velocity"
).forEach {
include("carbonchat-$it")