Closer to compilation

This commit is contained in:
Draycia committed 2020-09-25 01:45:35 -07:00
1 parent 8db4b9532c
commit 18c6fd7e2b
19 files changed
+379 -318

No files matched your search

@@ -4,6 +4,7 @@ import net.draycia.carbon.api.adventure.CarbonTranslations;
import net.draycia.carbon.api.adventure.MessageProcessor;
import net.draycia.carbon.api.channels.ChannelRegistry;
import net.draycia.carbon.api.commands.settings.CommandSettingsRegistry;
import net.draycia.carbon.api.config.CarbonSettings;
import net.draycia.carbon.api.config.ModerationSettings;
import net.draycia.carbon.api.messaging.MessageService;
import net.draycia.carbon.api.users.ChatUser;
@@ -20,7 +21,7 @@ public interface CarbonChat {
LegacyComponentSerializer.builder()
.extractUrls()
.hexColors()
.character('§')
.character(LegacyComponentSerializer.SECTION_CHAR)
.useUnusualXRepeatedCharacterHexFormat()
.build();
@@ -36,6 +37,8 @@ public interface CarbonChat {
@NonNull MessageService messageService();
@NonNull CarbonSettings carbonSettings();
@NonNull ChannelRegistry channelRegistry();
@NonNull CommandSettingsRegistry commandSettingsRegistry();
@@ -70,7 +70,7 @@ public interface ChatChannel extends ForwardingAudience {
@Nullable String messagePrefix();
@Nullable String aliases();
@Nullable List<String> aliases();
@Nullable String switchMessage();
@@ -4,7 +4,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import org.spongepowered.configurate.objectmapping.Setting;
import org.spongepowered.configurate.serialize.ConfigSerializable;
import java.util.List;
import java.util.Set;
@ConfigSerializable
@@ -0,0 +1,52 @@
package net.draycia.carbon.api.config;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import java.util.Map;
public class CarbonSettings {
private @NonNull String spyPrefix;
private @NonNull String serverName;
private boolean showTips;
private @NonNull List<@NonNull ChannelSettings> channelSettings;
private @Nullable StorageType storageType;
private @NonNull SQLCredentials sqlCredentials;
private @NonNull Map<@Nullable String, @NonNull String> customPlaceholders;
public @NonNull String spyPrefix() {
return this.spyPrefix;
}
public @NonNull String serverName() {
return this.serverName;
}
public boolean showTips() {
return this.showTips;
}
public @NonNull List<@NonNull ChannelSettings> channelSettings() {
return this.channelSettings;
}
public @Nullable StorageType storageType() {
return this.storageType;
}
public SQLCredentials sqlCredentials() {
return this.sqlCredentials;
}
public Map<String, String> customPlaceholders() {
return this.customPlaceholders;
}
public enum StorageType {
MYSQL,
JSON
}
}
@@ -0,0 +1,167 @@
package net.draycia.carbon.api.config;
import net.draycia.carbon.api.Context;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public class ChannelSettings {
private String key;
private String color;
private Map<String, Context> contexts;
private Map<String, String> formats;
private String defaultFormatName;
private boolean isDefault;
private boolean ignorable;
private boolean crossServer;
private boolean honorsRecipientList;
private boolean permissionGroupMatching;
private List<String> groupOverrides;
private String name;
private String messagePrefix;
private String switchMessage;
private List<Pattern> itemLinkPatterns;
private String switchOtherMessage;
private List<String> aliases;
private boolean shouldCancelChatEvent;
private boolean primaryGroupOnly;
private String cannotUseMessage;
private String toggleOtherOffMessage;
private String toggleOtherOnMessage;
private String toggleOnMessage;
private String toggleOffMessage;
private String cannotIgnoreMessage;
private String switchFailureMessage;
@NonNull
public String key() {
return this.key;
}
@Nullable
public String color() {
return this.color;
}
@Nullable
public Map<String, Context> contexts() {
return this.contexts;
}
@Nullable
public Map<String, String> formats() {
return this.formats;
}
@Nullable
public String defaultFormatName() {
return this.defaultFormatName;
}
public boolean isDefault() {
return this.isDefault;
}
public boolean ignorable() {
return this.ignorable;
}
public boolean crossServer() {
return this.crossServer;
}
public boolean honorsRecipientList() {
return this.honorsRecipientList;
}
public boolean permissionGroupMatching() {
return this.permissionGroupMatching;
}
@NonNull
public List<@NonNull String> groupOverrides() {
return this.groupOverrides;
}
@NonNull
public String name() {
if (this.name == null) {
return this.key;
}
return this.name;
}
@Nullable
public String messagePrefix() {
return this.messagePrefix;
}
@Nullable
public String switchMessage() {
return this.switchMessage;
}
@Nullable
public String switchOtherMessage() {
return this.switchOtherMessage;
}
@Nullable
public String switchFailureMessage() {
return this.switchFailureMessage;
}
@Nullable
public String cannotIgnoreMessage() {
return this.cannotIgnoreMessage;
}
@Nullable
public String toggleOffMessage() {
return this.toggleOffMessage;
}
@Nullable
public String toggleOnMessage() {
return this.toggleOnMessage;
}
@Nullable
public String toggleOtherOnMessage() {
return this.toggleOtherOnMessage;
}
@Nullable
public String toggleOtherOffMessage() {
return this.toggleOtherOffMessage;
}
@Nullable
public String cannotUseMessage() {
return this.cannotUseMessage;
}
public boolean primaryGroupOnly() {
return this.primaryGroupOnly;
}
public boolean shouldCancelChatEvent() {
return this.shouldCancelChatEvent;
}
@NonNull
public List<@NonNull Pattern> itemLinkPatterns() {
return this.itemLinkPatterns;
}
@Nullable
public List<String> aliases() {
return this.aliases;
}
}
@@ -0,0 +1,42 @@
package net.draycia.carbon.api.config;
import org.checkerframework.checker.nullness.qual.NonNull;
public class SQLCredentials {
private final @NonNull String username;
private final @NonNull String password;
private final @NonNull String database;
private final @NonNull String host;
private final int port;
public SQLCredentials(final @NonNull String username, final @NonNull String password,
final @NonNull String database, final @NonNull String host, final int port) {
this.username = username;
this.password = password;
this.database = database;
this.host = host;
this.port = port;
}
public @NonNull String username() {
return this.username;
}
public @NonNull String password() {
return this.password;
}
public @NonNull String database() {
return this.database;
}
public @NonNull String host() {
return this.host;
}
public int port() {
return this.port;
}
}