feat: discord format

This commit is contained in:
DaRacci committed 2022-10-23 21:05:42 +11:00
1 parent cb95886a99
commit dac67eaac3
6 files changed
+112 -1

No files matched your search

@@ -24,6 +24,7 @@ import com.google.inject.Singleton;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import net.draycia.carbon.api.CarbonChat;
import net.draycia.carbon.api.channels.ChatChannel;
@@ -140,4 +141,19 @@ public final class BasicChatChannel implements ChatChannel {
return this.key;
}
@Override
public boolean equals(final Object other) {
if (!(other instanceof BasicChatChannel otherChannel)) return false;
if (!(otherChannel.commandName().equals(this.commandName()))) return false;
if (!(Objects.equals(otherChannel.quickPrefix(), this.quickPrefix()))) return false;
if (!(Objects.equals(otherChannel.permission(), this.permission()))) return false;
if (otherChannel.radius() != this.radius()) return false;
return otherChannel.key().equals(this.key());
}
@Override
public int hashCode() {
return Objects.hash(this.commandName(), this.quickPrefix(), this.permission(), this.radius(), this.key());
}
}
@@ -290,4 +290,19 @@ public final class ConfigChatChannel implements ChatChannel {
return this.radius;
}
@Override
public boolean equals(final Object other) {
if (!(other instanceof BasicChatChannel otherChannel)) return false;
if (!(otherChannel.commandName().equals(this.commandName()))) return false;
if (!(Objects.equals(otherChannel.quickPrefix(), this.quickPrefix()))) return false;
if (!(Objects.equals(otherChannel.permission(), this.permission()))) return false;
if (otherChannel.radius() != this.radius()) return false;
return otherChannel.key().equals(this.key());
}
@Override
public int hashCode() {
return Objects.hash(this.commandName(), this.quickPrefix(), this.permission(), this.radius(), this.key());
}
}
@@ -44,6 +44,7 @@ public class ConfigChannelMessageSource implements IMessageSource<SourcedAudienc
Basic chat formats.
The "default_format" format is the main one you want to edit.
The "console" format is what's shown to console.
The "discord" format is what's shown to supported discord integrations.
If PlaceholderAPI is installed, PAPI placeholders (with %) are supported.
The keys are group names, the values are chat formats (MiniMessage).
For example:
@@ -51,6 +52,7 @@ public class ConfigChannelMessageSource implements IMessageSource<SourcedAudienc
default_format="<<username>> <message>"
vip="[VIP] <<username>> <message>"
admin="<white>[</white>Prefix<white>]</white> <display_name><white>: <message></white>"
discord="<<username>> <message>"
}
""")
private Map<String, String> defaults = Map.of(
@@ -351,4 +351,16 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
return this.uuid;
}
@Override
public boolean equals(final @Nullable Object other) {
if (other == null || this.getClass() != other.getClass()) return false;
return this.uuid.equals(((CarbonPlayerCommon) other).uuid);
}
@Override
public int hashCode() {
return this.uuid.hashCode();
}
}