此页面最后更新于 3.1.0 b475
添加jitpack
库
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
添加LM依赖
<dependency>
<groupId>com.github.lokka30</groupId>
<artifactId>LevelledMobs</artifactId>
<version>REPLACE ME</version>
</dependency>
替换REPLACE ME
至LM版本号,不包含构建版本。例:3.1.0
我们提供了 LevelInterface 类,使你可以直接于LM交互
我们提供了一些可供监听和编辑的事件
你可以阻止实体获取等级或在他们获取等级之后进行某些操作等。
你可以查看我们的javadocs
这是我们代码的docs,我们还在努力修改
如果你希望在你的插件之中调用LM的自定义掉落,可以使用我们的API 以下是示例:
private void testCustomDrops(){
ItemStack itemStack = new ItemStack(Material.NETHERITE_SWORD);
ItemMeta meta = itemStack.getItemMeta();
assert meta != null;
meta.setDisplayName("Cool Netherite Sword");
meta.setLore(List.of("Created via API"));
itemStack.setItemMeta(meta);
// https://arcaneplugins.github.io/LevelledMobs/3.9.3/me/lokka30/levelledmobs/LevelledMobs.html
LevelledMobs lm = LevelledMobs.getInstance();
// https://arcaneplugins.github.io/LevelledMobs/3.9.3/me/lokka30/levelledmobs/customdrops/CustomDropItem.html
CustomDropItem customDropItem = new CustomDropItem(lm); // must pass instance to LevelledMobs main class
customDropItem.setItemStack(itemStack);
// these options correspond to many of the item specific options shown here:
// https://github.com/ArcanePlugins/LevelledMobs/wiki/Documentation---customdrops.yml
customDropItem.chance = 1.0F;
customDropItem.equippedSpawnChance = 1.0F;
// https://arcaneplugins.github.io/LevelledMobs/3.9.3/me/lokka30/levelledmobs/customdrops/CustomDropInstance.html
final CustomDropInstance customDropInstance = new CustomDropInstance(EntityType.ZOMBIE);
customDropInstance.customItems.add(customDropItem);
// mob specific options can be set on customDropInstance
lm.customDropsHandler.externalCustomDrops.addCustomDrop(customDropInstance);
// the drop is now registered just as if it were in customdrops.yml
main.getLogger().info("Added a new drop for zombie");
}
如果你在你的插件之用调用LM出现任何问题,可以联系我们寻求帮助!:)