public final class ListenerManager extends Object
SubListener
referencesModifier and Type | Method and Description |
---|---|
static <S extends SubListener<? extends org.bukkit.plugin.Plugin>> |
getListener(Class<S> listener)
Gets a listener by its string name.
|
static <P extends org.bukkit.plugin.Plugin,S extends SubListener<P>> |
getRegisteringPlugin(Class<S> listener)
Returns the
Plugin relevant to the passed SubListener
class |
static <T extends SubListener<?>> |
isRegistered(Class<T> listener)
Returns whether or not a listener is registered under the relevant
listener key
|
static boolean |
isRegisteredToBukkit(org.bukkit.plugin.Plugin p,
org.bukkit.event.Listener l)
Returns
true if the passed Listener has another Listener
of the same class type already registered for bukkit. |
static <S extends SubListener<?>> |
registerListener(S listener)
Registers a listener through Bukkit and
ListenerManager |
static <T extends SubListener<?>> |
registerListeners(T... listeners)
Calls
registerListener(SubListener) for every
passed listener. |
static void |
release()
Unregisters all the listeners attached to this
ListenerManager . |
static void |
unregisterListener(Class<? extends SubListener<?>> listener)
Unregisters a specific
SubListener from both CodelanxLib and
Bukkit |
public static <S extends SubListener<? extends org.bukkit.plugin.Plugin>> S getListener(Class<S> listener)
S
- The SubListener
typelistener
- An instance of the class type to retrieveIllegalArgumentException
- If the listener isn't registeredpublic static <P extends org.bukkit.plugin.Plugin,S extends SubListener<P>> P getRegisteringPlugin(Class<S> listener)
Plugin
relevant to the passed SubListener
classP
- The Plugin
typeS
- The SubListener
typelistener
- The SubListener
class that was registeredPlugin
that registered the SubListener
IllegalArgumentException
- If the listener isn't registeredpublic static <T extends SubListener<?>> boolean isRegistered(Class<T> listener)
T
- The SubListener
class to getlistener
- The listener class to look fortrue
if registered, false
otherwisepublic static boolean isRegisteredToBukkit(org.bukkit.plugin.Plugin p, org.bukkit.event.Listener l)
true
if the passed Listener
has another Listener
of the same class type already registered for bukkit. This should not be
used with any listeners that are from an anonymous class, as this will
return true
for any other anonymous classes as wellp
- The Plugin
that registers this Listener
l
- The Listener
to checktrue
if registered to bukkitpublic static <S extends SubListener<?>> S registerListener(S listener)
ListenerManager
S
- The SubListener
class to registerlistener
- The listener to registerIllegalArgumentException
- Attempted to register a Listener twicepublic static <T extends SubListener<?>> void registerListeners(T... listeners)
registerListener(SubListener)
for every
passed listener. Any exception thrown will be re-thrown after all
listeners are registeredT
- The SubListener
class to registerlisteners
- The listeners to registerIllegalArgumentException
- Attempted to register a Listener twicepublic static void unregisterListener(Class<? extends SubListener<?>> listener)
SubListener
from both CodelanxLib and
Bukkitlistener
- The SubListener
class to unregisterpublic static void release()
ListenerManager
.
Can only be called from CodelanxLib
IllegalPluginAccessException
- Only CodelanxLib
can useCopyright © 2015. All rights reserved.