Dev/remove standalone #86
@@ -19,6 +19,10 @@ public class McBotPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
|
if (Bukkit.getOnlineMode()) {
|
||||||
|
// Don't load CommandAPI
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
CommandAPI.onLoad(new CommandAPIBukkitConfig(this).verboseOutput(false));
|
CommandAPI.onLoad(new CommandAPIBukkitConfig(this).verboseOutput(false));
|
||||||
this.commandApiCanLoad = true;
|
this.commandApiCanLoad = true;
|
||||||
@@ -30,23 +34,23 @@ public class McBotPlugin extends JavaPlugin {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
instance = this;
|
|
||||||
Logger.setupBukkitLogging(this);
|
|
||||||
|
|
||||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||||
if (!this.commandApiCanLoad) {
|
|
||||||
Logger.error("CommandAPI could not be loaded, plugin disabling!");
|
|
||||||
pluginManager.disablePlugin(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Bukkit.getOnlineMode()) {
|
if (Bukkit.getOnlineMode()) {
|
||||||
Logger.error("This plugin will only work in offline mode!");
|
Logger.error("This plugin will only work in offline mode!");
|
||||||
pluginManager.disablePlugin(this);
|
pluginManager.disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
instance = this;
|
||||||
|
Logger.setupBukkitLogging(this);
|
||||||
|
|
||||||
|
|
||||||
|
if (!this.commandApiCanLoad) {
|
||||||
|
Logger.error("CommandAPI could not be loaded, plugin disabling!");
|
||||||
|
pluginManager.disablePlugin(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadNicknameFile();
|
loadNicknameFile();
|
||||||
setupBotLogic();
|
setupBotLogic();
|
||||||
setupCommand();
|
setupCommand();
|
||||||
@@ -58,7 +62,7 @@ public class McBotPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
CommandAPI.onDisable();
|
if (!Bukkit.getOnlineMode()) CommandAPI.onDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadNicknameFile() {
|
private void loadNicknameFile() {
|
||||||
@@ -70,6 +74,7 @@ public class McBotPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupCommand() {
|
private void setupCommand() {
|
||||||
|
CommandAPI.onEnable();
|
||||||
new Command(this);
|
new Command(this);
|
||||||
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
|
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user