13
0
geforkt von Mirrors/Velocity

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 net.kyori.text.TextComponent;
import net.kyori.text.format.TextColor;
import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
import org.checkerframework.checker.nullness.qual.NonNull;
public class ShutdownCommand implements Command {
@ -17,7 +18,12 @@ public class ShutdownCommand implements Command {
@Override
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