|
1 | 1 | /* |
2 | | - * Copyright (c) 2021-2025 GeyserMC |
| 2 | + * Copyright (c) 2021-2026 GeyserMC |
3 | 3 | * Licensed under the MIT license |
4 | 4 | * @link https://github.com/GeyserMC/GlobalLinkServer |
5 | 5 | */ |
|
12 | 12 | import java.sql.Connection; |
13 | 13 | import java.sql.PreparedStatement; |
14 | 14 | import java.sql.SQLException; |
15 | | -import java.sql.Timestamp; |
16 | | -import java.time.Instant; |
17 | 15 | import java.util.Iterator; |
18 | 16 | import java.util.Random; |
19 | 17 | import java.util.UUID; |
@@ -48,9 +46,8 @@ public LinkManager(PlayerManager playerManager, DatabaseManager database) { |
48 | 46 | } |
49 | 47 |
|
50 | 48 | public int createTempLink(Player player) { |
51 | | - long nameTimestamp = playerManager.nameTimestampMillis(player); |
52 | 49 | String correctUsername = playerManager.correctUsername(player); |
53 | | - var linkRequest = new LinkRequest(createCode(), PENDING_LINK_TTL_MILLIS, player.getUniqueId(), correctUsername, nameTimestamp); |
| 50 | + var linkRequest = new LinkRequest(createCode(), PENDING_LINK_TTL_MILLIS, player.getUniqueId(), correctUsername); |
54 | 51 |
|
55 | 52 | linkRequests.put(linkRequest.code(), linkRequest); |
56 | 53 | linkRequestForPlayer.put(player.getUniqueId(), linkRequest.code()); |
@@ -102,32 +99,6 @@ public CompletableFuture<Boolean> finaliseLink(Link linkRequest) { |
102 | 99 | return CompletableFuture.supplyAsync( |
103 | 100 | () -> { |
104 | 101 | try (Connection connection = database.connection()) { |
105 | | - try (PreparedStatement query = connection.prepareStatement(""" |
106 | | - INSERT INTO java_identity_current AS c(id, username, detected_at) |
107 | | - VALUES (?::uuid, ?, ?) |
108 | | - ON CONFLICT (id) DO |
109 | | - UPDATE SET username = EXCLUDED.username, detected_at = EXCLUDED.detected_at |
110 | | - WHERE c.detected_at <= EXCLUDED.detected_at AND c.username != EXCLUDED.username |
111 | | - """)) { |
112 | | - query.setString(1, linkRequest.javaId().toString()); |
113 | | - query.setString(2, linkRequest.javaUsername()); |
114 | | - query.setTimestamp(3, Timestamp.from(Instant.EPOCH.plusMillis(linkRequest.javaNameTimestamp()))); |
115 | | - query.executeUpdate(); |
116 | | - } |
117 | | - |
118 | | - try (PreparedStatement query = connection.prepareStatement(""" |
119 | | - INSERT INTO xbox_identity_current AS c(xuid, gamertag, detected_at) |
120 | | - VALUES (?::xuid, ?, ?) |
121 | | - ON CONFLICT (xuid) DO |
122 | | - UPDATE SET gamertag = EXCLUDED.gamertag, detected_at = EXCLUDED.detected_at |
123 | | - WHERE c.detected_at <= EXCLUDED.detected_at AND c.gamertag != EXCLUDED.gamertag |
124 | | - """)) { |
125 | | - query.setLong(1, linkRequest.bedrockId()); |
126 | | - query.setString(2, linkRequest.bedrockName()); |
127 | | - query.setTimestamp(3, Timestamp.from(Instant.EPOCH.plusMillis(linkRequest.bedrockNameTimestamp()))); |
128 | | - query.executeUpdate(); |
129 | | - } |
130 | | - |
131 | 102 | try (PreparedStatement query = connection.prepareStatement(""" |
132 | 103 | INSERT INTO links (xuid, java_id) |
133 | 104 | VALUES (?::xuid, ?::uuid) |
|
0 commit comments