Skip to content

Developer API

Denis Istratov edited this page Mar 31, 2024 · 11 revisions

Adding depencencies

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    compileOnly 'com.github.iRedTea:NoDropX:VERSION'
}

Maven

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>


<dependency>
    <groupId>com.github.iRedTea</groupId>
    <artifactId>NoDropX</artifactId>
    <version>VERSION</version>
    <scope>provided</scope>
</dependency>

Getting API class instance

NoDropAPI api = NoDropX.getAPI();

API class methods

Set no drop to item

setNoDrop(@NotNull ItemStack item, boolean isNoDrop);

Check if item is no drop item

isNoDrop(@NotNull ItemStack item);

Get no drop item stack

ItemStack getNoDrop(@NotNull Material material, int amount);

Returns the slot numbers that no drop item with this material saves at death

getCapacitySlots(Material material);

Set AllNoDrop status to item

setAllNoDrop(@NotNull ItemStack item, boolean isAllNoDrop);

Check if item AllNoDrop

isAllNoDrop(@NotNull ItemStack item);

Get allnodrop item stack

ItemStack getAllNoDrop(@NotNull Material material, int amount);

Events

PlayerChangeNoDropEvent.java calls when no drop status of item changes by player
NoDropItemDropOnDeathEvent.java calls when player dies with no drop item in inventory
NoDropItemThrownEvent.java calls when player thrown out from inventory no drop item

StorageManipulator methods

Returns StorageManipulator of player

api.getStorageManipulator(UUID);

Adds no drop item to player storage

add(@NotNull ItemStack item);

Remove no drop item to player storage

remove(@NotNull ItemStack item);

return items in storage

all();
Clone this wiki locally