From 78b6a651dc4a4aa8f888e6049bdf91982f9375d4 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sun, 7 Sep 2014 21:27:46 +0200 Subject: [PATCH] Add a way to skip the plugin verifier. --- .../comphenix/protocol/events/ListenerOptions.java | 5 +++++ .../protocol/injector/PacketFilterManager.java | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerOptions.java b/ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerOptions.java index 63ebed9e..9bf2f207 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerOptions.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/events/ListenerOptions.java @@ -19,6 +19,11 @@ public enum ListenerOptions { */ DISABLE_GAMEPHASE_DETECTION, + /** + * Do not verify that the owning plugin has a vaid plugin.yml. + */ + SKIP_PLUGIN_VERIFIER, + /** * Notify ProtocolLib that {@link PacketListener#onPacketSending(PacketEvent)} is thread safe. */ diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java index 2199344f..e4539f44 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/PacketFilterManager.java @@ -23,7 +23,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; -import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -402,15 +401,19 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok // A listener can only be added once if (packetListeners.contains(listener)) - return; - // Check plugin - printPluginWarnings(listener.getPlugin()); - + return; ListeningWhitelist sending = listener.getSendingWhitelist(); ListeningWhitelist receiving = listener.getReceivingWhitelist(); boolean hasSending = sending != null && sending.isEnabled(); boolean hasReceiving = receiving != null && receiving.isEnabled(); + // Check plugin + if (!(hasSending && sending.getOptions().contains(ListenerOptions.SKIP_PLUGIN_VERIFIER)) && + !(hasReceiving && receiving.getOptions().contains(ListenerOptions.SKIP_PLUGIN_VERIFIER))) { + + printPluginWarnings(listener.getPlugin()); + } + if (hasSending || hasReceiving) { // Add listeners and hooks if (hasSending) {