Refactor PlayerShops to use Dialogs.
This commit is contained in:
@@ -3,7 +3,7 @@ package com.alttd.playershops.commands;
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.commands.arguments.OfflinePlayerArgument;
|
||||
import com.alttd.playershops.commands.subcommands.CheckStockCommand;
|
||||
import com.alttd.playershops.gui.HomeGui;
|
||||
import com.alttd.playershops.dialog.ShopDialog;
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
@@ -28,14 +28,13 @@ public class PlayerShopCommand {
|
||||
if (!(source.getSource().getSender() instanceof Player player))
|
||||
return 1;
|
||||
|
||||
// TODO -- DIALOG
|
||||
HomeGui gui = new HomeGui(player.getUniqueId());
|
||||
gui.open();
|
||||
ShopDialog shopDialog = new ShopDialog(player.getUniqueId());
|
||||
shopDialog.open();
|
||||
return 1;
|
||||
})
|
||||
.then(
|
||||
Commands.literal("reload")
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(BASE_PERM + "reload"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(BASE_PERM + ".reload"))
|
||||
.executes(source -> {
|
||||
PlayerShops.getInstance().reloadConfigs();
|
||||
return 1;
|
||||
@@ -43,7 +42,7 @@ public class PlayerShopCommand {
|
||||
)
|
||||
.then(
|
||||
Commands.literal("checkstock")
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(BASE_PERM + "checkstock")
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(BASE_PERM + ".checkstock")
|
||||
&& commandSourceStack.getSender() instanceof Player)
|
||||
.then(
|
||||
Commands.argument("range", IntegerArgumentType.integer(1, 100))
|
||||
@@ -72,7 +71,7 @@ public class PlayerShopCommand {
|
||||
)
|
||||
.then(
|
||||
Commands.literal("transfershops")
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(BASE_PERM + "transfershops"))
|
||||
.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission(BASE_PERM + ".transfershops"))
|
||||
.then(
|
||||
Commands.argument("old", new OfflinePlayerArgument())
|
||||
.then(
|
||||
|
||||
Reference in New Issue
Block a user