From 4cf344aac480f89e4f0834e43f793abd3b70435b Mon Sep 17 00:00:00 2001 From: rtm516 Date: Fri, 17 Jan 2025 18:25:31 +0000 Subject: [PATCH] Fix link command code argument --- .../java/org/geysermc/globallinkserver/GlobalLinkServer.java | 3 ++- .../java/org/geysermc/globallinkserver/util/CommandUtils.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/geysermc/globallinkserver/GlobalLinkServer.java b/src/main/java/org/geysermc/globallinkserver/GlobalLinkServer.java index e383d40..10eda56 100644 --- a/src/main/java/org/geysermc/globallinkserver/GlobalLinkServer.java +++ b/src/main/java/org/geysermc/globallinkserver/GlobalLinkServer.java @@ -11,6 +11,7 @@ import java.util.logging.Logger; import com.destroystokyo.paper.event.server.PaperServerListPingEvent; +import com.mojang.brigadier.arguments.IntegerArgumentType; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; import io.papermc.paper.event.player.AsyncChatEvent; @@ -82,7 +83,7 @@ public void onEnable() { Commands.literal("link") .requires(ctx -> ctx.getSender() instanceof Player) .executes(commandUtils::startLink) - .then(Commands.argument("code", ArgumentTypes.integerRange()) + .then(Commands.argument("code", IntegerArgumentType.integer()) .executes(commandUtils::linkWithCode) ) .build(), diff --git a/src/main/java/org/geysermc/globallinkserver/util/CommandUtils.java b/src/main/java/org/geysermc/globallinkserver/util/CommandUtils.java index c50ff56..930b47a 100644 --- a/src/main/java/org/geysermc/globallinkserver/util/CommandUtils.java +++ b/src/main/java/org/geysermc/globallinkserver/util/CommandUtils.java @@ -5,6 +5,7 @@ */ package org.geysermc.globallinkserver.util; +import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.context.CommandContext; import io.papermc.paper.command.brigadier.CommandSourceStack; import net.kyori.adventure.text.Component; @@ -47,7 +48,7 @@ public int startLink(CommandContext ctx) { } public int linkWithCode(CommandContext ctx) { - int linkId = ctx.getArgument("code", Integer.class); + int linkId = IntegerArgumentType.getInteger(ctx, "code"); Player player = getPlayer(ctx);