23 lines
872 B
Java
23 lines
872 B
Java
package io.gitlab.jumperdenfer.features;
|
|
|
|
import org.bukkit.Location;
|
|
import org.bukkit.NamespacedKey;
|
|
import org.bukkit.World;
|
|
import org.bukkit.entity.Item;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.persistence.PersistentDataType;
|
|
|
|
class WoodCuttingFeature {
|
|
private static Item dropProducedPlanks(World world, Location position, ItemStack planks) {
|
|
var meta = planks.getItemMeta();
|
|
if (meta != null) {
|
|
var data = meta.getPersistentDataContainer();
|
|
var origin = new NamespacedKey("dunerealms", "origin_world");
|
|
if (!data.has(origin) && !data.has(new NamespacedKey("dunerealms", "preview_only"))) {
|
|
data.set(origin, PersistentDataType.STRING, world.getName());
|
|
planks.setItemMeta(meta);
|
|
}
|
|
}
|
|
return world.dropItem(position, planks);
|
|
}
|
|
}
|

Staff