Coder Social home page Coder Social logo

powernbt's Introduction

PowerNBT

Command-based in-game NBT editor for Bukkit


build:

mvn -Dplugin-version=LOCALDEV-SNAPSHOT package

Features:

  • Browsing and editing NBT tags
  • supports items, players, offline-players, entities, blocks, chunks, schematic files and all other nbt files
  • save tags to files
  • spawn entity with custom nbt tags
  • parse mojangson string
  • custom colors and unicode symbols
  • supports tab-completion
  • supports operations copy/paste/cut/swap
  • supports variables
  • JSON editor for NBT strings

Permissions

  • powernbt.use

Commands

Use nbt command:
/powernbt ...
/pnbt ...
/nbt ...

Use nbt command in silent mode:
/powernbt. ...
/pnbt. ...
/nbt. ...

(command) (required param) (optional param)

Browse tags

You can browse nbt tree structure using this command:
/nbt (object) (query) (view-mode)

object - Object that contains NBT tag.
Examples:
/nbt inventory - show items in your inventory as nbt list
/nbt block - show nbt of target block
/nbt item - show nbt tag of item in hand

query (optional) - Query to view nested tags.
Examples:
/nbt block . - empty query for block. Command is similar to /nbt block
/nbt me HealF - show your health
/nbt *admin EnderItems[0].id - show id of first item in admin's enderchest

view-mode (optional) - View mode of tag

Edit tags

Set new value for nbt tag:

/nbt object query = value type
/nbt value type > object query

value - New value of nbt tag
Value can be: number, string, hexadecimal value, color, array of numbers
Example:
/nbt me foodLevel = 20 - set your food level to full (20)

type (optional in some cases) - Type of value
Type can be: any of nbt tag type
Type is required for numeric values. In other cases type is optional.
Example:
/nbt buffer foo = 12 float - set new value (12 float) to tag "foo" in buffer compound

Set new value for nbt tag from other object:

/nbt object1 query1 = object2 query2
/nbt object1 query1 < object2 query2
/nbt object2 query2 > object1 query1

object1 - Object to be changed
query1 (optional) - Value in object be changed (query)
object2 - Object whose value will be read
query2 (optional) - Query to get the specific value of object2
Examples:
/nbt $playerFile = *playerName - save all tags of playerName to file playerFile.nbt
/nbt me HealF = $playerFile HealF - set value of your health to stored in playerFile.nbt in tag "HealF"

Move value (cut and paste):

/nbt object1 query1 >> object2 query2
/nbt object2 query2 << object1 query1
Value will be removed from object1 and set to object2

Swap values:

/nbt object1 query1 <> object2 query2
/nbt object1 query1 swap object2 query2
Values of the objects will be swapped
Example:
/nbt block Items <> me Inventory - swap your inventory with targeted chest

Add value:

/nbt object1 query1 add value
/nbt object1 query1 add object2 query2
/nbt object1 query1 += value
/nbt object1 query1 += object2 query2
Add value to object1

Behavior is different for the following cases:
Object1 is number, value is number - increace number
Object1 is string - concatenate
Object1 is list or array, value is list or array - add all items from value to object
Object is compound and value is compound - add all entries from value to object
Examples:
/nbt me HealF += 2 - Increace your hp by 2
/nbt me HealF += -2 - Decreace your hp by 2
/nbt item display.Name += "(tool)" - add text to item name

Insert value to special position

/nbt object1 query1 insert position value type
/nbt object1 query1 ins position value type
/nbt object1 query1 insert position object2 query2
/nbt object1 query1 ins position object2 query2
Insert value to object to special position Object1 must be an list or array.
Example:

before: item display.Lore = ["Lore1","Lore2","Lore3","Lore4"]
/nbt item display.Lore insert 2 "New Lore" - insert "New lore" to position 2 in list
after: item display.Lore = ["Lore1","Lore2","New Lore","Lore3","Lore4"]

Bitwise operations

/nbt object1 query1 &= object2 query2
/nbt object1 query1 |= object2 query2
/nbt object1 query1 ^= object2 query2
/nbt object1 query1 &= value type
/nbt object1 query1 |= value type
/nbt object1 query1 ^= value type
/nbt object1 query1 inverse
/nbt object1 query1 inv
/nbt object1 query1 ~

&= - bitwise AND
|= - bitwise OR
|= - bitwise XOR
~ - bitwise NOT
Examples:
/nbt item HideFlags |= b0000100 - hide "Unbreakable" display property in item
/nbt item HideFlags &= b1111110 - show "ench" display property in item
/nbt item HideFlags ^= b0000010 - toggle "AttributeModifiers" display property in item

Multiplication

/nbt object1 query1 *= object2 query2
/nbt object1 query1 *= value type
Multiply left value to right value.
All values must be a numbers

Rename tags

/nbt object query1 rename newName
/nbt object query1 ren newName
Rename tag in compound to newName

Remove tags

/nbt object query remove
/nbt object query rem
If query is not present, it will attempt to remove object
Examples:
/nbt item display remove - remove all display attributes of item
/nbt $filename remove - remove file filename.nbt
/nbt id12345 remove - remove entity with id=12345

Buffer

Copy value to buffer

/nbt object query copy
/nbt value type copy

Cut value to buffer

/nbt object query cut

Paste value from buffer

/nbt object query paste

