Fix format getting and message parsing

This commit is contained in:
Draycia committed 2020-09-27 00:12:45 -07:00
1 parent 901e243d1e
commit c79c1bcbee
2 files changed
+16 -3

No files matched your search

@@ -81,10 +81,23 @@ public class ChannelOptions {
return this.contexts;
}
@Nullable
public String format(final String key) {
if (this.formats == null) {
return this.defaultOptions().formats().get(key);
}
final String format = this.formats.get(key);
if (format != null) {
return format;
}
return this.defaultOptions().formats().get(key);
}
@Nullable
public Map<String, String> formats() {
// TODO: properly implement default format inheritence
// TODO: perhaps add an option to make it so overriding any format overrides all?
if (this.formats == null) {
return this.defaultOptions().formats();
}
@@ -304,7 +304,7 @@ public class CarbonChatChannel implements ChatChannel {
@Override
@Nullable
public String format(final @NonNull String group) {
return this.options().formats().get("formats." + group);
return this.options().format(group);
}
private boolean isUserSpying(final @NonNull ChatUser sender, final @NonNull ChatUser target) {