Compare commits

..

No commits in common. "3e6cf96040ccf017a15f93ca821fbe043108f371" and "fcac9af7d1454d5e485d4b1a3d2b959941c24e59" have entirely different histories.

3 changed files with 7 additions and 24 deletions

View File

@ -5,7 +5,6 @@ import fr.pandacube.lib.paper.reflect.wrapper.craftbukkit.CraftServer;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.CompoundTag; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.CompoundTag;
import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.NbtIo; import fr.pandacube.lib.paper.reflect.wrapper.minecraft.nbt.NbtIo;
import fr.pandacube.lib.paper.util.PlayerDataWrapper; import fr.pandacube.lib.paper.util.PlayerDataWrapper;
import fr.pandacube.lib.paper.util.PlayerDataWrapper.PlayerDataLoadException;
import fr.pandacube.lib.paper.world.WorldUtil; import fr.pandacube.lib.paper.world.WorldUtil;
import fr.pandacube.lib.players.standalone.AbstractOffPlayer; import fr.pandacube.lib.players.standalone.AbstractOffPlayer;
import fr.pandacube.lib.reflect.wrapper.ReflectWrapper; import fr.pandacube.lib.reflect.wrapper.ReflectWrapper;
@ -156,16 +155,12 @@ public interface PaperOffPlayer extends AbstractOffPlayer {
*/ */
default CompoundTag getPlayerData() { default CompoundTag getPlayerData() {
if (isOnline()) if (isOnline())
throw new IllegalStateException("Cannot access data file of " + getName() + " because they're online."); throw new IllegalStateException("Cannot access data file of " + getName() + " because theyre online.");
try {
return ReflectWrapper.wrapTyped(Bukkit.getServer(), CraftServer.class) return ReflectWrapper.wrapTyped(Bukkit.getServer(), CraftServer.class)
.getServer() .getServer()
.getPlayerList() .getPlayerList()
.playerIo() .playerIo()
.load(getName(), getUniqueId().toString()).orElse(null); .load(getName(), getUniqueId().toString()).orElse(null);
} catch (Exception|LinkageError e) {
throw new PlayerDataLoadException(getName(), getUniqueId(), e);
}
} }
/** /**

View File

@ -103,7 +103,6 @@ public class GameWorldUtils implements Listener {
} }
w.setAutoSave(false); w.setAutoSave(false);
gameWorld.put(world, w); gameWorld.put(world, w);
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null)
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "mvm set hidden true "+copiedName); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "mvm set hidden true "+copiedName);
operationOnLoad.accept(w); operationOnLoad.accept(w);
return w; return w;

View File

@ -21,7 +21,6 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects; import java.util.Objects;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.UUID;
import java.util.function.IntUnaryOperator; import java.util.function.IntUnaryOperator;
/** /**
@ -363,14 +362,4 @@ public record PlayerDataWrapper(CompoundTag data) {
return null; return null;
} }
} }
public static class PlayerDataLoadException extends RuntimeException {
public PlayerDataLoadException(String playerName, UUID playerId, Throwable cause) {
super("Unable to load data of player " + playerName + " (" + playerId + ")", cause);
}
}
} }