diff --git a/pom.xml b/pom.xml
index 427e4be..d3d3350 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
cn.wode490390.nukkit
vipop
jar
- 1.0.2
+ 1.0.2-IGN.1
Classic Village Populator
This is a plugin that implements the old village feature for Nukkit servers
http://wode490390.cn/
diff --git a/src/main/java/cn/wode490390/nukkit/vipop/loot/RandomizableContainer.java b/src/main/java/cn/wode490390/nukkit/vipop/loot/RandomizableContainer.java
index 288bc17..ac46a7f 100644
--- a/src/main/java/cn/wode490390/nukkit/vipop/loot/RandomizableContainer.java
+++ b/src/main/java/cn/wode490390/nukkit/vipop/loot/RandomizableContainer.java
@@ -1,6 +1,7 @@
package cn.wode490390.nukkit.vipop.loot;
import cn.nukkit.item.Item;
+import cn.nukkit.item.enchantment.Enchantment;
import cn.nukkit.math.NukkitRandom;
import cn.nukkit.nbt.NBTIO;
import cn.nukkit.nbt.tag.CompoundTag;
@@ -10,6 +11,7 @@
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
public class RandomizableContainer {
@@ -32,7 +34,11 @@ public void create(ListTag list, NukkitRandom random) {
result -= entry.getWeight();
if (result < 0) {
int index = random.nextBoundedInt(tags.length);
- tags[index] = NBTIO.putItemHelper(Item.get(entry.getId(), entry.getMeta(), random.nextRange(entry.getMinCount(), entry.getMaxCount())), index);
+ Item item = Item.get(entry.getId(), entry.getMeta(), random.nextRange(entry.getMinCount(), entry.getMaxCount()));
+ if (item.getId() == Item.ENCHANT_BOOK) {
+ item.addEnchantment(Enchantment.getEnchantment(ThreadLocalRandom.current().nextInt(37)));
+ }
+ tags[index] = NBTIO.putItemHelper(item, index);
break;
}
}