forked from HelpChat/ChatChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRangedChatCommand.java
More file actions
32 lines (25 loc) · 1.05 KB
/
RangedChatCommand.java
File metadata and controls
32 lines (25 loc) · 1.05 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
package at.helpch.chatchat.command;
import at.helpch.chatchat.ChatChatPlugin;
import at.helpch.chatchat.api.user.ChatUser;
import dev.triumphteam.cmd.bukkit.annotation.Permission;
import dev.triumphteam.cmd.core.BaseCommand;
import dev.triumphteam.cmd.core.annotation.Command;
import dev.triumphteam.cmd.core.annotation.Default;
@Command("rangedchat")
public class RangedChatCommand extends BaseCommand {
private static final String CHAT_TOGGLE_PERMISSION = "chatchat.rangedchat";
private final ChatChatPlugin plugin;
public RangedChatCommand(final ChatChatPlugin plugin) {
this.plugin = plugin;
}
@Default
@Permission(CHAT_TOGGLE_PERMISSION)
public void toggleRangedChat(final ChatUser sender) {
sender.rangedChat(!sender.rangedChat());
final var messageHolder = plugin.configManager().messages();
final var message = sender.rangedChat() ?
messageHolder.rangedChatEnabledSuccessfully() :
messageHolder.rangedChatDisabledSuccessfully();
sender.sendMessage(message);
}
}