pull/6/head
parent
e84cd87d07
commit
ec07253263
2 changed files with 46 additions and 0 deletions
@ -1,4 +1,41 @@ |
||||
package xyz.soukup.ecoCraftCore.commands; |
||||
|
||||
import com.mojang.brigadier.arguments.*; |
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; |
||||
import com.mojang.brigadier.context.CommandContext; |
||||
import io.papermc.paper.command.brigadier.CommandSourceStack; |
||||
import io.papermc.paper.command.brigadier.Commands; |
||||
import org.eclipse.sisu.inject.TypeArguments; |
||||
|
||||
public class ShopCommand { |
||||
public static LiteralArgumentBuilder<CommandSourceStack> createCommand() { |
||||
return Commands.literal("shop") |
||||
.then(Commands.argument("amount", IntegerArgumentType.integer(1)) |
||||
.then(Commands.literal("buy") |
||||
.then(Commands.argument("buy_price", FloatArgumentType.floatArg(0.1F)) |
||||
.executes(ShopCommand::createBuyShop) |
||||
.then(Commands.literal("sell") |
||||
.then(Commands.argument("sell_price", FloatArgumentType.floatArg(0.1F)) |
||||
.executes(ShopCommand::createBuyAndSellShop))))) |
||||
.then(Commands.literal("sell") |
||||
.then(Commands.argument("sell_price", FloatArgumentType.floatArg(0.1F)) |
||||
.executes(ShopCommand::createSellShop) |
||||
.then(Commands.literal("buy") |
||||
.then(Commands.argument("buy_price", FloatArgumentType.floatArg(0.1F)) |
||||
.executes(ShopCommand::createBuyAndSellShop)))))); |
||||
|
||||
} |
||||
|
||||
private static int createBuyShop(CommandContext<CommandSourceStack> ctx){ |
||||
ctx.getSource().getSender().sendPlainMessage("buy"); |
||||
return 1; |
||||
} |
||||
private static int createSellShop(CommandContext<CommandSourceStack> ctx){ |
||||
ctx.getSource().getSender().sendPlainMessage("sell"); |
||||
return 1; |
||||
} |
||||
private static int createBuyAndSellShop(CommandContext<CommandSourceStack> ctx){ |
||||
ctx.getSource().getSender().sendPlainMessage("buy and sell"); |
||||
return 1; |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue