Depreceate old register command / listener methods.

This commit is contained in:
md_5 2013-03-15 21:08:50 +11:00
parent 8ea5205fef
commit 113dada511

View File

@ -34,12 +34,23 @@ public class PluginManager
private final Map<String, Plugin> plugins = new HashMap<>(); private final Map<String, Plugin> plugins = new HashMap<>();
private final Map<String, Command> commandMap = new HashMap<>(); private final Map<String, Command> commandMap = new HashMap<>();
/**
* @deprecated use
* {@link #registerCommand(net.md_5.bungee.api.plugin.Plugin, net.md_5.bungee.api.plugin.Command)}
*/
@Deprecated
public void registerCommand(Command command)
{
registerCommand( null, command );
}
/** /**
* Register a command so that it may be executed. * Register a command so that it may be executed.
* *
* @param plugin the plugin owning this command
* @param command the command to register * @param command the command to register
*/ */
public void registerCommand(Command command) public void registerCommand(Plugin plugin, Command command)
{ {
commandMap.put( command.getName().toLowerCase(), command ); commandMap.put( command.getName().toLowerCase(), command );
for ( String alias : command.getAliases() ) for ( String alias : command.getAliases() )
@ -215,14 +226,25 @@ public class PluginManager
return event; return event;
} }
/**
* @deprecated see
* {@link #registerListener(net.md_5.bungee.api.plugin.Plugin, net.md_5.bungee.api.plugin.Listener)}
*/
@Deprecated
public void registerListener(Listener listener)
{
registerListener( null, listener );
}
/** /**
* Register a {@link Listener} for receiving called events. Methods in this * Register a {@link Listener} for receiving called events. Methods in this
* Object which wish to receive events must be annotated with the * Object which wish to receive events must be annotated with the
* {@link Subscribe} annotation. * {@link Subscribe} annotation.
* *
* @param plugin the owning plugin
* @param listener the listener to register events for * @param listener the listener to register events for
*/ */
public void registerListener(Listener listener) public void registerListener(Plugin plugin, Listener listener)
{ {
eventBus.register( listener ); eventBus.register( listener );
} }