mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +00:00
More TODOs
This commit is contained in:
1 parent
1685fa6ba9
commit
bea9816c45
8 files changed
+51
-25
No files matched your search
-1
@@ -62,7 +62,6 @@ public class CarbonWhisperChannel implements WhisperChannel {
|
||||
public @NonNull Map<PlayerUser, Component> parseMessage(@NonNull final PlayerUser user,
|
||||
@NonNull final Collection<@NonNull PlayerUser> recipients,
|
||||
@NonNull final String message, final boolean fromRemote) {
|
||||
// TODO: extract to method, this is just the same thing but twice
|
||||
final Map<PlayerUser, Component> result = new HashMap<>();
|
||||
|
||||
// Formats
|
||||
|
||||
+37
-14
@@ -6,6 +6,8 @@ import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.users.CarbonUser;
|
||||
import net.draycia.carbon.api.commands.settings.CommandSettings;
|
||||
import net.draycia.carbon.api.users.PlayerUser;
|
||||
import net.draycia.carbon.common.commands.arguments.PlayerUserArgument;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -32,7 +34,15 @@ public class ClearChatCommand {
|
||||
.build()
|
||||
);
|
||||
|
||||
// TODO: /clearchat [player]
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.senderType(CarbonUser.class) // player & console
|
||||
.permission("carbonchat.clearchat.clear.player")
|
||||
.argument(PlayerUserArgument.requiredPlayerUserArgument())
|
||||
.handler(this::clearChatPlayer)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
private void clearChat(@NonNull final CommandContext<CarbonUser> context) {
|
||||
@@ -41,22 +51,35 @@ public class ClearChatCommand {
|
||||
final Component component = this.carbonChat.messageProcessor().processMessage(format, "br", "\n");
|
||||
|
||||
for (final CarbonUser user : this.carbonChat.userService().onlineUsers()) {
|
||||
if (user.hasPermission("carbonchat.clearchat.exempt")) {
|
||||
final String message = this.carbonChat.translations().clearExempt();
|
||||
user.sendMessage(Identity.nil(), this.carbonChat.messageProcessor()
|
||||
.processMessage(message, "player", sender));
|
||||
} else {
|
||||
for (int i = 0; i < this.carbonChat.moderationSettings().clearChat().messageCount(); i++) {
|
||||
user.sendMessage(Identity.nil(), component);
|
||||
}
|
||||
}
|
||||
this.clearUserChat(user, component, sender);
|
||||
}
|
||||
}
|
||||
|
||||
if (user.hasPermission("carbonchat.clearchat.notify")) {
|
||||
final String message = this.carbonChat.translations().clearNotify();
|
||||
user.sendMessage(Identity.nil(), this.carbonChat.messageProcessor()
|
||||
.processMessage(message, "player", sender));
|
||||
private void clearChatPlayer(@NonNull final CommandContext<CarbonUser> context) {
|
||||
final PlayerUser target = context.get("user");
|
||||
final String sender = context.getSender().name();
|
||||
final String format = this.carbonChat.moderationSettings().clearChat().message();
|
||||
final Component component = this.carbonChat.messageProcessor().processMessage(format, "br", "\n");
|
||||
|
||||
this.clearUserChat(target, component, sender);
|
||||
}
|
||||
|
||||
private void clearUserChat(@NonNull final CarbonUser user, @NonNull final Component component, @NonNull final String sender) {
|
||||
if (user.hasPermission("carbonchat.clearchat.exempt")) {
|
||||
final String message = this.carbonChat.translations().clearExempt();
|
||||
user.sendMessage(Identity.nil(), this.carbonChat.messageProcessor()
|
||||
.processMessage(message, "player", sender));
|
||||
} else {
|
||||
for (int i = 0; i < this.carbonChat.moderationSettings().clearChat().messageCount(); i++) {
|
||||
user.sendMessage(Identity.nil(), component);
|
||||
}
|
||||
}
|
||||
|
||||
if (user.hasPermission("carbonchat.clearchat.notify")) {
|
||||
final String message = this.carbonChat.translations().clearNotify();
|
||||
user.sendMessage(Identity.nil(), this.carbonChat.messageProcessor()
|
||||
.processMessage(message, "player", sender));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,7 +46,6 @@ public class IgnoreCommand {
|
||||
sender.sendMessage(Identity.nil(), this.carbonChat.messageProcessor().processMessage(
|
||||
this.carbonChat.translations().notIgnoringUser(), "player", targetUser.displayName()));
|
||||
} else {
|
||||
// TODO: schedule task because sync permission checks
|
||||
final String format;
|
||||
|
||||
if (sender.hasPermission("carbonchat.ignore.exempt")) {
|
||||
|
||||
@@ -49,7 +49,6 @@ public class MuteCommand {
|
||||
|
||||
user.sendMessage(Identity.nil(), message);
|
||||
} else {
|
||||
// TODO: schedule task because LuckPerms doesn't like sync offline permission checks
|
||||
final String format;
|
||||
|
||||
if (target.hasPermission("carbonchat.mute.exempt")) {
|
||||
|
||||
+3
-1
@@ -1,6 +1,7 @@
|
||||
package net.draycia.carbon.common.commands;
|
||||
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.arguments.StaticArgument;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
@@ -25,13 +26,14 @@ public class SetColorCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Test and fix
|
||||
for (final ChatChannel channel : this.carbonChat.channelRegistry()) {
|
||||
commandManager.command(
|
||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||
commandManager.createDefaultCommandMeta())
|
||||
.senderType(PlayerUser.class) // player
|
||||
.permission("carbonchat.setcolor")
|
||||
.argument(StaticArgument.of(channel.key()))
|
||||
// TODO: register command for each channel with the channel key as a literal, with permission
|
||||
// TODO: colorArgument (cloud 1.1.0-SNAPSHOT)
|
||||
//.argument(CommandUtils.colorArgument())
|
||||
.handler(context -> {
|
||||
|
||||
-1
@@ -49,7 +49,6 @@ public class ShadowMuteCommand {
|
||||
|
||||
user.sendMessage(Identity.nil(), message);
|
||||
} else {
|
||||
// TODO: schedule task because LuckPerms doesn't like sync offline permission checks
|
||||
final String format;
|
||||
|
||||
if (target.hasPermission("carbonchat.mute.exempt")) {
|
||||
|
||||
Reference in new issue
Block a user