Skip to content

Instantly share code, notes, and snippets.

@daboross
Created January 28, 2014 06:50
Show Gist options
  • Save daboross/8663277 to your computer and use it in GitHub Desktop.
Save daboross/8663277 to your computer and use it in GitHub Desktop.
/*
* Copyright (C) 2013-2014 Dabo Ross <http://www.daboross.net/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.example.exampleplugin.commands;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.PluginManager;
public class ExampleMultipleCommands {
private final Plugin plugin;
public ExampleMultipleCommands(Plugin plugin) {
this.plugin = plugin;
}
public void registerCommands() {
PluginManager pm = plugin.getProxy().getPluginManager();
pm.registerCommand( plugin,new Command1());
pm.registerCommand(plugin, new Command2());
}
public class Command1 extends Command {
public Command1() {
super("command1");
}
@Override
public void execute(final CommandSender sender, final String[] args) {
// command 1
}
}
public class Command2 extends Command {
public Command2() {
super("command2");
}
@Override
public void execute(final CommandSender sender, final String[] args) {
// command 1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment