mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-15 20:16:34 +00:00
moved post targets to an enum, in order to have more type safety, this might be changed in the future
added validation check when a feature is enabled, in order to notify which configuration is missing for this feature to function properly
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package dev.sheldan.abstracto.modmail.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ModMailFeature implements FeatureConfig {
|
||||
|
||||
@Autowired
|
||||
private ModMailLoggingFeature modMailLoggingFeature;
|
||||
|
||||
@Override
|
||||
public FeatureEnum getFeature() {
|
||||
return ModMailFeatures.MOD_MAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeatureConfig> getDependantFeatures() {
|
||||
return Arrays.asList(modMailLoggingFeature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||
return Arrays.asList(ModMailPostTargets.MOD_MAIL_PING);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package dev.sheldan.abstracto.modmail.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
|
||||
public enum ModMailFeatures implements FeatureEnum {
|
||||
MOD_MAIL("modmail"), MOD_MAIL_LOGGING("modmail_logging");
|
||||
|
||||
private String key;
|
||||
|
||||
ModMailFeatures(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package dev.sheldan.abstracto.modmail.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ModMailLoggingFeature implements FeatureConfig {
|
||||
|
||||
@Autowired
|
||||
private ModMailFeature modMailFeature;
|
||||
|
||||
@Override
|
||||
public FeatureEnum getFeature() {
|
||||
return ModMailFeatures.MOD_MAIL_LOGGING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FeatureConfig> getRequiredFeatures() {
|
||||
return Arrays.asList(modMailFeature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||
return Arrays.asList(ModMailPostTargets.MOD_MAIL_LOG);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sheldan.abstracto.modmail.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ModMailPostTargets implements PostTargetEnum {
|
||||
MOD_MAIL_PING("modmailPing"), MOD_MAIL_LOG("modmailLog");
|
||||
|
||||
private String key;
|
||||
|
||||
ModMailPostTargets(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package dev.sheldan.abstracto.modmail.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:config/modmail.properties")
|
||||
public class ModMailProperties {
|
||||
}
|
||||
Reference in New Issue
Block a user