geforkt von Mirrors/Velocity
feat: Require any ConsoleCommandSender for the shutdown command (#1428)
Dieser Commit ist enthalten in:
Ursprung
2299b78ad3
Commit
78f6cfc26c
@ -23,6 +23,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|||||||
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
||||||
import com.velocitypowered.api.command.BrigadierCommand;
|
import com.velocitypowered.api.command.BrigadierCommand;
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
|
import com.velocitypowered.api.proxy.ConsoleCommandSource;
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
@ -43,7 +44,7 @@ public final class ShutdownCommand {
|
|||||||
*/
|
*/
|
||||||
public static BrigadierCommand command(final VelocityServer server) {
|
public static BrigadierCommand command(final VelocityServer server) {
|
||||||
return new BrigadierCommand(LiteralArgumentBuilder.<CommandSource>literal("shutdown")
|
return new BrigadierCommand(LiteralArgumentBuilder.<CommandSource>literal("shutdown")
|
||||||
.requires(source -> source == server.getConsoleCommandSource())
|
.requires(source -> source instanceof ConsoleCommandSource)
|
||||||
.executes(context -> {
|
.executes(context -> {
|
||||||
server.shutdown(true);
|
server.shutdown(true);
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren