Skip to content

Commit

Permalink
Phybros/nbt upgrade 2.11.2 (#210)
Browse files Browse the repository at this point in the history
* fix for new version of nbt api

* tidy imports/reformat
  • Loading branch information
phybros authored Apr 14, 2023
1 parent 9456f3b commit fcadbd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api-plugin</artifactId>
<version>2.8.0</version>
<version>2.11.2</version>
</dependency>

<!-- logging framework -->
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/io/servertap/api/v1/PlayerApi.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.servertap.api.v1;

import de.tr7zw.nbtapi.NBTFile;
import de.tr7zw.nbtapi.NBTListCompound;
import io.javalin.http.*;
import io.javalin.openapi.*;
import io.servertap.Constants;
Expand Down Expand Up @@ -227,13 +226,13 @@ public static void getPlayerInv(Context ctx) {
}
NBTFile playerFile = new NBTFile(playerfile);

for (NBTListCompound item : playerFile.getCompoundList("Inventory")) {
playerFile.getCompoundList("Inventory").forEach(item -> {
ItemStack itemObj = new ItemStack();
itemObj.setId(item.getString("id"));
itemObj.setCount(item.getInteger("Count"));
itemObj.setSlot(item.getInteger("Slot"));
inv.add(itemObj);
}
});

ctx.json(inv);

Expand Down

0 comments on commit fcadbd1

Please sign in to comment.