3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Fix Checkstyle errors.

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-05-25 13:24:41 -04:00
Ursprung 0cb4c02107
Commit abd81a0216

Datei anzeigen

@ -155,27 +155,6 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
return true; return true;
} }
private CompletableFuture<Void> processCommandExecuteResult(String originalCommand,
CommandResult result) {
if (result == CommandResult.denied()) {
return CompletableFuture.completedFuture(null);
}
MinecraftConnection smc = player.ensureAndGetCurrentServer().ensureConnected();
String commandToRun = result.getCommand().orElse(originalCommand);
if (result.isForwardToServer()) {
return CompletableFuture.runAsync(() -> smc.write(Chat.createServerbound("/" +
commandToRun)), smc.eventLoop());
} else {
return server.getCommandManager().executeImmediatelyAsync(player, commandToRun)
.thenAcceptAsync(hasRun -> {
if (!hasRun) {
smc.write(Chat.createServerbound("/" + commandToRun));
}
}, smc.eventLoop());
}
}
@Override @Override
public boolean handle(TabCompleteRequest packet) { public boolean handle(TabCompleteRequest packet) {
boolean isCommand = !packet.isAssumeCommand() && packet.getCommand().startsWith("/"); boolean isCommand = !packet.isAssumeCommand() && packet.getCommand().startsWith("/");
@ -485,6 +464,27 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
}, player.getConnection().eventLoop()); }, player.getConnection().eventLoop());
} }
private CompletableFuture<Void> processCommandExecuteResult(String originalCommand,
CommandResult result) {
if (result == CommandResult.denied()) {
return CompletableFuture.completedFuture(null);
}
MinecraftConnection smc = player.ensureAndGetCurrentServer().ensureConnected();
String commandToRun = result.getCommand().orElse(originalCommand);
if (result.isForwardToServer()) {
return CompletableFuture.runAsync(() -> smc.write(Chat.createServerbound("/"
+ commandToRun)), smc.eventLoop());
} else {
return server.getCommandManager().executeImmediatelyAsync(player, commandToRun)
.thenAcceptAsync(hasRun -> {
if (!hasRun) {
smc.write(Chat.createServerbound("/" + commandToRun));
}
}, smc.eventLoop());
}
}
/** /**
* Immediately send any queued messages to the server. * Immediately send any queued messages to the server.
*/ */