parent
5aac4d2d72
commit
381cf0b94e
2 changed files with 39 additions and 0 deletions
@ -0,0 +1,37 @@ |
|||||||
|
package xyz.soukup.ecoCraftCore.commands; |
||||||
|
|
||||||
|
import io.papermc.paper.command.brigadier.CommandSourceStack; |
||||||
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder; |
||||||
|
import io.papermc.paper.command.brigadier.Commands; |
||||||
|
import com.mojang.brigadier.context.CommandContext; |
||||||
|
import xyz.soukup.ecoCraftCore.utilities.Messages; |
||||||
|
import net.kyori.adventure.text.Component; |
||||||
|
import org.bukkit.command.CommandSender; |
||||||
|
import dev.triumphteam.gui.guis.Gui; |
||||||
|
import org.bukkit.entity.Player; |
||||||
|
|
||||||
|
public class GuiCommand { |
||||||
|
public static LiteralArgumentBuilder<CommandSourceStack> createCommand() { |
||||||
|
return Commands.literal("gopen") |
||||||
|
.executes(GuiCommand::obtainGui); |
||||||
|
} |
||||||
|
|
||||||
|
private static int obtainGui(CommandContext<CommandSourceStack> context){ |
||||||
|
|
||||||
|
CommandSender commandSender = context.getSource().getSender(); |
||||||
|
|
||||||
|
if (!(commandSender instanceof Player)){ |
||||||
|
Messages.send(commandSender, "generic.error.not-player"); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
Gui gui = Gui.gui() |
||||||
|
.title(Component.text("GUI Title!")) |
||||||
|
.rows(6) |
||||||
|
.create(); |
||||||
|
|
||||||
|
gui.open((Player) commandSender); |
||||||
|
return 1; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
Loading…
Reference in new issue