mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 06:28:53 +00:00
More TODOs
This commit is contained in:
1 parent
1685fa6ba9
commit
bea9816c45
8 files changed
+38
-12
No files matched your search
@@ -29,12 +29,14 @@ public final class ChannelOptions {
|
|||||||
private String color;
|
private String color;
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
@Comment("The contexts for this channel, ")
|
@Comment("The contexts for this channel, which can modify the behaviour of channels and how/when players can use them.")
|
||||||
private Map<String, Context> contexts = new HashMap<>(); // TODO: set defaults
|
private Map<String, Context> contexts = new HashMap<>();
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
@Comment("The formats for this channel. The key is the name of the group as your permissions plugin reports it.")
|
@Comment("The formats for this channel. The key is the name of the group as your permissions plugin reports it.")
|
||||||
private Map<String, String> formats = new HashMap<>(); // TODO: set defaults
|
private Map<String, String> formats = new HashMap<String, String>() {{
|
||||||
|
put("default", "<color><<displayname><reset><color>> <message>");
|
||||||
|
}};
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
@Comment("The name of the format that the plugin will fall back to when it cannot find a matching format for the player's groups.")
|
@Comment("The name of the format that the plugin will fall back to when it cannot find a matching format for the player's groups.")
|
||||||
|
|||||||
+5
-2
@@ -15,8 +15,11 @@ import java.util.Map;
|
|||||||
public final class SharedChannelOptions {
|
public final class SharedChannelOptions {
|
||||||
|
|
||||||
@Setting private String color = "#FFFFFF";
|
@Setting private String color = "#FFFFFF";
|
||||||
@Setting private Map<String, Context> contexts = new HashMap<>(); // TODO: set defaults
|
@Setting private Map<String, Context> contexts = new HashMap<>();
|
||||||
@Setting private Map<String, String> formats = new HashMap<>(); // TODO: set defaults
|
@Setting private Map<String, String> formats = new HashMap<String, String>() {{
|
||||||
|
put("default", "<color><<displayname><reset><color>> <message>");
|
||||||
|
put("staff", "<#00CED1>[Staff] <color><<displayname><reset><color>> <message>");
|
||||||
|
}};
|
||||||
@Setting private String defaultFormatName = "default";
|
@Setting private String defaultFormatName = "default";
|
||||||
@Setting private boolean ignorable = true;
|
@Setting private boolean ignorable = true;
|
||||||
@Setting private boolean crossServer = true;
|
@Setting private boolean crossServer = true;
|
||||||
|
|||||||
-1
@@ -62,7 +62,6 @@ public class CarbonWhisperChannel implements WhisperChannel {
|
|||||||
public @NonNull Map<PlayerUser, Component> parseMessage(@NonNull final PlayerUser user,
|
public @NonNull Map<PlayerUser, Component> parseMessage(@NonNull final PlayerUser user,
|
||||||
@NonNull final Collection<@NonNull PlayerUser> recipients,
|
@NonNull final Collection<@NonNull PlayerUser> recipients,
|
||||||
@NonNull final String message, final boolean fromRemote) {
|
@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<>();
|
final Map<PlayerUser, Component> result = new HashMap<>();
|
||||||
|
|
||||||
// Formats
|
// Formats
|
||||||
|
|||||||
+25
-2
@@ -6,6 +6,8 @@ import net.draycia.carbon.api.CarbonChat;
|
|||||||
import net.draycia.carbon.api.CarbonChatProvider;
|
import net.draycia.carbon.api.CarbonChatProvider;
|
||||||
import net.draycia.carbon.api.users.CarbonUser;
|
import net.draycia.carbon.api.users.CarbonUser;
|
||||||
import net.draycia.carbon.api.commands.settings.CommandSettings;
|
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.identity.Identity;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
@@ -32,7 +34,15 @@ public class ClearChatCommand {
|
|||||||
.build()
|
.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) {
|
private void clearChat(@NonNull final CommandContext<CarbonUser> context) {
|
||||||
@@ -41,6 +51,20 @@ public class ClearChatCommand {
|
|||||||
final Component component = this.carbonChat.messageProcessor().processMessage(format, "br", "\n");
|
final Component component = this.carbonChat.messageProcessor().processMessage(format, "br", "\n");
|
||||||
|
|
||||||
for (final CarbonUser user : this.carbonChat.userService().onlineUsers()) {
|
for (final CarbonUser user : this.carbonChat.userService().onlineUsers()) {
|
||||||
|
this.clearUserChat(user, component, 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")) {
|
if (user.hasPermission("carbonchat.clearchat.exempt")) {
|
||||||
final String message = this.carbonChat.translations().clearExempt();
|
final String message = this.carbonChat.translations().clearExempt();
|
||||||
user.sendMessage(Identity.nil(), this.carbonChat.messageProcessor()
|
user.sendMessage(Identity.nil(), this.carbonChat.messageProcessor()
|
||||||
@@ -57,6 +81,5 @@ public class ClearChatCommand {
|
|||||||
.processMessage(message, "player", sender));
|
.processMessage(message, "player", sender));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,6 @@ public class IgnoreCommand {
|
|||||||
sender.sendMessage(Identity.nil(), this.carbonChat.messageProcessor().processMessage(
|
sender.sendMessage(Identity.nil(), this.carbonChat.messageProcessor().processMessage(
|
||||||
this.carbonChat.translations().notIgnoringUser(), "player", targetUser.displayName()));
|
this.carbonChat.translations().notIgnoringUser(), "player", targetUser.displayName()));
|
||||||
} else {
|
} else {
|
||||||
// TODO: schedule task because sync permission checks
|
|
||||||
final String format;
|
final String format;
|
||||||
|
|
||||||
if (sender.hasPermission("carbonchat.ignore.exempt")) {
|
if (sender.hasPermission("carbonchat.ignore.exempt")) {
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ public class MuteCommand {
|
|||||||
|
|
||||||
user.sendMessage(Identity.nil(), message);
|
user.sendMessage(Identity.nil(), message);
|
||||||
} else {
|
} else {
|
||||||
// TODO: schedule task because LuckPerms doesn't like sync offline permission checks
|
|
||||||
final String format;
|
final String format;
|
||||||
|
|
||||||
if (target.hasPermission("carbonchat.mute.exempt")) {
|
if (target.hasPermission("carbonchat.mute.exempt")) {
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,7 @@
|
|||||||
package net.draycia.carbon.common.commands;
|
package net.draycia.carbon.common.commands;
|
||||||
|
|
||||||
import cloud.commandframework.CommandManager;
|
import cloud.commandframework.CommandManager;
|
||||||
|
import cloud.commandframework.arguments.StaticArgument;
|
||||||
import net.draycia.carbon.api.CarbonChat;
|
import net.draycia.carbon.api.CarbonChat;
|
||||||
import net.draycia.carbon.api.CarbonChatProvider;
|
import net.draycia.carbon.api.CarbonChatProvider;
|
||||||
import net.draycia.carbon.api.channels.ChatChannel;
|
import net.draycia.carbon.api.channels.ChatChannel;
|
||||||
@@ -25,13 +26,14 @@ public class SetColorCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Test and fix
|
|
||||||
for (final ChatChannel channel : this.carbonChat.channelRegistry()) {
|
for (final ChatChannel channel : this.carbonChat.channelRegistry()) {
|
||||||
commandManager.command(
|
commandManager.command(
|
||||||
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
commandManager.commandBuilder(commandSettings.name(), commandSettings.aliases(),
|
||||||
commandManager.createDefaultCommandMeta())
|
commandManager.createDefaultCommandMeta())
|
||||||
.senderType(PlayerUser.class) // player
|
.senderType(PlayerUser.class) // player
|
||||||
.permission("carbonchat.setcolor")
|
.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)
|
// TODO: colorArgument (cloud 1.1.0-SNAPSHOT)
|
||||||
//.argument(CommandUtils.colorArgument())
|
//.argument(CommandUtils.colorArgument())
|
||||||
.handler(context -> {
|
.handler(context -> {
|
||||||
|
|||||||
-1
@@ -49,7 +49,6 @@ public class ShadowMuteCommand {
|
|||||||
|
|
||||||
user.sendMessage(Identity.nil(), message);
|
user.sendMessage(Identity.nil(), message);
|
||||||
} else {
|
} else {
|
||||||
// TODO: schedule task because LuckPerms doesn't like sync offline permission checks
|
|
||||||
final String format;
|
final String format;
|
||||||
|
|
||||||
if (target.hasPermission("carbonchat.mute.exempt")) {
|
if (target.hasPermission("carbonchat.mute.exempt")) {
|
||||||
|
|||||||
Reference in new issue
Block a user