mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 14:38:49 +00:00
Update paper module to 1.19, fix db issues
This commit is contained in:
1 parent
c4ebaf9877
commit
c20128c086
5 files changed
+27
-15
No files matched your search
+19
-7
@@ -29,6 +29,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
import net.draycia.carbon.api.CarbonChat;
|
||||||
import net.draycia.carbon.api.CarbonChatProvider;
|
import net.draycia.carbon.api.CarbonChatProvider;
|
||||||
import net.draycia.carbon.api.users.ComponentPlayerResult;
|
import net.draycia.carbon.api.users.ComponentPlayerResult;
|
||||||
import net.draycia.carbon.api.users.UserManager;
|
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 DataSource dataSource = new HikariDataSource(hikariConfig);
|
||||||
|
|
||||||
final Flyway flyway = Flyway.configure(Thread.currentThread().getContextClassLoader())
|
final Flyway flyway = Flyway.configure(CarbonChat.class.getClassLoader())
|
||||||
.baselineVersion("0")
|
.baselineVersion("0")
|
||||||
.baselineOnMigrate(true)
|
.baselineOnMigrate(true)
|
||||||
.locations("queries/migrations/mysql")
|
.locations("queries/migrations/mysql")
|
||||||
@@ -123,13 +124,24 @@ public final class MySQLUserManager implements UserManager<CarbonPlayerCommon>,
|
|||||||
.mapTo(CarbonPlayerCommon.class)
|
.mapTo(CarbonPlayerCommon.class)
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
if (carbonPlayerCommon != null) {
|
if (carbonPlayerCommon == null) {
|
||||||
handle.createQuery(this.locator.query("select-ignores"))
|
// Player doesn't exist in the DB, create them!
|
||||||
.bind("id", uuid)
|
final String name = Objects.requireNonNull(
|
||||||
.mapTo(UUID.class)
|
CarbonChatProvider.carbonChat().server().resolveName(uuid).join());
|
||||||
.forEach(ignoredPlayer -> carbonPlayerCommon.ignoring(ignoredPlayer, true));
|
|
||||||
|
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());
|
return new ComponentPlayerResult<>(carbonPlayerCommon, empty());
|
||||||
} catch (final IllegalStateException exception) {
|
} catch (final IllegalStateException exception) {
|
||||||
// Player doesn't exist in the DB, create them!
|
// 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)
|
this.bindPlayerArguments(handle.createUpdate(this.locator.query("insert-player")), player)
|
||||||
.execute();
|
.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);
|
}).completeOnTimeout(new ComponentPlayerResult<>(null, text("Timed out loading data of UUID [" + uuid + " ]")), 30, TimeUnit.SECONDS);
|
||||||
|
|||||||
+1
-1
@@ -137,7 +137,7 @@ public final class PostgreSQLUserManager implements UserManager<CarbonPlayerComm
|
|||||||
this.bindPlayerArguments(handle.createUpdate(this.locator.query("insert-player")), player)
|
this.bindPlayerArguments(handle.createUpdate(this.locator.query("insert-player")), player)
|
||||||
.execute();
|
.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);
|
}).completeOnTimeout(new ComponentPlayerResult<>(null, text("Timed out loading data of UUID [" + uuid + " ]")), 30, TimeUnit.SECONDS);
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ versions:
|
|||||||
indra: 2.1.1
|
indra: 2.1.1
|
||||||
licenser: 0.6.1
|
licenser: 0.6.1
|
||||||
shadow: 7.1.2
|
shadow: 7.1.2
|
||||||
adventure: 4.10.1
|
adventure: 4.11.0
|
||||||
cloud: 1.7.0+1.18.2-SNAPSHOT
|
cloud: 1.7.0-SNAPSHOT
|
||||||
configurate: 4.1.2
|
configurate: 4.1.2
|
||||||
typesafeConfig: 1.4.1
|
typesafeConfig: 1.4.1
|
||||||
checkerQual: 3.22.0
|
checkerQual: 3.22.0
|
||||||
@@ -22,7 +22,7 @@ versions:
|
|||||||
gson: 2.8.0
|
gson: 2.8.0
|
||||||
guava: 30.1-jre
|
guava: 30.1-jre
|
||||||
bstats: 3.0.0
|
bstats: 3.0.0
|
||||||
paperApi: 1.18.2-R0.1-SNAPSHOT
|
paperApi: 1.19-R0.1-SNAPSHOT
|
||||||
paperLib: 1.0.8-SNAPSHOT
|
paperLib: 1.0.8-SNAPSHOT
|
||||||
kyoriEventApi: 5.0.0-SNAPSHOT
|
kyoriEventApi: 5.0.0-SNAPSHOT
|
||||||
kyoriRegistry: 1.0.0-SNAPSHOT
|
kyoriRegistry: 1.0.0-SNAPSHOT
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ tasks {
|
|||||||
relocateDependency("io.leangen.geantyref")
|
relocateDependency("io.leangen.geantyref")
|
||||||
}
|
}
|
||||||
runServer {
|
runServer {
|
||||||
minecraftVersion("1.18.2")
|
minecraftVersion("1.19")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ bukkit {
|
|||||||
name = rootProject.name
|
name = rootProject.name
|
||||||
version = project.version as String
|
version = project.version as String
|
||||||
main = "net.draycia.carbon.paper.CarbonChatPaper"
|
main = "net.draycia.carbon.paper.CarbonChatPaper"
|
||||||
apiVersion = "1.18"
|
apiVersion = "1.19"
|
||||||
author = "Draycia"
|
author = "Draycia"
|
||||||
depend = listOf("LuckPerms")
|
depend = listOf("LuckPerms")
|
||||||
softDepend = listOf("PlaceholderAPI", "EssentialsDiscord", "DiscordSRV")
|
softDepend = listOf("PlaceholderAPI", "EssentialsDiscord", "DiscordSRV")
|
||||||
|
|||||||
+2
-2
@@ -74,8 +74,8 @@ sequenceOf(
|
|||||||
"api",
|
"api",
|
||||||
"common",
|
"common",
|
||||||
"paper",
|
"paper",
|
||||||
"sponge",
|
//"sponge",
|
||||||
"fabric",
|
//"fabric",
|
||||||
"velocity"
|
"velocity"
|
||||||
).forEach {
|
).forEach {
|
||||||
include("carbonchat-$it")
|
include("carbonchat-$it")
|
||||||
|
|||||||
Reference in new issue
Block a user