mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-04 16:44:00 +01:00
8.13.1-SNAPSHOT
This commit is contained in:
parent
64ed22546c
commit
e1064e84c1
@ -48,8 +48,8 @@ If you use the `Sortable`class or the `ISortable` interface, you must also shade
|
|||||||
Then you can access the API via the plugin manager:
|
Then you can access the API via the plugin manager:
|
||||||
|
|
||||||
```
|
```
|
||||||
ChestSortPlugin chestSort = (ChestSortPlugin) getServer().getPluginManager().getPlugin("ChestSort");
|
ChestSort chestSort = (ChestSort) getServer().getPluginManager().getPlugin("ChestSort");
|
||||||
if(chestSort==null || !(chestSort instanceof ChestSortPlugin)) {
|
if(chestSort==null) {
|
||||||
getLogger().severe("Error: ChestSort is not installed.");
|
getLogger().severe("Error: ChestSort is not installed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -95,10 +95,18 @@ public void onChestSortEvent(ChestSortEvent event) {
|
|||||||
If you create a new Inventory inside your plugin, you can use the `Sortable` class to tell ChestSort that your custom inventory should be sortable.
|
If you create a new Inventory inside your plugin, you can use the `Sortable` class to tell ChestSort that your custom inventory should be sortable.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Sortable holder = new Sortable();
|
Inventory inv = Bukkit.createInventory(new Sortable(), 9, "Example");
|
||||||
Inventory inv = Bukkit.createInventory(holder, 9, "Example");
|
```
|
||||||
|
|
||||||
|
You can also store another InventoryHolder in the Inventory if needed:
|
||||||
|
|
||||||
|
```java
|
||||||
|
Sortable holder = new Sortable(player)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example Plugin
|
## Example Plugin
|
||||||
|
|
||||||
Here is a complete example plugin that shows to add and use the ChestSort API: [LINK](https://github.com/JEFF-Media-GbR/ChestSortAPIExample)
|
Here is a complete example plugin that shows to add and use the ChestSort API: [LINK](https://github.com/JEFF-Media-GbR/ChestSortAPIExample)
|
||||||
|
|
||||||
|
## Source code
|
||||||
|
The source code for the API can be found [here](https://github.com/JEFF-Media-GbR/Spigot-ChestSortAPI).
|
Loading…
Reference in New Issue
Block a user