Merge pull request '2.4.1 | WorldGuard bug' (#3) from OPsecurity-+-worldguard-flag-bug into main

Reviewed-on: JaTiTV/OPSecurity#3
This commit is contained in:
JaTiTV 2022-01-09 23:30:05 +01:00
commit 2a098d6977
4 changed files with 11 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<groupId>de.jatitv</groupId>
<artifactId>OPSecurity</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<packaging>jar</packaging>
<name>OPSecurity</name>

View File

@ -17,7 +17,10 @@ public class Events implements org.bukkit.event.Listener {
public void CommandSendEvent(PlayerCommandPreprocessEvent event) {
if (SelectConfig.CheckOnCommand) {
Player player = event.getPlayer();
event.setCancelled(Check.onCheck(player, false));
if (Check.onCheck(player, false)) {
if (event.isCancelled()) return;
event.setCancelled(true);
}
}
}
@ -26,9 +29,7 @@ public class Events implements org.bukkit.event.Listener {
if (SelectConfig.CheckOnChat) {
Player player = event.getPlayer();
if (Check.onCheck(player, false)) {
if (event.isCancelled()) {
return;
}
if (event.isCancelled()) return;
event.setCancelled(true);
}
}

View File

@ -23,6 +23,7 @@ public class OPCommand implements Listener {
@EventHandler
public void onOPServer(ServerCommandEvent event) {
if ((event.getCommand().toLowerCase().startsWith("op ") || event.getCommand().toLowerCase().startsWith("minecraft:op ")) && SelectConfig.OP_Whitelist_Enable) {
switch (this.isNotOPWTL(event.getCommand())) {
case 1:
@ -40,6 +41,7 @@ public class OPCommand implements Listener {
@EventHandler
public void onOpPlayer(PlayerCommandPreprocessEvent event) {
if (SelectConfig.OP_Whitelist_Enable) {
if ((event.getMessage().toLowerCase().startsWith("/op ") || event.getMessage().toLowerCase().startsWith("/minecraft:op "))) {
switch (this.isNotOPWTL(event.getMessage())) {
@ -57,6 +59,7 @@ public class OPCommand implements Listener {
}
private int isNotOPWTL(String command) {
if (!command.contains("op")) return 0;
if (command.charAt(0) == '/') command = command.replaceFirst("/", "");
String arg = command.replace("op ", "");

View File

@ -15,6 +15,7 @@ public class PlugManCommand implements Listener {
@EventHandler
public void onOPServer(ServerCommandEvent event) {
if ((event.getCommand().toLowerCase().contains("plugman disable") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|| (event.getCommand().toLowerCase().contains("plugman reload") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|| (event.getCommand().toLowerCase().contains("plugman unload") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
@ -27,6 +28,7 @@ public class PlugManCommand implements Listener {
@EventHandler
public void onOpPlayer(PlayerCommandPreprocessEvent event) {
if (event.getMessage().toLowerCase().startsWith("/plugman disable") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase())
|| (event.getMessage().toLowerCase().startsWith("/plugman reload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|| (event.getMessage().toLowerCase().startsWith("/plugman unload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))