mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-23 19:16:14 +01:00
remove setCancelled / isCancelled from PacketInjector (#1553)
closes #1552
This commit is contained in:
parent
b4eff32213
commit
4096952c16
@ -222,11 +222,6 @@ public class PacketFilterManager implements ListenerInvoker, InternalManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object nmsPacket = packet.getHandle();
|
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
|
// check to which listeners we need to post the packet
|
||||||
if (filters) {
|
if (filters) {
|
||||||
// post to all listeners
|
// post to all listeners
|
||||||
@ -244,7 +239,6 @@ public class PacketFilterManager implements ListenerInvoker, InternalManager {
|
|||||||
|
|
||||||
// post to the player inject, reset our cancel state change
|
// post to the player inject, reset our cancel state change
|
||||||
this.playerInjectionHandler.receiveClientPacket(sender, nmsPacket);
|
this.playerInjectionHandler.receiveClientPacket(sender, nmsPacket);
|
||||||
this.packetInjector.setCancelled(nmsPacket, oldCancelState);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package com.comphenix.protocol.injector.packet;
|
|||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.concurrency.PacketTypeSet;
|
import com.comphenix.protocol.concurrency.PacketTypeSet;
|
||||||
import com.comphenix.protocol.events.ListenerOptions;
|
import com.comphenix.protocol.events.ListenerOptions;
|
||||||
import com.comphenix.protocol.injector.packet.PacketInjector;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class AbstractPacketInjector implements PacketInjector {
|
public abstract class AbstractPacketInjector implements PacketInjector {
|
||||||
@ -14,17 +13,6 @@ public abstract class AbstractPacketInjector implements PacketInjector {
|
|||||||
this.inboundFilters = inboundFilters;
|
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
|
@Override
|
||||||
public boolean addPacketHandler(PacketType type, Set<ListenerOptions> options) {
|
public boolean addPacketHandler(PacketType type, Set<ListenerOptions> options) {
|
||||||
this.inboundFilters.addType(type);
|
this.inboundFilters.addType(type);
|
||||||
|
@ -14,22 +14,6 @@ import org.bukkit.entity.Player;
|
|||||||
*/
|
*/
|
||||||
public interface PacketInjector {
|
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.
|
* Start intercepting packets with the given packet type.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user