JaTiTV 2022-11-19 03:12:53 +01:00
parent 43e51fee59
commit ea54d85ecc
5 changed files with 10 additions and 5 deletions

View File

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

View File

@ -90,7 +90,7 @@ public class OpCheck {
public static Boolean opWhitelist(Player player) { public static Boolean opWhitelist(Player player) {
for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getOpHashMap().entrySet()) { for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getOpHashMap().entrySet()) {
if (playerObject.getValue().playerName.equals(player.getName()) && playerObject.getValue().uuid.equals(player.getUniqueId().toString())) return true; if (playerObject.getValue().playerName.equals(player.getName()) && playerObject.getValue().uuid.equals(player.getUniqueId().toString().replace("-",""))) return true;
} }
return false; return false;
} }

View File

@ -56,7 +56,7 @@ public class PermissionCheck {
private static Boolean permWhitelist(Player player) { private static Boolean permWhitelist(Player player) {
for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getPermissionHashMap().entrySet()) { for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getPermissionHashMap().entrySet()) {
if (playerObject.getValue().playerName.equals(player.getName()) && playerObject.getValue().uuid.equals(player.getUniqueId().toString())) return true; if (playerObject.getValue().playerName.equals(player.getName()) && playerObject.getValue().uuid.equals(player.getUniqueId().toString().replace("-",""))) return true;
} }
return false; return false;
} }

View File

@ -128,7 +128,7 @@ public class FileSelect {
break; break;
case STRINGLIST: case STRINGLIST:
if (!yamlConfiguration.contains(value.path)) { if (!yamlConfiguration.contains(value.path)) {
yamlConfiguration.set(value.path, value.valueBoolean); yamlConfiguration.set(value.path, value.valueStringList);
} }
value.valueStringList = T2Creplace.replace(Util.getPrefix(), yamlConfiguration.getStringList(value.path)); value.valueStringList = T2Creplace.replace(Util.getPrefix(), yamlConfiguration.getStringList(value.path));
break; break;

View File

@ -6,6 +6,7 @@ import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
import net.t2code.opsecurity.enums.OpCommandRequest; import net.t2code.opsecurity.enums.OpCommandRequest;
import net.t2code.opsecurity.objects.PlayerCash; import net.t2code.opsecurity.objects.PlayerCash;
import net.t2code.opsecurity.objects.PlayerObject; import net.t2code.opsecurity.objects.PlayerObject;
import net.t2code.opsecurity.system.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.player.T2CnameHistory; import net.t2code.t2codelib.SPIGOT.api.player.T2CnameHistory;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -57,10 +58,12 @@ public class OpCommand implements Listener {
if (command.charAt(0) == '/') command = command.replaceFirst("/", ""); if (command.charAt(0) == '/') command = command.replaceFirst("/", "");
String arg = command.replace("op ", ""); String arg = command.replace("op ", "");
Player target = Bukkit.getPlayer(arg); Player target = Bukkit.getPlayer(arg);
if (OPWhitelist.playerMustBeOnlineToOp.valueBoolean) { if (OPWhitelist.playerMustBeOnlineToOp.valueBoolean) {
if (target == null) return OpCommandRequest.mustOnline; if (target == null) return OpCommandRequest.mustOnline;
if (!opWhitelist(target.getName(), target.getUniqueId().toString())) return OpCommandRequest.notWhitelisted; if (!opWhitelist(target.getName(), target.getUniqueId().toString())) return OpCommandRequest.notWhitelisted;
} }
String targetUUID; String targetUUID;
if (target != null) { if (target != null) {
targetUUID = target.getUniqueId().toString(); targetUUID = target.getUniqueId().toString();
@ -77,7 +80,9 @@ public class OpCommand implements Listener {
private static Boolean opWhitelist(String playerName, String playerUuid) { private static Boolean opWhitelist(String playerName, String playerUuid) {
for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getOpHashMap().entrySet()) { for (Map.Entry<String, PlayerObject> playerObject : PlayerCash.getOpHashMap().entrySet()) {
if (playerObject.getValue().playerName.equals(playerName) && playerObject.getValue().uuid.equals(playerUuid)) return true; if (playerObject.getValue().playerName.equals(playerName) && playerObject.getValue().uuid.equals(playerUuid.replace("-", ""))) {
return true;
}
} }
return false; return false;
} }