修复有些情况下玩家无法从res迁移领地的问题

This commit is contained in:
zhangyuheng 2024-08-04 22:50:12 +08:00
parent 0ad56e3c0b
commit 96c07e3067
2 changed files with 2 additions and 10 deletions

View File

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

View File

@ -1,14 +1,12 @@
package cn.lunadeer.dominion.utils;
import cn.lunadeer.dominion.Dominion;
import cn.lunadeer.dominion.dtos.PlayerDTO;
import cn.lunadeer.dominion.utils.Residence.Message;
import cn.lunadeer.dominion.utils.Residence.Permission;
import cn.lunadeer.dominion.utils.Residence.Residence;
import cn.lunadeer.dominion.utils.Residence.SaveFile;
import cn.lunadeer.minecraftpluginutils.XLogger;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.plugin.java.JavaPlugin;
import org.yaml.snakeyaml.Yaml;
@ -58,19 +56,13 @@ public class ResMigration {
}
private static ResidenceNode parseDominion(String name, World world, Residence res, SaveFile save) {
OfflinePlayer bukkitOwner = Dominion.instance.getServer().getOfflinePlayer(UUID.fromString(res.Permissions.OwnerUUID));
PlayerDTO owner = PlayerDTO.get(bukkitOwner);
if (owner == null) {
XLogger.warn("Owner not found: " + res.Permissions.OwnerUUID);
return null;
}
String[] loc = res.Areas.values().toArray()[0].toString().split(":");
if (loc.length != 6) {
XLogger.warn("Invalid location: " + res.Areas.get("main"));
return null;
}
ResidenceNode dominionNode = new ResidenceNode();
dominionNode.owner = owner.getUuid();
dominionNode.owner = UUID.fromString(res.Permissions.OwnerUUID);
dominionNode.world = world;
dominionNode.name = name;
dominionNode.joinMessage = save.Messages.get(res.Messages).EnterMessage;