Depending on your build environment, you may need to use different formatting for your build files. Below you'll find formatting for Apache Maven and Gradle (Kotlin DSL).
Insert these into your pom.xml file.
<repository>
<id>iridiumdevelopment</id>
<url>https://nexus.iridiumdevelopment.net/repository/maven-releases/</url>
</repository>
<dependency>
<groupId>com.iridium</groupId>
<artifactId>IridiumSkyblock</artifactId>
<version>LATEST</version>
</dependency>
After that, run mvn package, and maven should recognize the dependency and build your project.
Insert these into your build.gradle.kts file.
repositories {
maven("https://nexus.iridiumdevelopment.net/repository/maven-releases/")
}
dependencies {
implementation("com.iridium:IridiumSkyblock:LATEST")
}
After that, run gradle build, and gradle should recognize the dependency and build your project.
Note: You may have to change the version that you're compiling against. Change
LATESTto the version you need.
First get the User object using the following code.
And then you can retrieve an Optional Island from the user object
public Optional<Island> getPlayerIsland(Player player) {
User user = IridiumSkyblockAPI.getInstance().getUser(player);
Optional<Island> island = user.getIsland();
return island;
}
This will get the location specified in the second argument, however it will also use the island the player is standing on as cache. This is useful for getting Islands near a player, e.g. when they break a block right click a block ect, since 99% of the time this will be in the island they player is standing on. (and if it isnt it will do a regular lookup) This method is prefered since it is quicker and causes less lag
public Optional<Island> getPlayerIsland(Player player) {
User user = IridiumSkyblock.getInstance().getIslandManager().getTeamViaPlayerLocation(player, player.getLocation());
Optional<Island> island = user.getCurrentIsland();
return island;
}
You can retrieve an Optional Island from the IridiumSkyblockAPI instance
public Optional<Island> getIsland(Location location) {
Optional<Island> island = IridiumSkyblockAPI.getInstance().getIslandViaLocation(location);
return island;
}
You can retrieve an Optional Island from the IridiumSkyblockAPI instance
public Optional<Island> getIsland(String name) {
Optional<Island> island = IridiumSkyblockAPI.getInstance().getIslandByName(name);
return island;
}
To do this you first need to get the User object from a Player
You can then do this by using the IridiumSkyblockAPI#getIslandPermission function and passing in the correct PermissionType(BLOCK_PLACE)
public boolean canBuild(Island island, Player player) {
User user = IridiumSkyblockAPI.getInstance().getUser(player);
boolean isAllowed = IridiumSkyblockAPI.getInstance().getIslandPermission(island, user, PermissionType.BLOCK_PLACE);
return isAllowed;
}
private IridiumSkyblockAPI(@NotNull IridiumSkyblock iridiumSkyblock)Constructor for api initialization.
iridiumSkyblock — The instance of the {@link IridiumSkyblock} class
public static @NotNull IridiumSkyblockAPI getInstance()Accesses the api instance. Might be null if this method is called when {@link IridiumSkyblock}'s startup method is still being executed.
public void addBankItem(@NotNull BankItem bankItem)Adds an Island BankItem.
bankItem — The specified Bankitem
public void addEnhancement(@NotNull String enhancementName, @NotNull Enhancement<?> enhancement)Adds an Island enhancement.
enhancementName — The name of the enhancement (used for storage purposes)enhancement — the enhancement item
public void addPermission(@NotNull Permission permission, @NotNull String key)Adds an Island permission.
permission — The specified Permissionkey — the unique key associated with this permission
public void addCommand(@NotNull Command<Island, User> command)Adds an IridiumSkyblock command.
command — The command that should be added
public @NotNull User getUser(@NotNull OfflinePlayer offlinePlayer)Gets a {@link User}'s info. Creates one if they don't exist.
offlinePlayer — The player who's data should be fetched
public @NotNull Optional<Island> getIslandById(int id)Finds an Island by its id.
id — The id of the Island
public @NotNull Optional<Island> getIslandByName(@NotNull String name)Finds an Island by its name.
name — The name of the Island
public @NotNull Optional<Island> getIslandViaLocation(@NotNull Location location)Gets an {@link Island} from a location.
location — The location you are looking at
public @NotNull Optional<Permission> getPermissions(@NotNull String permissionKey)Gets a permission object from name.
permissionKey — The permission key
public @NotNull Optional<Permission> getPermissions(@NotNull PermissionType permissionType)Gets a permission object from name.
permissionType — The permission key
public boolean getIslandPermission(@NotNull Island island, @NotNull User user, @NotNull Permission permission, @NotNull String key)Gets whether a permission is allowed or denied.
island — The specified Islanduser — The Specified userpermission — The Specified permissionkey — The permission key
public boolean getIslandPermission(@NotNull Island island, @NotNull User user, @NotNull PermissionType permissionType)Gets whether a permission is allowed or denied.
island — The specified Islanduser — The specified userpermissionType — The specified permission type
public @NotNull List<Island> getIslands(@NotNull IslandManager.SortType sortType)Gets a list of Islands sorted by SortType.
sortType — How we are sorting the Islands
public @Nullable World getWorld()Returns the overworld.
public @Nullable World getNetherWorld()Returns the nether world.
public @Nullable World getEndWorld()Returns the end world.
public boolean isIslandWorld(@NotNull World world)Returns whether the specified world is from IridiumSkyblock.
world — The world that should be checked
public boolean isIslandOverWorld(@NotNull World world)Returns if this is the overworld of IridiumSkyblock.
world — The world that should be checked
public boolean isIslandNether(@NotNull World world)Returns if this is the nether world of IridiumSkyblock.
world — The world that should be checked
public boolean isIslandEnd(@NotNull World world)Returns if this is the end world of IridiumSkyblock.
world — The world that should be checked
public boolean canVisitIsland(@NotNull User user, @NotNull Island island)Returns whether the specified player can visit the provided Island.
user — the userisland — the Island
These API calls can be found in IslandCreateEvent.java.
@Nullable public String getIslandName()The name of the Island.
null indicates that the name of the Player is used as the Island name because it hasn't been set.
public void setIslandName(@Nullable String islandName)Sets the name of the Island.
set it to null to default to the player's name
islandName — The name of the island
public void setSchematicConfig(Schematics.@NotNull SchematicConfig schematicConfig)Sets the schematic of the new island
schematicConfig — The schematic configuration of the island
These API calls can be found in IslandDeleteEvent.java.