Added player key tracking option
This commit is contained in:
@@ -8,6 +8,7 @@ import com.willfp.ecocrates.crate.Crates
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
import org.bukkit.util.StringUtil
|
||||
|
||||
class CommandGive(plugin: EcoPlugin) : Subcommand(
|
||||
@@ -48,6 +49,18 @@ class CommandGive(plugin: EcoPlugin) : Subcommand(
|
||||
if (physical) {
|
||||
val items = mutableListOf<ItemStack>().apply { repeat(amount) { add(crate.key.item) } }
|
||||
|
||||
if (plugin.configYml.getBool("track-player-keys")) {
|
||||
items.map {
|
||||
val meta = it.itemMeta!!
|
||||
meta.persistentDataContainer.set(
|
||||
plugin.namespacedKeyFactory.create("player"),
|
||||
PersistentDataType.STRING,
|
||||
player.uniqueId.toString()
|
||||
)
|
||||
it.itemMeta = meta
|
||||
}
|
||||
}
|
||||
|
||||
DropQueue(player)
|
||||
.addItems(items)
|
||||
.forceTelekinesis()
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#
|
||||
|
||||
no-key-velocity: 1.5 # The speed at which a player should be launched away from a crate if they try to open it without a key. Set to 0 to disable.
|
||||
track-player-keys: false # If an NBT tag should be added to keys that links them to a player - will prevent stacking some keys.
|
||||
|
||||
# If a reward allows permission multipliers, the weights
|
||||
# will be multiplied by highest-priority multiplier that a player
|
||||
|
||||
Reference in New Issue
Block a user