mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
added config option and fixed issues. should be ready to merge
This commit is contained in:
1 parent
90ef438ea9
commit
15c445ee91
5 files changed
+29
-5
No files matched your search
@@ -103,6 +103,11 @@ public final class BasicChatChannel implements ChatChannel {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean emptyRadiusRecipientsMessage() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelPermissionResult speechPermitted(final CarbonPlayer carbonPlayer) {
|
||||
return ChannelPermissionResult.allowed();
|
||||
|
||||
@@ -110,6 +110,12 @@ public final class ConfigChatChannel implements ChatChannel {
|
||||
""")
|
||||
private int radius = -1;
|
||||
|
||||
@Comment("""
|
||||
If true, players will be able to see if they're not sending messages to anyone
|
||||
because they're out of range from the radius.
|
||||
""")
|
||||
private boolean emptyRadiusRecipientsMessage = true;
|
||||
|
||||
private transient @Nullable ConfigChannelMessages messageService = null;
|
||||
|
||||
@Override
|
||||
@@ -290,6 +296,11 @@ public final class ConfigChatChannel implements ChatChannel {
|
||||
return this.radius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean emptyRadiusRecipientsMessage() {
|
||||
return this.emptyRadiusRecipientsMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (!(other instanceof BasicChatChannel otherChannel)) return false;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RadiusListener {
|
||||
final CarbonMessages carbonMessages
|
||||
) {
|
||||
carbonChat.eventHandler().subscribe(CarbonChatEvent.class, 0, false, event -> {
|
||||
if (event.chatChannel() == null) {
|
||||
if (event.chatChannel() == null || event.previewing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ public class RadiusListener {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
if (event.recipients().size() > 1) return;
|
||||
|
||||
carbonMessages.emptyRecipients(event.sender());
|
||||
if (event.recipients().size() <= 2 && event.chatChannel().emptyRadiusRecipientsMessage()) { // the player and cosole
|
||||
carbonMessages.emptyRecipients(event.sender());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user