Archiviert
13
0

Add a way to skip the plugin verifier.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2014-09-07 21:27:46 +02:00
Ursprung f0fd904396
Commit 78b6a651dc
2 geänderte Dateien mit 13 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -19,6 +19,11 @@ public enum ListenerOptions {
*/ */
DISABLE_GAMEPHASE_DETECTION, 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. * Notify ProtocolLib that {@link PacketListener#onPacketSending(PacketEvent)} is thread safe.
*/ */

Datei anzeigen

@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -403,14 +402,18 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
// A listener can only be added once // A listener can only be added once
if (packetListeners.contains(listener)) if (packetListeners.contains(listener))
return; return;
// Check plugin
printPluginWarnings(listener.getPlugin());
ListeningWhitelist sending = listener.getSendingWhitelist(); ListeningWhitelist sending = listener.getSendingWhitelist();
ListeningWhitelist receiving = listener.getReceivingWhitelist(); ListeningWhitelist receiving = listener.getReceivingWhitelist();
boolean hasSending = sending != null && sending.isEnabled(); boolean hasSending = sending != null && sending.isEnabled();
boolean hasReceiving = receiving != null && receiving.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) { if (hasSending || hasReceiving) {
// Add listeners and hooks // Add listeners and hooks
if (hasSending) { if (hasSending) {