BentoBox version
This commit is contained in:
parent
b780d68064
commit
ed50d243d4
4
pom.xml
4
pom.xml
|
@ -49,8 +49,8 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>us.tastybento</groupId>
|
||||
<artifactId>bskyblock</artifactId>
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>bentobox</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -6,15 +6,14 @@ import java.util.Set;
|
|||
|
||||
import org.bukkit.World;
|
||||
|
||||
import bentobox.addon.acidisland.AcidIsland;
|
||||
import bskyblock.addon.warps.commands.WarpCommand;
|
||||
import bskyblock.addon.warps.commands.WarpsCommand;
|
||||
import bskyblock.addon.warps.config.PluginConfig;
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.addons.Addon;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
import bskyblock.addon.acidisland.AcidIsland;
|
||||
import world.bentobox.bbox.BentoBox;
|
||||
import world.bentobox.bbox.api.addons.Addon;
|
||||
import world.bentobox.bbox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bbox.util.Util;
|
||||
|
||||
/**
|
||||
* Addin to BSkyBlock that enables welcome warp signs
|
||||
|
@ -25,8 +24,8 @@ public class Warp extends Addon {
|
|||
|
||||
private static final String BSKYBLOCK_LEVEL = "BSkyBlock-Level";
|
||||
|
||||
// The BSkyBlock plugin instance.
|
||||
private BSkyBlock plugin;
|
||||
// The plugin instance.
|
||||
private BentoBox plugin;
|
||||
|
||||
// Warp panel object
|
||||
private WarpPanelManager warpPanelManager;
|
||||
|
@ -59,20 +58,25 @@ public class Warp extends Addon {
|
|||
// Load the listener
|
||||
getServer().getPluginManager().registerEvents(new WarpSignsListener(this, plugin), plugin);
|
||||
// Register commands
|
||||
CompositeCommand bsbIslandCmd = (CompositeCommand) BSkyBlock.getInstance().getCommandsManager().getCommand("island");
|
||||
new WarpCommand(this, bsbIslandCmd);
|
||||
new WarpsCommand(this, bsbIslandCmd);
|
||||
registeredWorlds.add(plugin.getIWM().getBSBIslandWorld());
|
||||
// AcidIsland hook in
|
||||
getServer().getScheduler().runTask(getBSkyBlock(), () -> {
|
||||
// Register for BSkyBlock
|
||||
/*
|
||||
CompositeCommand bsbIslandCmd = BentoBox.getInstance().getCommandsManager().getCommand("island");
|
||||
new WarpCommand(this, bsbIslandCmd);
|
||||
new WarpsCommand(this, bsbIslandCmd);
|
||||
registeredWorlds.add(plugin.getIWM().getBSBIslandWorld());
|
||||
*/
|
||||
// AcidIsland hook in
|
||||
this.getBSkyBlock().getAddonsManager().getAddonByName("AcidIsland").ifPresent(acidIsland -> {
|
||||
CompositeCommand acidIslandCmd = getBSkyBlock().getCommandsManager().getCommand("ai");
|
||||
new WarpCommand(this, acidIslandCmd);
|
||||
new WarpsCommand(this, acidIslandCmd);
|
||||
registeredWorlds.add(((AcidIsland)acidIsland).getAiw().getOverWorld());
|
||||
if (acidIslandCmd != null) {
|
||||
new WarpCommand(this, acidIslandCmd);
|
||||
new WarpsCommand(this, acidIslandCmd);
|
||||
registeredWorlds.add(((AcidIsland)acidIsland).getAiw().getOverWorld());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Get the level addon if it exists
|
||||
setLevelAddon(getBSkyBlock().getAddonsManager().getAddonByName(BSKYBLOCK_LEVEL));
|
||||
});
|
||||
|
|
|
@ -11,10 +11,10 @@ import org.bukkit.Material;
|
|||
import org.bukkit.World;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
import us.tastybento.bskyblock.api.panels.builders.PanelBuilder;
|
||||
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import world.bentobox.bbox.api.panels.PanelItem;
|
||||
import world.bentobox.bbox.api.panels.builders.PanelBuilder;
|
||||
import world.bentobox.bbox.api.panels.builders.PanelItemBuilder;
|
||||
import world.bentobox.bbox.api.user.User;
|
||||
|
||||
public class WarpPanelManager {
|
||||
|
||||
|
@ -57,11 +57,11 @@ public class WarpPanelManager {
|
|||
|
||||
/**
|
||||
* Show the warp panel for the user
|
||||
* @param world
|
||||
* @param world
|
||||
* @param user
|
||||
* @param index
|
||||
*/
|
||||
public void showWarpPanel(World world, User user, int index) {
|
||||
public void showWarpPanel(World world, User user, int index) {
|
||||
List<UUID> warps = new ArrayList<>(addon.getWarpSignsManager().getSortedWarps(world));
|
||||
if (DEBUG) {
|
||||
Bukkit.getLogger().info("DEBUG: showing warps. warps list is " + warps.size());
|
||||
|
@ -77,7 +77,7 @@ public class WarpPanelManager {
|
|||
|
||||
int i = index * PANEL_MAX_SIZE;
|
||||
for (; i < (index * PANEL_MAX_SIZE + PANEL_MAX_SIZE) && i < warps.size(); i++) {
|
||||
panelBuilder.item(getPanelItem(world, warps.get(i)));
|
||||
panelBuilder.item(getPanelItem(world, warps.get(i)));
|
||||
}
|
||||
final int panelNum = index;
|
||||
// Add signs
|
||||
|
|
|
@ -15,8 +15,8 @@ import org.bukkit.event.block.SignChangeEvent;
|
|||
import bskyblock.addon.level.Level;
|
||||
import bskyblock.addon.warps.config.Settings;
|
||||
import bskyblock.addon.warps.event.WarpRemoveEvent;
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import world.bentobox.bbox.BentoBox;
|
||||
import world.bentobox.bbox.api.user.User;
|
||||
|
||||
/**
|
||||
* Handles warping. Players can add one sign
|
||||
|
@ -25,7 +25,7 @@ import us.tastybento.bskyblock.api.user.User;
|
|||
*
|
||||
*/
|
||||
public class WarpSignsListener implements Listener {
|
||||
private BSkyBlock plugin;
|
||||
private BentoBox plugin;
|
||||
|
||||
private Warp addon;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class WarpSignsListener implements Listener {
|
|||
* @param addon - addon
|
||||
* @param plugin - BSB plugin
|
||||
*/
|
||||
public WarpSignsListener(Warp addon, BSkyBlock plugin) {
|
||||
public WarpSignsListener(Warp addon, BentoBox plugin) {
|
||||
this.addon = addon;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ import org.bukkit.block.Sign;
|
|||
import bskyblock.addon.warps.database.object.WarpsData;
|
||||
import bskyblock.addon.warps.event.WarpInitiateEvent;
|
||||
import bskyblock.addon.warps.event.WarpListEvent;
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
import world.bentobox.bbox.BentoBox;
|
||||
import world.bentobox.bbox.api.user.User;
|
||||
import world.bentobox.bbox.database.BSBDatabase;
|
||||
import world.bentobox.bbox.database.objects.Island;
|
||||
import world.bentobox.bbox.util.Util;
|
||||
|
||||
/**
|
||||
* Handles warping. Players can add one sign
|
||||
|
@ -43,7 +43,7 @@ import us.tastybento.bskyblock.util.Util;
|
|||
public class WarpSignsManager {
|
||||
private static final boolean DEBUG2 = false;
|
||||
private static final int MAX_WARPS = 600;
|
||||
private BSkyBlock plugin;
|
||||
private BentoBox plugin;
|
||||
// Map of all warps stored as player, warp sign Location
|
||||
private Map<World, Map<UUID, Location>> worldsWarpList;
|
||||
// Database handler for level data
|
||||
|
@ -58,9 +58,9 @@ public class WarpSignsManager {
|
|||
|
||||
/**
|
||||
* @param addon - addon
|
||||
* @param plugin - BSB plugin
|
||||
* @param plugin - plugin
|
||||
*/
|
||||
public WarpSignsManager(Warp addon, BSkyBlock plugin) {
|
||||
public WarpSignsManager(Warp addon, BentoBox plugin) {
|
||||
this.addon = addon;
|
||||
this.plugin = plugin;
|
||||
// Set up the database handler to store and retrieve Island classes
|
||||
|
|
|
@ -7,8 +7,8 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
|
||||
import bskyblock.addon.warps.Warp;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import world.bentobox.bbox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bbox.api.user.User;
|
||||
|
||||
/**
|
||||
* The /is warp <name> command
|
||||
|
|
|
@ -6,8 +6,8 @@ package bskyblock.addon.warps.commands;
|
|||
import java.util.List;
|
||||
|
||||
import bskyblock.addon.warps.Warp;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import world.bentobox.bbox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bbox.api.user.User;
|
||||
|
||||
/**
|
||||
* @author ben
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.bukkit.World;
|
|||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import us.tastybento.bskyblock.database.objects.DataObject;
|
||||
import world.bentobox.bbox.database.objects.DataObject;
|
||||
|
||||
public class WarpsData implements DataObject {
|
||||
|
||||
|
|
Loading…
Reference in New Issue