Giter VIP home page Giter VIP logo

nbteditor's People

Contributors

artelgg avatar bananapuncher714 avatar gw2princeps avatar loohp avatar portlek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nbteditor's Issues

NBTEditor appears to be affected by Paper relocation change

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.

CI with travis

Can we add Travis that can test the library with unit tests? It makes the project more stable/safe.

Unable to set values as of 1.20

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() throws NPE

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.

Cannot invoke "Object.getClass()" because "obj" is null

[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)

cant load

my server can't load this plugin :(((

Issue when re-setting values

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);
}

It doesn't work for 1.18.2

Server: Purpur 1.18.2 - 1576

NBTEditor Version: 7.18.0

Example code

val nbtCompound = NBTEditor.getNBTCompound(item)
nbtCompound.set(item, cost, "tag", "RepairCost")
return NBTEditor.getItemFromTag(nbtCompound)

Result:

image


Example code

NBTEditor.contains(item, "RepairCost")

Result:

return false for every ItemStack


Example Code

NBTEditor.set(item, 6, "RepairCost")

Result: it doesn't work

java.lang.reflect.InvocationTargetException

[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)

Discussion about Unit Test.

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?

Function "getCompound(Block block) " was broken since commit cc72cdc

cc72cdc

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)

if ( LOCAL_VERSION.greaterThanOrEqualTo( MinecraftVersion.v1_18_R1 ) ) {
tag = getMethod( "getTileTag" ).invoke( tileEntity );
} else {
tag = getNMSClass( "NBTTagCompound" ).newInstance();
getMethod( "getTileTag" ).invoke( tileEntity, tag );
}

if ( LOCAL_VERSION.greaterThanOrEqualTo( MinecraftVersion.v1_18_R1 ) ) {
tag = getMethod( MethodId.getTileTag ).invoke( tileEntity );
} else {
tag = getNMSClass( ClassId.NBTTagCompound ).newInstance();
getMethod( MethodId.getTileEntity ).invoke( tileEntity, tag );
}

Durability

Hi, after adding an NBT tag, the durability of an item won't go down

Nonnull Can't be imported

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

Deep design thoughts.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.