13
0
geforkt von Mirrors/Velocity

Validate that we have a target

Dieser Commit ist enthalten in:
Shane Freeder 2022-06-25 21:38:55 +01:00
Ursprung 662fbc4e3c
Commit c03d7e259c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C

Datei anzeigen

@ -229,6 +229,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
@Override @Override
public boolean handle(PlayerCommand packet) { public boolean handle(PlayerCommand packet) {
player.ensureAndGetCurrentServer();
if (!validateChat(packet.getCommand())) { if (!validateChat(packet.getCommand())) {
return true; return true;
} }
@ -246,6 +247,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
@Override @Override
public boolean handle(PlayerChat packet) { public boolean handle(PlayerChat packet) {
player.ensureAndGetCurrentServer();
if (!validateChat(packet.getMessage())) { if (!validateChat(packet.getMessage())) {
return true; return true;
} }
@ -270,6 +272,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
@Override @Override
public boolean handle(LegacyChat packet) { public boolean handle(LegacyChat packet) {
player.ensureAndGetCurrentServer();
String msg = packet.getMessage(); String msg = packet.getMessage();
if (!validateChat(msg)) { if (!validateChat(msg)) {
return true; return true;
@ -703,7 +706,15 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
return CompletableFuture.completedFuture(null); return CompletableFuture.completedFuture(null);
} }
MinecraftConnection smc = player.ensureAndGetCurrentServer().ensureConnected(); MinecraftConnection smc;
try {
smc = player.ensureAndGetCurrentServer().ensureConnected();
} catch (Exception ex) {
player.disconnect(Component.translatable("velocity.error.player-connection-error",
NamedTextColor.RED));
return CompletableFuture.completedFuture(null);
}
String commandToRun = result.getCommand().orElse(originalCommand); String commandToRun = result.getCommand().orElse(originalCommand);
if (result.isForwardToServer()) { if (result.isForwardToServer()) {
ChatBuilder write = ChatBuilder ChatBuilder write = ChatBuilder