mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-01-04 23:37:47 +01:00
Update to new API
This commit is contained in:
parent
b75ec5d12b
commit
2d25850b3a
@ -21,7 +21,7 @@ public class ChallengesAddon extends Addon {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Check if it is enabled - it might be loaded, but not enabled.
|
// 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!");
|
Bukkit.getLogger().severe("BSkyBlock is not available or disabled!");
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
return;
|
return;
|
||||||
@ -34,21 +34,21 @@ public class ChallengesAddon extends Addon {
|
|||||||
|
|
||||||
// Register commands - run one tick later to allow all addons to load
|
// Register commands - run one tick later to allow all addons to load
|
||||||
// AcidIsland hook in
|
// AcidIsland hook in
|
||||||
getServer().getScheduler().runTask(getBSkyBlock(), () -> {
|
getServer().getScheduler().runTask(getPlugin(), () -> {
|
||||||
this.getBSkyBlock().getAddonsManager().getAddonByName("AcidIsland").ifPresent(a -> {
|
this.getPlugin().getAddonsManager().getAddonByName("AcidIsland").ifPresent(a -> {
|
||||||
CompositeCommand acidIslandCmd = getBSkyBlock().getCommandsManager().getCommand("ai");
|
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand("ai");
|
||||||
if (acidIslandCmd != null) {
|
if (acidIslandCmd != null) {
|
||||||
new ChallengesCommand(this, acidIslandCmd);
|
new ChallengesCommand(this, acidIslandCmd);
|
||||||
CompositeCommand acidCmd = getBSkyBlock().getCommandsManager().getCommand("acid");
|
CompositeCommand acidCmd = getPlugin().getCommandsManager().getCommand("acid");
|
||||||
new ChallengesAdminImportCommand(this, acidCmd);
|
new ChallengesAdminImportCommand(this, acidCmd);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.getBSkyBlock().getAddonsManager().getAddonByName("BSkyBlock").ifPresent(a -> {
|
this.getPlugin().getAddonsManager().getAddonByName("BSkyBlock").ifPresent(a -> {
|
||||||
// BSkyBlock hook in
|
// BSkyBlock hook in
|
||||||
CompositeCommand bsbIslandCmd = getBSkyBlock().getCommandsManager().getCommand("island");
|
CompositeCommand bsbIslandCmd = getPlugin().getCommandsManager().getCommand("island");
|
||||||
if (bsbIslandCmd != null) {
|
if (bsbIslandCmd != null) {
|
||||||
new ChallengesCommand(this, bsbIslandCmd);
|
new ChallengesCommand(this, bsbIslandCmd);
|
||||||
CompositeCommand bsbAdminCmd = getBSkyBlock().getCommandsManager().getCommand("bsbadmin");
|
CompositeCommand bsbAdminCmd = getPlugin().getCommandsManager().getCommand("bsbadmin");
|
||||||
new ChallengesAdminImportCommand(this, bsbAdminCmd);
|
new ChallengesAdminImportCommand(this, bsbAdminCmd);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -356,7 +356,7 @@ public class ChallengesManager {
|
|||||||
*/
|
*/
|
||||||
public void save(boolean async) {
|
public void save(boolean async) {
|
||||||
if (async) {
|
if (async) {
|
||||||
addon.getServer().getScheduler().runTaskAsynchronously(addon.getBSkyBlock(), this::save);
|
addon.getServer().getScheduler().runTaskAsynchronously(addon.getPlugin(), this::save);
|
||||||
} else {
|
} else {
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class CreateSurrounding extends CompositeCommand implements Listener {
|
|||||||
public CreateSurrounding(ChallengesAddon addon, CompositeCommand parent) {
|
public CreateSurrounding(ChallengesAddon addon, CompositeCommand parent) {
|
||||||
super(parent, "surrounding");
|
super(parent, "surrounding");
|
||||||
this.addon = addon;
|
this.addon = addon;
|
||||||
addon.getServer().getPluginManager().registerEvents(this, addon.getBSkyBlock());
|
addon.getServer().getPluginManager().registerEvents(this, addon.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -218,7 +218,7 @@ public class ChallengesPanels {
|
|||||||
if (expReward > 0) {
|
if (expReward > 0) {
|
||||||
result.addAll(splitTrans(user,"challenges.exp-reward", "[reward]", String.valueOf(expReward)));
|
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)));
|
result.addAll(splitTrans(user,"challenges.money-reward", "[reward]", String.valueOf(moneyReward)));
|
||||||
}
|
}
|
||||||
// Final placeholder change for [label]
|
// Final placeholder change for [label]
|
||||||
|
Loading…
Reference in New Issue
Block a user