public class InjectionFactory extends Object
Note that the factory will return ClosedInjector when the factory is closed.
| Constructor and Description |
|---|
InjectionFactory(org.bukkit.plugin.Plugin plugin) |
| Modifier and Type | Method and Description |
|---|---|
Injector |
cacheInjector(org.bukkit.entity.Player player,
Injector injector)
Cache an injector by player.
|
Injector |
cacheInjector(String name,
Injector injector)
Cache an injector by name alone.
|
void |
close()
Close all injectors created by this factory, and cease the creation of new injections.
|
Injector |
fromChannel(io.netty.channel.Channel channel,
ChannelListener listener,
TemporaryPlayerFactory playerFactory)
Construct a new channel injector for the given channel.
|
Injector |
fromName(String name,
org.bukkit.entity.Player player)
Retrieve a cached injector from a name.
|
Injector |
fromPlayer(org.bukkit.entity.Player player,
ChannelListener listener)
Construct or retrieve a channel injector from an existing Bukkit player.
|
org.bukkit.plugin.Plugin |
getPlugin()
Retrieve the main plugin associated with this injection factory.
|
Injector |
invalidate(org.bukkit.entity.Player player)
Invalidate a cached injector.
|
boolean |
isClosed()
Determine if the factory is closed.
|
public org.bukkit.plugin.Plugin getPlugin()
@Nonnull public Injector fromPlayer(org.bukkit.entity.Player player, ChannelListener listener)
player - - the existing Bukkit player.listener - - the listener.public Injector fromName(String name, org.bukkit.entity.Player player)
The injector may be NULL if the plugin has been reloaded during a player login.
name - - the name.player - - the player.@Nonnull public Injector fromChannel(io.netty.channel.Channel channel, ChannelListener listener, TemporaryPlayerFactory playerFactory)
channel - - the channel.listener - - the listener.playerFactory - - a temporary player creator.public Injector invalidate(org.bukkit.entity.Player player)
player - - the associated player.public Injector cacheInjector(org.bukkit.entity.Player player, Injector injector)
player - - the player.injector - - the injector to cache.public Injector cacheInjector(String name, Injector injector)
name - - the name to lookup.injector - - the injector.public boolean isClosed()
If it is, all new injectors will be closed by default.
public void close()
Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.