SpawnOnSleepListener.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:BloodMoon 作者:
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
    World world = event.getPlayer().getWorld();

    if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.SPAWN_ON_SLEEP)) {
        PluginConfig worldConfig = plugin.getConfig(world);
        String mobName = ListUtils.getRandom(worldConfig.getStringList(Config.FEATURE_SPAWN_ON_SLEEP_SPAWN));
        EntityType creatureType = EntityType.fromName(mobName.toUpperCase());

        if (creatureType != null) {
            //world.spawn(location, creatureType.getEntityClass(), SpawnReason.NATURAL);
            world.spawnEntity(event.getPlayer().getLocation(), creatureType);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号