mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +00:00
Add cancel config
This commit is contained in:
1 parent
889e4f9fd6
commit
922c6960d5
4 files changed
+14
No files matched your search
@@ -105,4 +105,6 @@ public abstract class ChatChannel {
|
|||||||
|
|
||||||
public String processPlaceholders(ChatUser user, String input) { return input; }
|
public String processPlaceholders(ChatUser user, String input) { return input; }
|
||||||
|
|
||||||
|
public abstract boolean isCanceled();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -437,4 +437,8 @@ public class CarbonChatChannel extends ChatChannel {
|
|||||||
return aliases;
|
return aliases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCanceled() {
|
||||||
|
return getBoolean("cancel");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,9 @@ public class BukkitChatListener implements Listener {
|
|||||||
ChatUser user = carbonChat.getUserService().wrap(event.getPlayer());
|
ChatUser user = carbonChat.getUserService().wrap(event.getPlayer());
|
||||||
ChatChannel channel = user.getSelectedChannel();
|
ChatChannel channel = user.getSelectedChannel();
|
||||||
|
|
||||||
|
if (channel.isCanceled()) event.setCancelled(true);
|
||||||
|
carbonChat.getLogger().info(String.format("Message sent, canceled: %s", event.isCancelled()));
|
||||||
|
|
||||||
for (ChatChannel entry : carbonChat.getChannelManager().getRegistry().values()) {
|
for (ChatChannel entry : carbonChat.getChannelManager().getRegistry().values()) {
|
||||||
if (entry.getMessagePrefix() == null) {
|
if (entry.getMessagePrefix() == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ default:
|
|||||||
primary-group-only: true
|
primary-group-only: true
|
||||||
# The name of the vault group which should be considered as the default group.
|
# The name of the vault group which should be considered as the default group.
|
||||||
default-group: 'default'
|
default-group: 'default'
|
||||||
|
# For plugin compatibility. If true, all chat messages sent will be "canceled".
|
||||||
|
# The messages will still go through, however other plugins should assume they didn't.
|
||||||
|
# As such, setting this on private channels is recommended.
|
||||||
|
# For example, use this if DiscordSRV is sending messages when you don't want it to.
|
||||||
|
cancel: false
|
||||||
|
|
||||||
channels:
|
channels:
|
||||||
global:
|
global:
|
||||||
|
|||||||
Reference in new issue
Block a user