Skip to content

Commit 22a0a2d

Browse files
author
david
committed
Add PayCommand to support player-to-player payments
This commit introduces the PayCommand class, enabling the functionality for players to send payments to each other. The command requires appropriate permissions and is registered using the plugin's lifecycle manager upon initialization.
1 parent 41d760b commit 22a0a2d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package net.thenextlvl.economist.command;
2+
3+
import io.papermc.paper.command.brigadier.Commands;
4+
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
5+
import lombok.RequiredArgsConstructor;
6+
import net.thenextlvl.economist.EconomistPlugin;
7+
8+
@RequiredArgsConstructor
9+
@SuppressWarnings("UnstableApiUsage")
10+
public class PayCommand {
11+
private final EconomistPlugin plugin;
12+
13+
public void register() {
14+
var command = Commands.literal("pay")
15+
.requires(stack -> stack.getSender().hasPermission("economist.pay"))
16+
.build();
17+
plugin.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS.newHandler(event ->
18+
event.registrar().register(command, "Pay another player")));
19+
}
20+
}

0 commit comments

Comments
 (0)