Spigot NBTProxy 2.1.1

NBT library for accessing NBT data on items, entities, tile entities and files.

  1. MrBlobman submitted a new resource:

    NBTProxy - NBT library for accessing NBT data on items, entities and tile entities.

    Read more about this resource...
     
  2. MrBlobman updated NBTProxy with a new update entry:

    1.10 support and a file IO delegate

    Read the rest of this update entry...
     
  3. MTC

    MTC

    Code (Java):
    try {
        TagFactory factory = TagFactory.get();
    } catch (UnsupportedOperationException e) {
        //Code to run if there is not a compatible version running on the server
        this.getLogger().severe(e.getMessage());
        this.setEnabled(false);
        return;
    }
    Why don't you just return null if factory is not found ?

    E.g.:
    Code (Java):
    TagFactory factory = TagFactory.get();
    if (factory != null) {
        // Do stuff
    } else {
        //Code to run if there is not a compatible version running on the server
        this.getLogger().severe("Sorry this plugin is not compatible with your server version");
        this.setEnabled(false);
        return;
    }
     
  4. I wanted to throw my own exception instead of having server owners going to the dev of the plugin that is depending on this library asking about a null pointer exception. This way if the dev using the library didn't put some sort of code in the onEnable that would disable the plugin with a nice message at least the error message would tell the server owner that NBTProxy is the issue. The try-catch in the onEnable is a way to override that behavior if you would like.

    Since the class is a singleton there is really no problem with calling TagFactory.get() anytime you need an instance and you don't ever have to worry about that instance being null. It will handle that potential null pointer exception with a more descriptive exception instead.
     
  5. MrBlobman updated NBTProxy with a new update entry:

    Admin tools, a parser and nms version 1_11_R1

    Read the rest of this update entry...
     
  6. MrBlobman updated NBTProxy with a new update entry:

    1.12 support

    Read the rest of this update entry...
     
  7. @MrBlobman Will there be an update for 1.12.1?
     
  8. Hi @Narwhal! Everything should be working with 1.12.1, the last update was for pre2 because that is what was out at the time but the NMS required didn't change since then.

    Please let me know if something isn't working or you are looking for anything added/changed with the library. Glad to see you are interested in the project :)
     
  9. @MrBlobman Thanks for the quick reply. I believe that as of 1.12.1, CraftBlockState#getTileEntity no longer exists and block NBT data needs to be fetched using CraftBlockEntityState#getSnapshotNBT. https://pastebin.com/sasmNdKL
     
  10. MrBlobman updated NBTProxy with a new update entry:

    1.12.1 update

    Read the rest of this update entry...
     
  11. The details are much appreciated, it's fixed in the new version just released. I tested on 1.12 and 1.12.1, looked at a furnace and executed `/nbt read block` which worked fine in both versions.

    The new implementation is here on github if you are interested.
     
    • Like Like x 1