Fixes #753
This commit is contained in:
Jesse Boyd
2015-12-04 20:00:30 +11:00
parent c72edc40f0
commit 35589dcc5f
13 changed files with 310 additions and 249 deletions

View File

@ -15,7 +15,6 @@ import com.intellectualcrafters.plot.util.PlotWeather;
public class ConsolePlayer extends PlotPlayer {
private static ConsolePlayer instance;
private Location loc;
private final HashMap<String, Object> meta;
public static ConsolePlayer getConsole() {
@ -38,8 +37,9 @@ public class ConsolePlayer extends PlotPlayer {
} else {
world = "world";
}
loc = new Location(world, 0, 0, 0);
meta = new HashMap<>();
Location loc = new Location(world, 0, 0, 0);
setMeta("location", loc);
}
public static boolean isConsole(final PlotPlayer plr) {
@ -53,12 +53,12 @@ public class ConsolePlayer extends PlotPlayer {
@Override
public Location getLocation() {
return loc;
return (Location) getMeta("location");
}
@Override
public Location getLocationFull() {
return loc;
return (Location) getMeta("location");
}
@Override
@ -85,7 +85,7 @@ public class ConsolePlayer extends PlotPlayer {
public void teleport(final Location loc) {
final Plot plot = MainUtil.getPlot(loc);
setMeta("lastplot", plot);
this.loc = loc;
setMeta("location", loc);
}
@Override

View File

@ -7,14 +7,15 @@ import java.util.concurrent.ConcurrentHashMap;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.util.CmdConfirm;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandCaller;
import com.plotsquared.listener.PlotListener;
/**
* The PlotPlayer class<br>
@ -321,17 +322,19 @@ public abstract class PlotPlayer implements CommandCaller {
public void unregister() {
final Plot plot = getCurrentPlot();
if (plot != null) {
PlotListener.plotExit(this, plot);
EventUtil.manager.callLeave(this, plot);
}
ExpireManager.dates.put(getUUID(), System.currentTimeMillis());
EventUtil.unregisterPlayer(this);
if (Settings.DELETE_PLOTS_ON_BAN && isBanned()) {
for (final Plot owned : PS.get().getPlotsInWorld(getName())) {
owned.deletePlot(null);
PS.debug(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), getName()));
}
}
UUIDHandler.getPlayers().remove(getName());
String name = getName();
ExpireManager.dates.put(getUUID(), System.currentTimeMillis());
SetupUtils.setupMap.remove(name);
CmdConfirm.removePending(name);
UUIDHandler.getPlayers().remove(name);
PS.get().IMP.unregister(this);
}
}

View File

@ -284,6 +284,11 @@ public abstract class PlotWorld {
}
}
@Override
public String toString() {
return worldname;
}
/**
* Used for the <b>/plot setup</b> command Return null if you do not want to support this feature
*