Example:
/nbt me Inventory copy - copy your inventory to buffer (clipboard)
/nbt buffer [0].tag.display.Name = "new Name of item" - change value in buffer
/nbt me Inventory paste - paste buffer back to your inventory

Variables

Set variable

/nbt %variable set object query
/nbt %variable set value type
/nbt object query as %variable
/nbt value type as %variable
After this command you can use a variable as if using the object
%variable - Name of variable

Get variable

/nbt %variable

Remove variable

/nbt %variable remove

Example:
/nbt %b set block - set block as variable %b
/nbt block as %b - set block as variable %b
/nbt %b Items - Now you can use a variable %b as if you are using a block

Spawn entities

/nbt object [query] spawn world
/nbt mojangsonValue spawn world
world (optional) - World where spawn entity. Required for executing from console.
Required tags in left side to spawn entity:
id - entity Savegame ID
Pos - position of entity. List of doubles

Examples:
/nbt {id:pig,Pos:[1d,100d,2d],Riding:{id:MinecartRideable}} spawn world1 - spawn pig in minecart at position 1:100:2 in world world1
/nbt id123(Creeper) copy - copy entity value to buffer
/nbt buffer Pos = me Pos - change position stored in buffer to your position
/nbt buffer spawn - spawn entity at your position

Debug mode

Enable or disable debug mode: /nbt debug on /nbt debug off

Object

Object is special container that can contains nbt tag. Plugin can read tags from it, save, and remove container. You can use these objects:

  • me - you =) as player
  • item, i - item in hand (only tagged items)
  • block, b - block at the line of sight
  • chunk - chunk in player's position (disabled in 1.17+)
  • id<?> - entity with specified id. Example: id102
  • x:y:z:world - block at position x:y:z in world
  • chunk:x:z:world - chunk at position x:z in world (disabled in 1.17+)
  • buffer, c - your buffer
  • *name - online player.
  • @nаme - offline player's .dat file.
  • %variable - defined variable. Example: %skeleton
  • inventory, inv - your inventory. (alias for "me Inventory")
  • hand, h - Selected slot in your inventory. (alias for "me Inventory[n]")
  • hand:рlayer, h:рlayer - Selected slot in inventory of player.
  • $name - file name.nbt in folder plugins/PowerNBT/nbt/
  • $$name - compressed file name.nbtz in folder plugins/PowerNBT/nbt/
  • file:filename - file in minecraft folder.
    filename can be enclosed in quotes: file:"plugins/myplugin/file.dat"
  • gzip:filename - compressed file in minecraft folder.
  • sch:schematicName, schematic:schematicName - Get schematic file in plugins/WorldEdit/schematics/
  • compound - create a new empty compound
  • list - create a new empty list
  • self, this - get object from left fide (or right side in some cases)
    Examples:
    /nbt item display.Lore[2] = this display.Name
    /nbt me Inventory = this EnderItems
  • * - future object.
    after this command you must select any block or entity or input new value to chat

Query

Query allows you to browse and select special tag in object.
Query is string containing tags, sepatated by .
Examples:
Inventory[1].id - id of second item in player inventory
display.Name - item's name.
pages[0] - first page of book
. - root

Tag name can contains spaces and unicode characters.
In this case, enter the tag name in quotes:
forgeData."foo bar"[0]
forgeData."unicode\u2600".tag
forgeData.example."multi\nline"

JSON query: #

display.Name# - select string display.Name as JSON
display.Name#text - select "text" property of JSON
Example:
/nbt item display.Name#text = "name"
/nbt item display.Name {"text":"name"}

Range query: [A..B]

Select subarray or substring.
[1..3] - select items from 1 to 3
[1..] - select items from 1 to end
[3..1] - select items from 1 to 3 in reversed order
[..3] - select items from 3 to end in reversed order
Examples:
/nbt item display.Lore[2..4] remove
/nbt block Items = me Inventory[0..7]

View mode

limit

Limit of display lines or chars
Examples:
/nbt me Inventory 10 - show first 10 items in inventory
/nbt item display.Name 100 - show first 100 characters of item name

range

Show results from start range to end
Example:
/nbt me Inventory 10-20 - show items in inventory from 10 to 19
(default view limit is 0-10)

all

Show all lines or full result Example:
/nbt me . all

hex

Show number or string in hex mode
Example:
/nbt item display.color hex - show color of item in hex mode

You can combine hex mode with others by ,:
/nbt item display.Name 5-10,hex - show 5-10 characters of item name in hex mode

Value

In some commands you can specify new value for tag. But in some cases you also must specify a type.
Value can be:

string

string must be enclosed in quotes.
supported java-like escaping by char \
escaping features:
\c - Translate to COLOR_CHAR §
& - Translate to COLOR_CHAR §
\& - Translate to &
\_ - Translate to space
type is not required (type is string by default)
extra types can be used:
json - convert json string to object
mojangson - convert mojangson string to object
Example:
/nbt item display.Name = "\cbItem name"
/nbt "{test:true, text:\"foo\"}" json

numeric value

if the previous object already contains a value - type is optional
available types: byte, short, int, long, float, double
Examples:
/nbt me Health = 100500
/nbt buffer NewValue = 18 int

hexadecimal

default type is int, but you can specify other type
available types: byte, short, int, long, float, double
Example:
/nbt item display.color = #FF0000 - red color

binary

Binary value, starting by b
default type is int, but you can specify other type
available types: byte, short, int, long, float, double
Example:
/nbt item HideFlags = b101 - hide display properties for "ench" and "Unbreakable"

