mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Initial abstraction -> ChatUser
This commit is contained in:
1 parent
03e8f4ec53
commit
97089de7ef
22 files changed
+396
-365
No files matched your search
@@ -4,6 +4,7 @@ import co.aikar.commands.*;
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.commands.*;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@@ -20,10 +21,12 @@ public class CommandManager {
|
||||
commandManager = new BukkitCommandManager(simpleChat);
|
||||
|
||||
commandManager.getCommandCompletions().registerCompletion("chatchannel", (context) -> {
|
||||
ChatUser user = UserManager.wrap(context.getPlayer());
|
||||
|
||||
ArrayList<String> completions = new ArrayList<>();
|
||||
|
||||
for (ChatChannel chatChannel : simpleChat.getChannels()) {
|
||||
if (chatChannel.canPlayerUse(context.getPlayer())) {
|
||||
if (chatChannel.canPlayerUse(user)) {
|
||||
completions.add(chatChannel.getName());
|
||||
}
|
||||
}
|
||||
@@ -44,7 +47,9 @@ public class CommandManager {
|
||||
});
|
||||
|
||||
commandManager.getCommandConditions().addCondition(ChatChannel.class,"canuse", (context, execution, value) -> {
|
||||
if (!value.canPlayerUse(context.getIssuer().getPlayer())) {
|
||||
ChatUser user = UserManager.wrap(context.getIssuer().getPlayer());
|
||||
|
||||
if (!value.canPlayerUse(user)) {
|
||||
throw new ConditionFailedException(simpleChat.getConfig().getString("language.cannot-use-channel"));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user