Add support for custom channel aliases and improve string formatting consistency

This commit is contained in:
2025-07-29 19:11:14 +02:00
parent eb30750134
commit 3bfd358e78
3 changed files with 117 additions and 62 deletions
@@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ChatChannel extends BukkitCommand {
@@ -28,7 +27,7 @@ public class ChatChannel extends BukkitCommand {
this.command = channel.getChannelName().toLowerCase();
this.description = "Chat channel named " + channel.getChannelName() + ".";
this.usageMessage = "/" + command + " <message>";
this.setAliases(Collections.emptyList());
this.setAliases(channel.getAliases());
activeCommands.add(this);
this.toggleableForCustomChannel = new ToggleableForCustomChannel(channel);
}
@@ -43,7 +42,7 @@ public class ChatChannel extends BukkitCommand {
player.sendRichMessage(Config.CUSTOM_CHANNEL_TOGGLED, TagResolver.resolver(
Placeholder.unparsed("channel", channel.getChannelName()),
Placeholder.component("status", toggleableForCustomChannel.toggle(player.getUniqueId())
? Config.TOGGLED_ON : Config.TOGGLED_OFF)));
? Config.TOGGLED_ON : Config.TOGGLED_OFF)));
return false;
}