color

color contains an integer value
colors:

  • black
  • red
  • green
  • brown
  • blue
  • purple
  • cyan
  • lightgray
  • gray
  • pink
  • lime
  • lightgreen
  • yellow
  • lightblue
  • magenta
  • orange
  • white

Example:
/nbt item display.color = red

constants

on - aliases for "1 byte"
off - aliases for "0 byte"
true - "true" (json mode) or "1 byte" (nbt mode)
false - "false" (json mode) or "0 byte" (nbt mode)
int[], byte[], long[] - new empty array

typed arrays

[1,2,...]b, [1,2,...]i, [1,2,...]l - native arrays, values separated by ,
last char:
b -> byte[] array
i -> int[] array
l -> long[] array Example:
/nbt buffer myByteArray = [1,2,3,10]b

json / mojangson

Create nbt object from string in mojangson format
Spaces in tag names are not allowed.
Types can be used: json, mojangson (default)
Example:
/nbt item = {display:{Name:"New item name"}}
/nbt item.display.Name# = {text: "New item name"} json
See http://minecraft.gamepedia.com/Tutorials/Command_NBT_Tags

Type

Available nbt types:
byte, short, int, long, float, double, byte[], int[], long[], string
Extra types available for json and strings:
json, mojangson

Future object

Future object - is object that you can specify later

Example, set fire ticks:
/nbt * Fire = 1000 - waiting for future object
=> select entity by right-click
and selected entity begins to burn

Example, set variable:
/nbt %var select - waiting for future object
=> select entity or block by right-click
and selected object is stored in variable %var


API

http://flinbein.github.io/PowerNBT/apidocs/

powernbt's People

Contributors

dpoh-var avatar jb-aero avatar jlleitschuh avatar mcdjuady avatar myxomopx avatar timbru31 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

Watchers

 avatar  avatar  avatar  avatar  avatar

powernbt's Issues

Update for 1.13.1

on start all it's ok but we try to modify a value (to hand/entity/blocks...) that give us a message error said the value don't change we can't edit.
so can you update ?
thanks

"Can't load ChunkUtils" on spigot 1.9

[16:18:48 INFO]: [PowerNBT] Enabling PowerNBT v0.8.5.1
[16:18:48 INFO]: [PowerNBT] me.dpohvar.powernbt.utils.EntityUtils@3eab97c2
[16:18:48 INFO]: [PowerNBT] me.dpohvar.powernbt.utils.ItemStackUtils@7af3eb54
[16:18:48 INFO]: [PowerNBT] me.dpohvar.powernbt.utils.NBTBlockUtils@93b3a32
[16:18:48 INFO]: [PowerNBT] me.dpohvar.powernbt.utils.NBTCompressedUtils@77cd1aef
[16:18:48 WARN]: [PowerNBT] Can't load ChunkUtils!
java.lang.RuntimeException: no such field
        at me.dpohvar.powernbt.utils.ReflectionUtils$RefClass.findField(ReflectionUtils.java:431) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.utils.ReflectionUtils$RefClass.findField(ReflectionUtils.java:401) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.utils.ChunkUtils.<init>(ChunkUtils.java:50) [PowerNBT.jar:?]
        at me.dpohvar.powernbt.utils.ChunkUtils.<clinit>(ChunkUtils.java:19) [PowerNBT.jar:?]
        at me.dpohvar.powernbt.PowerNBT.initializeUtils(PowerNBT.java:137) [PowerNBT.jar:?]
        at me.dpohvar.powernbt.PowerNBT.onEnable(PowerNBT.java:125) [PowerNBT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292) [server.jar:git-Spigot-095e59a-a12b1a4]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [server.jar:git-Spigot-095e59a-a12b1a4]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [server.jar:git-Spigot-095e59a-a12b1a4]
        at org.bukkit.craftbukkit.v1_9_R1.CraftServer.loadPlugin(CraftServer.java:361) [server.jar:git-Spigot-095e59a-a12b1a4]
        at org.bukkit.craftbukkit.v1_9_R1.CraftServer.enablePlugins(CraftServer.java:321) [server.jar:git-Spigot-095e59a-a12b1a4]
        at net.minecraft.server.v1_9_R1.MinecraftServer.t(MinecraftServer.java:411) [server.jar:git-Spigot-095e59a-a12b1a4]
        at net.minecraft.server.v1_9_R1.MinecraftServer.l(MinecraftServer.java:376) [server.jar:git-Spigot-095e59a-a12b1a4]
        at net.minecraft.server.v1_9_R1.MinecraftServer.a(MinecraftServer.java:331) [server.jar:git-Spigot-095e59a-a12b1a4]
        at net.minecraft.server.v1_9_R1.DedicatedServer.init(DedicatedServer.java:269) [server.jar:git-Spigot-095e59a-a12b1a4]
        at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:527) [server.jar:git-Spigot-095e59a-a12b1a4]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
[16:18:48 INFO]: [PowerNBT] me.dpohvar.powernbt.utils.ChunkUtils@47b541d2
[16:18:48 INFO]: [PowerNBT] me.dpohvar.powernbt.utils.NBTUtils_Bukkit_raw@1f3c2919
[16:18:48 INFO]: [PowerNBT] me.dpohvar.powernbt.utils.PacketUtils@1f3be580

This appears when i start spigot 1.9 server (and set in NBT-config debug:true).

Error by using NBTBlockUtils

