mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 14:38:49 +00:00
Improve / fix ignorable setting, fixes #33
This commit is contained in:
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 {
|
||||
|
||||
@@ -16,6 +16,7 @@ default:
|
||||
toggle-other-on: '<gray><player> <reset><gray>can now see <color><channel> <gray>chat!'
|
||||
toggle-other-off: '<gray><player> <reset><gray>can no longer see <color><channel> <gray>chat!'
|
||||
cannot-use-channel: 'You cannot use that channel!'
|
||||
cannot-ignore-message: '<red>You cannot ignore that channel!'
|
||||
formats:
|
||||
# Placeholders: <username>, <displayname>, <channel>, <server>, <message>, <primaryrole>, <color>
|
||||
# Also supports PlaceholderAPI
|
||||
|
||||
Reference in new issue
Block a user