Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-06 00:00:47 +01:00
Merge pull request #300 from Leymooo/command-event
fix command forwarding to server
Dieser Commit ist enthalten in:
Commit
42ad7594ae
@ -9,7 +9,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is fired when a player types in a chat message.
|
* This event is fired when someone executing command
|
||||||
*/
|
*/
|
||||||
public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
||||||
|
|
||||||
|
@ -131,13 +131,13 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
Optional<String> eventCommand = event.getResult().getCommand();
|
Optional<String> eventCommand = event.getResult().getCommand();
|
||||||
String command = eventCommand.orElse(event.getCommand());
|
String command = eventCommand.orElse(event.getCommand());
|
||||||
if (commandResult.isForwardToServer()) {
|
if (commandResult.isForwardToServer()) {
|
||||||
smc.write(Chat.createServerbound(command));
|
smc.write(Chat.createServerbound("/" + command));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (commandResult.isAllowed()) {
|
if (commandResult.isAllowed()) {
|
||||||
try {
|
try {
|
||||||
if (!server.getCommandManager().executeImmediately(player, command)) {
|
if (!server.getCommandManager().executeImmediately(player, command)) {
|
||||||
smc.write(Chat.createServerbound(command));
|
smc.write(Chat.createServerbound("/" + command));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.info("Exception occurred while running command for {}", player.getUsername(),
|
logger.info("Exception occurred while running command for {}", player.getUsername(),
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren