Skip to content

Commit 4cf344a

Browse files
committed
Fix link command code argument
1 parent 31e40a9 commit 4cf344a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/org/geysermc/globallinkserver/GlobalLinkServer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.util.logging.Logger;
1212

1313
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
14+
import com.mojang.brigadier.arguments.IntegerArgumentType;
1415
import io.papermc.paper.command.brigadier.Commands;
1516
import io.papermc.paper.command.brigadier.argument.ArgumentTypes;
1617
import io.papermc.paper.event.player.AsyncChatEvent;
@@ -82,7 +83,7 @@ public void onEnable() {
8283
Commands.literal("link")
8384
.requires(ctx -> ctx.getSender() instanceof Player)
8485
.executes(commandUtils::startLink)
85-
.then(Commands.argument("code", ArgumentTypes.integerRange())
86+
.then(Commands.argument("code", IntegerArgumentType.integer())
8687
.executes(commandUtils::linkWithCode)
8788
)
8889
.build(),

src/main/java/org/geysermc/globallinkserver/util/CommandUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
package org.geysermc.globallinkserver.util;
77

8+
import com.mojang.brigadier.arguments.IntegerArgumentType;
89
import com.mojang.brigadier.context.CommandContext;
910
import io.papermc.paper.command.brigadier.CommandSourceStack;
1011
import net.kyori.adventure.text.Component;
@@ -47,7 +48,7 @@ public int startLink(CommandContext<CommandSourceStack> ctx) {
4748
}
4849

4950
public int linkWithCode(CommandContext<CommandSourceStack> ctx) {
50-
int linkId = ctx.getArgument("code", Integer.class);
51+
int linkId = IntegerArgumentType.getInteger(ctx, "code");
5152

5253
Player player = getPlayer(ctx);
5354

0 commit comments

Comments
 (0)