From 860f6ad4b7540768e5e96872a084b5f6baa77273 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 5 Jul 2011 04:48:27 +0100 Subject: [PATCH] Implements a World UID. By: Rigby --- .../main/java/org/bukkit/craftbukkit/CraftServer.java | 10 ++++++++++ .../main/java/org/bukkit/craftbukkit/CraftWorld.java | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 3735635f39..915186e848 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -490,6 +490,16 @@ public final class CraftServer implements Server { return worlds.get(name.toLowerCase()); } + public World getWorld(long uid) { + for (String worldName : worlds.keySet()) { + org.bukkit.World world = worlds.get(worldName); + if (world.getUID() == uid) { + return world; + } + } + return null; + } + public void addWorld(World world) { worlds.put(world.getName().toLowerCase(), world); } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index b09e357e4c..fac24e3eec 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -395,10 +395,15 @@ public class CraftWorld implements World { return world.worldData.name; } + @Deprecated public long getId() { return world.worldData.getSeed(); } + public long getUID() { + return world.worldData.getWorldUID(); + } + @Override public String toString() { return "CraftWorld{name=" + getName() + '}';