diff --git a/OpSecurity V3/pom.xml b/OpSecurity V3/pom.xml
index 49a6a7d..5df38ee 100644
--- a/OpSecurity V3/pom.xml
+++ b/OpSecurity V3/pom.xml
@@ -6,7 +6,7 @@
net.t2code
T2C-OPSecurity
- 3.1.0
+ 3.1.1_DEV-1
jar
@@ -83,7 +83,7 @@
net.t2code
T2CodeLib
- 13.4
+ 14.4
provided
diff --git a/OpSecurity V3/src/main/java/net/t2code/opsecurity/API/T2COpSecAPI.java b/OpSecurity V3/src/main/java/net/t2code/opsecurity/API/T2COpSecAPI.java
index d6a89a7..8ec6e3c 100644
--- a/OpSecurity V3/src/main/java/net/t2code/opsecurity/API/T2COpSecAPI.java
+++ b/OpSecurity V3/src/main/java/net/t2code/opsecurity/API/T2COpSecAPI.java
@@ -7,6 +7,7 @@ import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
import net.t2code.opsecurity.objects.PlayerCache;
import net.t2code.opsecurity.objects.PlayerObject;
+import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.entity.Player;
@@ -17,7 +18,8 @@ import java.util.Map;
public class T2COpSecAPI {
public static boolean checkOPWhiteList(Player player) {
if (!OPWhitelist.enable.valueBoolean) return true;
- return OpCheck.opWhitelist(player);
+ String debug = T2Cdebug.debugCode();
+ return OpCheck.opWhitelist(player,debug);
}
public static boolean checkPermissionWhiteList(Player player) {
diff --git a/OpSecurity V3/src/main/java/net/t2code/opsecurity/Util.java b/OpSecurity V3/src/main/java/net/t2code/opsecurity/Util.java
index f424423..7e05d92 100644
--- a/OpSecurity V3/src/main/java/net/t2code/opsecurity/Util.java
+++ b/OpSecurity V3/src/main/java/net/t2code/opsecurity/Util.java
@@ -8,7 +8,7 @@ public class Util {
private static String infoText = "";
@Getter
- private static String requiredT2CodeLibVersion = "13.4";
+ private static String requiredT2CodeLibVersion = "14.4";
@Getter
private static String prefix = "§8[§4T2C§8-§2OP§4Security§8]";
diff --git a/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/OpCheck.java b/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/OpCheck.java
index 12a7947..6c73eca 100644
--- a/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/OpCheck.java
+++ b/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/OpCheck.java
@@ -16,25 +16,26 @@ import org.bukkit.entity.Player;
import java.util.Map;
public class OpCheck {
- public static Boolean onCheck(Player player, Boolean join) {
+ public static Boolean onCheck(Player player, Boolean join, String debug) {
if (!OPWhitelist.enable.valueBoolean) return false;
if (!player.isOp()) return false;
- if (opWhitelist(player)) 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())));
Bukkit.getScheduler().runTask(Main.getPlugin(), new Runnable() {
@Override
public void run() {
- execute(player, join);
+ execute(player, join, debug);
}
});
return true;
}
- private static void execute(Player player, Boolean join) {
+ private static void execute(Player player, Boolean join, String debug) {
if (Config.notifyJoinWarning.valueBoolean && join) {
if (Config.notifyBungee.valueBoolean) {
BungeeSenderReceiver.sendToBungee(Language.opWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
- } else Events.notifyPlayer(Language.opWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
+ } else
+ Events.notifyPlayer(Language.opWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
}
if (OPWhitelist.noOpPlayerSetGameModeEnable.valueBoolean) {
@@ -46,18 +47,18 @@ public class OpCheck {
if (OPWhitelist.noOpPlayerKickEnable.valueBoolean) {
if (!OPWhitelist.customCommandsEnable.valueBoolean) {
if (Config.kickCustomCommand.valueBoolean) {
- T2Ccmd.console(Config.kickCommand.valueString.replace("[player]", player.getName()).replace("[reason]",
+ T2Ccmd.console( Config.kickCommand.valueString.replace("[player]", player.getName()).replace("[reason]",
OPWhitelist.noOpPlayerKickEnable.valueBoolean && OPWhitelist.noOpPlayerDeopEnable.valueBoolean && OPWhitelist.noOpPlayerDeopPlayerSendMessage.valueBoolean
? Language.opWhitelistKick.value + "
" + 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);
}
- T2Csend.console(Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName().replace("[uuid]", String.valueOf(player.getUniqueId()))) + "
"
+ T2Csend.console("["+debug+ "]" +Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName().replace("[uuid]", String.valueOf(player.getUniqueId()))) + "
"
+ Language.opWhitelistNotifyKick.value.replace("[player]", player.getName().replace("[uuid]", String.valueOf(player.getUniqueId()))).replace("[uuid]", String.valueOf(player.getUniqueId())));
Events.notifyPlayer(Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName()) + "
"
+ Language.opWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
} else {
- T2Csend.console(Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
+ T2Csend.console("["+debug+ "]" +Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
Events.notifyPlayer(Language.opWhitelistNotifyDeop.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
if (OPWhitelist.noOpPlayerDeopPlayerSendMessage.valueBoolean) {
@@ -77,7 +78,7 @@ public class OpCheck {
T2Ccmd.console(Config.kickCommand.valueString.replace("[player]", player.getName()).replace("[reason]", Language.opWhitelistKick.value));
} else player.kickPlayer(Language.opWhitelistKick.value);
}
- T2Csend.console(Language.opWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
+ T2Csend.console("["+debug+ "]" +Language.opWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
Events.notifyPlayer(Language.opWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]", String.valueOf(player.getUniqueId())));
}
}
@@ -88,15 +89,15 @@ public class OpCheck {
}
}
- public static Boolean opWhitelist(Player player) {
+ public static Boolean opWhitelist(Player player, String debug) {
for (Map.Entry playerObject : PlayerCache.getOpHashMap().entrySet()) {
- 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("-", ""));
+ T2Csend.debug(Main.getPlugin(), "[" + debug + "] --------- " + player.getName());
+ T2Csend.debug(Main.getPlugin(), "[" + debug + "] opWhitelist playerObject Name: " + playerObject.getValue().playerName);
+ T2Csend.debug(Main.getPlugin(), "[" + debug + "] opWhitelist Player Name: " + player.getName());
+ T2Csend.debug(Main.getPlugin(), "[" + debug + "] opWhitelist playerObject UUID: " + playerObject.getValue().uuid);
+ T2Csend.debug(Main.getPlugin(), "[" + debug + "] 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!");
+ T2Csend.debug(Main.getPlugin(), "[" + debug + "] opWhitelist Player on list!");
return true;
}
}
diff --git a/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/PermissionCheck.java b/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/PermissionCheck.java
index d28a2b4..d5c96e1 100644
--- a/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/PermissionCheck.java
+++ b/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/PermissionCheck.java
@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
import java.util.Map;
public class PermissionCheck {
- public static Boolean onCheck(Player player, Boolean join) {
+ public static Boolean onCheck(Player player, Boolean join, String debug) {
if (!PermissionWhitelist.enable.valueBoolean) return false;
for (String perm : PermissionWhitelist.permissions.valueStringList) {
if (!player.hasPermission(perm)) return false;
@@ -24,7 +24,7 @@ public class PermissionCheck {
Bukkit.getScheduler().runTask(Main.getPlugin(), new Runnable() {
@Override
public void run() {
- execute(player, join, perm);
+ execute(player, join, perm, debug);
}
});
return true;
@@ -32,8 +32,8 @@ public class PermissionCheck {
return false;
}
- private static void execute(Player player, Boolean join, String perm) {
- if (join) T2Csend.console(Language.permissionWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]",String.valueOf(player.getUniqueId())));
+ private static void execute(Player player, Boolean join, String perm, String debug) {
+ if (join) T2Csend.console("["+debug+ "]" +Language.permissionWhitelistNotifyKick.value.replace("[player]", player.getName()).replace("[uuid]",String.valueOf(player.getUniqueId())));
if (Config.notifyJoinWarning.valueBoolean && join) {
if (Config.notifyBungee.valueBoolean) {
BungeeSenderReceiver.sendToBungee(Language.permissionWhitelistNotifyOnJoin.value.replace("[player]", player.getName()).replace("[uuid]",String.valueOf(player.getUniqueId())));
@@ -44,7 +44,7 @@ public class PermissionCheck {
if (Config.kickCustomCommand.valueBoolean) {
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]",
+ T2Csend.console("["+debug+ "]" +Language.permissionWhitelistNotifyKick.value.replace("[player]",
player.getName()).replace("[perm]", perm).replace("[uuid]",String.valueOf(player.getUniqueId())));
}
if (PermissionWhitelist.customCommandsEnable.valueBoolean) {
diff --git a/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/Timer.java b/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/Timer.java
index 9da4f6d..6156fb5 100644
--- a/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/Timer.java
+++ b/OpSecurity V3/src/main/java/net/t2code/opsecurity/check/Timer.java
@@ -6,6 +6,7 @@ import net.t2code.opsecurity.config.config.Config;
import net.t2code.opsecurity.config.opWhitelist.OPWhitelist;
import net.t2code.opsecurity.config.permissionWhitelist.PermissionWhitelist;
import net.t2code.opsecurity.system.Main;
+import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -19,8 +20,9 @@ public class Timer {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
- OpCheck.onCheck(player, false);
- PermissionCheck.onCheck(player, false);
+ String debug = T2Cdebug.debugCode();
+ OpCheck.onCheck(player, false, debug);
+ PermissionCheck.onCheck(player, false, debug);
}
}
}, 0, 20L * Config.checkTimerRefreshInSec.valueInt);
diff --git a/OpSecurity V3/src/main/java/net/t2code/opsecurity/command/Commands.java b/OpSecurity V3/src/main/java/net/t2code/opsecurity/command/Commands.java
index a3e3e20..a8426e8 100644
--- a/OpSecurity V3/src/main/java/net/t2code/opsecurity/command/Commands.java
+++ b/OpSecurity V3/src/main/java/net/t2code/opsecurity/command/Commands.java
@@ -7,6 +7,7 @@ import net.t2code.opsecurity.config.config.Config;
import net.t2code.opsecurity.config.language.Language;
import net.t2code.opsecurity.system.Main;
import net.t2code.opsecurity.system.Permissions;
+import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import org.bukkit.Bukkit;
@@ -53,7 +54,8 @@ public class Commands {
if (sender instanceof Player) {
Player player = (Player) sender;
if (Config.onlyOPcanUseThePlugin.valueBoolean) {
- if (!OpCheck.opWhitelist(player)) {
+ String debug = T2Cdebug.debugCode();
+ if (!OpCheck.opWhitelist(player,debug)) {
sender.sendMessage(Util.getPrefix() + " §4You are not on the Whitelist!"); // todo
return;
}
diff --git a/OpSecurity V3/src/main/java/net/t2code/opsecurity/events/Events.java b/OpSecurity V3/src/main/java/net/t2code/opsecurity/events/Events.java
index 40e3d8f..eee59b6 100644
--- a/OpSecurity V3/src/main/java/net/t2code/opsecurity/events/Events.java
+++ b/OpSecurity V3/src/main/java/net/t2code/opsecurity/events/Events.java
@@ -6,6 +6,7 @@ import net.t2code.opsecurity.check.OpCheck;
import net.t2code.opsecurity.check.PermissionCheck;
import net.t2code.opsecurity.system.Main;
import net.t2code.opsecurity.system.Permissions;
+import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import org.bukkit.Bukkit;
@@ -28,7 +29,13 @@ public class Events implements Listener {
public void CommandSendEvent(PlayerCommandPreprocessEvent event) {
if (!Config.checkOnCommand.valueBoolean) return;
Player player = event.getPlayer();
- if (OpCheck.onCheck(player, false) || PermissionCheck.onCheck(player, false)) {
+ String debug = T2Cdebug.debugCode();
+ if (OpCheck.onCheck(player, false, debug)) {
+ if (event.isCancelled()) return;
+ event.setCancelled(true);
+ }
+ String debug2 = T2Cdebug.debugCode();
+ if (PermissionCheck.onCheck(player, false, debug2)) {
if (event.isCancelled()) return;
event.setCancelled(true);
}
@@ -38,7 +45,13 @@ public class Events implements Listener {
public void PlayerChatEvent(PlayerChatEvent event) {
if (!Config.checkOnChat.valueBoolean) return;
Player player = event.getPlayer();
- if (OpCheck.onCheck(player, false) || PermissionCheck.onCheck(player, false)) {
+ String debug = T2Cdebug.debugCode();
+ if (OpCheck.onCheck(player, false, debug)) {
+ if (event.isCancelled()) return;
+ event.setCancelled(true);
+ }
+ String debug2 = T2Cdebug.debugCode();
+ if (PermissionCheck.onCheck(player, false, debug2)) {
if (event.isCancelled()) return;
event.setCancelled(true);
}
@@ -47,11 +60,16 @@ public class Events implements Listener {
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if (!Config.checkOnInteract.valueBoolean) return;
- Player player = event.getPlayer();
Bukkit.getScheduler().runTaskLaterAsynchronously(Main.getPlugin(), new Runnable() {
@Override
public void run() {
- if (OpCheck.onCheck(player, false) || PermissionCheck.onCheck(player, false)) {
+ Player player = event.getPlayer();
+ String debug = T2Cdebug.debugCode();
+ if (OpCheck.onCheck(player, false, debug)) {
+ event.setCancelled(true);
+ }
+ String debug2 = T2Cdebug.debugCode();
+ if (PermissionCheck.onCheck(player, false, debug2)) {
event.setCancelled(true);
}
}
@@ -61,12 +79,14 @@ public class Events implements Listener {
@EventHandler
public void onJoinCheck(PlayerJoinEvent event) {
if (!Config.checkOnJoin.valueBoolean) return;
- Player player = event.getPlayer();
Bukkit.getScheduler().runTaskLaterAsynchronously(Main.getPlugin(), new Runnable() {
@Override
public void run() {
- OpCheck.onCheck(player, true);
- PermissionCheck.onCheck(player, true);
+ Player player = event.getPlayer();
+ String debug = T2Cdebug.debugCode();
+ OpCheck.onCheck(player, true, debug);
+ String debug2 = T2Cdebug.debugCode();
+ PermissionCheck.onCheck(player, true, debug2);
}
}, 1L);
}