I have a Cauldron server running on 1.7.10 but when I start the server there is already a error from PowerNBT which says:

java.lang.ExceptionInInitializerError - java.lang.RuntimeException: no such method: [suffix:load,types:[class net.minecraft.nbt.NBTTagCompound]] for class net.minecraft.tileentity.TileEntity

But after the error the plugins still works the commands are working, but after I want to instantiate a new NBTManager with the API in my own plugin the hole thing breaks and says:

java.lang.NoClassDefFoundError: Could not initialize class me.dpohvar.powernbt.utils.NBTBlockUtils

Can someone help me? Would love to create something with this plugin.

java.lang.NullPointerException on Load Plugin

Fails to load Plugin on Server with Purpur 1.18.1

org.bukkit.plugin.InvalidPluginException: java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map$Entry.getKey()" is null
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:157) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:414) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:322) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.loadPlugins(CraftServer.java:421) ~[purpur-1.18.jar:git-Purpur-1433]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:318) ~[purpur-1.18.jar:git-Purpur-1433]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1215) ~[purpur-1.18.jar:git-Purpur-1433]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[purpur-1.18.jar:git-Purpur-1433]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map$Entry.getKey()" is null
        at org.bukkit.configuration.file.YamlConfiguration.convertMapsToSections(YamlConfiguration.java:78) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.convertMapsToSections(YamlConfiguration.java:82) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.convertMapsToSections(YamlConfiguration.java:82) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.convertMapsToSections(YamlConfiguration.java:82) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:72) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:160) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:217) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.reloadConfig(JavaPlugin.java:165) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.getConfig(JavaPlugin.java:134) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at me.dpohvar.powernbt.PowerNBT.<init>(PowerNBT.java:42) ~[PowerNBT.jar:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
        at java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) ~[?:?]
        at jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347) ~[?:?]
        at java.lang.Class.newInstance(Class.java:645) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:83) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:153) ~[purpur-api-1.18-R0.1-SNAPSHOT.jar:?]
        ... 7 more

PLZ HELP!!!!

When I do /nbt display i "&8&lDeath&c&l*&8&lBringer" its disconnects me then when i go back on it continues to disconnect me HELP?!!!

1.14.3 compatibility?

Appears as though that this wonderful plugin has dropped support recently and I would really like to see it get updated for 1.14. I see someone has a github issue open #28 there for a 1.13.1 update but I figured I'd make a new one since it is a different minecraft version.
Error I get when attempting to launch the server with PowerNBT:

[21:39:52] [Server thread/ERROR]: Error occurred while enabling PowerNBT v0.8.9.2 (Is it up to date?)
java.lang.ExceptionInInitializerError: null
	at me.dpohvar.powernbt.PowerNBT.initializeUtils(PowerNBT.java:135) ~[?:?]
	at me.dpohvar.powernbt.PowerNBT.onEnable(PowerNBT.java:125) ~[?:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.14.3.jar:git-Paper-131]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:338) ~[patched_1.14.3.jar:git-Paper-131]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:420) ~[patched_1.14.3.jar:git-Paper-131]
	at org.bukkit.craftbukkit.v1_14_R1.CraftServer.enablePlugin(CraftServer.java:467) ~[patched_1.14.3.jar:git-Paper-131]
	at org.bukkit.craftbukkit.v1_14_R1.CraftServer.enablePlugins(CraftServer.java:381) ~[patched_1.14.3.jar:git-Paper-131]
	at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:464) ~[patched_1.14.3.jar:git-Paper-131]
	at net.minecraft.server.v1_14_R1.DedicatedServer.init(DedicatedServer.java:282) ~[patched_1.14.3.jar:git-Paper-131]
	at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:859) ~[patched_1.14.3.jar:git-Paper-131]
	at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.RuntimeException: no such method
	at me.dpohvar.powernbt.utils.ReflectionUtils$RefClass.findMethodByReturnType(ReflectionUtils.java:365) ~[?:?]
	at me.dpohvar.powernbt.utils.ReflectionUtils$RefClass.findMethodByReturnType(ReflectionUtils.java:330) ~[?:?]
	at me.dpohvar.powernbt.utils.NBTBlockUtils.<init>(NBTBlockUtils.java:26) ~[?:?]
	at me.dpohvar.powernbt.utils.NBTBlockUtils.<clinit>(NBTBlockUtils.java:20) ~[?:?]
	... 11 more
[21:39:52] [Server thread/INFO]: [PowerNBT] Disabling PowerNBT v0.8.9.2

Illegal YAML and command/permission

I'm not sure what's going on here.

plugin.yml

name: PowerNBT
description: Powerful nbt editor for bukkit
author: DPOH-VAR
main: me.dpohvar.powernbt.PowerNBT
website: https://github.com/flinbein/powernbt
version: 1.0.2
softdepend:
    - VarScript
commands:
    powernbt:
        description: use nbt commands
        usage: /nbt ... use [Tab] key for help
        permission: powernbt.use
        aliases:
            - pnbt
            - nbt
    powernbt.:
        description: use nbt commands (silent mode)
        usage: /nbt. ... use [Tab] key for help
        permission: powernbt.use
        aliases:
            - pnbt.
            - nbt.

[AntiMalware] [07:17:08] [SEVERE]: Failed to set config section Key: powernbt. Value: {description=use nbt commands (silent mode), usage=/nbt. ... use [Tab] key for help, permission=powernbt.use, aliases=[pnbt., nbt.]}

