Added softdepend to addon.yml. Removed tick delays in onEnable.

This commit is contained in:
tastybento 2018-08-17 21:58:56 -07:00
parent de57229d36
commit 4e32d0ab4a
2 changed files with 28 additions and 29 deletions

View File

@ -47,36 +47,33 @@ public class Warp extends Addon {
this.setEnabled(false);
return;
}
// We have to wait for the worlds to load, so we do the rest 1 tick later
getServer().getScheduler().runTask(this.getPlugin(), () -> {
registeredWorlds = new HashSet<>();
// Start warp signs
warpSignsManager = new WarpSignsManager(this, plugin);
warpPanelManager = new WarpPanelManager(this);
// Load the listener
getServer().getPluginManager().registerEvents(new WarpSignsListener(this), plugin);
// Register commands
getServer().getScheduler().runTask(getPlugin(), () -> {
// BSkyBlock hook in
this.getPlugin().getAddonsManager().getAddonByName(BSKYBLOCK).ifPresent(acidIsland -> {
CompositeCommand bsbIslandCmd = BentoBox.getInstance().getCommandsManager().getCommand("island");
if (bsbIslandCmd != null) {
new WarpCommand(this, bsbIslandCmd);
new WarpsCommand(this, bsbIslandCmd);
registeredWorlds.add(plugin.getIWM().getWorld(BSKYBLOCK));
}
});
// AcidIsland hook in
this.getPlugin().getAddonsManager().getAddonByName(ACIDISLAND).ifPresent(acidIsland -> {
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand("ai");
if (acidIslandCmd != null) {
new WarpCommand(this, acidIslandCmd);
new WarpsCommand(this, acidIslandCmd);
registeredWorlds.add(plugin.getIWM().getWorld(ACIDISLAND));
}
});
});
registeredWorlds = new HashSet<>();
// Start warp signs
warpSignsManager = new WarpSignsManager(this, plugin);
warpPanelManager = new WarpPanelManager(this);
// Load the listener
getServer().getPluginManager().registerEvents(new WarpSignsListener(this), plugin);
// Register commands
// BSkyBlock hook in
this.getPlugin().getAddonsManager().getAddonByName(BSKYBLOCK).ifPresent(acidIsland -> {
CompositeCommand bsbIslandCmd = BentoBox.getInstance().getCommandsManager().getCommand("island");
if (bsbIslandCmd != null) {
new WarpCommand(this, bsbIslandCmd);
new WarpsCommand(this, bsbIslandCmd);
registeredWorlds.add(plugin.getIWM().getWorld(BSKYBLOCK));
}
});
// AcidIsland hook in
this.getPlugin().getAddonsManager().getAddonByName(ACIDISLAND).ifPresent(acidIsland -> {
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand("ai");
if (acidIslandCmd != null) {
new WarpCommand(this, acidIslandCmd);
new WarpsCommand(this, acidIslandCmd);
registeredWorlds.add(plugin.getIWM().getWorld(ACIDISLAND));
}
});
// Done
}

View File

@ -4,6 +4,8 @@ version: 0.1
authors: tastybento
softdepend: AcidIsland, BSkyBlock
permissions:
bskyblock.island.warp:
description: Player can use warp or warps commands