forked from HelpChat/ChatChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve HelpChat#228, implement Ranged-Chat command.
- Loading branch information
Showing
7 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
plugin/src/main/java/at/helpch/chatchat/command/RangedChatCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters