Improve / fix ignorable setting, fixes #33

This commit is contained in:
Draycia committed 2020-08-25 00:07:34 -07:00
1 parent 92505974d7
commit a8e3267be4
4 files changed
+15 -1

No files matched your search

@@ -56,6 +56,8 @@ public abstract class ChatChannel implements ForwardingAudience {
public abstract String getSwitchFailureMessage();
public abstract String getCannotIgnoreMessage();
/**
* @return The message to be send to the player when toggling this channel off.
*/
@@ -45,6 +45,10 @@ public class CarbonChatChannel extends ChatChannel {
@Override
public Boolean canPlayerUse(ChatUser user) {
if (user.getChannelSettings(this).isIgnored()) {
return false;
}
return user.asPlayer().hasPermission("carbonchat.channels." + getName() + ".use");
}
@@ -402,6 +406,11 @@ public class CarbonChatChannel extends ChatChannel {
return getString("switch-failure-message");
}
@Override
public String getCannotIgnoreMessage() {
return getString("cannot-ignore-message");
}
@Override
public String getToggleOffMessage() {
return getString("toggle-off-message");
@@ -26,7 +26,9 @@ public class ToggleCommand extends BaseCommand {
UserChannelSettings settings = user.getChannelSettings(channel);
if (settings.isIgnored()) {
if (!channel.isIgnorable()) {
message = channel.getCannotIgnoreMessage();
} else if (settings.isIgnored()) {
settings.setIgnoring(false);
message = channel.getToggleOffMessage();
} else {