public class NBTManager extends Object
NBTCompound
is used to work with NBTTagCompound,NBTList
is used to work with NBTTagList,String
is used to work with NBTTagString,Modifier and Type | Field and Description |
---|---|
static NBTManager |
nbtManager |
Modifier and Type | Method and Description |
---|---|
org.bukkit.inventory.ItemStack |
asCraftItemStack(org.bukkit.inventory.ItemStack itemStack)
Convert bukkit ItemStack to CraftItemStack.
|
org.bukkit.inventory.ItemStack |
createCraftItemStack(NBTCompound compound)
Create CraftItemStack from nbt value
|
static NBTManager |
getInstance()
Get single instance of
NBTManager . |
File |
getPlayerFile(org.bukkit.OfflinePlayer player)
Get
OfflinePlayer file with stored nbt data. |
Object |
parseMojangson(String value)
Parse mojangson string.
|
NBTCompound |
read(org.bukkit.block.Block block)
Read nbt data of tile entity at block.
|
NBTCompound |
read(org.bukkit.Chunk chunk)
Read nbt tag of
Chunk . |
Object |
read(DataInput dataInput)
Read nbt data from dataInput and convert to java object.
|
NBTCompound |
read(org.bukkit.entity.Entity entity)
Read NBT tag of bukkit entity.
|
Object |
read(File file)
Read raw nbt data from file and convert to java object.
|
Object |
read(InputStream inputStream)
Read raw NBT data from input stream and convert to java object.
|
NBTList |
read(org.bukkit.inventory.Inventory inventory)
Read items as nbt values from inventory
|
NBTCompound |
read(org.bukkit.inventory.ItemStack item)
Read nbt tag of
ItemStack . |
NBTCompound |
readCompressed(File file)
Read compressed nbt data from file and convert to java object.
|
NBTCompound |
readCompressed(InputStream inputStream)
Read compressed nbt compound.
|
NBTCompound |
readForgeData(org.bukkit.entity.Entity entity)
Read extra nbt data of entity.
|
NBTCompound |
readOfflinePlayer(org.bukkit.OfflinePlayer player)
Read offline player's .dat file.
|
NBTCompound |
readOfflinePlayer(String player)
Read offline player's .dat file.
|
org.bukkit.entity.Entity |
spawnEntity(NBTCompound compound,
org.bukkit.World world)
Spawn entity in world by nbt compound.
|
void |
write(org.bukkit.block.Block block,
NBTCompound compound)
Save nbt data to tile entity at block.
|
void |
write(org.bukkit.Chunk chunk,
NBTCompound compound)
Store nbt tag to selected chunk.
|
void |
write(DataOutput dataOutput,
Object value)
Convert value to nbt and write to dataOutput.
|
void |
write(org.bukkit.entity.Entity entity,
NBTCompound compound)
Store nbt data to entity.
|
void |
write(File file,
Object value)
Write to file value converted to nbt tag.
|
void |
write(org.bukkit.inventory.Inventory inventory,
NBTList value)
Store items from nbt data to inventory
|
void |
write(org.bukkit.inventory.ItemStack item,
NBTCompound compound)
Save nbt tag to item stack.
|
void |
write(OutputStream outputStream,
Object value)
Convert java object to nbt and write to outputStream.
|
void |
writeCompressed(File file,
NBTCompound value)
Convert value to nbt and write to file with compression.
|
void |
writeCompressed(OutputStream outputStream,
NBTCompound value)
Compress nbt compound and write to outputStream.
|
void |
writeForgeData(org.bukkit.entity.Entity entity,
NBTCompound compound)
Store extra nbt data to entity.
|
boolean |
writeOfflinePlayer(org.bukkit.OfflinePlayer player,
NBTCompound value)
Write nbt data to player's .dat file.
|
boolean |
writeOfflinePlayer(String player,
NBTCompound value)
Write nbt data to player's .dat file.
|
public static final NBTManager nbtManager
public static NBTManager getInstance()
NBTManager
.public NBTCompound read(org.bukkit.entity.Entity entity)
entity
- Entity to readpublic void write(org.bukkit.entity.Entity entity, NBTCompound compound)
entity
- Entity to modifycompound
- Nbt data to be storedpublic NBTCompound readForgeData(org.bukkit.entity.Entity entity)
entity
- Entity to readpublic void writeForgeData(org.bukkit.entity.Entity entity, NBTCompound compound)
entity
- entitycompound
- extra nbt datapublic NBTCompound read(org.bukkit.inventory.ItemStack item)
ItemStack
.item
- Bukkit ItemStack
public NBTCompound read(org.bukkit.Chunk chunk)
Chunk
.chunk
- Bukkit chunkpublic void write(org.bukkit.Chunk chunk, NBTCompound compound)
chunk
- Chunk to be changedcompound
- Nbt datapublic void write(org.bukkit.inventory.ItemStack item, NBTCompound compound)
ItemMeta
.item
- bukkit item stackcompound
- tagpublic NBTCompound read(org.bukkit.block.Block block)
block
- Block with tile entitypublic void write(org.bukkit.block.Block block, NBTCompound compound)
block
- Block with tile entitycompound
- Tag to be savedpublic Object read(InputStream inputStream) throws IOException
inputStream
- InputStream to readIOException
- it happens sometimespublic void write(OutputStream outputStream, Object value) throws IOException
outputStream
- outputStream to writevalue
- value to be writtenIOException
- it happens sometimespublic NBTCompound readCompressed(InputStream inputStream)
inputStream
- InputStream to readpublic void writeCompressed(OutputStream outputStream, NBTCompound value)
outputStream
- outputStream to writevalue
- valuepublic Object read(DataInput dataInput) throws IOException
dataInput
- dataInput to readIOException
- it happenspublic void write(DataOutput dataOutput, Object value) throws IOException
dataOutput
- dataOutput to savevalue
- value to be writtenIOException
- it happens sometimespublic Object read(File file) throws IOException
file
- file to readIOException
- it happenspublic void write(File file, Object value) throws IOException
file
- file to writevalue
- value to be writtenIOException
- it happenspublic NBTList read(org.bukkit.inventory.Inventory inventory)
inventory
- an inventorypublic void write(org.bukkit.inventory.Inventory inventory, NBTList value)
inventory
- an inventory to changevalue
- nbt array with itemspublic NBTCompound readCompressed(File file) throws FileNotFoundException
file
- file to readFileNotFoundException
- if file not foundpublic void writeCompressed(File file, NBTCompound value) throws FileNotFoundException
file
- file to writevalue
- value to be writtenFileNotFoundException
- check your filepublic NBTCompound readOfflinePlayer(org.bukkit.OfflinePlayer player)
player
- player to readpublic NBTCompound readOfflinePlayer(String player)
player
- player namepublic boolean writeOfflinePlayer(org.bukkit.OfflinePlayer player, NBTCompound value)
player
- offline playervalue
- value to be writtenpublic boolean writeOfflinePlayer(String player, NBTCompound value)
player
- player namevalue
- value to be writtenpublic File getPlayerFile(org.bukkit.OfflinePlayer player)
OfflinePlayer
file with stored nbt data.player
- offline playerpublic Object parseMojangson(String value)
NBTList
or NBTCompound
manager.parseMojangson("12s\\"); // 12 short manager.parseMojangson("{foo:bar}"); // NBTCompound
value
- String in Mojangson formatpublic org.bukkit.entity.Entity spawnEntity(NBTCompound compound, org.bukkit.World world)
compound
- Entity dataworld
- World where to spawn entitypublic org.bukkit.inventory.ItemStack asCraftItemStack(org.bukkit.inventory.ItemStack itemStack)
itemStack
- Bukkit ItemStackpublic org.bukkit.inventory.ItemStack createCraftItemStack(NBTCompound compound)
compound
- nbt data of item: Slot, Count, Damage, id, tagCopyright © 2017. All rights reserved.