Update to new API

This commit is contained in:
tastybento 2018-07-29 17:21:41 -07:00
parent b75ec5d12b
commit 2d25850b3a
4 changed files with 11 additions and 11 deletions

View File

@ -21,7 +21,7 @@ public class ChallengesAddon extends Addon {
@Override
public void onEnable() {
// Check if it is enabled - it might be loaded, but not enabled.
if (getBSkyBlock() == null || !getBSkyBlock().isEnabled()) {
if (getPlugin() == null || !getPlugin().isEnabled()) {
Bukkit.getLogger().severe("BSkyBlock is not available or disabled!");
this.setEnabled(false);
return;
@ -34,21 +34,21 @@ public class ChallengesAddon extends Addon {
// Register commands - run one tick later to allow all addons to load
// AcidIsland hook in
getServer().getScheduler().runTask(getBSkyBlock(), () -> {
this.getBSkyBlock().getAddonsManager().getAddonByName("AcidIsland").ifPresent(a -> {
CompositeCommand acidIslandCmd = getBSkyBlock().getCommandsManager().getCommand("ai");
getServer().getScheduler().runTask(getPlugin(), () -> {
this.getPlugin().getAddonsManager().getAddonByName("AcidIsland").ifPresent(a -> {
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand("ai");
if (acidIslandCmd != null) {
new ChallengesCommand(this, acidIslandCmd);
CompositeCommand acidCmd = getBSkyBlock().getCommandsManager().getCommand("acid");
CompositeCommand acidCmd = getPlugin().getCommandsManager().getCommand("acid");
new ChallengesAdminImportCommand(this, acidCmd);
}
});
this.getBSkyBlock().getAddonsManager().getAddonByName("BSkyBlock").ifPresent(a -> {
this.getPlugin().getAddonsManager().getAddonByName("BSkyBlock").ifPresent(a -> {
// BSkyBlock hook in
CompositeCommand bsbIslandCmd = getBSkyBlock().getCommandsManager().getCommand("island");
CompositeCommand bsbIslandCmd = getPlugin().getCommandsManager().getCommand("island");
if (bsbIslandCmd != null) {
new ChallengesCommand(this, bsbIslandCmd);
CompositeCommand bsbAdminCmd = getBSkyBlock().getCommandsManager().getCommand("bsbadmin");
CompositeCommand bsbAdminCmd = getPlugin().getCommandsManager().getCommand("bsbadmin");
new ChallengesAdminImportCommand(this, bsbAdminCmd);
}
});

View File

@ -356,7 +356,7 @@ public class ChallengesManager {
*/
public void save(boolean async) {
if (async) {
addon.getServer().getScheduler().runTaskAsynchronously(addon.getBSkyBlock(), this::save);
addon.getServer().getScheduler().runTaskAsynchronously(addon.getPlugin(), this::save);
} else {
save();
}

View File

@ -39,7 +39,7 @@ public class CreateSurrounding extends CompositeCommand implements Listener {
public CreateSurrounding(ChallengesAddon addon, CompositeCommand parent) {
super(parent, "surrounding");
this.addon = addon;
addon.getServer().getPluginManager().registerEvents(this, addon.getBSkyBlock());
addon.getServer().getPluginManager().registerEvents(this, addon.getPlugin());
}
@Override

View File

@ -218,7 +218,7 @@ public class ChallengesPanels {
if (expReward > 0) {
result.addAll(splitTrans(user,"challenges.exp-reward", "[reward]", String.valueOf(expReward)));
}
if (addon.getBSkyBlock().getSettings().isUseEconomy() && moneyReward > 0) {
if (addon.getPlugin().getSettings().isUseEconomy() && moneyReward > 0) {
result.addAll(splitTrans(user,"challenges.money-reward", "[reward]", String.valueOf(moneyReward)));
}
// Final placeholder change for [label]