code changes
Descriptions adapted API changes java update to java 11
This commit is contained in:
parent
a89cdb837d
commit
75edfe88d5
@ -25,8 +25,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>9</source>
|
<source>11</source>
|
||||||
<target>9</target>
|
<target>11</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -60,10 +60,6 @@
|
|||||||
<id>spigotmc-repo</id>
|
<id>spigotmc-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>sonatype</id>
|
|
||||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
|
||||||
</repository>
|
|
||||||
<!-- t2code -->
|
<!-- t2code -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>T2Code</id>
|
<id>T2Code</id>
|
||||||
@ -76,7 +72,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- t2code -->
|
<!-- t2code -->
|
||||||
@ -84,15 +80,16 @@
|
|||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>16.7</version>
|
<version>16.7</version>
|
||||||
<classifier>dev-6</classifier>
|
<classifier>dev-11</classifier>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.24</version>
|
<version>1.18.30</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -2,6 +2,9 @@ package net.t2code.opsecurity;
|
|||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -28,22 +31,9 @@ public class Util {
|
|||||||
@Getter
|
@Getter
|
||||||
private static String discord = "http://dc.t2code.net";
|
private static String discord = "http://dc.t2code.net";
|
||||||
|
|
||||||
@Getter
|
public static String[] getConfigLogo() {
|
||||||
private static final String[] configLogo = new String[]{
|
ArrayList<String> arrayList = new ArrayList<>(net.t2code.t2codelib.Util.getConfigT2CodeLogo());
|
||||||
"####################################################################################################################",
|
arrayList.addAll(Arrays.asList("", "# Spigot: " + spigot));
|
||||||
"## ##",
|
return arrayList.toArray(new String[0]);
|
||||||
"## /$$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ ##",
|
}
|
||||||
"## |__ $$__//$$__ $$ /$$__ $$ | $$ | $$ ##",
|
|
||||||
"## | $$ |__/ \\ $$| $$ \\__/ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ ##",
|
|
||||||
"## | $$ /$$$$$$/| $$ /$$__ $$ /$$__ $$ /$$__ $$ | $$__ $$ /$$__ $$|_ $$_/ ##",
|
|
||||||
"## | $$ /$$____/ | $$ | $$ \\ $$| $$ | $$| $$$$$$$$ | $$ \\ $$| $$$$$$$$ | $$ ##",
|
|
||||||
"## | $$ | $$ | $$ $$| $$ | $$| $$ | $$| $$_____/ | $$ | $$| $$_____/ | $$ /$$ ##",
|
|
||||||
"## | $$ | $$$$$$$$| $$$$$$/| $$$$$$/| $$$$$$$| $$$$$$$ /$$| $$ | $$| $$$$$$$ | $$$$/ ##",
|
|
||||||
"## |__/ |________/ \\______/ \\______/ \\_______/ \\_______/|__/|__/ |__/ \\_______/ \\___/ ##",
|
|
||||||
"## ##",
|
|
||||||
"## T2CodeLib from JaTiTV / T2Code.net. In case of problems please contact the Discord: https://dc.t2code.net ##",
|
|
||||||
"## ##",
|
|
||||||
"####################################################################################################################"};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package net.t2code.opsecurity.check;
|
package net.t2code.opsecurity.check;
|
||||||
|
|
||||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
|
||||||
import net.t2code.opsecurity.config.config.Config;
|
import net.t2code.opsecurity.config.config.Config;
|
||||||
import net.t2code.opsecurity.config.language.Language;
|
import net.t2code.opsecurity.config.language.Languages;
|
||||||
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
||||||
import net.t2code.opsecurity.events.Events;
|
import net.t2code.opsecurity.events.Events;
|
||||||
import net.t2code.opsecurity.objects.PlayerCache;
|
import net.t2code.opsecurity.objects.PlayerCache;
|
||||||
@ -24,7 +23,7 @@ public class OpCheck {
|
|||||||
if (!(boolean) OPWhitelist.VALUES.enable.getValue()) return false;
|
if (!(boolean) OPWhitelist.VALUES.enable.getValue()) return false;
|
||||||
if (!player.isOp()) return false;
|
if (!player.isOp()) return false;
|
||||||
if (opWhitelist(player, debug)) return false;
|
if (opWhitelist(player, debug)) return false;
|
||||||
if (join) T2Csend.console(Language.opWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
if (join) T2Csend.console(Languages.VALUES.opWhitelistNotifyOnJoin.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
Bukkit.getScheduler().runTask(Main.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTask(Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -37,9 +36,9 @@ public class OpCheck {
|
|||||||
private static void execute(Player player, Boolean join, String debug) {
|
private static void execute(Player player, Boolean join, String debug) {
|
||||||
if ((boolean)Config.VALUES.notifyJoinWarning.getValue() && join) {
|
if ((boolean)Config.VALUES.notifyJoinWarning.getValue() && join) {
|
||||||
if ((boolean)Config.VALUES.notifyBungee.getValue()) {
|
if ((boolean)Config.VALUES.notifyBungee.getValue()) {
|
||||||
BungeeSenderReceiver.sendToBungee(Language.opWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
BungeeSenderReceiver.sendToBungee(Languages.VALUES.opWhitelistNotifyOnJoin.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
} else
|
} else
|
||||||
Events.notifyPlayer(Language.opWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
Events.notifyPlayer(Languages.VALUES.opWhitelistNotifyOnJoin.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((boolean)OPWhitelist.VALUES.noOpPlayerSetGameModeEnable.getValue()) {
|
if ((boolean)OPWhitelist.VALUES.noOpPlayerSetGameModeEnable.getValue()) {
|
||||||
@ -51,25 +50,25 @@ public class OpCheck {
|
|||||||
if ((boolean)OPWhitelist.VALUES.noOpPlayerKickEnable.getValue()) {
|
if ((boolean)OPWhitelist.VALUES.noOpPlayerKickEnable.getValue()) {
|
||||||
if (!(boolean)OPWhitelist.VALUES.customCommandsEnable.getValue()) {
|
if (!(boolean)OPWhitelist.VALUES.customCommandsEnable.getValue()) {
|
||||||
if ((boolean) Config.VALUES.kickCustomCommand.getValue()) {
|
if ((boolean) Config.VALUES.kickCustomCommand.getValue()) {
|
||||||
T2Ccmd.console( Config.VALUES.kickCommand.getValue().toString().replace("[player]", player.getName()).replace("[reason]",
|
T2Ccmd.console( Config.VALUES.kickCommand.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[reason]",
|
||||||
(boolean)OPWhitelist.VALUES.noOpPlayerKickEnable.getValue() && (boolean)OPWhitelist.VALUES.noOpPlayerDeopEnable.getValue() && (boolean)OPWhitelist.VALUES.noOpPlayerDeopPlayerSendMessage.getValue()
|
(boolean)OPWhitelist.VALUES.noOpPlayerKickEnable.getValue() && (boolean)OPWhitelist.VALUES.noOpPlayerDeopEnable.getValue() && (boolean)OPWhitelist.VALUES.noOpPlayerDeopPlayerSendMessage.getValue()
|
||||||
? Language.opWhitelistKick.value + "<br> <br>" + Language.opWhitelistDeop.value : Language.opWhitelistKick.value));
|
? Languages.VALUES.opWhitelistKick.getValue().toString() + "<br> <br>" + Languages.VALUES.opWhitelistDeop.getValue().toString() : Languages.VALUES.opWhitelistKick.getValue().toString()));
|
||||||
} else player.kickPlayer((boolean)OPWhitelist.VALUES.noOpPlayerDeopEnable.getValue() && (boolean)OPWhitelist.VALUES.noOpPlayerDeopPlayerSendMessage.getValue()
|
} else player.kickPlayer((boolean)OPWhitelist.VALUES.noOpPlayerDeopEnable.getValue() && (boolean)OPWhitelist.VALUES.noOpPlayerDeopPlayerSendMessage.getValue()
|
||||||
? Language.opWhitelistKick.value + "\n \n" + Language.opWhitelistDeop.value : Language.opWhitelistKick.value);
|
? Languages.VALUES.opWhitelistKick.getValue() + "\n \n" + Languages.VALUES.opWhitelistDeop.getValue() : Languages.VALUES.opWhitelistKick.getValue().toString());
|
||||||
}
|
}
|
||||||
T2Csend.console("["+debug+ "]" +Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName().replace("[uuid]", String.valueOf(player.getUniqueId()))) + "<br>"
|
T2Csend.console("["+debug+ "]" + Languages.VALUES.opWhitelistNotifyDeop.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())) + "<br>"
|
||||||
+ Language.opWhitelistNotifyKick.value.replace("[player]", player.getName().replace("[uuid]", String.valueOf(player.getUniqueId()))).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
+ Languages.VALUES.opWhitelistNotifyKick.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
Events.notifyPlayer(Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName()) + "<br>"
|
Events.notifyPlayer(Languages.VALUES.opWhitelistNotifyDeop.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()) + "<br>"
|
||||||
+ Language.opWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
+ Languages.VALUES.opWhitelistNotifyKick.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
} else {
|
} else {
|
||||||
T2Csend.console("["+debug+ "]" +Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
T2Csend.console("["+debug+ "]" + Languages.VALUES.opWhitelistNotifyDeop.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
Events.notifyPlayer(Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
Events.notifyPlayer(Languages.VALUES.opWhitelistNotifyDeop.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
|
|
||||||
if ((boolean)OPWhitelist.VALUES.noOpPlayerDeopPlayerSendMessage.getValue()) {
|
if ((boolean)OPWhitelist.VALUES.noOpPlayerDeopPlayerSendMessage.getValue()) {
|
||||||
Bukkit.getScheduler().runTaskLater(Main.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskLater(Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
T2Csend.player(player, Language.opWhitelistDeop.value);
|
T2Csend.player(player, Languages.VALUES.opWhitelistDeop.getValue().toString());
|
||||||
}
|
}
|
||||||
}, 5L);
|
}, 5L);
|
||||||
}
|
}
|
||||||
@ -79,16 +78,16 @@ public class OpCheck {
|
|||||||
if (!(boolean)OPWhitelist.VALUES.noOpPlayerDeopEnable.getValue()) {
|
if (!(boolean)OPWhitelist.VALUES.noOpPlayerDeopEnable.getValue()) {
|
||||||
if (!(boolean)OPWhitelist.VALUES.customCommandsEnable.getValue()) {
|
if (!(boolean)OPWhitelist.VALUES.customCommandsEnable.getValue()) {
|
||||||
if ((boolean)Config.VALUES.kickCustomCommand.getValue()) {
|
if ((boolean)Config.VALUES.kickCustomCommand.getValue()) {
|
||||||
T2Ccmd.console(Config.VALUES.kickCommand.getValue().toString().replace("[player]", player.getName()).replace("[reason]", Language.opWhitelistKick.value));
|
T2Ccmd.console(Config.VALUES.kickCommand.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[reason]", Languages.VALUES.opWhitelistKick.getValue().toString()));
|
||||||
} else player.kickPlayer(Language.opWhitelistKick.value);
|
} else player.kickPlayer(Languages.VALUES.opWhitelistKick.getValue().toString());
|
||||||
}
|
}
|
||||||
T2Csend.console("["+debug+ "]" +Language.opWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
T2Csend.console("["+debug+ "]" + Languages.VALUES.opWhitelistNotifyKick.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
Events.notifyPlayer(Language.opWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
Events.notifyPlayer(Languages.VALUES.opWhitelistNotifyKick.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((boolean)OPWhitelist.VALUES.customCommandsEnable.getValue()) {
|
if ((boolean)OPWhitelist.VALUES.customCommandsEnable.getValue()) {
|
||||||
for (String cmd : (StringList)OPWhitelist.VALUES.customCommandsCommands.getValue()) {
|
for (String cmd : (List<String>)OPWhitelist.VALUES.customCommandsCommands.getValue()) {
|
||||||
T2Ccmd.console(cmd.replace("[player]", player.getName()));
|
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%",player.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package net.t2code.opsecurity.check;
|
package net.t2code.opsecurity.check;
|
||||||
|
|
||||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
|
||||||
import net.t2code.opsecurity.config.config.Config;
|
import net.t2code.opsecurity.config.config.Config;
|
||||||
import net.t2code.opsecurity.config.language.Language;
|
import net.t2code.opsecurity.config.language.Languages;
|
||||||
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
|
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
|
||||||
import net.t2code.opsecurity.events.Events;
|
import net.t2code.opsecurity.events.Events;
|
||||||
import net.t2code.opsecurity.objects.PlayerCache;
|
import net.t2code.opsecurity.objects.PlayerCache;
|
||||||
@ -15,12 +14,12 @@ import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PermissionCheck {
|
public class PermissionCheck {
|
||||||
public static Boolean onCheck(Player player, Boolean join, String debug) {
|
public static Boolean onCheck(Player player, Boolean join, String debug) {
|
||||||
if (!(boolean) PermissionWhitelist.VALUES.enable.getValue()) return false;
|
for (String perm : (List<String>) PermissionWhitelist.VALUES.permissions.getValue()) {
|
||||||
for (String perm : (StringList) PermissionWhitelist.VALUES.permissions.getValue()) {
|
|
||||||
if (!player.hasPermission(perm)) return false;
|
if (!player.hasPermission(perm)) return false;
|
||||||
T2Cdebug.debug(Main.getPlugin(), "[" + debug + "] check Permission: " + perm);
|
T2Cdebug.debug(Main.getPlugin(), "[" + debug + "] check Permission: " + perm);
|
||||||
if (permWhitelist(player, debug)) return false;
|
if (permWhitelist(player, debug)) return false;
|
||||||
@ -37,24 +36,24 @@ public class PermissionCheck {
|
|||||||
|
|
||||||
private static void execute(Player player, Boolean join, String perm, String debug) {
|
private static void execute(Player player, Boolean join, String perm, String debug) {
|
||||||
if (join)
|
if (join)
|
||||||
T2Csend.console("[" + debug + "]" + Language.permissionWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
T2Csend.console("[" + debug + "]" + Languages.VALUES.permissionWhitelistNotifyKick.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
if ((boolean) Config.VALUES.notifyJoinWarning.getValue() && join) {
|
if ((boolean) Config.VALUES.notifyJoinWarning.getValue() && join) {
|
||||||
if ((boolean) Config.VALUES.notifyBungee.getValue()) {
|
if ((boolean) Config.VALUES.notifyBungee.getValue()) {
|
||||||
BungeeSenderReceiver.sendToBungee(Language.permissionWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
BungeeSenderReceiver.sendToBungee(Languages.VALUES.permissionWhitelistNotifyOnJoin.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
} else
|
} else
|
||||||
Events.notifyPlayer(Language.permissionWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
Events.notifyPlayer(Languages.VALUES.permissionWhitelistNotifyOnJoin.getValue().toString().replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((boolean) PermissionWhitelist.VALUES.playerWithPermissionKick.getValue()) {
|
if ((boolean) PermissionWhitelist.VALUES.playerWithPermissionKick.getValue()) {
|
||||||
if ((boolean) Config.VALUES.kickCustomCommand.getValue()) {
|
if ((boolean) Config.VALUES.kickCustomCommand.getValue()) {
|
||||||
T2Ccmd.console(Config.VALUES.kickCommand.getValue().toString().replace("[perm]", perm).replace("[player]", player.getName()).replace("[reason]", Language.permissionWhitelistKick.value));
|
T2Ccmd.console(Config.VALUES.kickCommand.getValue().toString().replace("[perm]", perm).replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[reason]", Languages.VALUES.permissionWhitelistKick.getValue().toString()));
|
||||||
} else player.kickPlayer(Language.permissionWhitelistKick.value);
|
} else player.kickPlayer(Languages.VALUES.permissionWhitelistKick.getValue().toString());
|
||||||
T2Csend.console("[" + debug + "]" + Language.permissionWhitelistNotifyKick.value.replace("[player]",
|
T2Csend.console("[" + debug + "]" + Languages.VALUES.permissionWhitelistNotifyKick.getValue().toString().replace("[player]",
|
||||||
player.getName()).replace("[perm]", perm).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
player.getName()).replace("[perm]", perm).replace("[uuid]", String.valueOf(player.getUniqueId())));
|
||||||
}
|
}
|
||||||
if ((boolean) PermissionWhitelist.VALUES.customCommandsEnable.getValue()) {
|
if ((boolean) PermissionWhitelist.VALUES.customCommandsEnable.getValue()) {
|
||||||
for (String cmd : (StringList)PermissionWhitelist.VALUES.customCommandsCommands.getValue()) {
|
for (String cmd : (List<String>) PermissionWhitelist.VALUES.customCommandsCommands.getValue()) {
|
||||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[perm]", perm));
|
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%",player.getName()).replace("[perm]", perm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,8 @@ package net.t2code.opsecurity.command;
|
|||||||
|
|
||||||
import net.t2code.opsecurity.Util;
|
import net.t2code.opsecurity.Util;
|
||||||
import net.t2code.opsecurity.check.OpCheck;
|
import net.t2code.opsecurity.check.OpCheck;
|
||||||
import net.t2code.opsecurity.config.FileSelect;
|
|
||||||
import net.t2code.opsecurity.config.config.Config;
|
import net.t2code.opsecurity.config.config.Config;
|
||||||
import net.t2code.opsecurity.config.language.Language;
|
import net.t2code.opsecurity.config.language.Languages;
|
||||||
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
||||||
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
|
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
|
||||||
import net.t2code.opsecurity.system.Main;
|
import net.t2code.opsecurity.system.Main;
|
||||||
@ -20,7 +19,7 @@ public class Commands {
|
|||||||
|
|
||||||
public static void help(CommandSender sender) {
|
public static void help(CommandSender sender) {
|
||||||
if (!sender.hasPermission(Permissions.help)) {
|
if (!sender.hasPermission(Permissions.help)) {
|
||||||
T2Csend.sender(sender, Language.noPermissionForOpSec.value);
|
T2Csend.sender(sender, Languages.VALUES.noPermissionForOpSec.getValue().toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//todo to language file
|
//todo to language file
|
||||||
@ -62,17 +61,17 @@ public class Commands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T2Csend.player(player, Language.reloadStart.value);
|
T2Csend.player(player, Languages.VALUES.reloadStart.getValue().toString());
|
||||||
}
|
}
|
||||||
if (sender instanceof Player) T2Csend.player((Player) sender, Language.reloadEnd.value);
|
if (sender instanceof Player) T2Csend.player((Player) sender, Languages.VALUES.reloadEnd.getValue().toString());
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §6Plugin reload...");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §6Plugin reload...");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
// Load.onLoad(Main.getPlugin(),Main.getAutor(),Main.getVersion());
|
// Load.onLoad(Main.getPlugin(),Main.getAutor(),Main.getVersion());
|
||||||
Config.set();
|
Config.set(false);
|
||||||
FileSelect.selectLanguage();
|
Languages.set(false);
|
||||||
OPWhitelist.set();
|
OPWhitelist.set(false);
|
||||||
PermissionWhitelist.set();
|
PermissionWhitelist.set(false);
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
package net.t2code.opsecurity.config;
|
|
||||||
|
|
||||||
import net.t2code.opsecurity.Util;
|
|
||||||
import net.t2code.opsecurity.config.config.Config;
|
|
||||||
import net.t2code.opsecurity.config.language.Language;
|
|
||||||
import net.t2code.opsecurity.system.Main;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class FileSelect {
|
|
||||||
|
|
||||||
private static ArrayList<String> defaultLanguages = new ArrayList<>(Arrays.asList("german", "english"));
|
|
||||||
|
|
||||||
public static void selectLanguage() {
|
|
||||||
long long_ = System.currentTimeMillis();
|
|
||||||
|
|
||||||
for (String language : defaultLanguages) {
|
|
||||||
File config = new File(Main.getPath(), "languages/" + language + ".yml");
|
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
||||||
for (Language value : Language.values()) {
|
|
||||||
if (!yamlConfiguration.contains(value.path)) {
|
|
||||||
switch (language) {
|
|
||||||
case "german":
|
|
||||||
yamlConfiguration.set(value.path, value.german);
|
|
||||||
break;
|
|
||||||
case "english":
|
|
||||||
yamlConfiguration.set(value.path, value.english);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
T2Cdebug.debug(Main.getPlugin(), "save: " + language);
|
|
||||||
try {
|
|
||||||
yamlConfiguration.save(config);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String selectMSG;
|
|
||||||
File config = new File(Main.getPath(), "languages/" + Config.VALUES.language.getValue() + ".yml");
|
|
||||||
T2Cdebug.debug(Main.getPlugin(), config.getAbsolutePath());
|
|
||||||
if (!config.isFile()) {
|
|
||||||
T2Csend.console(Util.getPrefix());
|
|
||||||
T2Csend.console(Util.getPrefix() + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
T2Csend.console(Util.getPrefix() + " §4The selected §c" + Config.VALUES.language.getValue() + " §4language file was not found.");
|
|
||||||
T2Csend.console(Util.getPrefix() + " §6The default language §eEnglish §6is used!");
|
|
||||||
T2Csend.console(Util.getPrefix() + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
T2Csend.console(Util.getPrefix());
|
|
||||||
config = new File(Main.getPath(), "languages/" + "english.yml");
|
|
||||||
selectMSG = "english";
|
|
||||||
} else selectMSG = Config.VALUES.language.getValue().toString();
|
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
||||||
|
|
||||||
for (Language value : Language.values()) {
|
|
||||||
T2Cdebug.debug(Main.getPlugin(), "Select: File: " + config.getName() + " Path: " + value.path);
|
|
||||||
value.value = T2Creplace.replace(Util.getPrefix(), yamlConfiguration.getString(value.path));
|
|
||||||
}
|
|
||||||
T2Ctemplate.onStartMsg(Util.getPrefix(),"§2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,95 +21,95 @@ public class Config {
|
|||||||
|
|
||||||
language("plugin.language", "english", true,
|
language("plugin.language", "english", true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Hier kannst du die Sprache des Plugins einstellen."));
|
||||||
put(T2CLanguageEnum.english, List.of("Here you can set the language of the plugin."));
|
put(T2CLanguageEnum.english, List.of("Here you can set the language of the plugin."));
|
||||||
put(T2CLanguageEnum.german, List.of());
|
|
||||||
}}),
|
}}),
|
||||||
onlyOPcanUseThePlugin("plugin.onlyOPcanUseThePlugin", true, true,
|
onlyOPcanUseThePlugin("plugin.onlyOPcanUseThePlugin", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Hier kannst du festlegen, dass nur Spieler mit OP die Befehle des Plugins nutzen können."));
|
||||||
put(T2CLanguageEnum.english, List.of("Here you can specify that only players with OP can use the commands of the plugin."));
|
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,
|
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Mit dieser Option kannst du festlegen, ob Spieler mit der Berechtigung 't2c.opsecurity.updatemsg' beim Beitritt eine Update-Nachricht erhalten, wenn ein Update für das Plugin verfügbar ist."));
|
||||||
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.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,
|
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("In dieser Option kannst du einstellen, ob du Beta- und Snapshot-Versionen in der Update-Prüfung erhalten und anzeigen möchtest."));
|
||||||
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.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,
|
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Mit dieser Option kannst du das Zeitintervall in Minuten festlegen, in dem Aktualisierungen überprüft werden sollen."));
|
||||||
put(T2CLanguageEnum.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
|
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,
|
checkOnJoin("check.onJoin.enable", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Aktiviere die Prüfung, ob der Spieler berechtigt ist, wenn er dem Server beitritt."));
|
||||||
put(T2CLanguageEnum.english, List.of("Activate the checks whether the player is authorised when joining the player."));
|
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,
|
checkOnInteract("check.onInteract.enable", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Aktiviere die Prüfung, ob der Spieler für Spielerinteraktionen autorisiert ist."));
|
||||||
put(T2CLanguageEnum.english, List.of("Activate the checks whether the player is authorised for player interactions."));
|
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,
|
checkOnCommand("check.onCommand.enable", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Aktiviere die Prüfung, ob der Spieler berechtigt ist, wenn er einen Befehl ausführt."));
|
||||||
put(T2CLanguageEnum.english, List.of("Activate the checks whether the player is authorised when the player executes a command."));
|
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,
|
checkOnCommandWhitelist("check.onCommand.whitelist", List.of("command 1", "command 2"), true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Hier kannst du Befehle angeben, für die die Prüfung nicht durchgeführt wird."));
|
||||||
put(T2CLanguageEnum.english, List.of("Here you can specify commands for which the check is not carried out."));
|
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,
|
checkOnChat("check.onChat.enable", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Aktiviere die Überprüfung, ob der Spieler autorisiert ist, wenn er eine Chat-Nachricht schreibt."));
|
||||||
put(T2CLanguageEnum.english, List.of("Activate the checks whether the player is authorised when the player writes a chat message."));
|
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,
|
checkTimerEnable("check.timer.enable", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Aktiviere die Überprüfung aller Spieler in einem Zeitintervall."));
|
||||||
put(T2CLanguageEnum.english, List.of("Activate the check of all players in a time interval."));
|
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,
|
checkTimerRefreshInSec("check.timer.refreshInSec", 60, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Hier stellst du die Sekunden ein, mit denen die Prüfung in einem Zeitintervall durchgeführt wird."));
|
||||||
put(T2CLanguageEnum.english, List.of("Here you set the seconds with which the check is carried out in a time interval."));
|
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,
|
kickCustomCommand("kick.customCommand.enable", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Soll ein separater Kick-Befehl für den Kick verwendet werden? Zum Beispiel, wenn du ein eigenes Verbotssystem verwenden."));
|
||||||
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.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,
|
kickCommand("kick.customCommand.command", "minecraft:kick [player] [reason]", true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Hier kannst du den benutzerdefinierten Kick-Befehl einstellen."));
|
||||||
put(T2CLanguageEnum.english, List.of("This is where you set the user-defined kick command."));
|
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,
|
notifyJoinWarning("notify.warn.enable", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Sollen Spieler mit der Berechtigung 't2c.opsecurity.notify' gewarnt werden, wenn ein Spieler entdeckt wird, der nicht berechtigt ist, mit OP / einer Permission auf dem Server zu sein."));
|
||||||
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.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,
|
notifyBungee("notify.allBungeePlayer.enable", false, true,
|
||||||
new HashMap<>() {{
|
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("Sollen die Warnungen an das gesamte Netzwerk (true) oder nur an den einzelnen Server (false) gesendet werden.", "Damit diese Funktion funktioniert, muss die T2CodeLib auf deinem Proxy vorhanden sein und in deren Config die API für T2C-OPSecurity aktiviert werden!"));
|
||||||
put(T2CLanguageEnum.german, List.of());
|
put(T2CLanguageEnum.english, List.of("Should the warnings be sent on the entire network (true) or only on the individual server (false).", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!"));
|
||||||
}}),
|
}}),
|
||||||
notifySoundEnable("notify.soundEnable", true, true,
|
notifySoundEnable("notify.soundEnable", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Soll ein Sound abgespielt werden, bei einer Benachrichtigung?"));
|
||||||
put(T2CLanguageEnum.english, List.of("Should a sound be played during the warnings?"));
|
put(T2CLanguageEnum.english, List.of("Should a sound be played during the warnings?"));
|
||||||
put(T2CLanguageEnum.german, List.of());
|
|
||||||
}}),
|
}}),
|
||||||
notifySoundValue("notify.sound", sound(), true,
|
notifySoundValue("notify.sound", sound(), true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Welcher Sound soll bei Benachrichtigung abgespielt werden?"));
|
||||||
put(T2CLanguageEnum.english, List.of("Which sound should be played during the warnings?"));
|
put(T2CLanguageEnum.english, List.of("Which sound should be played during the warnings?"));
|
||||||
put(T2CLanguageEnum.german, List.of());
|
|
||||||
}}),
|
}}),
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -157,11 +157,11 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void set() {
|
public static void set(boolean pluginStart) {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
T2CconfigWriter.createConfig(new File(Main.getPath(), "config.yml"), VALUES.values(), Util.getConfigLogo());
|
T2CconfigWriter.createConfig(new File(Main.getPath(), "config.yml"), VALUES.values(), Util.getConfigLogo());
|
||||||
|
|
||||||
T2Ctemplate.onStartMsg(Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
T2Ctemplate.setCenterAligned(Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", pluginStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,10 @@ import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
|||||||
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
|
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
|
||||||
import net.t2code.opsecurity.objects.PlayerObject;
|
import net.t2code.opsecurity.objects.PlayerObject;
|
||||||
import net.t2code.opsecurity.system.Main;
|
import net.t2code.opsecurity.system.Main;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
|
||||||
|
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.T2CconfigItem;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -17,6 +19,7 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Converter {
|
public class Converter {
|
||||||
@ -125,17 +128,17 @@ public class Converter {
|
|||||||
}
|
}
|
||||||
if (!yamlConfiguration.contains("check.onInteract.enable")) {
|
if (!yamlConfiguration.contains("check.onInteract.enable")) {
|
||||||
Boolean onInteract = yamlConfiguration.getBoolean("check.onInteract");
|
Boolean onInteract = yamlConfiguration.getBoolean("check.onInteract");
|
||||||
T2Csend.debugmsg(Main.getPlugin(), "onInteract = " + onInteract);
|
T2Cdebug.debugmsg(Main.getPlugin(), "onInteract = " + onInteract);
|
||||||
yamlConfiguration.set("check.onInteract.enable", onInteract);
|
yamlConfiguration.set("check.onInteract.enable", onInteract);
|
||||||
}
|
}
|
||||||
if (!yamlConfiguration.contains("check.onCommand.enable")) {
|
if (!yamlConfiguration.contains("check.onCommand.enable")) {
|
||||||
Boolean onCommand = yamlConfiguration.getBoolean("check.onCommand");
|
Boolean onCommand = yamlConfiguration.getBoolean("check.onCommand");
|
||||||
T2Csend.debugmsg(Main.getPlugin(), "onCommand = " + onCommand);
|
T2Cdebug.debugmsg(Main.getPlugin(), "onCommand = " + onCommand);
|
||||||
yamlConfiguration.set("check.onCommand.enable", onCommand);
|
yamlConfiguration.set("check.onCommand.enable", onCommand);
|
||||||
}
|
}
|
||||||
if (!yamlConfiguration.contains("check.onChat.enable")) {
|
if (!yamlConfiguration.contains("check.onChat.enable")) {
|
||||||
Boolean onChat = yamlConfiguration.getBoolean("check.onChat");
|
Boolean onChat = yamlConfiguration.getBoolean("check.onChat");
|
||||||
T2Csend.debugmsg(Main.getPlugin(), "onChat = " + onChat);
|
T2Cdebug.debugmsg(Main.getPlugin(), "onChat = " + onChat);
|
||||||
yamlConfiguration.set("check.onChat.enable", onChat);
|
yamlConfiguration.set("check.onChat.enable", onChat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,21 +170,21 @@ public class Converter {
|
|||||||
|
|
||||||
private enum PLAYERENUM implements T2CconfigItem {
|
private enum PLAYERENUM implements T2CconfigItem {
|
||||||
|
|
||||||
name("", "", true),
|
name("", "", true, new HashMap<>()),
|
||||||
uuid("", "", true),
|
uuid("", "", true, new HashMap<>()),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
protected String path;
|
private String path;
|
||||||
protected Object value;
|
private Object value;
|
||||||
private boolean forceSet;
|
private final boolean forceSet;
|
||||||
private final List<String> comments;
|
private final HashMap<T2CLanguageEnum, List<String>> comments;
|
||||||
|
|
||||||
PLAYERENUM(String path, Object value,boolean forceSet, String... comments) {
|
PLAYERENUM(String path, Object value, boolean forceSet, HashMap<T2CLanguageEnum, List<String>> comments) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.forceSet = forceSet;
|
this.forceSet = forceSet;
|
||||||
this.comments = new ArrayList<>(Arrays.asList(comments));
|
this.comments = comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -201,10 +204,15 @@ public class Converter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getComments() {
|
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguagePath() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(Object newValue) {
|
public void setValue(Object newValue) {
|
||||||
value = newValue;
|
value = newValue;
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
package net.t2code.opsecurity.config.language;
|
|
||||||
|
|
||||||
public enum Language {
|
|
||||||
soundNotFound("plugin.soundNotFound",null,
|
|
||||||
"[prefix] <dark_red>Der Sound <gold>[sound]</gold> wurde nicht gefunden! Bitte überprüfe die Einstellungen.</dark_red>",
|
|
||||||
"[prefix] <dark_red>The sound <gold>[sound]</gold> could not be found! Please check your settings.</dark_red>"),
|
|
||||||
|
|
||||||
noPermission("plugin.NoPermission",null,
|
|
||||||
"<dark_red>Keine Berechtigung!</dark_red>",
|
|
||||||
"<dark_red>No Permission!</dark_red>"),
|
|
||||||
|
|
||||||
noPermissionForOpSec("plugin.NoPermission",null,
|
|
||||||
"[prefix] <red>Du hast keine Berechtigung für OPSecurity!</red>",
|
|
||||||
"[prefix] <red>You do not have permission for OPSecurity!</red>"),
|
|
||||||
|
|
||||||
playerMustBeOnlineToOp("plugin.PlayerMustBeOnlineToOp",null,
|
|
||||||
"[prefix] <dark_red>Der Spieler muss online sein, um OP zu erhalten!</dark_red>",
|
|
||||||
"[prefix] <dark_red>Player must be online to get op!</dark_red>"),
|
|
||||||
|
|
||||||
reloadStart("plugin.reload.start",null,
|
|
||||||
"[prefix] <gold>Plugin wird neu geladen...</gold>",
|
|
||||||
"[prefix] <gold>Plugin is reloaded...</gold>"),
|
|
||||||
|
|
||||||
reloadEnd("plugin.reload.end",null,
|
|
||||||
"[prefix] <green>Plugin wurde erfolgreich neu geladen.</green>",
|
|
||||||
"[prefix] <green>Plugin was successfully reloaded.</green>"),
|
|
||||||
|
|
||||||
opWhitelistOpCommand("opWhitelist.opCommand",null,
|
|
||||||
"[prefix] <dark_red>Der angegebene Spieler befindet sich nicht auf der OP_Whitelist!</dark_red>",
|
|
||||||
"[prefix] <dark_red>The specified player is not on the OP_Whitelist!</dark_red>"),
|
|
||||||
|
|
||||||
opWhitelistNotifyOnJoin("opWhitelist.notify.onJoin",null,
|
|
||||||
"[prefix] <dark_red>Spieler <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> ist dem Server beigetreten, befindet sich aber nicht auf der OP_Whitelist!</dark_red>",
|
|
||||||
"[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> is joined to the server but is not on the OP_Whitelist!</dark_red>"),
|
|
||||||
|
|
||||||
opWhitelistNotifyDeop("opWhitelist.notify.deop",null,
|
|
||||||
"[prefix] <dark_red>Spieler <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> wurde OP entfernt da er nicht auf der Spielerliste steht!</dark_red>",
|
|
||||||
"[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> was removed OP because he is not on the playerlist!</dark_red>"),
|
|
||||||
|
|
||||||
opWhitelistNotifyKick("opWhitelist.notify.kick",null,
|
|
||||||
"[prefix] <dark_red>Spieler <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> wurde gekickt, da er nicht auf der OP_Whitelist steht!</dark_red>",
|
|
||||||
"[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> was kicked because he is not on the OP_Whitelist!</dark_red>"),
|
|
||||||
|
|
||||||
opWhitelistDeop("opWhitelist.deop",null,
|
|
||||||
"&4Dir wurde OP entfernt da du dazu keine Permission besitzt.",
|
|
||||||
"&4You have been removed from OP because you do not have permission."),
|
|
||||||
|
|
||||||
opWhitelistKick("opWhitelist.kick",null,
|
|
||||||
"&4Du hast OP, bist dazu aber nicht berechtigt. Deswegen wurdest du gekickt!",
|
|
||||||
"&4You have op but are not authorized to do so, that's why you were kicked!"),
|
|
||||||
|
|
||||||
permissionWhitelistNotifyOnJoin("permissionWhitelist.notify.onJoin",null,
|
|
||||||
"[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> hat die Permission <gold>[perm]</gold> und ist dazu nicht berechtigt! <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> ist nicht in der Spielerliste!</dark_red>",
|
|
||||||
"[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> has permission <gold>[perm]</gold> and is not authorized to do so! <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> is not on the Player list!</dark_red>"),
|
|
||||||
|
|
||||||
permissionWhitelistNotifyKick("permissionWhitelist.notify.kick",null,
|
|
||||||
"[prefix] <dark_red>Spieler <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> hat die Permission <gold>[perm]</gold> und ist dazu nicht berechtigt! Daher wurde er gekickt! <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> ist nicht in der Spielerliste!</dark_red>",
|
|
||||||
"[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> has permission <gold>[perm]</gold> and is not authorized to do so! Therefore he was kicked! <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> is not on the Player list!</dark_red>"),
|
|
||||||
|
|
||||||
permissionWhitelistKick("permissionWhitelist.kick",null,
|
|
||||||
"&4Du wurdest gekickt, da du Permissions besitzt, für die du keine Berechtigung besitzt!",
|
|
||||||
"&4You were kicked because you have permissions to which you do not have permission!"),
|
|
||||||
|
|
||||||
exactKickReason("console.exactKickReason", null,
|
|
||||||
"[prefix] <dark_red>Genauer Grund:</dark_red> <gold>[reason]</gold>",
|
|
||||||
"[prefix] <dark_red>Exact reason:</dark_red> <gold>[reason]</gold>");
|
|
||||||
|
|
||||||
|
|
||||||
public String path;
|
|
||||||
public String value;
|
|
||||||
public String german;
|
|
||||||
public String english;
|
|
||||||
|
|
||||||
Language(String path,String value, String german,String english) {
|
|
||||||
this.path = path;
|
|
||||||
this.value=value;
|
|
||||||
this.german = german;
|
|
||||||
this.english = english;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,230 @@
|
|||||||
|
package net.t2code.opsecurity.config.language;
|
||||||
|
|
||||||
|
import net.t2code.opsecurity.Util;
|
||||||
|
import net.t2code.opsecurity.config.config.Config;
|
||||||
|
import net.t2code.opsecurity.system.Main;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriterLanguage;
|
||||||
|
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||||
|
import net.t2code.t2codelib.T2CconfigItemLanguages;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Languages {
|
||||||
|
|
||||||
|
public enum VALUES implements T2CconfigItemLanguages {
|
||||||
|
otherLang("plugin", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, null);
|
||||||
|
put(T2CLanguageEnum.english, null);
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Wenn du eine Eigene Sprache hinzufügen magst, dann kopiere einfach eine Sprachdatei und benenne sie in deine Sprache, dies kannst du dann in der config.yml einstellen.",""));
|
||||||
|
put(T2CLanguageEnum.english, List.of("If you want to add your own language, simply copy a language file and rename it to your language, you can then set this in config.yml.",""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
soundNotFound("plugin.soundNotFound", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Der Sound <gold>[sound]</gold> wurde nicht gefunden! Bitte überprüfe die Einstellungen.</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>The sound <gold>[sound]</gold> could not be found! Please check your settings.</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
noPermission("plugin.NoPermission", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "<dark_red>Keine Berechtigung!</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "<dark_red>No Permission!</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
noPermissionForOpSec("plugin.NoPermission", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <red>Du hast keine Berechtigung für OPSecurity!</red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <red>You do not have permission for OPSecurity!</red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
playerMustBeOnlineToOp("plugin.PlayerMustBeOnlineToOp", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Der Spieler muss online sein, um OP zu erhalten!</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>Player must be online to get op!</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
reloadStart("plugin.reload.start", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <gold>Plugin wird neu geladen...</gold>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <gold>Plugin is reloaded...</gold>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
reloadEnd("plugin.reload.end", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <green>Plugin wurde erfolgreich neu geladen.</green>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <green>Plugin was successfully reloaded.</green>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
opWhitelistOpCommand("opWhitelist.opCommand", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Der angegebene Spieler befindet sich nicht auf der OP_Whitelist!</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>The specified player is not on the OP_Whitelist!</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
opWhitelistNotifyOnJoin("opWhitelist.notify.onJoin", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Spieler <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> ist dem Server beigetreten, befindet sich aber nicht auf der OP_Whitelist!</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> is joined to the server but is not on the OP_Whitelist!</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
opWhitelistNotifyDeop("opWhitelist.notify.deop", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Spieler <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> wurde OP entfernt da er nicht auf der Spielerliste steht!</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> was removed OP because he is not on the playerlist!</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
opWhitelistNotifyKick("opWhitelist.notify.kick", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Spieler <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> wurde gekickt, da er nicht auf der OP_Whitelist steht!</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> was kicked because he is not on the OP_Whitelist!</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
opWhitelistDeop("opWhitelist.deop", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "&4Dir wurde OP entfernt da du dazu keine Permission besitzt.");
|
||||||
|
put(T2CLanguageEnum.english, "&4You have been removed from OP because you do not have permission.");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
opWhitelistKick("opWhitelist.kick", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "&4Du hast OP, bist dazu aber nicht berechtigt. Deswegen wurdest du gekickt!");
|
||||||
|
put(T2CLanguageEnum.english, "&4You have op but are not authorized to do so, that's why you were kicked!");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
permissionWhitelistNotifyOnJoin("permissionWhitelist.notify.onJoin", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> hat die Permission <gold>[perm]</gold> und ist dazu nicht berechtigt! <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> ist nicht in der Spielerliste!</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> has permission <gold>[perm]</gold> and is not authorized to do so! <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> is not on the Player list!</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
permissionWhitelistNotifyKick("permissionWhitelist.notify.kick", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Spieler <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> hat die Permission <gold>[perm]</gold> und ist dazu nicht berechtigt! Daher wurde er gekickt! <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> ist nicht in der Spielerliste!</dark_red>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>Player <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> has permission <gold>[perm]</gold> and is not authorized to do so! Therefore he was kicked! <gold><hover:show_text:'<gold>Name:</gold> <yellow>[player]</yellow><br><gold>UUID:</gold> <yellow>[uuid]</yellow>'>[player]</hover></gold> is not on the Player list!</dark_red>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
permissionWhitelistKick("permissionWhitelist.kick", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "&4Du wurdest gekickt, da du Permissions besitzt, für die du keine Berechtigung besitzt!");
|
||||||
|
put(T2CLanguageEnum.english, "&4You were kicked because you have permissions to which you do not have permission!");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
exactKickReason("console.exactKickReason", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, "[prefix] <dark_red>Genauer Grund:</dark_red> <gold>[reason]</gold>");
|
||||||
|
put(T2CLanguageEnum.english, "[prefix] <dark_red>Exact reason:</dark_red> <gold>[reason]</gold>");
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
}});
|
||||||
|
private final String path;
|
||||||
|
private Object value;
|
||||||
|
private final HashMap<T2CLanguageEnum, String> lang;
|
||||||
|
private final HashMap<T2CLanguageEnum, List<String>> comments;
|
||||||
|
|
||||||
|
VALUES(String path, Object value, HashMap<T2CLanguageEnum, String> lang, HashMap<T2CLanguageEnum, List<String>> comments) {
|
||||||
|
this.path = path;
|
||||||
|
this.value = value;
|
||||||
|
this.lang = lang;
|
||||||
|
this.comments = comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getValue() {
|
||||||
|
if (value == null) {
|
||||||
|
return lang.get(T2CLanguageEnum.english);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<T2CLanguageEnum, String> getLanguage() {
|
||||||
|
return lang;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
||||||
|
return comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(Object newValue) {
|
||||||
|
value = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void set(boolean pluginStart) {
|
||||||
|
T2CconfigWriterLanguage.createConfig(Util.getPrefix(),Main.getPath(), VALUES.values(), Config.VALUES.language.getValue().toString(),pluginStart, Util.getConfigLogo());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,47 +8,101 @@ import net.t2code.opsecurity.objects.PlayerObject;
|
|||||||
import net.t2code.opsecurity.system.Main;
|
import net.t2code.opsecurity.system.Main;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
|
||||||
|
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.T2CconfigItem;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OPWhitelist {
|
public class OPWhitelist {
|
||||||
|
|
||||||
public enum VALUES implements T2CconfigItem {
|
public enum VALUES implements T2CconfigItem {
|
||||||
|
|
||||||
enable("opWhitelist.enable", false, true),
|
enable("opWhitelist.enable", false, true,
|
||||||
playerMustBeOnlineToOp("opWhitelist.playerMustBeOnlineToOp", true, true),
|
new HashMap<>() {{
|
||||||
noOpPlayerDeopEnable("opWhitelist.noOpPlayerDeop.enable", true, true),
|
put(T2CLanguageEnum.german, List.of("Hiermit aktivierst du die OP-Whitelist."));
|
||||||
noOpPlayerDeopPlayerSendMessage("opWhitelist.noOpPlayerDeop.playerSendMessage", true, true),
|
put(T2CLanguageEnum.english, List.of("This activates the OP whitelist."));
|
||||||
noOpPlayerKickEnable("opWhitelist.noOpPlayerKick.enable", true, true),
|
}}),
|
||||||
noOpPlayerSetGameModeEnable("opWhitelist.noOpPlayerSetGameMode.enable", true, true),
|
playerMustBeOnlineToOp("opWhitelist.playerMustBeOnlineToOp", true, true,
|
||||||
noOpPlayerSetGameModeValue("opWhitelist.noOpPlayerSetGameMode.gameMode", GameMode.SURVIVAL, true),
|
new HashMap<>() {{
|
||||||
customCommandsEnable("opWhitelist.customCommands.enable", false, true),
|
put(T2CLanguageEnum.german, List.of("Wenn diese Option aktiviert ist, muss der Spieler dem OP gegeben werden soll sich auf dem Server befinden.", "Dies gilt auch wenn man einen Spieler per Console OP geben möchte."));
|
||||||
customCommandsCommands("opWhitelist.customCommands.commands", Arrays.asList("kick [player] &4You have op but are not authorized to do so, that's why you were kicked!"), true),
|
put(T2CLanguageEnum.english, List.of("If this option is activated, the player to whom the OP is to be given must be on the server.", "This also applies if you want to OP a player via console."));
|
||||||
|
}}),
|
||||||
playerSection("opWhitelist.whitelist", null, true),
|
noOpPlayerDeopEnable("opWhitelist.noOpPlayerDeop.enable", true, true,
|
||||||
player1name("opWhitelist.whitelist.player1.name", "player1", false),
|
new HashMap<>() {{
|
||||||
player1uuid("opWhitelist.whitelist.player1.uuid", "00000000000000000000000000000000", false),
|
put(T2CLanguageEnum.german, List.of("Sollen den Spielern die OP besitzen, die aber nicht auf der Whitelist stehen, OP entfernt bekommen?"));
|
||||||
player2name("opWhitelist.whitelist.player2.name", "player2", false),
|
put(T2CLanguageEnum.english, List.of("Should players who have OP but are not on the whitelist have OP removed?"));
|
||||||
player2uuid("opWhitelist.whitelist.player2.uuid", "00000000000000000000000000000000", false),
|
}}),
|
||||||
|
noOpPlayerDeopPlayerSendMessage("opWhitelist.noOpPlayerDeop.playerSendMessage", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Sollen Spieler eine Benachrichtigung erhalten, wenn sie OP entfernt bekommen?"));
|
||||||
|
put(T2CLanguageEnum.english, List.of("Should players receive a notification when they get OP removed?"));
|
||||||
|
}}),
|
||||||
|
noOpPlayerKickEnable("opWhitelist.noOpPlayerKick.enable", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Hier legst du fest ob ein Spieler gekickt werden soll, wenn er OP besitzt und nicht auf der Whitelist steht."));
|
||||||
|
put(T2CLanguageEnum.english, List.of("Here you determine whether a player should be kicked if he has OP and is not on the whitelist."));
|
||||||
|
}}),
|
||||||
|
noOpPlayerSetGameModeEnable("opWhitelist.noOpPlayerSetGameMode.enable", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Sollen Spieler, die OP besitzen und nicht auf der Whitelist stehen in einen bestimmten Gamemode gesetzt werden?"));
|
||||||
|
put(T2CLanguageEnum.english, List.of("Should players who own OP and are not on the whitelist be set to a specific gamemode?"));
|
||||||
|
}}),
|
||||||
|
noOpPlayerSetGameModeValue("opWhitelist.noOpPlayerSetGameMode.gameMode", GameMode.SURVIVAL, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Hier legst du den Gamemode fest, in den Spieler gesetzt werden sollen, die OP besitzen und nicht auf der Whitelist stehen."));
|
||||||
|
put(T2CLanguageEnum.english, List.of("Here you define the game mode in which players who have OP and are not on the whitelist are to be set."));
|
||||||
|
}}),
|
||||||
|
customCommandsEnable("opWhitelist.customCommands.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Soll ein bestimmter befehl ausgeführt werden, wenn ein Spieler OP hat und nicht auf der Whitelist steht."));
|
||||||
|
put(T2CLanguageEnum.english, List.of("Should a certain command be executed if a player has OP and is not on the whitelist."));
|
||||||
|
}}),
|
||||||
|
customCommandsCommands("opWhitelist.customCommands.commands", Arrays.asList("kick [player] &4You have op but are not authorized to do so, that's why you were kicked!"), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of("Hier kann man Mehrere Commands einfügen, die ausgeführt werden, wenn ein Spieler OP hat und nicht auf der Whitelist steht."));
|
||||||
|
put(T2CLanguageEnum.english, List.of("Here you can add several commands that are executed when a player has OP and is not on the whitelist."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
playerSection("opWhitelist.whitelist", null, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.german, List.of(
|
||||||
|
"Hier legst du wie im Beispiel die Spieler an, die OP besitzen dürfen.",
|
||||||
|
"Wichtig:",
|
||||||
|
" Es muss der Spielername und die UUID angegeben werden!",
|
||||||
|
" Der Spielername muss mit Groß/Kleinschreibung eingefügt werden!",
|
||||||
|
"Die UUID eines Spielers kannst du hier finden: https://mcuuid.net",
|
||||||
|
"Wenn dein Server nicht im OnlineModus ist, werden alle Spieler andere UUIDs erhalten, dann findest du die UUID eines Spielers in deiner Console, wenn der Spieler den Server betritt."
|
||||||
|
));
|
||||||
|
put(T2CLanguageEnum.english, List.of(
|
||||||
|
"Here, as in the example, you create the players who are allowed to own OP.",
|
||||||
|
"Important:",
|
||||||
|
" The player name and the UUID must be entered!",
|
||||||
|
" The player name must be inserted with upper/lower case!",
|
||||||
|
"You can find the UUID of a player here: https://mcuuid.net",
|
||||||
|
"If your server is not in online mode, all players will receive different UUIDs, then you will find the UUID of a player in your console when the player enters the server."
|
||||||
|
));
|
||||||
|
}}),
|
||||||
|
player1name("opWhitelist.whitelist.player1.name", "player1", false, new HashMap<>()),
|
||||||
|
player1uuid("opWhitelist.whitelist.player1.uuid", "00000000000000000000000000000000", false, new HashMap<>()),
|
||||||
|
player2name("opWhitelist.whitelist.player2.name", "player2", false, new HashMap<>()),
|
||||||
|
player2uuid("opWhitelist.whitelist.player2.uuid", "00000000000000000000000000000000", false, new HashMap<>()),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
private Object value;
|
private Object value;
|
||||||
private final boolean forceSet;
|
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.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.forceSet = forceSet;
|
this.forceSet = forceSet;
|
||||||
this.comments = new ArrayList<>(Arrays.asList(comments));
|
this.comments = comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,22 +121,27 @@ public class OPWhitelist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getComments() {
|
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguagePath() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(Object newValue) {
|
public void setValue(Object newValue) {
|
||||||
value = newValue;
|
value = newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set() {
|
public static void set(boolean pluginStart) {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
T2CconfigWriter.createConfig(new File(Main.getPath(), "opWhitelist.yml"), VALUES.values(), Util.getConfigLogo());
|
T2CconfigWriter.createConfig(new File(Main.getPath(), "opWhitelist.yml"), VALUES.values(), Util.getConfigLogo());
|
||||||
player();
|
player();
|
||||||
|
|
||||||
T2Ctemplate.onStartMsg(Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
T2Ctemplate.setCenterAligned(Util.getPrefix(), "§2opWhitelist.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms",pluginStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,42 +8,72 @@ import net.t2code.opsecurity.objects.PlayerObject;
|
|||||||
import net.t2code.opsecurity.system.Main;
|
import net.t2code.opsecurity.system.Main;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
|
||||||
|
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.T2CconfigItem;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PermissionWhitelist {
|
public class PermissionWhitelist {
|
||||||
|
|
||||||
public enum VALUES implements T2CconfigItem {
|
public enum VALUES implements T2CconfigItem {
|
||||||
|
|
||||||
enable("permissionWhitelist.enable", false, true),
|
enable("permissionWhitelist.enable", false, true,
|
||||||
playerWithPermissionKick("permissionWhitelist.playerWithPermissionKick", true, true),
|
new HashMap<>() {{
|
||||||
permissions("permissionWhitelist.permissions", Arrays.asList("*", "t2c.opsecurity.admin"), true),
|
put(T2CLanguageEnum.english, List.of());
|
||||||
customCommandsEnable("permissionWhitelist.customCommands.enable", false, true),
|
put(T2CLanguageEnum.german, List.of());
|
||||||
customCommandsCommands("permissionWhitelist.customCommands.commands", Arrays.asList("lp user [player] permission unset *", "lp user [player] permission unset t2c.opsecurity.admin"), true),
|
}}),
|
||||||
|
playerWithPermissionKick("permissionWhitelist.playerWithPermissionKick", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
}}),
|
||||||
|
permissions("permissionWhitelist.permissions", Arrays.asList("*", "t2c.opsecurity.admin"), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
}}),
|
||||||
|
customCommandsEnable("permissionWhitelist.customCommands.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
}}),
|
||||||
|
customCommandsCommands("permissionWhitelist.customCommands.commands", Arrays.asList("lp user [player] permission unset *", "lp user [player] permission unset t2c.opsecurity.admin"), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2CLanguageEnum.english, List.of());
|
||||||
|
put(T2CLanguageEnum.german, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
playerSection("permissionWhitelist.whitelist", null, true),
|
playerSection("permissionWhitelist.whitelist", null, true,
|
||||||
player1name("permissionWhitelist.whitelist.player1.name", "player1", false),
|
new HashMap<>() {{
|
||||||
player1uuid("permissionWhitelist.whitelist.player1.uuid", "00000000000000000000000000000000", false),
|
put(T2CLanguageEnum.english, List.of());
|
||||||
player2name("permissionWhitelist.whitelist.player2.name", "player2", false),
|
put(T2CLanguageEnum.german, List.of());
|
||||||
player2uuid("permissionWhitelist.whitelist.player2.uuid", "00000000000000000000000000000000", false),
|
}}),
|
||||||
|
player1name("permissionWhitelist.whitelist.player1.name", "player1", false,
|
||||||
|
new HashMap<>()),
|
||||||
|
player1uuid("permissionWhitelist.whitelist.player1.uuid", "00000000000000000000000000000000", false,
|
||||||
|
new HashMap<>()),
|
||||||
|
player2name("permissionWhitelist.whitelist.player2.name", "player2", false,
|
||||||
|
new HashMap<>()),
|
||||||
|
player2uuid("permissionWhitelist.whitelist.player2.uuid", "00000000000000000000000000000000", false,
|
||||||
|
new HashMap<>()),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
private Object value;
|
private Object value;
|
||||||
private final boolean forceSet;
|
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.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.forceSet = forceSet;
|
this.forceSet = forceSet;
|
||||||
this.comments = new ArrayList<>(Arrays.asList(comments));
|
this.comments = comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -62,22 +92,27 @@ public class PermissionWhitelist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getComments() {
|
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguagePath() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(Object newValue) {
|
public void setValue(Object newValue) {
|
||||||
value = newValue;
|
value = newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set() {
|
public static void set(boolean pluginStart) {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
T2CconfigWriter.createConfig(new File(Main.getPath(), "permissionWhitelist.yml"), VALUES.values(), Util.getConfigLogo());
|
T2CconfigWriter.createConfig(new File(Main.getPath(), "permissionWhitelist.yml"), VALUES.values(), Util.getConfigLogo());
|
||||||
player();
|
player();
|
||||||
|
|
||||||
T2Ctemplate.onStartMsg(Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
T2Ctemplate.setCenterAligned(Util.getPrefix(), "§2permissionWhitelist.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", pluginStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package net.t2code.opsecurity.events;
|
package net.t2code.opsecurity.events;
|
||||||
|
|
||||||
import com.sun.org.apache.xerces.internal.xs.StringList;
|
|
||||||
import net.t2code.opsecurity.Util;
|
import net.t2code.opsecurity.Util;
|
||||||
import net.t2code.opsecurity.check.OpCheck;
|
import net.t2code.opsecurity.check.OpCheck;
|
||||||
import net.t2code.opsecurity.check.PermissionCheck;
|
import net.t2code.opsecurity.check.PermissionCheck;
|
||||||
@ -25,7 +24,9 @@ public class Events implements Listener {
|
|||||||
for (Player notifyPlayer : Bukkit.getOnlinePlayers()) {
|
for (Player notifyPlayer : Bukkit.getOnlinePlayers()) {
|
||||||
if (!notifyPlayer.hasPermission(Permissions.notify)) continue;
|
if (!notifyPlayer.hasPermission(Permissions.notify)) continue;
|
||||||
T2Csend.player(notifyPlayer, msg);
|
T2Csend.player(notifyPlayer, msg);
|
||||||
if ((boolean) Config.VALUES.notifySoundEnable.getValue()) notifyPlayer.playSound(notifyPlayer.getLocation(), Sound.valueOf(Config.VALUES.notifySoundValue.getValue().toString()), 3, 1);
|
if ((boolean) Config.VALUES.notifySoundEnable.getValue()){
|
||||||
|
notifyPlayer.playSound(notifyPlayer.getLocation(), Sound.valueOf(Config.VALUES.notifySoundValue.getValue().toString()), 3, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ public class Events implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
String debug = T2Cdebug.debugCode();
|
String debug = T2Cdebug.debugCode();
|
||||||
|
|
||||||
for (String s : (StringList) Config.VALUES.checkOnCommandWhitelist.getValue()) {
|
for (String s : (List<String>) Config.VALUES.checkOnCommandWhitelist.getValue()) {
|
||||||
if (event.getMessage().startsWith("/" + s)) {
|
if (event.getMessage().startsWith("/" + s)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.opsecurity.events;
|
package net.t2code.opsecurity.events;
|
||||||
|
|
||||||
import net.t2code.opsecurity.config.language.Language;
|
import net.t2code.opsecurity.config.language.Languages;
|
||||||
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
||||||
import net.t2code.opsecurity.enums.OpCommandRequest;
|
import net.t2code.opsecurity.enums.OpCommandRequest;
|
||||||
import net.t2code.opsecurity.objects.PlayerCache;
|
import net.t2code.opsecurity.objects.PlayerCache;
|
||||||
@ -26,11 +26,11 @@ public class OpCommand implements Listener {
|
|||||||
if ((event.getCommand().toLowerCase().startsWith("op ") || event.getCommand().toLowerCase().startsWith("minecraft:op "))) {
|
if ((event.getCommand().toLowerCase().startsWith("op ") || event.getCommand().toLowerCase().startsWith("minecraft:op "))) {
|
||||||
switch (isNotOPWTL(event.getCommand())) {
|
switch (isNotOPWTL(event.getCommand())) {
|
||||||
case mustOnline:
|
case mustOnline:
|
||||||
T2Csend.sender(event.getSender(), Language.playerMustBeOnlineToOp.value);
|
T2Csend.sender(event.getSender(), Languages.VALUES.playerMustBeOnlineToOp.getValue().toString());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
case notWhitelisted:
|
case notWhitelisted:
|
||||||
T2Csend.sender(event.getSender(), Language.opWhitelistOpCommand.value);
|
T2Csend.sender(event.getSender(), Languages.VALUES.opWhitelistOpCommand.getValue());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -43,11 +43,11 @@ public class OpCommand implements Listener {
|
|||||||
if ((event.getMessage().toLowerCase().startsWith("/op ") || event.getMessage().toLowerCase().startsWith("/minecraft:op "))) {
|
if ((event.getMessage().toLowerCase().startsWith("/op ") || event.getMessage().toLowerCase().startsWith("/minecraft:op "))) {
|
||||||
switch (isNotOPWTL(event.getMessage())) {
|
switch (isNotOPWTL(event.getMessage())) {
|
||||||
case mustOnline:
|
case mustOnline:
|
||||||
T2Csend.player(event.getPlayer(), Language.playerMustBeOnlineToOp.value);
|
T2Csend.player(event.getPlayer(), Languages.VALUES.playerMustBeOnlineToOp.getValue().toString());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
case notWhitelisted:
|
case notWhitelisted:
|
||||||
T2Csend.player(event.getPlayer(), Language.opWhitelistOpCommand.value);
|
T2Csend.player(event.getPlayer(), Languages.VALUES.opWhitelistOpCommand.getValue().toString());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.t2code.opsecurity.objects;
|
package net.t2code.opsecurity.objects;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -2,7 +2,6 @@ package net.t2code.opsecurity.system;
|
|||||||
|
|
||||||
import net.t2code.opsecurity.events.Events;
|
import net.t2code.opsecurity.events.Events;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
@ -2,9 +2,9 @@ package net.t2code.opsecurity.system;
|
|||||||
|
|
||||||
import net.t2code.opsecurity.Util;
|
import net.t2code.opsecurity.Util;
|
||||||
import net.t2code.opsecurity.command.CmdExecuter;
|
import net.t2code.opsecurity.command.CmdExecuter;
|
||||||
import net.t2code.opsecurity.config.FileSelect;
|
|
||||||
import net.t2code.opsecurity.config.config.Config;
|
import net.t2code.opsecurity.config.config.Config;
|
||||||
import net.t2code.opsecurity.config.config.Converter;
|
import net.t2code.opsecurity.config.config.Converter;
|
||||||
|
import net.t2code.opsecurity.config.language.Languages;
|
||||||
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
|
||||||
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
|
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
|
||||||
import net.t2code.opsecurity.events.Events;
|
import net.t2code.opsecurity.events.Events;
|
||||||
@ -18,10 +18,7 @@ import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
|||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@ -36,11 +33,11 @@ public class Load {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.set();
|
Config.set(true);
|
||||||
|
|
||||||
FileSelect.selectLanguage();
|
Languages.set(true);
|
||||||
OPWhitelist.set();
|
OPWhitelist.set(true);
|
||||||
PermissionWhitelist.set();
|
PermissionWhitelist.set(true);
|
||||||
|
|
||||||
plugin.getCommand("t2c-opsecurity").setExecutor(new CmdExecuter());
|
plugin.getCommand("t2c-opsecurity").setExecutor(new CmdExecuter());
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ public final class Main extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// Plugin shutdown logic
|
// Plugin shutdown logic
|
||||||
if (t2codeLib) T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
if (t2codeLib) T2Ctemplate.onDisable(Util.getPrefix(),plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
private static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
if (Bukkit.getPluginManager().getPlugin(pl) == null || !Bukkit.getPluginManager().isPluginEnabled(pl)) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
|
||||||
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||||
|
Loading…
Reference in New Issue
Block a user