修复了部分领地tp点报错未捕获异常问题

This commit is contained in:
zhangyuheng 2024-08-24 19:15:07 +08:00
parent 150939dc45
commit ba495d9bd7
2 changed files with 9 additions and 1 deletions

View File

@ -4,7 +4,7 @@ plugins {
}
group = "cn.lunadeer"
version = "2.2.2-beta"
version = "2.2.3-beta"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))

View File

@ -392,6 +392,10 @@ public class DominionOperate {
int x = (dominionDTO.getX1() + dominionDTO.getX2()) / 2;
int z = (dominionDTO.getZ1() + dominionDTO.getZ2()) / 2;
World world = Dominion.instance.getServer().getWorld(dominionDTO.getWorld());
if (world == null) {
Notification.error(sender, "领地所在世界 %s 不存在", dominionDTO.getWorld());
return;
}
location = new Location(world, x, player.getLocation().getY(), z);
XLogger.warn("领地 %s 没有设置传送点,将尝试传送到中心点", dominionDTO.getName());
}
@ -460,6 +464,10 @@ public class DominionOperate {
int center_x = (dominionDTO.getX1() + dominionDTO.getX2()) / 2;
int center_z = (dominionDTO.getZ1() + dominionDTO.getZ2()) / 2;
World world = Dominion.instance.getServer().getWorld(dominionDTO.getWorld());
if (world == null) {
Notification.error(player, "领地所在世界 %s 不存在", dominionDTO.getWorld());
return;
}
if (location == null) {
location = new Location(world, center_x, player.getLocation().getY(), center_z);
Notification.warn(player, "领地 %s 没有设置传送点,将尝试传送到中心点", dominionDTO.getName());