修复有些情况下玩家无法从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" group = "cn.lunadeer"
version = "1.44.3-beta" version = "1.44.4-beta"
java { java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21)) toolchain.languageVersion.set(JavaLanguageVersion.of(21))

View File

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