Lazy command initialization

This commit is contained in:
boy0001
2015-07-28 01:41:06 +10:00
parent 870495ac1a
commit faf6cbea0f
5 changed files with 18 additions and 11 deletions

View File

@ -349,7 +349,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} else {
getServer().getPluginManager().registerEvents(new WEListener(), this);
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
MainCommand.instance.createCommand(new WE_Anywhere());
MainCommand.getInstance().createCommand(new WE_Anywhere());
}
}
}

View File

@ -53,11 +53,11 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
return null;
}
final Set<String> tabOptions = new HashSet<>();
ArrayList<Command<PlotPlayer>> commands = MainCommand.instance.getCommands();
ArrayList<Command<PlotPlayer>> commands = MainCommand.getInstance().getCommands();
String best = new StringComparison(strings[0], commands).getBestMatch();
tabOptions.add(best);
final String arg = strings[0].toLowerCase();
for (final Command<PlotPlayer> cmd : MainCommand.instance.getCommands()) {
for (final Command<PlotPlayer> cmd : MainCommand.getInstance().getCommands()) {
String label = cmd.getCommand();
if (!label.equalsIgnoreCase(best)) {
if (label.startsWith(arg)) {