Skip to content

Instantly share code, notes, and snippets.

@rmsy
Created June 18, 2013 02:42
Show Gist options
  • Save rmsy/5802284 to your computer and use it in GitHub Desktop.
Save rmsy/5802284 to your computer and use it in GitHub Desktop.
import com.sk89q.bukkit.util.BukkitCommandsManager;
import com.sk89q.bukkit.util.CommandsManagerRegistration;
import com.sk89q.minecraft.util.commands.CommandsManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.mcstats.Metrics;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.logging.Level;
public class ChannelsPlugin extends JavaPlugin {
/**
* The plugin's commands.
*/
private static final Class[] COMMANDS = new Class[]{SomeCommandClass.class};
/**
* The MCStats metrics instance. Null if creation failed.
*/
@Nullable
private Metrics metrics;
/**
* The command manager.
*/
@Nonnull
private CommandsManager commandsManager;
/**
* The command registration.
*/
@Nonnull
private CommandsManagerRegistration commandsRegistration;
@Override
public void onDisable() {
}
@Override
public void onEnable() {
this.commandsManager = new BukkitCommandsManager();
this.commandsRegistration = new CommandsManagerRegistration(this, this.commandsManager);
for (Class commandsClass : ChannelsPlugin.COMMANDS) {
this.commandsRegistration.register(commandsClass);
}
try {
this.metrics = new Metrics(this);
this.metrics.start();
} catch (IOException exception) {
this.getLogger().log(Level.WARNING, "An unknown error occurred. Metrics were not started.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment