Class InjectionFactory
java.lang.Object
com.comphenix.protocol.injector.netty.channel.InjectionFactory
Represents an injector factory.
Note that the factory will return EmptyInjector when the factory is closed.
-
Constructor Summary
ConstructorsConstructorDescriptionInjectionFactory(org.bukkit.plugin.Plugin plugin, ErrorReporter errorReporter, ListenerManager listenerManager) -
Method Summary
Modifier and TypeMethodDescriptioncacheInjector(String name, Injector injector) Cache an injector by name alone.cacheInjector(org.bukkit.entity.Player player, Injector injector) Cache an injector by player.voidclose()Close all injectors created by this factory, and cease the creation of new injections.fromChannel(io.netty.channel.Channel channel) Construct a new channel injector for the given channel.Retrieve a cached injector from a name.fromPlayer(org.bukkit.entity.Player player) Construct or retrieve a channel injector from an existing Bukkit player.org.bukkit.plugin.PluginRetrieve the main plugin associated with this injection factory.invalidate(org.bukkit.entity.Player player, String name) Invalidate a cached injector.booleanisClosed()Determine if the factory is closed.
-
Constructor Details
-
InjectionFactory
public InjectionFactory(org.bukkit.plugin.Plugin plugin, ErrorReporter errorReporter, ListenerManager listenerManager)
-
-
Method Details
-
getPlugin
public org.bukkit.plugin.Plugin getPlugin()Retrieve the main plugin associated with this injection factory.- Returns:
- The main plugin.
-
fromPlayer
Construct or retrieve a channel injector from an existing Bukkit player.- Parameters:
player- - the existing Bukkit player.- Returns:
- A new injector, an existing injector associated with this player, or a closed injector.
-
fromName
Retrieve a cached injector from a name.The injector may be NULL if the plugin has been reloaded during a player login.
- Parameters:
name- - the name.player- - the player.- Returns:
- The cached injector, or a closed injector if it could not be found.
-
fromChannel
Construct a new channel injector for the given channel.- Parameters:
channel- - the channel.- Returns:
- The channel injector, or a closed injector.
-
invalidate
Invalidate a cached injector.- Parameters:
player- - the associated player.- Returns:
- The cached injector, or NULL if nothing was cached.
-
cacheInjector
Cache an injector by player.- Parameters:
player- - the player.injector- - the injector to cache.- Returns:
- The previously cached injector.
-
cacheInjector
Cache an injector by name alone.- Parameters:
name- - the name to lookup.injector- - the injector.- Returns:
- The cached injector.
-
isClosed
public boolean isClosed()Determine if the factory is closed.If it is, all new injectors will be closed by default.
- Returns:
- TRUE if it is closed, FALSE otherwise.
-
close
public void close()Close all injectors created by this factory, and cease the creation of new injections.
-