Skip to content

Commit 9b146a7

Browse files
author
games647
authored
Merge branch 'main' into feature/floodgate/newdb
2 parents 0f24b9c + cb5598f commit 9b146a7

File tree

7 files changed

+50
-49
lines changed

7 files changed

+50
-49
lines changed

bukkit/pom.xml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,7 @@
233233
<scope>provided</scope>
234234
<exclusions>
235235
<exclusion>
236-
<groupId>io.netty</groupId>
237-
<artifactId>*</artifactId>
238-
</exclusion>
239-
<exclusion>
240-
<groupId>org.geysermc.cumulus</groupId>
236+
<groupId>*</groupId>
241237
<artifactId>*</artifactId>
242238
</exclusion>
243239
</exclusions>
@@ -265,7 +261,7 @@
265261
<scope>provided</scope>
266262
<exclusions>
267263
<exclusion>
268-
<groupId>org.geysermc.cumulus</groupId>
264+
<groupId>*</groupId>
269265
<artifactId>*</artifactId>
270266
</exclusion>
271267
</exclusions>
@@ -375,7 +371,7 @@
375371
<dependency>
376372
<groupId>org.bouncycastle</groupId>
377373
<artifactId>bcprov-jdk18on</artifactId>
378-
<version>1.71</version>
374+
<version>1.72</version>
379375
<scope>test</scope>
380376
</dependency>
381377

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ private void onEncryptionBegin(PacketEvent packetEvent, Player sender) {
179179
private boolean verifyNonce(Player sender, PacketContainer packet,
180180
ClientPublicKey clientPublicKey, byte[] expectedToken) {
181181
try {
182-
if (MinecraftVersion.atOrAbove(new MinecraftVersion(1, 19, 0))) {
182+
if (MinecraftVersion.atOrAbove(new MinecraftVersion(1, 19, 0))
183+
&& !MinecraftVersion.atOrAbove(new MinecraftVersion(1, 19, 3))) {
183184
Either<byte[], ?> either = packet.getSpecificModifier(Either.class).read(0);
184185
if (clientPublicKey == null) {
185186
Optional<byte[]> left = either.left();
@@ -222,27 +223,34 @@ private void onLoginStart(PacketEvent packetEvent, Player player, String usernam
222223
plugin.removeSession(player.getAddress());
223224

224225
PacketContainer packet = packetEvent.getPacket();
225-
val profileKey = packet.getOptionals(BukkitConverters.getWrappedPublicKeyDataConverter())
226-
.optionRead(0);
227-
228-
val clientKey = profileKey.flatMap(Function.identity()).flatMap(data -> {
229-
Instant expires = data.getExpireTime();
230-
PublicKey key = data.getKey();
231-
byte[] signature = data.getSignature();
232-
return Optional.of(ClientPublicKey.of(expires, key, signature));
233-
});
234-
235-
// start reading from index 1, because 0 is already used by the public key
236-
Optional<UUID> sessionUUID = packet.getOptionals(Converters.passthrough(UUID.class)).readSafely(1);
237-
if (verifyClientKeys && sessionUUID.isPresent() && clientKey.isPresent()
238-
&& verifyPublicKey(clientKey.get(), sessionUUID.get())) {
239-
// missing or incorrect
240-
// expired always not allowed
241-
player.kickPlayer(plugin.getCore().getMessage("invalid-public-key"));
242-
plugin.getLog().warn("Invalid public key from player {}", username);
243-
return;
226+
Optional<ClientPublicKey> clientKey = Optional.empty();
227+
if (MinecraftVersion.atOrAbove(new MinecraftVersion(1, 19, 3))) {
228+
// public key sent separate
229+
clientKey = Optional.empty();
230+
} else {
231+
val profileKey = packet.getOptionals(BukkitConverters.getWrappedPublicKeyDataConverter())
232+
.optionRead(0);
233+
234+
clientKey = profileKey.flatMap(Function.identity()).flatMap(data -> {
235+
Instant expires = data.getExpireTime();
236+
PublicKey key = data.getKey();
237+
byte[] signature = data.getSignature();
238+
return Optional.of(ClientPublicKey.of(expires, key, signature));
239+
});
240+
241+
// start reading from index 1, because 0 is already used by the public key
242+
Optional<UUID> sessionUUID = packet.getOptionals(Converters.passthrough(UUID.class)).readSafely(1);
243+
if (verifyClientKeys && sessionUUID.isPresent() && clientKey.isPresent()
244+
&& verifyPublicKey(clientKey.get(), sessionUUID.get())) {
245+
// missing or incorrect
246+
// expired always not allowed
247+
player.kickPlayer(plugin.getCore().getMessage("invalid-public-key"));
248+
plugin.getLog().warn("Invalid public key from player {}", username);
249+
return;
250+
}
244251
}
245252

253+
246254
plugin.getLog().trace("GameProfile {} with {} connecting", sessionKey, username);
247255

248256
packetEvent.getAsyncMarker().incrementProcessingDelay();

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
import com.comphenix.protocol.ProtocolLibrary;
2929
import com.comphenix.protocol.events.PacketContainer;
3030
import com.comphenix.protocol.events.PacketEvent;
31+
import com.comphenix.protocol.injector.packet.PacketRegistry;
3132
import com.comphenix.protocol.injector.temporary.TemporaryPlayerFactory;
3233
import com.comphenix.protocol.reflect.EquivalentConverter;
3334
import com.comphenix.protocol.reflect.FuzzyReflection;
3435
import com.comphenix.protocol.reflect.accessors.Accessors;
36+
import com.comphenix.protocol.reflect.accessors.ConstructorAccessor;
3537
import com.comphenix.protocol.reflect.accessors.FieldAccessor;
3638
import com.comphenix.protocol.utility.MinecraftReflection;
3739
import com.comphenix.protocol.utility.MinecraftVersion;
@@ -269,10 +271,9 @@ private void kickPlayer(String reason) {
269271

270272
//fake a new login packet in order to let the server handle all the other stuff
271273
private void receiveFakeStartPacket(String username, ClientPublicKey clientKey) {
272-
//see StartPacketListener for packet information
273-
PacketContainer startPacket = new PacketContainer(START);
274-
274+
PacketContainer startPacket;
275275
if (MinecraftVersion.atOrAbove(new MinecraftVersion(1, 19, 0))) {
276+
startPacket = new PacketContainer(START);
276277
startPacket.getStrings().write(0, username);
277278

278279
EquivalentConverter<WrappedProfileKeyData> converter = BukkitConverters.getWrappedPublicKeyDataConverter();
@@ -284,7 +285,11 @@ private void receiveFakeStartPacket(String username, ClientPublicKey clientKey)
284285
} else {
285286
//uuid is ignored by the packet definition
286287
WrappedGameProfile fakeProfile = new WrappedGameProfile(UUID.randomUUID(), username);
287-
startPacket.getGameProfiles().write(0, fakeProfile);
288+
289+
Class<?> profileHandleType = fakeProfile.getHandleType();
290+
Class<?> packetHandleType = PacketRegistry.getPacketClassFromType(START);
291+
ConstructorAccessor startCons = Accessors.getConstructorAccessorOrNull(packetHandleType, profileHandleType);
292+
startPacket = new PacketContainer(START, startCons.invoke(fakeProfile));
288293
}
289294

290295
//we don't want to handle our own packets so ignore filters

bungee/pom.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,7 @@
174174
<scope>provided</scope>
175175
<exclusions>
176176
<exclusion>
177-
<groupId>io.netty</groupId>
178-
<artifactId>*</artifactId>
179-
</exclusion>
180-
<exclusion>
181-
<groupId>org.geysermc.cumulus</groupId>
177+
<groupId>*</groupId>
182178
<artifactId>*</artifactId>
183179
</exclusion>
184180
</exclusions>
@@ -206,7 +202,7 @@
206202
<scope>provided</scope>
207203
<exclusions>
208204
<exclusion>
209-
<groupId>org.geysermc.cumulus</groupId>
205+
<groupId>*</groupId>
210206
<artifactId>*</artifactId>
211207
</exclusion>
212208
</exclusions>

core/pom.xml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<dependency>
8383
<groupId>org.slf4j</groupId>
8484
<artifactId>slf4j-jdk14</artifactId>
85-
<version>2.0.0</version>
85+
<version>2.0.6</version>
8686
</dependency>
8787

8888
<!-- snakeyaml is present in Bungee, Spigot, Cauldron, so we could use this independent implementation -->
@@ -106,11 +106,7 @@
106106
<scope>provided</scope>
107107
<exclusions>
108108
<exclusion>
109-
<groupId>io.netty</groupId>
110-
<artifactId>*</artifactId>
111-
</exclusion>
112-
<exclusion>
113-
<groupId>org.geysermc.cumulus</groupId>
109+
<groupId>*</groupId>
114110
<artifactId>*</artifactId>
115111
</exclusion>
116112
</exclusions>
@@ -138,7 +134,7 @@
138134
<scope>provided</scope>
139135
<exclusions>
140136
<exclusion>
141-
<groupId>org.geysermc.cumulus</groupId>
137+
<groupId>*</groupId>
142138
<artifactId>*</artifactId>
143139
</exclusion>
144140
</exclusions>
@@ -185,7 +181,7 @@
185181
<dependency>
186182
<groupId>com.google.code.gson</groupId>
187183
<artifactId>gson</artifactId>
188-
<version>2.9.1</version>
184+
<version>2.10</version>
189185
</dependency>
190186

191187
<dependency>

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
<dependency>
142142
<groupId>com.puppycrawl.tools</groupId>
143143
<artifactId>checkstyle</artifactId>
144-
<version>10.3.2</version>
144+
<version>10.5.0</version>
145145
</dependency>
146146
</dependencies>
147147
<executions>
@@ -194,15 +194,15 @@
194194
<dependency>
195195
<groupId>org.junit.jupiter</groupId>
196196
<artifactId>junit-jupiter</artifactId>
197-
<version>5.9.0</version>
197+
<version>5.9.1</version>
198198
<scope>test</scope>
199199
</dependency>
200200

201201
<!-- Require inline to support static mocks -->
202202
<dependency>
203203
<groupId>org.mockito</groupId>
204204
<artifactId>mockito-inline</artifactId>
205-
<version>4.7.0</version>
205+
<version>4.10.0</version>
206206
<scope>test</scope>
207207
</dependency>
208208
</dependencies>

velocity/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
<dependency>
145145
<groupId>org.mariadb.jdbc</groupId>
146146
<artifactId>mariadb-java-client</artifactId>
147-
<version>3.0.7</version>
147+
<version>3.1.0</version>
148148
</dependency>
149149
</dependencies>
150150
</project>

0 commit comments

Comments
 (0)