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

Allow users to specify a reason in the shutdown command

Dieser Commit ist enthalten in:
Alex 2019-12-30 23:20:55 -07:00
Ursprung 941800ce96
Commit 9f340347b6

Datei anzeigen

@ -5,6 +5,7 @@ import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import net.kyori.text.TextComponent; import net.kyori.text.TextComponent;
import net.kyori.text.format.TextColor; import net.kyori.text.format.TextColor;
import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
public class ShutdownCommand implements Command { public class ShutdownCommand implements Command {
@ -17,7 +18,12 @@ public class ShutdownCommand implements Command {
@Override @Override
public void execute(CommandSource source, String @NonNull [] args) { public void execute(CommandSource source, String @NonNull [] args) {
server.shutdown(true); if (args.length == 0) {
server.shutdown(true);
} else {
String reason = String.join(" ", args);
server.shutdown(true, LegacyComponentSerializer.legacy().deserialize(reason, '&'));
}
} }
@Override @Override