mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-13 10:44:03 +01:00
Update README.md
This commit is contained in:
parent
785d56271c
commit
b4095db9b5
@ -43,9 +43,10 @@ cd Minepacks
|
||||
mvn -pl Minepacks-API
|
||||
```
|
||||
|
||||
## Usage:
|
||||
### Get access to the API:
|
||||
```java
|
||||
public MinepacksPlugin getMinepacks() {
|
||||
public static MinepacksPlugin getMinepacks() {
|
||||
Plugin bukkitPlugin = Bukkit.getPluginManager().getPlugin("Minepacks");
|
||||
if(!(bukkitPlugin instanceof MinepacksPlugin)) {
|
||||
// Do something if Minepacks is not available
|
||||
@ -56,6 +57,16 @@ public MinepacksPlugin getMinepacks() {
|
||||
```
|
||||
You can now use the returned `MinepacksPlugin` object to interact with the Minepacks plugin.
|
||||
|
||||
### Access a players backpack inventory:
|
||||
```java
|
||||
public static Inventory getPlayerBackpackInventory(Player player) {
|
||||
Backpack bp = getMinepacks().getBackpackCachedOnly(player);
|
||||
if(bp == null) return null; //Backpack not loaded (retry later)
|
||||
return bp.getInventory();
|
||||
}
|
||||
```
|
||||
This will return null if the backpack is not loaded or the inventory of the backpack if the backpack is already loaded.
|
||||
|
||||
## Links:
|
||||
* [JavaDoc][apiJavaDoc]
|
||||
* [API Build Server][apiBuilds]
|
||||
|
Loading…
Reference in New Issue
Block a user