Also -- perhaps as a consequence -- LuckPerms does not tab-complete the permissions nodes. Are they registered?

Writing on blocks

Hello,
I'm trying to use the PowerNBT api. It is loaded as a plugin and added in maven as a dependency (which is correctly resolved). Maybe i'm misusing it ?
Is NBTManager#write(Block, NBTCompound) not properly working ?

NBTManager manager = plugin.getNBTManager(); NBTCompound compound = manager.read(container); compound.put("placedBy", uniqueId.toString()); manager.write(container, compound); Bukkit.broadcastMessage("1: " + compound.getString("placedBy")); Bukkit.broadcastMessage("2: " + manager.read(container).getString("placedBy"));

Output :
1:
2: nothing

[REQUEST] Saving NBT tags to files

Hello, I want to make a feature request. Can you add command that writes/reads a clipboard to/from file?

Здравствуйте. Хочу вам предложить функциональность для вашего плагина - сделать команды, которые читают/записывают NBT-файлы (в отдельной папке типа plugins/PowerNBT/files)

Unable to get NBTTagCompound from NBTTagList

This method looking wrong [NBTTagList.java:122]

    public NBTTagList getList(int i) {
        NBTBase t = get(i);
        if (t instanceof NBTTagList) return ((NBTTagList) t);
        return null;
    }

    public NBTTagList getCompound(int i) {
        NBTBase t = get(i);
        if (t instanceof NBTTagList) return ((NBTTagList) t);
        return null;
    }

Spigot 1.9: Can't Load Chunk Utils

Appears to be a problem with this line in ChunkUtils.java:
fChunkProvider = cWorldServer.findField(cChunkProviderServer);

[19:03:17 WARN]: [PowerNBT] Can't load ChunkUtils!
java.lang.RuntimeException: no such field
        at me.dpohvar.powernbt.utils.ReflectionUtils$RefClass.findField(ReflectionUtils.java:431) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.utils.ReflectionUtils$RefClass.findField(ReflectionUtils.java:401) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.utils.ChunkUtils.<init>(ChunkUtils.java:50) [PowerNBT.jar:?]
        at me.dpohvar.powernbt.utils.ChunkUtils.<clinit>(ChunkUtils.java:19) [PowerNBT.jar:?]
        at me.dpohvar.powernbt.PowerNBT.initializeUtils(PowerNBT.java:137) [PowerNBT.jar:?]
        at me.dpohvar.powernbt.PowerNBT.onEnable(PowerNBT.java:125) [PowerNBT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292) [server.jar:git-Spigot-1480adb-8b61cc5]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [server.jar:git-Spigot-1480adb-8b61cc5]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [server.jar:git-Spigot-1480adb-8b61cc5]
        at org.bukkit.craftbukkit.v1_9_R1.CraftServer.loadPlugin(CraftServer.java:361) [server.jar:git-Spigot-1480adb-8b61cc5]
        at org.bukkit.craftbukkit.v1_9_R1.CraftServer.enablePlugins(CraftServer.java:321) [server.jar:git-Spigot-1480adb-8b61cc5]
        at net.minecraft.server.v1_9_R1.MinecraftServer.t(MinecraftServer.java:411) [server.jar:git-Spigot-1480adb-8b61cc5]
        at net.minecraft.server.v1_9_R1.MinecraftServer.l(MinecraftServer.java:376) [server.jar:git-Spigot-1480adb-8b61cc5]
        at net.minecraft.server.v1_9_R1.MinecraftServer.a(MinecraftServer.java:331) [server.jar:git-Spigot-1480adb-8b61cc5]
        at net.minecraft.server.v1_9_R1.DedicatedServer.init(DedicatedServer.java:269) [server.jar:git-Spigot-1480adb-8b61cc5]
        at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:527) [server.jar:git-Spigot-1480adb-8b61cc5]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_74]

Tab autocomplete truncated !

Hi

Great job for your plugin. He save time for admin job on my server to edit Commands block, when it require a color text modification.

But now when i use command block and the string test is big, i use the text like this :
"/nbt Block command = [TAB]"

It made only 1 lign and trunc it with that " ..." (3 points).

Impossible to set the text !

Can you correct them ?

java.lang.ClassCastException when adding false

When you try to save a NBTCompound containing a boolean value of 'false' a java.lang.ClassCastException will be thrown. This only happens with false but not with true
He is the error:

[12:13:08 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'nbttest' in plugin NBTTest v1.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-d97e08b-880a532]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-d97e08b-880a532]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) ~[spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-d97e08b-880a532]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_45]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_45]
        at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:714) [spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:653) [spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:556) [spigot.jar:git-Spigot-d97e08b-880a532]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at me.dpohvar.powernbt.utils.ReflectionUtils$RefMethod$RefExecutor.call(ReflectionUtils.java:666) ~[?:?]
        at me.dpohvar.powernbt.utils.NBTUtils_Bukkit_raw.cloneTag(NBTUtils_Bukkit_raw.java:188) ~[?:?]
        at me.dpohvar.powernbt.api.NBTCompound.getHandleCopy(NBTCompound.java:108) ~[?:?]
        at me.dpohvar.powernbt.api.NBTManager.write(NBTManager.java:145) ~[?:?]
        at com.googlemail.mcdjuady.nbttest.NBTTest.onCommand(NBTTest.java:35) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-d97e08b-880a532]
        ... 15 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
        at me.dpohvar.powernbt.utils.ReflectionUtils$RefMethod$RefExecutor.call(ReflectionUtils.java:664) ~[?:?]
        at me.dpohvar.powernbt.utils.NBTUtils_Bukkit_raw.cloneTag(NBTUtils_Bukkit_raw.java:188) ~[?:?]
        at me.dpohvar.powernbt.api.NBTCompound.getHandleCopy(NBTCompound.java:108) ~[?:?]
        at me.dpohvar.powernbt.api.NBTManager.write(NBTManager.java:145) ~[?:?]
        at com.googlemail.mcdjuady.nbttest.NBTTest.onCommand(NBTTest.java:35) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-d97e08b-880a532]
        ... 15 more
