bananapuncher714 / nbteditor Goto Github PK
View Code? Open in Web Editor NEWA single class NBT editor for items, skulls, mobs, and tile entities
License: MIT License
A single class NBT editor for items, skulls, mobs, and tile entities
License: MIT License
After testing out my plugin to see if it works after this change: https://forums.papermc.io/threads/important-dev-psa-future-removal-of-cb-package-relocation.1106/ I noticed that I'm getting errors from NBTEditor. I use the following code to test:
ItemStack stack = event.getPlayer().getItemInHand();
stack = NBTEditor.set(stack, "test", "customtag");
event.getPlayer().getInventory().addItem(stack);```
And get a stacktrace that tells me that the error is on the NBTEditor.set(..) line.
Can we add Travis that can test the library with unit tests? It makes the project more stable/safe.
Currently running v7.18.6 as of the most recent commit on Github.
The NBTEditor was working without issue in 1.19 but once updating to 1.20 of spigot, NBTEditor.set(ItemStack, Value, Keys...) is no longer working. No errors are thrown when set but the NBTEditor.Get(ItemStack, Keys...) always returns null (Or default 0 in the case of getInt).
NBTEditor.contains(object)
throws a NullPointerException. This is used with a Block (tried with both pressure plates and chests). It looks like, when the block does not have any tags set, it throws an error.
I tested it on Spigot 1.8.8.
[22:21:52 WARN]: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "obj" is null
[22:21:52 WARN]: at java.base/java.lang.reflect.Method.invoke(Method.java:561)
[22:21:52 WARN]: at Cardinal-1.0.jar//sk.DexterSK.Cardinal.utilz.NBTEditor.getCompound(NBTEditor.java:807)
[22:21:52 WARN]: at Cardinal-1.0.jar//sk.DexterSK.Cardinal.utilz.NBTEditor.getBlockTag(NBTEditor.java:784)
[22:21:52 WARN]: at Cardinal-1.0.jar//sk.DexterSK.Cardinal.utilz.NBTEditor.getValue(NBTEditor.java:942)
[22:21:52 WARN]: at Cardinal-1.0.jar//sk.DexterSK.Cardinal.utilz.NBTEditor.contains(NBTEditor.java:1151)
Please update it to 1.20.6, thanks!
my server can't load this plugin :(((
Hello, I have this code and, the first set it's ok. But, when I try to re-set, it doesn't set anything.
First, I have this one, that happens ok:
// CREATE YOUR OWN COMPOUND AND SET THE VALUES
NBTEditor.NBTCompound properties = NBTEditor.getEmptyNBTCompound();
properties.set("sim", "ySpawnersV2");
properties.set(p.getName(), "Dono");
properties.set(toStack, "Stack");
properties.set(0, "Drop");
properties.set(Lists.newArrayList("").toString(), "Amigos");
properties.set(Lists.newArrayList("").toString(), "Remover");
properties.set(Lists.newArrayList("").toString(), "Matar");
properties.set(Lists.newArrayList("").toString(), "Vender");
// SET THE OWN COMPOUND ON THE SPAWNDATA
spawnData.set(properties, "SpawnData");
// SET THE SPAWNDATA ON BLOCK
NBTEditor.set(block, spawnData);
And, I have this another code, that doesn't work:
public static void setString(Block block, String data, String value){
NBTEditor.NBTCompound compound = NBTEditor.getNBTCompound(block, "SpawnData");
compound.set(value, data);
NBTEditor.set(block, compound);
}
val nbtCompound = NBTEditor.getNBTCompound(item)
nbtCompound.set(item, cost, "tag", "RepairCost")
return NBTEditor.getItemFromTag(nbtCompound)
NBTEditor.contains(item, "RepairCost")
return false for every ItemStack
NBTEditor.set(item, 6, "RepairCost")
[12:47:49 WARN]: java.lang.reflect.InvocationTargetException
[12:47:49 WARN]: at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[12:47:49 WARN]: at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
[12:47:49 WARN]: at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[12:47:49 WARN]: at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
[12:47:49 WARN]: at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
[12:47:49 WARN]: at utils.NBTEditor.getHead(NBTEditor.java:461)
I saw that we probably can't use a real unit test with Jupiter because we don't have NMS classes so, maybe we can make a do-test.sh
shell script that can download BuildTools.jar and set up a temp. server in test
directory and then it can run a class that can test the project.
What do you think about that?
The method key(getTileTag) is different between two commit
then cause the java.lang.IllegalArgumentException
[22:42:02 WARN]: java.lang.IllegalArgumentException: java.lang.ClassCastException@7f6d9a6e
[22:42:02 WARN]: at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
[22:42:02 WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[22:42:02 WARN]: at java.lang.reflect.Method.invoke(Method.java:498)
[22:42:02 WARN]: at top.iseason.bukkit.sakurabind.libs.nbteditor.NBTEditor.getCompound(NBTEditor.java:697)
[22:42:02 WARN]: at top.iseason.bukkit.sakurabind.libs.nbteditor.NBTEditor.getBlockTag(NBTEditor.java:666)
[22:42:02 WARN]: at top.iseason.bukkit.sakurabind.libs.nbteditor.NBTEditor.getValue(NBTEditor.java:841)
[22:42:02 WARN]: at top.iseason.bukkit.sakurabind.libs.nbteditor.NBTEditor.contains(NBTEditor.java:1050)
NBTEditor/src/main/java/io/github/bananapuncher714/nbteditor/NBTEditor.java
Lines 812 to 817 in 35d6f93
NBTEditor/src/main/java/io/github/bananapuncher714/nbteditor/NBTEditor.java
Lines 692 to 697 in cc72cdc
using core : CatServer-1.16.5-1d8d6313-server
using version : 1.16.5
Hi, after adding an NBT tag, the durability of an item won't go down
When i installed this Resource i have an error
Error:(1313, 33) java: cannot find symbol
symbol: class Nonnull
location: class me.iitproductions.unbreakable.NBTEditor.NBTCompound
I think the usage design is terrible for newbie developer: We should make it more understandable, for example;
NBTEditor.of(itemStack).getCompound();
NBTEditor.of(itemStack).setCompound(compond);
Just an example. Also this design is more OOP so, we can understand how we can use the library or what the library behavior is. We have to look at the parameter name to understand how the library works, But I think we should add more understandable codes like above.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.