This commit is contained in:
JaTiTV 2024-07-04 00:46:30 +02:00
parent 09c81238c7
commit a89cdb837d
2 changed files with 104 additions and 28 deletions

View File

@ -25,8 +25,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
<plugin>
@ -84,7 +84,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>16.7</version>
<classifier>dev-3</classifier>
<classifier>dev-6</classifier>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->

View File

@ -6,51 +6,123 @@ import net.t2code.opsecurity.system.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
import net.t2code.t2codelib.T2CLanguageEnum;
import net.t2code.t2codelib.T2CconfigItem;
import net.t2code.opsecurity.Util;
import org.bukkit.Sound;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
public class Config {
public enum VALUES implements T2CconfigItem {
language("plugin.language", "english", true,"Here you can set the language of the plugin."),
onlyOPcanUseThePlugin("plugin.onlyOPcanUseThePlugin", true, true, "Here you can specify that only players with OP can use the commands of the plugin."),
language("plugin.language", "english", true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Here you can set the language of the plugin."));
put(T2CLanguageEnum.german, List.of());
}}),
onlyOPcanUseThePlugin("plugin.onlyOPcanUseThePlugin", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Here you can specify that only players with OP can use the commands of the plugin."));
put(T2CLanguageEnum.german, List.of());
}}),
updateCheckOnJoin("plugin.updateCheck.onJoin",true,true, "In this option you can set if players with the permission 't2c.opsecurity.updatemsg' will get an update message on join when an update for the plugin is available."),
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates",true,true,"In this option you can set whether you want to receive and display beta and snapshot versions in the update check."),
updateCheckTimeInterval("plugin.updateCheck.timeInterval",60,true,"In this option you can set the time interval in minutes in which updates should be checked."),
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("In this option you can set if players with the permission 't2c.opsecurity.updatemsg' will get an update message on join when an update for the plugin is available."));
put(T2CLanguageEnum.german, List.of());
}}),
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
put(T2CLanguageEnum.german, List.of());
}}),
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
put(T2CLanguageEnum.german, List.of());
}}),
checkOnJoin("check.onJoin.enable", true, true, "Activate the checks whether the player is authorised when joining the player."),
checkOnInteract("check.onInteract.enable", true, true,"Activate the checks whether the player is authorised for player interactions."),
checkOnCommand("check.onCommand.enable", true, true,"Activate the checks whether the player is authorised when the player executes a command."),
checkOnCommandWhitelist("check.onCommand.whitelist", Arrays.asList("command 1","command 2"), true, "Here you can specify commands for which the check is not carried out."),
checkOnChat("check.onChat.enable", true, true,"Activate the checks whether the player is authorised when the player writes a chat message." ),
checkTimerEnable("check.timer.enable", true, true, "Activate the check of all players in a time interval."),
checkTimerRefreshInSec("check.timer.refreshInSec", 60, true,"Here you set the seconds with which the check is carried out in a time interval."),
kickCustomCommand("kick.customCommand.enable", false,true, "Should a separate kick command be used for the kick? For example, if you use your own ban system."),
kickCommand("kick.customCommand.command", "minecraft:kick [player] [reason]", true, "This is where you set the user-defined kick command."),
notifyJoinWarning("notify.warn.enable", true, true, "Should players with the permission 't2c.opsecurity.notify' be warned if a player is detected who is not authorised to be on the server with OP / a permission."),
notifyBungee("notify.allBungeePlayer.enable", false, true, "Should the warnings be sent on the entire network (true) or only on the individual server (false)."),
notifySoundEnable("notify.soundEnable", true, true, "Should a sound be played during the warnings?"),
notifySoundValue("notify.sound", sound(), true, "Which sound should be played during the warnings?"),
checkOnJoin("check.onJoin.enable", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Activate the checks whether the player is authorised when joining the player."));
put(T2CLanguageEnum.german, List.of());
}}),
checkOnInteract("check.onInteract.enable", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Activate the checks whether the player is authorised for player interactions."));
put(T2CLanguageEnum.german, List.of());
}}),
checkOnCommand("check.onCommand.enable", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Activate the checks whether the player is authorised when the player executes a command."));
put(T2CLanguageEnum.german, List.of());
}}),
checkOnCommandWhitelist("check.onCommand.whitelist", List.of("command 1", "command 2"), true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Here you can specify commands for which the check is not carried out."));
put(T2CLanguageEnum.german, List.of());
}}),
checkOnChat("check.onChat.enable", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Activate the checks whether the player is authorised when the player writes a chat message."));
put(T2CLanguageEnum.german, List.of());
}}),
checkTimerEnable("check.timer.enable", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Activate the check of all players in a time interval."));
put(T2CLanguageEnum.german, List.of());
}}),
checkTimerRefreshInSec("check.timer.refreshInSec", 60, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Here you set the seconds with which the check is carried out in a time interval."));
put(T2CLanguageEnum.german, List.of());
}}),
kickCustomCommand("kick.customCommand.enable", false, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Should a separate kick command be used for the kick? For example, if you use your own ban system."));
put(T2CLanguageEnum.german, List.of());
}}),
kickCommand("kick.customCommand.command", "minecraft:kick [player] [reason]", true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("This is where you set the user-defined kick command."));
put(T2CLanguageEnum.german, List.of());
}}),
notifyJoinWarning("notify.warn.enable", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Should players with the permission 't2c.opsecurity.notify' be warned if a player is detected who is not authorised to be on the server with OP / a permission."));
put(T2CLanguageEnum.german, List.of());
}}),
notifyBungee("notify.allBungeePlayer.enable", false, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Should the warnings be sent on the entire network (true) or only on the individual server (false)."));
put(T2CLanguageEnum.german, List.of());
}}),
notifySoundEnable("notify.soundEnable", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Should a sound be played during the warnings?"));
put(T2CLanguageEnum.german, List.of());
}}),
notifySoundValue("notify.sound", sound(), true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("Which sound should be played during the warnings?"));
put(T2CLanguageEnum.german, List.of());
}}),
;
private final String path;
private Object value;
private final boolean forceSet;
private final List<String> comments;
private final HashMap<T2CLanguageEnum, List<String>> comments;
VALUES(String path, Object value,boolean forceSet, String... comments) {
VALUES(String path, Object value, boolean forceSet, HashMap<T2CLanguageEnum, List<String>> comments) {
this.path = path;
this.value = value;
this.forceSet = forceSet;
this.comments = new ArrayList<>(Arrays.asList(comments));
this.comments = comments;
}
@Override
@ -69,10 +141,15 @@ public class Config {
}
@Override
public List<String> getComments() {
public HashMap<T2CLanguageEnum, List<String>> getComments() {
return comments;
}
@Override
public String getLanguagePath() {
return language.path;
}
@Override
public void setValue(Object newValue) {
value = newValue;
@ -80,7 +157,6 @@ public class Config {
}
public static void set() {
long long_ = System.currentTimeMillis();
T2CconfigWriter.createConfig(new File(Main.getPath(), "config.yml"), VALUES.values(), Util.getConfigLogo());