Update to new API

This commit is contained in:
tastybento 2018-07-29 17:22:53 -07:00
parent ed50d243d4
commit f8fde97edc
4 changed files with 12 additions and 12 deletions

View File

@ -43,14 +43,14 @@ public class Warp extends Addon {
// Load the plugin's config
new PluginConfig(this);
// Get the BSkyBlock plugin. This will be available because this plugin depends on it in plugin.yml.
plugin = this.getBSkyBlock();
plugin = this.getPlugin();
// Check if it is enabled - it might be loaded, but not enabled.
if (!plugin.isEnabled()) {
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.getBSkyBlock(), () -> {
getServer().getScheduler().runTask(this.getPlugin(), () -> {
registeredWorlds = new HashSet<>();
// Start warp signs
warpSignsManager = new WarpSignsManager(this, plugin);
@ -58,7 +58,7 @@ public class Warp extends Addon {
// Load the listener
getServer().getPluginManager().registerEvents(new WarpSignsListener(this, plugin), plugin);
// Register commands
getServer().getScheduler().runTask(getBSkyBlock(), () -> {
getServer().getScheduler().runTask(getPlugin(), () -> {
// Register for BSkyBlock
/*
CompositeCommand bsbIslandCmd = BentoBox.getInstance().getCommandsManager().getCommand("island");
@ -67,8 +67,8 @@ public class Warp extends Addon {
registeredWorlds.add(plugin.getIWM().getBSBIslandWorld());
*/
// AcidIsland hook in
this.getBSkyBlock().getAddonsManager().getAddonByName("AcidIsland").ifPresent(acidIsland -> {
CompositeCommand acidIslandCmd = getBSkyBlock().getCommandsManager().getCommand("ai");
this.getPlugin().getAddonsManager().getAddonByName("AcidIsland").ifPresent(acidIsland -> {
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand("ai");
if (acidIslandCmd != null) {
new WarpCommand(this, acidIslandCmd);
new WarpsCommand(this, acidIslandCmd);
@ -78,7 +78,7 @@ public class Warp extends Addon {
});
// Get the level addon if it exists
setLevelAddon(getBSkyBlock().getAddonsManager().getAddonByName(BSKYBLOCK_LEVEL));
setLevelAddon(getPlugin().getAddonsManager().getAddonByName(BSKYBLOCK_LEVEL));
});
// Done
}
@ -111,7 +111,7 @@ public class Warp extends Addon {
}
public String getPermPrefix(World world) {
this.getBSkyBlock().getIWM().getPermissionPrefix(world);
this.getPlugin().getIWM().getPermissionPrefix(world);
return null;
}

View File

@ -34,7 +34,7 @@ public class WarpPanelManager {
cachedSigns.putIfAbsent(world, new HashMap<>());
return new PanelItemBuilder()
.icon(Material.SIGN)
.name(addon.getBSkyBlock().getPlayers().getName(warpOwner))
.name(addon.getPlugin().getPlayers().getName(warpOwner))
.description(cachedSigns.get(world).getOrDefault(warpOwner, getSign(world, warpOwner)))
.clickHandler((panel, clicker, click, slot) -> { {
addon.getWarpSignsManager().warpPlayer(world, clicker, warpOwner);

View File

@ -378,13 +378,13 @@ public class WarpSignsManager {
// Check if the warp spot is safe
if (warpSpot == null) {
user.sendMessage("warps.error.NotReadyYet");
addon.getLogger().warning("Null warp found, owned by " + addon.getBSkyBlock().getPlayers().getName(owner));
addon.getLogger().warning("Null warp found, owned by " + addon.getPlugin().getPlayers().getName(owner));
return;
}
// Find out if island is locked
// TODO: Fire event
Island island = addon.getBSkyBlock().getIslands().getIsland(world, owner);
Island island = addon.getPlugin().getIslands().getIsland(world, owner);
boolean pvp = false;
if (island != null) {
//if ((warpSpot.getWorld().equals(IslandWorld.getIslandWorld()) && island.getFlag(SettingsFlag.PVP_OVERWORLD))
@ -419,7 +419,7 @@ public class WarpSignsManager {
// WALL_SIGN's will always be unsafe if the place in front is obscured.
if (b.getType().equals(Material.SIGN)) {
addon.getLogger().warning(
"Unsafe warp found at " + warpSpot.toString() + " owned by " + addon.getBSkyBlock().getPlayers().getName(owner));
"Unsafe warp found at " + warpSpot.toString() + " owned by " + addon.getPlugin().getPlayers().getName(owner));
}
return;

View File

@ -39,7 +39,7 @@ public class WarpCommand extends CompositeCommand {
final Set<UUID> warpList = plugin.getWarpSignsManager().listWarps(getWorld());
for (UUID warp : warpList) {
options.add(plugin.getBSkyBlock().getPlayers().getName(warp));
options.add(plugin.getPlugin().getPlayers().getName(warp));
}
return Optional.of(options);