Skip to content

Commit

Permalink
Remove world caching from Location to fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
14mRh4X0r committed Aug 19, 2013
1 parent 7f48acb commit 8da8026
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
11 changes: 2 additions & 9 deletions src/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8da8026

Please sign in to comment.