Skip to content

Commit

Permalink
修复坐标不写小数报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lt-name committed Nov 21, 2023
1 parent 93d5c61 commit f988289
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/com/smallaswater/npc/data/RsNpcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,17 @@ public RsNpcConfig(@NonNull String name, @NonNull Config config) throws RsNpcCon
throw new RsNpcLoadException("世界:" + this.levelName + " 不存在!无法加载当前世界的NPC");
}
Level level = Server.getInstance().getLevelByName(this.levelName);
this.location = new Location((double) map.get("x"), (double) map.get("y"), (double) map.get("z"),
(double) map.getOrDefault("yaw", 0D), 0, level);
if (level == null) {
throw new RsNpcLoadException("世界:" + this.levelName + " 不存在!无法加载当前世界的NPC");
}
this.location = new Location(
Utils.toDouble(map.get("x")),
Utils.toDouble(map.get("y")),
Utils.toDouble(map.get("z")),
Utils.toDouble(map.getOrDefault("yaw", 0D)),
0,
level
);
} catch (Exception e) {
throw new RsNpcConfigLoadException("NPC配置 位置/世界配置错误!请检查配置文件!", e);
}
Expand Down

0 comments on commit f988289

Please sign in to comment.