mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2025-01-01 05:57:52 +01:00
Compare packet type with equals(), just in case.
This commit is contained in:
parent
45e236b54a
commit
3257d6069a
@ -29,6 +29,7 @@ import org.bukkit.event.Cancellable;
|
|||||||
import com.comphenix.protocol.Application;
|
import com.comphenix.protocol.Application;
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.async.AsyncMarker;
|
import com.comphenix.protocol.async.AsyncMarker;
|
||||||
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
public class PacketEvent extends EventObject implements Cancellable {
|
public class PacketEvent extends EventObject implements Cancellable {
|
||||||
@ -169,7 +170,7 @@ public class PacketEvent extends EventObject implements Cancellable {
|
|||||||
throw new IllegalStateException("The packet event is read-only.");
|
throw new IllegalStateException("The packet event is read-only.");
|
||||||
if (packet == null)
|
if (packet == null)
|
||||||
throw new IllegalArgumentException("Cannot set packet to NULL. Use setCancelled() instead.");
|
throw new IllegalArgumentException("Cannot set packet to NULL. Use setCancelled() instead.");
|
||||||
if (this.packet != null && this.packet.getType() != packet.getType())
|
if (this.packet != null && !Objects.equal(this.packet.getType(), packet.getType()))
|
||||||
throw new IllegalArgumentException("Cannot change packet type from " + this.packet.getType() + " to " + packet.getType());
|
throw new IllegalArgumentException("Cannot change packet type from " + this.packet.getType() + " to " + packet.getType());
|
||||||
this.packet = packet;
|
this.packet = packet;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user