-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuSubCommand.java
More file actions
34 lines (31 loc) · 1.14 KB
/
Copy pathMenuSubCommand.java
File metadata and controls
34 lines (31 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package dev.plex.command.sub;
import dev.plex.Guilds;
import dev.plex.command.source.RequiredCommandSource;
import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class MenuSubCommand extends GuildSubCommand
{
public MenuSubCommand()
{
super(command("menu")
.description("Opens the guild management menu")
.usage("/guild <command>")
.aliases("gui,panel")
.permission("plex.guilds.menu")
.source(RequiredCommandSource.IN_GAME)
.build());
}
@Override
protected Component execute(@NotNull CommandSender commandSender, @Nullable Player player, @NotNull String[] args)
{
assert player != null;
Guilds.get().getGuildHolder().getGuild(player.getUniqueId()).ifPresentOrElse(
guild -> Guilds.get().getGuildMenuListener().openHome(player, guild),
() -> send(player, messageComponent("guildNotFound"))
);
return null;
}
}