mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Add better channel switch failure messages
This commit is contained in:
1 parent
6ca2b9c4c8
commit
c351aa5e48
9 files changed
+69
-25
No files matched your search
@@ -1,9 +1,14 @@
|
||||
package net.draycia.simplechat.commands;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.ConditionFailedException;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.channels.impls.AllianceChatChannel;
|
||||
import net.draycia.simplechat.channels.impls.NationChatChannel;
|
||||
import net.draycia.simplechat.channels.impls.PartyChatChannel;
|
||||
import net.draycia.simplechat.channels.impls.TownChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -26,8 +31,17 @@ public class AliasedChannelCommand extends BaseCommand {
|
||||
ChatUser user = simpleChat.getUserService().wrap(player);
|
||||
|
||||
if (!chatChannel.canPlayerUse(user)) {
|
||||
// TODO: send message
|
||||
return;
|
||||
if (chatChannel.isTownChat() && !((TownChatChannel)chatChannel).isInTown(user)) {
|
||||
throw new ConditionFailedException(simpleChat.getConfig().getString("language.town-cannot-use"));
|
||||
} else if (chatChannel.isNationChat() && !((NationChatChannel)chatChannel).isInNation(user)) {
|
||||
throw new ConditionFailedException(simpleChat.getConfig().getString("language.nation-cannot-use"));
|
||||
} else if (chatChannel.isAllianceChat() && !((AllianceChatChannel)chatChannel).isInTown(user)) {
|
||||
throw new ConditionFailedException(simpleChat.getConfig().getString("alliance-cannot-use"));
|
||||
} else if (chatChannel.isPartyChat() && !((PartyChatChannel)chatChannel).isInParty(user)) {
|
||||
throw new ConditionFailedException(simpleChat.getConfig().getString("party-cannot-use"));
|
||||
} else {
|
||||
throw new ConditionFailedException(simpleChat.getConfig().getString("cannot-use-channel"));
|
||||
}
|
||||
}
|
||||
|
||||
if (args == null || args.length == 0) {
|
||||
|
||||
Reference in new issue
Block a user