Update NBTData.kt

This commit is contained in:
bluefireoly
2020-09-25 16:02:27 +02:00
parent c7b2023539
commit 3059671d66

View File

@@ -1,3 +1,5 @@
@file:Suppress("MemberVisibilityCanBePrivate")
package net.axay.kspigot.data package net.axay.kspigot.data
import net.axay.kspigot.annotations.NMS_General import net.axay.kspigot.annotations.NMS_General
@@ -47,6 +49,16 @@ class NBTData {
dataType.writeToCompound(key, value, nbtTagCompound) dataType.writeToCompound(key, value, nbtTagCompound)
} }
/**
* This method removes the
* given [key] from the NBTTagCompound.
* Its value will be lost.
*/
fun remove(key: String) = nbtTagCompound.remove(key)
/** @see remove */
operator fun minusAssign(key: String) = remove(key)
companion object { companion object {
fun deserialize(nbtString: String) = NBTData(nbtString) fun deserialize(nbtString: String) = NBTData(nbtString)