Fix Operator Permission

This commit is contained in:
RayzsYT committed 2024-06-09 00:47:12 +02:00
1 parent 057d1e4256
commit bcf64d297b
4 files changed
+5 -6

No files matched your search

@@ -4,6 +4,7 @@ import de.rayzs.pat.api.netty.bukkit.handlers.LegacyPacketHandler;
import de.rayzs.pat.api.netty.bukkit.handlers.ModernPacketHandler;
import de.rayzs.pat.api.storage.Storage;
import de.rayzs.pat.utils.Reflection;
import de.rayzs.pat.utils.permission.PermissionUtil;
import io.netty.channel.*;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -81,7 +82,7 @@ public class BukkitPacketAnalyzer {
@Override
public void channelRead(ChannelHandlerContext channel, Object packetObj) {
try {
if (!player.hasPermission("proantitab.bypass") && packetObj.getClass() != null) {
if (!PermissionUtil.hasBypassPermission(player, "proantitab.bypass") && packetObj.getClass() != null) {
String packetName = packetObj.getClass().getSimpleName();
if (packetName.equals("PacketPlayInTabComplete")) {
if(!PACKET_HANDLER.handleIncomingPacket(player, packetObj)) return;
@@ -95,7 +96,7 @@ public class BukkitPacketAnalyzer {
@Override
public void write(ChannelHandlerContext channel, Object packetObj, ChannelPromise promise) {
try {
if (!player.hasPermission("proantitab.bypass") && packetObj.getClass() != null) {
if (!PermissionUtil.hasBypassPermission(player, "proantitab.bypass") && packetObj.getClass() != null) {
String packetName = packetObj.getClass().getSimpleName();
if (packetName.equals("PacketPlayOutTabComplete")) {
if(!PACKET_HANDLER.handleOutgoingPacket(player, packetObj)) return;
@@ -31,7 +31,7 @@ public class LegacyPacketHandler implements BukkitPacketHandler {
if(input == null) return false;
boolean cancelsBeforeHand = false;
boolean cancelsBeforeHand;
int spaces = 0;
if(input.startsWith("/")) {
@@ -41,8 +41,6 @@ public class BukkitBlockCommandListener implements Listener {
}
}
if(player.isOp()) return;
if(Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isPluginsCommand(command) && !PermissionUtil.hasBypassPermission(player, command)) {
event.setCancelled(true);
MessageTranslator.send(player, Storage.ConfigSections.Settings.CUSTOM_PLUGIN.MESSAGE, "%command%", rawCommand.replaceFirst("/", ""));
@@ -74,7 +74,7 @@ public class PermissionUtil {
}
if(sender.isOperator())
if(!Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED)
if (!Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED)
return true;
return permissionMap.isPermitted("*") || permissionMap.isPermitted("proantitab.*") || permissionMap.isPermitted("proantitab." + permission);