From 8da8026aa4d42e536ce281d41c790b78057c36ff Mon Sep 17 00:00:00 2001 From: Willem Mulder Date: Mon, 19 Aug 2013 08:41:44 +0200 Subject: [PATCH] Remove world caching from Location to fix issue --- src/Location.java | 11 ++--------- src/Player.java | 3 +-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Location.java b/src/Location.java index f68d0b24..5b77b849 100644 --- a/src/Location.java +++ b/src/Location.java @@ -43,9 +43,6 @@ public class Location implements java.io.Serializable { */ public String world; - // Cache world for efficiency - private transient World worldRef; - /** * Creates a location */ @@ -126,17 +123,13 @@ public Location(World world, double X, double Y, double Z, float rotation, float * dimension. May return null if the given world does not exist! */ public World getWorld() { - if (worldRef == null) { - OWorld oworld = etc.getMCServer().getWorld(world, dimension); - worldRef = oworld == null ? null : oworld.world; - } - return worldRef; + OWorld oworld = etc.getMCServer().getWorld(world, dimension); + return oworld == null ? null : oworld.world; } public void setWorld(World newWorld) { world = newWorld.getName(); dimension = newWorld.getType().getId(); - worldRef = newWorld; } /** diff --git a/src/Player.java b/src/Player.java index 83249968..522594fc 100644 --- a/src/Player.java +++ b/src/Player.java @@ -852,8 +852,7 @@ public void switchWorlds(World world) { || world.getType() == World.Dimension.NORMAL && this.getWorld().getType() == World.Dimension.END) { Location loc = this.getLocation(); - loc.world = world.getName(); // teleport to new world - loc.dimension = world.getType().getId(); + loc.setWorld(world); // teleport to new world // SRG mcServer.func_71203_ab().func_72368_a(ent, loc.dimension, true, loc); // Respawn with location mcServer.af().a(ent, loc.dimension, true, loc); // Respawn with location