mirror of
https://github.com/BentoBoxWorld/Warps.git
synced 2025-02-20 14:21:44 +01:00
Update to new API
This commit is contained in:
parent
ed50d243d4
commit
f8fde97edc
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user