code changes

This commit is contained in:
JaTiTV 2022-01-09 04:44:10 +01:00
parent 156784f37c
commit e8a3c26650
2 changed files with 32 additions and 29 deletions

View File

@ -18,6 +18,7 @@ import java.util.Iterator;
public class LPCommand implements Listener {
/*
private boolean LPCheck(String command) {
if (command.charAt(0) == '/') {
command = command.replaceFirst("/", "");
@ -83,4 +84,6 @@ public class LPCommand implements Listener {
event.setCancelled(true);
}
}
*/
}

View File

@ -21,35 +21,6 @@ import org.bukkit.event.server.ServerCommandEvent;
public class OPCommand implements Listener {
private int isNotOPWTL(String command) {
if (command.charAt(0) == '/') command = command.replaceFirst("/", "");
String arg = command.replace("op ", "");
if (SelectConfig.PlayerMustBeOnlineToOp) {
if (Main.opHashMap.containsKey(arg.toLowerCase())) {
Player target = Bukkit.getPlayer(arg);
if (target == null) {
return 1;
}
if (Main.opHashMap.get(target.getName().toLowerCase()).UUID.equals(target.getUniqueId().toString().replace("-", ""))) {
return 0;
} else return 2;
} else return 2;
} else {
if (Main.opHashMap.containsKey(arg.toLowerCase())) {
String targetUUID = null;
try {
targetUUID = NameHistory.getPlayerUUID(arg);
} catch (IOException e) {
e.printStackTrace();
}
if (Main.opHashMap.get(arg.toLowerCase()).UUID.equals(targetUUID)) {
return 0;
} else return 2;
} else return 2;
}
}
@EventHandler
public void onOPServer(ServerCommandEvent event) {
if ((event.getCommand().toLowerCase().startsWith("op ") || event.getCommand().toLowerCase().startsWith("minecraft:op ")) && SelectConfig.OP_Whitelist_Enable) {
@ -84,4 +55,33 @@ public class OPCommand implements Listener {
}
}
}
private int isNotOPWTL(String command) {
if (command.charAt(0) == '/') command = command.replaceFirst("/", "");
String arg = command.replace("op ", "");
if (SelectConfig.PlayerMustBeOnlineToOp) {
if (Main.opHashMap.containsKey(arg.toLowerCase())) {
Player target = Bukkit.getPlayer(arg);
if (target == null) {
return 1;
}
if (Main.opHashMap.get(target.getName().toLowerCase()).UUID.equals(target.getUniqueId().toString().replace("-", ""))) {
return 0;
} else return 2;
} else return 2;
} else {
if (Main.opHashMap.containsKey(arg.toLowerCase())) {
String targetUUID = null;
try {
targetUUID = NameHistory.getPlayerUUID(arg);
} catch (IOException e) {
e.printStackTrace();
}
if (Main.opHashMap.get(arg.toLowerCase()).UUID.equals(targetUUID)) {
return 0;
} else return 2;
} else return 2;
}
}
}