Caused by: java.lang.ClassCastException: java.lang.Byte cannot be cast to net.minecraft.server.v1_8_R3.NBTBase
        at net.minecraft.server.v1_8_R3.NBTTagCompound.clone(SourceFile:364) ~[spigot.jar:git-Spigot-d97e08b-880a532]
        at net.minecraft.server.v1_8_R3.NBTTagCompound.clone(SourceFile:364) ~[spigot.jar:git-Spigot-d97e08b-880a532]
        at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_45]
        at me.dpohvar.powernbt.utils.ReflectionUtils$RefMethod$RefExecutor.call(ReflectionUtils.java:664) ~[?:?]
        at me.dpohvar.powernbt.utils.NBTUtils_Bukkit_raw.cloneTag(NBTUtils_Bukkit_raw.java:188) ~[?:?]
        at me.dpohvar.powernbt.api.NBTCompound.getHandleCopy(NBTCompound.java:108) ~[?:?]
        at me.dpohvar.powernbt.api.NBTManager.write(NBTManager.java:145) ~[?:?]
        at com.googlemail.mcdjuady.nbttest.NBTTest.onCommand(NBTTest.java:35) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-d97e08b-880a532]
        ... 15 more

This error is reproducable so i wrote a small plugin to test it: https://github.com/McDjuady/NBTTest
Simply execute /nbttest while holding an item in hand

Can't use /nbt me key = value

I can't use /nbt me hi = true for exemple.
I only can do /nbt item hi = true.
Why can't I write on a nbt player file?

I tested this on 2 plugins version and 2 bukkit versions. (with Spigot and without.)

How i get and change an Object Integer located in ForgeData.PlayerPersisted ?

Hello. I'm learning to use the Api of PowerNBT, and i have a issue. I'm using Dragon Block C, and i want to make a plugin to get the body of the player. But i'm with a lot of errors
`public class CommandTest implements CommandExecutor{

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	Player p = (Player)sender;
	if(cmd.getName().equalsIgnoreCase("getBody")) {
		if(p.hasPermission("admin.getbody")) {
			if(args.length >= 1 ) {
				Player t = Bukkit.getPlayer(args[0]);
				GetBody(t, sender);
				return true;
			}
		}
	}
	return false;
}

public void GetBody(Player t, CommandSender sender) {
	NBTManager manager = PowerNBT.getApi();
	NBTCompound playerData = manager.read(t);
	int Body = (int) playerData.get("ForgeData.PlayerPersisted.jrmcBodyI");
	sender.sendMessage("§eHello! The player §f" + t.getName() + " §ehas §5" + Body + " §eOf Body");
}`

image

And the line with errors, is this:
int Body = (int) playerData.get("ForgeData.PlayerPersisted.jrmcBodyI");

[14:35:09] [Server thread/INFO]: RafaelLocoDeCafe issued server command: /getbody RafaelLocoDeCafe [14:35:09] [Server thread/ERROR]: null org.bukkit.command.CommandException: Unhandled exception executing command 'getbody' in plugin jrmca2 v1.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[PluginCommand.class:1.7.10-R0.1-SNAPSHOT] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[SimpleCommandMap.class:1.7.10-R0.1-SNAPSHOT] at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:717) ~[CraftServer.class:1.7.10-R0.1-SNAPSHOT] at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:1317) [nh.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:1099) [nh.class:?] at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(C01PacketChatMessage.java:38) [ir.class:?] at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(C01PacketChatMessage.java:53) [ir.class:?] at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:245) [ej.class:?] at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:173) [nc.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:991) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431) [lt.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:809) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] Caused by: java.lang.NullPointerException at com.Rafaelzin.Jrmca2.CommandTest.GetBody(CommandTest.java:33) ~[?:?] at com.Rafaelzin.Jrmca2.CommandTest.onCommand(CommandTest.java:22) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[PluginCommand.class:1.7.10-R0.1-SNAPSHOT] ... 13 more

If anyone can give me a quick help there, I need the work for this week. Thank you!

Protocol error, unexpected packet

I trying to make plugin that allows users to place their own mob spawners.
Player tries to place spawner in the world, after plugin will detect needed spawner's configuration, spawn needed entity, tune it, place NBT container from entity to spawner, delete entity, tune spawner properties and that is all, spawner is ready. All works fine on localhost, but on remote server when I try to place spawner I lost connection with reason "Protocol error, unexpected packet".

Server: Bukkit 1.6.4-R2.0 Build #2918
Plugins: PowerNBT 0.7.3.1, My Own Plugin

It also tested on MCPC+ 1.6.4 and 1.5.2

P.S. Sorry for my bad english.

[PowerNBT] PowerNBT v2.0-ALPHA-RC01 problems

