From 4096952c16be9c5ffb3a13438d680d65f1a55b40 Mon Sep 17 00:00:00 2001 From: Pasqual Koschmieder Date: Sat, 26 Mar 2022 18:00:12 +0100 Subject: [PATCH] remove setCancelled / isCancelled from PacketInjector (#1553) closes #1552 --- .../protocol/injector/PacketFilterManager.java | 6 ------ .../injector/packet/AbstractPacketInjector.java | 12 ------------ .../protocol/injector/packet/PacketInjector.java | 16 ---------------- 3 files changed, 34 deletions(-) diff --git a/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java b/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java index 6cb234f1..95e240a0 100644 --- a/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java +++ b/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java @@ -222,11 +222,6 @@ public class PacketFilterManager implements ListenerInvoker, InternalManager { } Object nmsPacket = packet.getHandle(); - - // make sure packets which are force received through this method are never cancelled - boolean oldCancelState = this.packetInjector.isCancelled(nmsPacket); - this.packetInjector.setCancelled(nmsPacket, false); - // check to which listeners we need to post the packet if (filters) { // post to all listeners @@ -244,7 +239,6 @@ public class PacketFilterManager implements ListenerInvoker, InternalManager { // post to the player inject, reset our cancel state change this.playerInjectionHandler.receiveClientPacket(sender, nmsPacket); - this.packetInjector.setCancelled(nmsPacket, oldCancelState); } } diff --git a/src/main/java/com/comphenix/protocol/injector/packet/AbstractPacketInjector.java b/src/main/java/com/comphenix/protocol/injector/packet/AbstractPacketInjector.java index fe671889..4a038d58 100644 --- a/src/main/java/com/comphenix/protocol/injector/packet/AbstractPacketInjector.java +++ b/src/main/java/com/comphenix/protocol/injector/packet/AbstractPacketInjector.java @@ -3,7 +3,6 @@ package com.comphenix.protocol.injector.packet; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.concurrency.PacketTypeSet; import com.comphenix.protocol.events.ListenerOptions; -import com.comphenix.protocol.injector.packet.PacketInjector; import java.util.Set; public abstract class AbstractPacketInjector implements PacketInjector { @@ -14,17 +13,6 @@ public abstract class AbstractPacketInjector implements PacketInjector { this.inboundFilters = inboundFilters; } - @Override - public boolean isCancelled(Object packet) { - // No, it's never cancelled - return false; - } - - @Override - public void setCancelled(Object packet, boolean cancelled) { - throw new UnsupportedOperationException(); - } - @Override public boolean addPacketHandler(PacketType type, Set options) { this.inboundFilters.addType(type); diff --git a/src/main/java/com/comphenix/protocol/injector/packet/PacketInjector.java b/src/main/java/com/comphenix/protocol/injector/packet/PacketInjector.java index 4894f3be..4bbb66a7 100644 --- a/src/main/java/com/comphenix/protocol/injector/packet/PacketInjector.java +++ b/src/main/java/com/comphenix/protocol/injector/packet/PacketInjector.java @@ -14,22 +14,6 @@ import org.bukkit.entity.Player; */ public interface PacketInjector { - /** - * Determine if a packet is cancelled or not. - * - * @param packet - the packet to check. - * @return TRUE if it is, FALSE otherwise. - */ - boolean isCancelled(Object packet); - - /** - * Set whether or not a packet is cancelled. - * - * @param packet - the packet to set. - * @param cancelled - TRUE to cancel the packet, FALSE otherwise. - */ - void setCancelled(Object packet, boolean cancelled); - /** * Start intercepting packets with the given packet type. *