code changes

This commit is contained in:
JaTiTV 2022-12-23 00:38:55 +01:00
parent e14f91c584
commit dba1e57b91
7 changed files with 12 additions and 20 deletions

View File

@ -4,7 +4,7 @@ import net.t2code.opsecurity.config.config.Config;
import net.t2code.opsecurity.config.language.Language; import net.t2code.opsecurity.config.language.Language;
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.PlayerCash; import net.t2code.opsecurity.objects.PlayerCache;
import net.t2code.opsecurity.objects.PlayerObject; import net.t2code.opsecurity.objects.PlayerObject;
import net.t2code.opsecurity.system.BungeeSenderReceiver; import net.t2code.opsecurity.system.BungeeSenderReceiver;
import net.t2code.opsecurity.system.Main; import net.t2code.opsecurity.system.Main;
@ -89,7 +89,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 : PlayerCache.getOpHashMap().entrySet()) {
T2Csend.debug(Main.getPlugin(), "--------- " + player.getName()); T2Csend.debug(Main.getPlugin(), "--------- " + player.getName());
T2Csend.debug(Main.getPlugin(), "opWhitelist playerObject Name: " + playerObject.getValue().playerName); T2Csend.debug(Main.getPlugin(), "opWhitelist playerObject Name: " + playerObject.getValue().playerName);
T2Csend.debug(Main.getPlugin(), "opWhitelist Player Name: " + player.getName()); T2Csend.debug(Main.getPlugin(), "opWhitelist Player Name: " + player.getName());

View File

@ -4,7 +4,7 @@ import net.t2code.opsecurity.config.config.Config;
import net.t2code.opsecurity.config.language.Language; import net.t2code.opsecurity.config.language.Language;
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.PlayerCash; import net.t2code.opsecurity.objects.PlayerCache;
import net.t2code.opsecurity.objects.PlayerObject; import net.t2code.opsecurity.objects.PlayerObject;
import net.t2code.opsecurity.system.BungeeSenderReceiver; import net.t2code.opsecurity.system.BungeeSenderReceiver;
import net.t2code.opsecurity.system.Main; import net.t2code.opsecurity.system.Main;
@ -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 : PlayerCache.getPermissionHashMap().entrySet()) {
T2Csend.debug(Main.getPlugin(), "--------- " + player.getName()); T2Csend.debug(Main.getPlugin(), "--------- " + player.getName());
T2Csend.debug(Main.getPlugin(),"permWhitelist playerObject Name: "+playerObject.getValue().playerName ); T2Csend.debug(Main.getPlugin(),"permWhitelist playerObject Name: "+playerObject.getValue().playerName );
T2Csend.debug(Main.getPlugin(),"permWhitelist Player Name: "+player.getName() ); T2Csend.debug(Main.getPlugin(),"permWhitelist Player Name: "+player.getName() );

View File

@ -4,12 +4,8 @@ package net.t2code.opsecurity.command;
import net.t2code.opsecurity.Util; import net.t2code.opsecurity.Util;
import net.t2code.opsecurity.config.config.Config; import net.t2code.opsecurity.config.config.Config;
import net.t2code.opsecurity.objects.PlayerCash;
import net.t2code.opsecurity.objects.PlayerObject;
import net.t2code.opsecurity.system.Main;
import net.t2code.opsecurity.system.Permissions; import net.t2code.opsecurity.system.Permissions;
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab; import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -18,7 +14,6 @@ import org.bukkit.command.TabCompleter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
public class CmdExecuter implements CommandExecutor, TabCompleter { public class CmdExecuter implements CommandExecutor, TabCompleter {

View File

@ -5,8 +5,6 @@ import net.t2code.opsecurity.check.OpCheck;
import net.t2code.opsecurity.config.FileSelect; 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.Language;
import net.t2code.opsecurity.enums.OpCommandRequest;
import net.t2code.opsecurity.objects.PlayerCash;
import net.t2code.opsecurity.system.Main; import net.t2code.opsecurity.system.Main;
import net.t2code.opsecurity.system.Permissions; import net.t2code.opsecurity.system.Permissions;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;

View File

@ -5,7 +5,7 @@ import net.t2code.opsecurity.config.config.Config;
import net.t2code.opsecurity.config.language.Language; import net.t2code.opsecurity.config.language.Language;
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.objects.PlayerCash; import net.t2code.opsecurity.objects.PlayerCache;
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.messages.T2Creplace; import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
@ -115,7 +115,7 @@ public class FileSelect {
} }
public static void selectOpWhitelist() { public static void selectOpWhitelist() {
PlayerCash.getOpHashMap().clear(); PlayerCache.getOpHashMap().clear();
File config = new File(Main.getPath(), "opWhitelist.yml"); File config = new File(Main.getPath(), "opWhitelist.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
for (OPWhitelist value : OPWhitelist.values()) { for (OPWhitelist value : OPWhitelist.values()) {
@ -144,7 +144,7 @@ public class FileSelect {
PlayerObject playerObject = new PlayerObject( PlayerObject playerObject = new PlayerObject(
name, name,
yamlConfiguration.getString(value.pathPlayerUuid.replace("KEY", key)).replace("-", "")); yamlConfiguration.getString(value.pathPlayerUuid.replace("KEY", key)).replace("-", ""));
PlayerCash.getOpHashMap().put(name, playerObject); PlayerCache.getOpHashMap().put(name, playerObject);
} }
break; break;
case GAMEMODE: case GAMEMODE:
@ -168,7 +168,7 @@ public class FileSelect {
} }
public static void selectPermissionWhitelist() { public static void selectPermissionWhitelist() {
PlayerCash.getPermissionHashMap().clear(); PlayerCache.getPermissionHashMap().clear();
File config = new File(Main.getPath(), "permissionWhitelist.yml"); File config = new File(Main.getPath(), "permissionWhitelist.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
for (PermissionWhitelist value : PermissionWhitelist.values()) { for (PermissionWhitelist value : PermissionWhitelist.values()) {
@ -197,7 +197,7 @@ public class FileSelect {
PlayerObject playerObject = new PlayerObject( PlayerObject playerObject = new PlayerObject(
name, name,
yamlConfiguration.getString(value.pathPlayerUuid.replace("KEY", key)).replace("-", "")); yamlConfiguration.getString(value.pathPlayerUuid.replace("KEY", key)).replace("-", ""));
PlayerCash.getPermissionHashMap().put(name, playerObject); PlayerCache.getPermissionHashMap().put(name, playerObject);
} }
break; break;
} }

View File

@ -1,10 +1,9 @@
package net.t2code.opsecurity.events; package net.t2code.opsecurity.events;
import net.t2code.opsecurity.check.OpCheck;
import net.t2code.opsecurity.config.language.Language; import net.t2code.opsecurity.config.language.Language;
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.PlayerCash; import net.t2code.opsecurity.objects.PlayerCache;
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.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
@ -79,7 +78,7 @@ 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 : PlayerCache.getOpHashMap().entrySet()) {
T2Csend.debug(Main.getPlugin(), "--------- " + playerName); T2Csend.debug(Main.getPlugin(), "--------- " + playerName);
T2Csend.debug(Main.getPlugin(),"opWhitelist (op command) playerObject Name: "+playerObject.getValue().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) Player Name: "+ playerName );

View File

@ -4,7 +4,7 @@ import lombok.Getter;
import java.util.HashMap; import java.util.HashMap;
public class PlayerCash { public class PlayerCache {
@Getter @Getter
private static HashMap<String, PlayerObject> opHashMap = new HashMap<String, PlayerObject>(); private static HashMap<String, PlayerObject> opHashMap = new HashMap<String, PlayerObject>();
@Getter @Getter