mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
fix saving new players to database
This commit is contained in:
1 parent
af263020ff
commit
f4f5f0d7e5
5 files changed
+43
-47
No files matched your search
@@ -68,7 +68,7 @@ public abstract class DatabaseUserManager extends CachingUserManager {
|
|||||||
@Override
|
@Override
|
||||||
public final void saveSync(final CarbonPlayerCommon player) {
|
public final void saveSync(final CarbonPlayerCommon player) {
|
||||||
this.jdbi.withHandle(handle -> {
|
this.jdbi.withHandle(handle -> {
|
||||||
this.bindPlayerArguments(handle.createUpdate(this.locator.query("save-player")), player)
|
this.bindPlayerArguments(handle.createUpdate(this.locator.query("insert-player")), player)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
if (!player.ignoredPlayers().isEmpty()) {
|
if (!player.ignoredPlayers().isEmpty()) {
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
INSERT INTO carbon_users VALUES (
|
INSERT INTO carbon_users SET
|
||||||
UNHEX(REPLACE(:id, '-', '')),
|
id = UNHEX(REPLACE(:id, '-', '')),
|
||||||
:muted,
|
muted = :muted,
|
||||||
:deafened,
|
deafened = :deafened,
|
||||||
:selectedchannel,
|
selectedchannel = :selectedchannel,
|
||||||
:username,
|
username= :username,
|
||||||
:displayname,
|
displayname = :displayname,
|
||||||
UNHEX(REPLACE(:lastwhispertarget, '-', '')),
|
lastwhispertarget = UNHEX(REPLACE(:lastwhispertarget, '-', '')),
|
||||||
UNHEX(REPLACE(:whisperreplytarget, '-', '')),
|
whisperreplytarget = UNHEX(REPLACE(:whisperreplytarget, '-', '')),
|
||||||
:spying
|
spying = :spying
|
||||||
);
|
ON DUPLICATE KEY UPDATE
|
||||||
|
id = UNHEX(REPLACE(:id, '-', '')),
|
||||||
|
muted = :muted,
|
||||||
|
deafened = :deafened,
|
||||||
|
selectedchannel = :selectedchannel,
|
||||||
|
username= :username,
|
||||||
|
displayname = :displayname,
|
||||||
|
lastwhispertarget = UNHEX(REPLACE(:lastwhispertarget, '-', '')),
|
||||||
|
whisperreplytarget = UNHEX(REPLACE(:whisperreplytarget, '-', '')),
|
||||||
|
spying = :spying
|
||||||
|
;
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
UPDATE carbon_users
|
|
||||||
SET
|
|
||||||
id = UNHEX(REPLACE(:id, '-', '')),
|
|
||||||
muted = :muted,
|
|
||||||
deafened = :deafened,
|
|
||||||
selectedchannel = :selectedchannel,
|
|
||||||
username= :username,
|
|
||||||
displayname = :displayname,
|
|
||||||
lastwhispertarget = UNHEX(REPLACE(:lastwhispertarget, '-', '')),
|
|
||||||
whisperreplytarget = UNHEX(REPLACE(:whisperreplytarget, '-', '')),
|
|
||||||
spying = :spying
|
|
||||||
WHERE id = UNHEX(REPLACE(:id, '-', ''));
|
|
||||||
@@ -1,11 +1,21 @@
|
|||||||
INSERT INTO carbon_users VALUES (
|
INSERT INTO carbon_users SET
|
||||||
:id,
|
id = :id,
|
||||||
:muted,
|
muted = :muted,
|
||||||
:deafened,
|
deafened = :deafened,
|
||||||
:selectedchannel,
|
selectedchannel = :selectedchannel,
|
||||||
:username,
|
username= :username,
|
||||||
:displayname,
|
displayname = :displayname,
|
||||||
:lastwhispertarget,
|
lastwhispertarget = :lastwhispertarget,
|
||||||
:whisperreplytarget,
|
whisperreplytarget = :whisperreplytarget,
|
||||||
:spying
|
spying = :spying
|
||||||
);
|
ON CONFLICT (id) DO UPDATE SET
|
||||||
|
id = :id,
|
||||||
|
muted = :muted,
|
||||||
|
deafened = :deafened,
|
||||||
|
selectedchannel = :selectedchannel,
|
||||||
|
username= :username,
|
||||||
|
displayname = :displayname,
|
||||||
|
lastwhispertarget = :lastwhispertarget,
|
||||||
|
whisperreplytarget = :whisperreplytarget,
|
||||||
|
spying = :spying
|
||||||
|
;
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
UPDATE carbon_users
|
|
||||||
SET
|
|
||||||
id = :id,
|
|
||||||
muted = :muted,
|
|
||||||
deafened = :deafened,
|
|
||||||
selectedchannel = :selectedchannel,
|
|
||||||
username= :username,
|
|
||||||
displayname = :displayname,
|
|
||||||
lastwhispertarget = :lastwhispertarget,
|
|
||||||
whisperreplytarget = :whisperreplytarget,
|
|
||||||
spying = :spying
|
|
||||||
WHERE id = :id;
|
|
||||||
Reference in new issue
Block a user