Basic commands no longer work:

/nbt Item.display view

"Not enough arguments"

Basically, any command comes back with "Not enough arguments", as a result no nbt can be viewed or modified. All current documentation as for how commands work is no help whatsoever. I have seen that it is possible - with a single command - to completely wipe out the entirety of my inventory and send myself to spawn, but this is never a desireable outcome. Will be reverting to previous release version, will either need updated documentation or a fix for how commands used to function.

Thanks much!

Power nbt wont work for 1.7.10 plz help

Power nbt wont work for 1.7.10 plz help Sorry to bother you?!?!?!?! :) Hope everybody has a great/amazing nite/day?!?!!?!?!? :) Hope everybody has a great/amazing rest of there nite/day!?!?!?!? :)

NPE in me.dpohvar.powernbt.utils.ReflectionUtils

Quick bug report on an NPE

[20:32:42 WARN]: copy item meta
java.lang.RuntimeException: java.lang.NullPointerException
        at me.dpohvar.powernbt.utils.ReflectionUtils$RefField$RefExecutor.get(ReflectionUtils.java:802) ~[?:?]
        at me.dpohvar.powernbt.utils.ItemStackUtils.getTag(ItemStackUtils.java:86) ~[?:?]
        at me.dpohvar.powernbt.utils.ItemStackUtils.getTagCB(ItemStackUtils.java:194) ~[?:?]
        at me.dpohvar.powernbt.utils.ItemStackUtils.getTagOrigin(ItemStackUtils.java:217) ~[?:?]
        at me.dpohvar.powernbt.utils.ItemStackUtils.getTag(ItemStackUtils.java:142) ~[?:?]
        at me.dpohvar.powernbt.api.NBTManager.read(NBTManager.java:107) ~[?:?]
        at me.egg82.tcpp.lib.ninja.egg82.nbt.core.PowerNBTCompound.readCompound(PowerNBTCompound.java:300) ~[?:?]
        at me.egg82.tcpp.lib.ninja.egg82.nbt.core.PowerNBTCompound.hasTag(PowerNBTCompound.java:52) ~[?:?]
        at me.egg82.tcpp.events.inventory.inventoryClick.AttachEventCommand.onExecute(AttachEventCommand.java:119) ~[?:?]
        at me.egg82.tcpp.lib.ninja.egg82.patterns.SynchronousCommand.start(SynchronousCommand.java:40) ~[?:?]
        at me.egg82.tcpp.lib.ninja.egg82.plugin.reflection.event.AbstractEventListener.onAnyEvent(AbstractEventListener.java:154) ~[?:?]
        at me.egg82.tcpp.lib.ninja.egg82.plugin.reflection.event.EventListener_1_12.onInventoryClick(EventListener_1_12.java:340) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor231.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:70) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:515) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:500) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1981) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at net.minecraft.server.v1_12_R1.PacketPlayInWindowClick.a(SourceFile:33) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at net.minecraft.server.v1_12_R1.PacketPlayInWindowClick.a(SourceFile:10) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at net.minecraft.server.v1_12_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14) ~[paperclip-1.12.2.jar:git-Paper-1345]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_161]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_161]
        at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [paperclip-1.12.2.jar:git-Paper-1345]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:843) [paperclip-1.12.2.jar:git-Paper-1345]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:426) [paperclip-1.12.2.jar:git-Paper-1345]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:767) [paperclip-1.12.2.jar:git-Paper-1345]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:665) [paperclip-1.12.2.jar:git-Paper-1345]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
Caused by: java.lang.NullPointerException

Server version: Paper 1.12.2

NullPointerException in utils.ReflectionUtils "public T get()" (Line 800)

A stack-trace was given to me by the user "Hexanite" regarding one of my plugins that relies on PowerNBT.

The hastebin is available here or the full stack-trace below.
I have found the class and line number here.
My implementation that lead to this error (including specific line number) is available here.

