Update HOW_TO_USE_API.md

This commit is contained in:
JEFF 2018-11-08 00:00:24 +01:00 committed by GitHub
parent e6cb527e6a
commit 92bc0c4dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,16 +4,16 @@ You have to import ChestSort.jar into your BuildPath.
Then you can access it via the plugin manager:
```
JeffChestSortPlugin chestSort = (JeffChestSortPlugin) getServer().getPluginManager().getPlugin("ChestSort");
JeffChestSortPlugin chestSort = (JeffChestSortPlugin) getServer().getPluginManager().getPlugin("ChestSort");
if(chestSort==null || !(chestSort instanceof JeffChestSortPlugin)) {
getLogger().warning("ChestSort plugin not found.");
}
if(chestSort==null || !(chestSort instanceof JeffChestSortPlugin)) {
getLogger().warning("ChestSort plugin not found.");
}
```
Now, you can sort any Inventory! Just like this:
```
Inventory inv = ...
chestSort.sortInventory(inv);
```
Inventory inv = ...
chestSort.sortInventory(inv);
```