The Island Warps API allows you to create, manage, and organize island warps for quick teleportation within islands.
Creating Warps
createWarp(String name, Location location, WarpCategory warpCategory)
Create a warp for the island.
The category for the warp, or null for no category
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.island.warps.IslandWarp;
import org.bukkit.Location;
IslandWarp warp = island.createWarp(
"spawn",
player.getLocation(),
null
);
createWarp(String name, WorldInfo worldInfo, WorldPosition position, WarpCategory warpCategory)
Create a warp using WorldInfo and WorldPosition.
The category for the warp, or null for no category
Managing Warps
getWarp(String name)
Get a warp by its name.
The warp, or null if not found
IslandWarp warp = island.getWarp("spawn");
if (warp != null) {
// Warp exists
}
getWarp(Location location)
Get a warp at a specific location.
The warp at that location, or null if not found
getIslandWarps()
Get all warps on the island.
Map of warp names to warp objects
import java.util.Map;
Map<String, IslandWarp> warps = island.getIslandWarps();
for (Map.Entry<String, IslandWarp> entry : warps.entrySet()) {
String name = entry.getKey();
IslandWarp warp = entry.getValue();
// Process warp
}
renameWarp(IslandWarp islandWarp, String newName)
Rename a warp.
The new name for the warp
IslandWarp warp = island.getWarp("old-name");
if (warp != null) {
island.renameWarp(warp, "new-name");
}
deleteWarp(String name)
Delete a warp by name.
The name of the warp to delete
island.deleteWarp("spawn");
deleteWarp(SuperiorPlayer superiorPlayer, Location location)
Delete a warp at a specific location.
The player requesting the operation, or null
The location of the warp to delete
Warp Teleportation
warpPlayer(SuperiorPlayer superiorPlayer, String warpName)
Teleport a player to a warp.
The name of the warp to teleport to
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
island.warpPlayer(superiorPlayer, "spawn");
warpPlayer(SuperiorPlayer superiorPlayer, String warpName, boolean force)
Teleport a player to a warp with force option.
The name of the warp to teleport to
Whether to force the teleportation
// Force teleport (bypasses checks)
island.warpPlayer(superiorPlayer, "spawn", true);
Warp Categories
createWarpCategory(String name)
Create a new warp category.
The category (new or existing)
import com.bgsoftware.superiorskyblock.api.island.warps.WarpCategory;
WarpCategory category = island.createWarpCategory("public");
getWarpCategory(String name)
Get a warp category by name.
The category, or null if not found
WarpCategory category = island.getWarpCategory("public");
getWarpCategory(int slot)
Get a warp category by its slot in the manage menu.
The category in that slot, or null
WarpCategory category = island.getWarpCategory(10);
getWarpCategories()
Get all warp categories.
returns
Map<String, WarpCategory>
Map of category names to category objects
Map<String, WarpCategory> categories = island.getWarpCategories();
for (WarpCategory category : categories.values()) {
// Process category
}
renameCategory(WarpCategory warpCategory, String newName)
Rename a category.
The new name for the category
WarpCategory category = island.getWarpCategory("old-name");
if (category != null) {
island.renameCategory(category, "new-name");
}
deleteCategory(WarpCategory warpCategory)
Delete a category and all its warps.
WarpCategory category = island.getWarpCategory("unused");
if (category != null) {
island.deleteCategory(category); // All warps in this category are deleted too
}
IslandWarp Interface
getIsland()
Get the island this warp belongs to.
getName()
Get the name of the warp.
getLocation()
Get the location of the warp.
Location warpLocation = warp.getLocation();
setLocation(Location location)
Set the location of the warp.
warp.setLocation(player.getLocation());
hasPrivateFlag()
Check if the warp is private or public to visitors.
True if the warp is private
if (warp.hasPrivateFlag()) {
// Only island members can use this warp
}
setPrivateFlag(boolean privateFlag)
Set whether the warp is private.
True for private, false for public
warp.setPrivateFlag(true); // Make warp private
getRawIcon()
Get the icon of the warp without placeholder parsing.
The raw icon, or null if no custom icon
getIcon(SuperiorPlayer superiorPlayer)
Get the icon after parsing placeholders.
The player to parse placeholders for, or null
The parsed icon, or null if no custom icon
import org.bukkit.inventory.ItemStack;
ItemStack icon = warp.getIcon(superiorPlayer);
setIcon(ItemStack icon)
Set the icon of the warp.
The icon to set, or null to remove
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
ItemStack icon = new ItemStack(Material.ENDER_PEARL);
warp.setIcon(icon);
getCategory()
Get the category of the warp.
WarpCategory category = warp.getCategory();
WarpCategory Interface
getIsland()
Get the island this category belongs to.
getName()
Get the name of the category.
getWarps()
Get all warps in this category.
List of warps in the category
import java.util.List;
List<IslandWarp> warps = category.getWarps();
for (IslandWarp warp : warps) {
// Process warp
}
getSlot()
Get the menu slot of the category.
setSlot(int slot)
Set the menu slot of the category.
getRawIcon()
Get the icon without placeholder parsing.
getIcon(SuperiorPlayer superiorPlayer)
Get the icon after parsing placeholders.
The player to parse placeholders for, or null
setIcon(ItemStack icon)
Set the icon of the category.
The icon to set, or null for default
Example: Warp Management System
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.island.warps.IslandWarp;
import com.bgsoftware.superiorskyblock.api.island.warps.WarpCategory;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class WarpManager {
public void createPublicWarp(Island island, String name, Location location) {
// Create public category if it doesn't exist
WarpCategory publicCategory = island.getWarpCategory("public");
if (publicCategory == null) {
publicCategory = island.createWarpCategory("public");
publicCategory.setSlot(0);
publicCategory.setIcon(new ItemStack(Material.EMERALD));
}
// Create the warp
IslandWarp warp = island.createWarp(name, location, publicCategory);
warp.setPrivateFlag(false); // Make it public
warp.setIcon(new ItemStack(Material.ENDER_PEARL));
}
public void createPrivateWarp(Island island, String name, Location location) {
WarpCategory privateCategory = island.getWarpCategory("private");
if (privateCategory == null) {
privateCategory = island.createWarpCategory("private");
privateCategory.setSlot(1);
privateCategory.setIcon(new ItemStack(Material.REDSTONE));
}
IslandWarp warp = island.createWarp(name, location, privateCategory);
warp.setPrivateFlag(true); // Make it private
}
public void teleportToWarp(Island island, SuperiorPlayer player, String warpName) {
IslandWarp warp = island.getWarp(warpName);
if (warp == null) {
player.asPlayer().sendMessage("Warp not found!");
return;
}
// Check if warp is private and player has permission
if (warp.hasPrivateFlag() && !island.isMember(player)) {
player.asPlayer().sendMessage("This warp is private!");
return;
}
// Teleport
island.warpPlayer(player, warpName);
}
public void listWarps(Island island, SuperiorPlayer player) {
player.asPlayer().sendMessage("=== Island Warps ===");
for (WarpCategory category : island.getWarpCategories().values()) {
player.asPlayer().sendMessage("Category: " + category.getName());
for (IslandWarp warp : category.getWarps()) {
String privacy = warp.hasPrivateFlag() ? "Private" : "Public";
player.asPlayer().sendMessage(" - " + warp.getName() + " (" + privacy + ")");
}
}
}
public void deleteAllWarpsInCategory(Island island, String categoryName) {
WarpCategory category = island.getWarpCategory(categoryName);
if (category != null) {
island.deleteCategory(category);
}
}
}
Warp Limits
Warp limits are managed through the upgrade system:
// Get current warp limit
int warpsLimit = island.getWarpsLimit();
// Set warp limit
island.setWarpsLimit(10);
// Get raw warp limit (set via command)
int rawLimit = island.getWarpsLimitRaw();
// Check if can create more warps
if (island.getIslandWarps().size() >= island.getWarpsLimit()) {
player.sendMessage("Warp limit reached!");
}