10.07 15:41:29 [Server] ERROR Could not pass event InventoryClickEvent to TrollCommandsPlusPlus v4.17.36 10.07 15:41:29 [Server] INFO org.bukkit.event.EventException: null 10.07 15:41:29 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:499) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1877) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInWindowClick.a(SourceFile:33) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInWindowClick.a(SourceFile:10) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_121] 10.07 15:41:29 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_121] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:747) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:405) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121] 10.07 15:41:29 [Server] INFO Caused by: java.lang.RuntimeException: java.lang.NullPointerException 10.07 15:41:29 [Server] INFO at me.dpohvar.powernbt.utils.ReflectionUtils$RefField$RefExecutor.get(ReflectionUtils.java:800) ~[PowerNBT.jar:?] 10.07 15:41:29 [Server] INFO at me.dpohvar.powernbt.utils.ItemStackUtils.getTag(ItemStackUtils.java:86) ~[PowerNBT.jar:?] 10.07 15:41:29 [Server] INFO at me.dpohvar.powernbt.utils.ItemStackUtils.getTagCB(ItemStackUtils.java:186) ~[PowerNBT.jar:?] 10.07 15:41:29 [Server] INFO at me.dpohvar.powernbt.utils.ItemStackUtils.getTag(ItemStackUtils.java:139) ~[PowerNBT.jar:?] 10.07 15:41:29 [Server] INFO at me.dpohvar.powernbt.api.NBTManager.read(NBTManager.java:108) ~[PowerNBT.jar:?] 10.07 15:41:29 [Server] INFO at me.egg82.tcpp.lib.ninja.egg82.plugin.reflection.nbt.PowerNBTHelper.hasTag(PowerNBTHelper.java:121) ~[TrollCommandsPlusPlus-4.17.36.jar:?] 10.07 15:41:29 [Server] INFO at me.egg82.tcpp.events.inventory.inventoryClick.AttachCommandEventCommand.onExecute(AttachCommandEventCommand.java:121) ~[TrollCommandsPlusPlus-4.17.36.jar:?] 10.07 15:41:29 [Server] INFO at me.egg82.tcpp.lib.ninja.egg82.patterns.SynchronousCommand.start(SynchronousCommand.java:37) ~[TrollCommandsPlusPlus-4.17.36.jar:?] 10.07 15:41:29 [Server] INFO at me.egg82.tcpp.events.InventoryClickEventCommand.lambda$0(InventoryClickEventCommand.java:37) ~[TrollCommandsPlusPlus-4.17.36.jar:?] 10.07 15:41:29 [Server] INFO at java.util.ArrayList.forEach(ArrayList.java:1249) ~[?:1.8.0_121] 10.07 15:41:29 [Server] INFO at me.egg82.tcpp.events.InventoryClickEventCommand.onExecute(InventoryClickEventCommand.java:35) ~[TrollCommandsPlusPlus-4.17.36.jar:?] 10.07 15:41:29 [Server] INFO at me.egg82.tcpp.lib.ninja.egg82.patterns.SynchronousCommand.start(SynchronousCommand.java:37) ~[TrollCommandsPlusPlus-4.17.36.jar:?] 10.07 15:41:29 [Server] INFO at me.egg82.tcpp.lib.ninja.egg82.plugin.reflection.event.EventListener_1_11_2.onAnyEvent(EventListener_1_11_2.java:785) ~[TrollCommandsPlusPlus-4.17.36.jar:?] 10.07 15:41:29 [Server] INFO at me.egg82.tcpp.lib.ninja.egg82.plugin.reflection.event.EventListener_1_11_2.onInventoryClick(EventListener_1_11_2.java:374) ~[TrollCommandsPlusPlus-4.17.36.jar:?] 10.07 15:41:29 [Server] INFO at sun.reflect.GeneratedMethodAccessor673.invoke(Unknown Source) ~[?:?] 10.07 15:41:29 [Server] INFO at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121] 10.07 15:41:29 [Server] INFO at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121] 10.07 15:41:29 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.12.jar:git-Spigot-7228328-50b75cd] 10.07 15:41:29 [Server] INFO ... 15 more 10.07 15:41:29 [Server] INFO Caused by: java.lang.NullPointerException

I would initially assume I simply passed a null value as an ItemStack, but as you can see in my code I check for that beforehand; this tells me something else is going on entirely.

I see two possible solutions:

  1. public T get() returns null on an exception and the containing code handles the null appropriately.
  2. The containing code handles the exception thrown appropriately and simply returns null.

I personally am a fan of option 1 as it results in fewer sandboxes and thus more performance. It also fires a null object sooner resulting in less cluttered code. However there may be other alternatives that I'm not seeing.

Cannot use hand (or most other commands) on 1.18.2

Upon using command /nbt h, after a /nbt debug call, I see the following in my server's console:

[00:57:55 WARN]: [PowerNBT] Exception on command: nbt
java.lang.NoClassDefFoundError: Could not initialize class me.dpohvar.powernbt.api.NBTManager
        at me.dpohvar.powernbt.nbt.NBTContainerEntity.readTag(NBTContainerEntity.java:40) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.nbt.NBTContainerEntity.readTag(NBTContainerEntity.java:15) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.nbt.NBTContainer.getCustomTag(NBTContainer.java:124) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.action.Argument.getContainer(Argument.java:377) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.action.Argument.<init>(Argument.java:79) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.action.ActionView.<init>(ActionView.java:15) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.action.ActionView.<init>(ActionView.java:19) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.CommandNBT.command(CommandNBT.java:71) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.Command.onCommand(Command.java:30) ~[PowerNBT.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:906) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2306) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2117) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2098) ~[?:?]
        at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[?:?]
        at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[?:?]
        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1399) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1376) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1369) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1347) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1229) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-351]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

Upon using /nbt block and targeting a mob spawner, I get the following error:

[00:59:06 WARN]: [PowerNBT] Exception on command: nbt
java.lang.NoClassDefFoundError: Could not initialize class me.dpohvar.powernbt.api.NBTManager
        at me.dpohvar.powernbt.nbt.NBTContainerBlock.readTag(NBTContainerBlock.java:51) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.nbt.NBTContainerBlock.readTag(NBTContainerBlock.java:17) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.nbt.NBTContainer.getCustomTag(NBTContainer.java:124) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.nbt.NBTContainer.getCustomTag(NBTContainer.java:138) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.utils.Caller.sendValueView(Caller.java:93) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.action.ActionView.execute(ActionView.java:56) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.CommandNBT.command(CommandNBT.java:72) ~[PowerNBT.jar:?]
        at me.dpohvar.powernbt.command.Command.onCommand(Command.java:30) ~[PowerNBT.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:906) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2306) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2117) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2098) ~[?:?]
        at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[?:?]
        at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[?:?]
        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1399) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1376) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1369) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1347) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1229) ~[paper-1.18.2.jar:git-Paper-351]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-351]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

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.