Include WoodCutting producer patch source
All checks were successful
DuneRealms Plugin CI / plugins (push) Successful in 9m2s
All checks were successful
DuneRealms Plugin CI / plugins (push) Successful in 9m2s
This commit is contained in:
parent
f9484ff164
commit
2e339864b9
1 changed files with 23 additions and 0 deletions
23
vendor/woodcutting/WoodCuttingFeature.java
vendored
Normal file
23
vendor/woodcutting/WoodCuttingFeature.java
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue

Staff