mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 19:46:21 +01:00
Fixed uuid code that was prematurely pushed.
This commit is contained in:
parent
9e49127c7d
commit
eb19e4e8dc
@ -980,6 +980,7 @@ public abstract class Entity {
|
||||
// CraftBukkit end
|
||||
|
||||
// CraftBukkit start - reset world
|
||||
if (this instanceof EntityPlayer) {
|
||||
org.bukkit.Server server = Bukkit.getServer();
|
||||
org.bukkit.World bworld = null;
|
||||
|
||||
@ -992,12 +993,13 @@ public abstract class Entity {
|
||||
} else {
|
||||
bworld = server.getWorld(worldName);
|
||||
}
|
||||
if(bworld == null && this instanceof EntityPlayer) {
|
||||
if (bworld == null) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) this;
|
||||
bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
|
||||
}
|
||||
|
||||
this.spawnIn(bworld == null ? null : ((org.bukkit.craftbukkit.CraftWorld) bworld).getHandle());
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.UUID; // CraftBukkit
|
||||
|
||||
public interface IDataManager {
|
||||
|
||||
@ -22,5 +22,5 @@ public interface IDataManager {
|
||||
|
||||
File b(String s);
|
||||
|
||||
UUID getUUID();
|
||||
UUID getUUID(); // CraftBukkit
|
||||
}
|
||||
|
@ -9,9 +9,10 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import java.util.UUID; // CraftBukkit
|
||||
|
||||
public class PlayerNBTManager implements PlayerFileData, IDataManager {
|
||||
|
||||
private static final Logger a = Logger.getLogger("Minecraft");
|
||||
@ -19,6 +20,7 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager {
|
||||
private final File c;
|
||||
private final File d;
|
||||
private final long e = System.currentTimeMillis();
|
||||
private UUID uuid = null; // CraftBukkit
|
||||
|
||||
public PlayerNBTManager(File file1, String s, boolean flag) {
|
||||
this.b = new File(file1, s);
|
||||
@ -223,20 +225,22 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager {
|
||||
|
||||
// CraftBukkit start
|
||||
public UUID getUUID() {
|
||||
if (uuid != null) return uuid;
|
||||
try {
|
||||
File file1 = new File(this.b, "uid.dat");
|
||||
UUID id;
|
||||
if(!file1.exists()) {
|
||||
if (!file1.exists()) {
|
||||
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file1));
|
||||
id = UUID.randomUUID();
|
||||
dos.writeLong(id.getMostSignificantBits());
|
||||
dos.writeLong(id.getLeastSignificantBits());
|
||||
uuid = UUID.randomUUID();
|
||||
dos.writeLong(uuid.getMostSignificantBits());
|
||||
dos.writeLong(uuid.getLeastSignificantBits());
|
||||
dos.close();
|
||||
}
|
||||
else {
|
||||
DataInputStream dis = new DataInputStream(new FileInputStream(file1));
|
||||
id = new UUID(dis.readLong(), dis.readLong());
|
||||
uuid = new UUID(dis.readLong(), dis.readLong());
|
||||
dis.close();
|
||||
}
|
||||
return id;
|
||||
return uuid;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
return null;
|
||||
|
@ -8,9 +8,10 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.UUID;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
@ -2415,4 +2416,5 @@ public class World implements IBlockAccess {
|
||||
public UUID getUUID() {
|
||||
return this.w.getUUID();
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -4,9 +4,10 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
|
Loading…
Reference in New Issue
Block a user