This commit is contained in:
JaTiTV 2022-11-20 20:17:55 +01:00
parent ea54d85ecc
commit 44507458e5
6 changed files with 34 additions and 10 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2C-OPSecurity</artifactId>
<version>3.0.5</version>
<version>3.0.6</version>
<packaging>jar</packaging>

View File

@ -50,7 +50,7 @@ public class OpCheck {
OPWhitelist.noOpPlayerKickEnable.valueBoolean && OPWhitelist.noOpPlayerDeopEnable.valueBoolean && OPWhitelist.noOpPlayerDeopPlayerSendMessage.valueBoolean
? Language.opWhitelistKick.value + "<br> <br>" + Language.opWhitelistDeop.value : Language.opWhitelistKick.value));
} else player.kickPlayer(OPWhitelist.noOpPlayerDeopEnable.valueBoolean && OPWhitelist.noOpPlayerDeopPlayerSendMessage.valueBoolean
? Language.opWhitelistKick.value + "\n \n" + Language.opWhitelistDeop.value : Language.opWhitelistKick.value);
? Language.opWhitelistKick.value + "\n \n" + Language.opWhitelistDeop.value : Language.opWhitelistKick.value);
}
T2Csend.console(Language.opWhitelistNotifyDeop.value.replace("[player]", 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())));
@ -90,7 +90,15 @@ public class OpCheck {
public static Boolean opWhitelist(Player player) {
for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getOpHashMap().entrySet()) {
if (playerObject.getValue().playerName.equals(player.getName()) && playerObject.getValue().uuid.equals(player.getUniqueId().toString().replace("-",""))) return true;
T2Csend.debug(Main.getPlugin(), "--------- " + player.getName());
T2Csend.debug(Main.getPlugin(), "opWhitelist playerObject Name: " + playerObject.getValue().playerName);
T2Csend.debug(Main.getPlugin(), "opWhitelist Player Name: " + player.getName());
T2Csend.debug(Main.getPlugin(), "opWhitelist playerObject UUID: " + playerObject.getValue().uuid);
T2Csend.debug(Main.getPlugin(), "opWhitelist Player UUID: " + player.getUniqueId().toString().replace("-", ""));
if (playerObject.getValue().playerName.equals(player.getName()) && playerObject.getValue().uuid.equals(player.getUniqueId().toString().replace("-", ""))) {
T2Csend.debug(Main.getPlugin(), "opWhitelist Player on list!");
return true;
}
}
return false;
}

View File

@ -19,8 +19,8 @@ public class PermissionCheck {
public static Boolean onCheck(Player player, Boolean join) {
if (!PermissionWhitelist.enable.valueBoolean) return false;
for (String perm : PermissionWhitelist.permissions.valueStringList) {
if (!player.hasPermission(perm)) continue;
if (permWhitelist(player)) continue;
if (!player.hasPermission(perm)) return false;
if (permWhitelist(player)) return false;
Bukkit.getScheduler().runTask(Main.getPlugin(), new Runnable() {
@Override
public void run() {
@ -42,7 +42,7 @@ public class PermissionCheck {
if (PermissionWhitelist.playerWithPermissionKick.valueBoolean) {
if (Config.kickCustomCommand.valueBoolean) {
T2Ccmd.console(Config.kickCommand.valueString.replace("[player]", player.getName()).replace("[reason]", Language.permissionWhitelistKick.value));
T2Ccmd.console(Config.kickCommand.valueString.replace("[perm]", perm).replace("[player]", player.getName()).replace("[reason]", Language.permissionWhitelistKick.value));
} else player.kickPlayer(Language.permissionWhitelistKick.value);
T2Csend.console(Language.permissionWhitelistNotifyKick.value.replace("[player]",
player.getName()).replace("[perm]", perm).replace("[uuid]",String.valueOf(player.getUniqueId())));
@ -55,8 +55,17 @@ public class PermissionCheck {
}
private static Boolean permWhitelist(Player player) {
for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getPermissionHashMap().entrySet()) {
if (playerObject.getValue().playerName.equals(player.getName()) && playerObject.getValue().uuid.equals(player.getUniqueId().toString().replace("-",""))) return true;
T2Csend.debug(Main.getPlugin(), "--------- " + player.getName());
T2Csend.debug(Main.getPlugin(),"permWhitelist playerObject Name: "+playerObject.getValue().playerName );
T2Csend.debug(Main.getPlugin(),"permWhitelist Player Name: "+player.getName() );
T2Csend.debug(Main.getPlugin(),"permWhitelist playerObject UUID: "+playerObject.getValue().uuid );
T2Csend.debug(Main.getPlugin(),"permWhitelist Player UUID: "+player.getUniqueId().toString().replace("-","") );
if (playerObject.getValue().playerName.equals(player.getName()) && playerObject.getValue().uuid.equals(player.getUniqueId().toString().replace("-",""))){
T2Csend.debug(Main.getPlugin(),"permWhitelist Player on list!");
return true;
}
}
return false;
}

View File

@ -196,7 +196,7 @@ public class FileSelect {
String name = yamlConfiguration.getString(value.pathPlayerName.replace("KEY", key));
PlayerObject playerObject = new PlayerObject(
name,
yamlConfiguration.getString(value.pathPlayerUuid.replace("KEY", key).replace("-", "")));
yamlConfiguration.getString(value.pathPlayerUuid.replace("KEY", key)).replace("-", ""));
PlayerCash.getPermissionHashMap().put(name, playerObject);
}
break;

View File

@ -58,8 +58,9 @@ public enum Language {
"[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,
"<dark_red>Du wurdest gekickt, da du Permissions besitzt, für die du keine Berechtigung besitzt!</dark_red>",
"<dark_red>You were kicked because you have permissions to which you do not have permission!</dark_red>"),
"&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>");

View File

@ -80,7 +80,13 @@ public class OpCommand implements Listener {
private static Boolean opWhitelist(String playerName, String playerUuid) {
for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getOpHashMap().entrySet()) {
T2Csend.debug(Main.getPlugin(), "--------- " + playerName);
T2Csend.debug(Main.getPlugin(),"opWhitelist (op command) playerObject Name: "+playerObject.getValue().playerName );
T2Csend.debug(Main.getPlugin(),"opWhitelist (op command) Player Name: "+ playerName );
T2Csend.debug(Main.getPlugin(),"opWhitelist (op command) playerObject UUID: "+playerObject.getValue().uuid );
T2Csend.debug(Main.getPlugin(),"opWhitelist (op command) Player UUID: "+ playerUuid );
if (playerObject.getValue().playerName.equals(playerName) && playerObject.getValue().uuid.equals(playerUuid.replace("-", ""))) {
T2Csend.debug(Main.getPlugin(),"opWhitelist (op command) on list!");
return true;
}
}