Examples

This page goes over how to use our API to develop against our plugin.

Checking permissions

boolean canBreakBlocks = IridiumSkyblockAPI.getInstance().getIslandPermission(island, user, PermissionType.BLOCK_BREAK);

You can do this simply using the IridiumSkyblockAPI#getIslandPermission() method, which will return true if a user has the specified permission, it will also acount for /is bypass

Creating custom permissions

/*
Create the Permission Object
the item parsed in will be the item displayed in the GUI
and the IslandRank is the lowest rank that can use this permission (by default)
*/
Permission myPermission = new Permission(
            new Item(XMaterial.BEDROCK, 1, 1, "&bMy Custom permission", Arrays.asList(
                    "&7My Custom Permission added though the IridiumSkyblock API.",
                    "", "&b&lPermission",
                    "%permission%")
            ), IslandRank.MEMBER
    );

/*
This will register the permission with IridiumSkyblock
The first object we are parsing in is the Permission object we created above
The second is a unique string we use to identify this permission 
*/
IridiumSkyblockAPI.getInstance().addPermission(myPermission, "myPermission");

Checking custom permissions

/*
This is getting the permission object assosiated with the Key "myPermission" This is the key you created yourself in the example above
*/
Optional<Permission> permission = IridiumSkyblockAPI.getInstance().getPermission("myPermission");

/*
Here we are getting if the user has access to this permission
The island we are parsing though is the island we are testing if they have this permission
The second is the user object
Next is the Permission object we got above
And finally we have the Permission Key

This will return if they player has access to break blocks taking if the user is bypassed into account
*/
boolean hasPermission = IridiumSkyblockAPI.getInstance().getIslandPermission(island, user, permission.get(), "myPermission");

Adding your own Island Upgrades

        Upgrade<SizeUpgrade> upgrade = new Upgrade<>(true, "Custom Upgrade",
                new Item(XMaterial.GRASS_BLOCK, 11, 1, "&b&lCustom Island Upgrade", Arrays.asList(
                        "&bMy Custom Island Upgrade",
                        "",
                        "&b&l[!] &bLeft Click to Purchase this Upgrade"
                )), ImmutableMap.<Integer, SizeUpgrade>builder()
                .put(1, new SizeUpgrade(1000, 15, 50))
                .put(2, new SizeUpgrade(1000, 15, 100))
                .put(3, new SizeUpgrade(1000, 15, 150))
                .build());
        IridiumSkyblockAPI.getInstance().addUpgrade("CustomUpgrade", upgrade);

Each Upgrade must be supplied with an Object Extending UpgradeData using generics, UpgradeData contains the ugrade cost assosiated with the upgrade, you can then add whatever other variables you with such as a size integer.

You can then get what Upgrade Level an island is on by using the following code Supplying the same key you passed in when calling the addUpgrade method

int level = IridiumSkyblockAPI.getInstance().getIslandUpgrade(island, "CustomUpgrade").getLevel()

Last updated