Fix forge relog

This commit is contained in:
Jesse Boyd 2018-08-22 20:39:44 +10:00
parent 9e6b3fabe4
commit 839a3151d5
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -143,17 +143,18 @@ public abstract class FawePlayer<T> extends Metadatable {
} }
} }
} }
VirtualWorld world = getSession().getVirtualWorld(); try {
if (world != null) { VirtualWorld world = getSession().getVirtualWorld();
if (close) { if (world != null) {
try { if (close) {
world.close(false); try {
} catch (IOException e) { world.close(false);
e.printStackTrace(); } catch (IOException e) {
} e.printStackTrace();
}
} else world.clear();
} }
else world.clear(); } catch (NoCapablePlatformException ignore) {}
}
return cancelled; return cancelled;
} }
@ -612,16 +613,18 @@ public abstract class FawePlayer<T> extends Metadatable {
public void unregister() { public void unregister() {
cancel(true); cancel(true);
if (Settings.IMP.HISTORY.DELETE_ON_LOGOUT) { if (Settings.IMP.HISTORY.DELETE_ON_LOGOUT) {
session = getSession(); try {
WorldEdit.getInstance().removeSession(toWorldEditPlayer()); session = getSession();
session.setClipboard(null); WorldEdit.getInstance().removeSession(toWorldEditPlayer());
session.clearHistory(); session.setClipboard(null);
for (Map.Entry<Integer, Tool> entry : session.getTools().entrySet()) { session.clearHistory();
Tool tool = entry.getValue(); for (Map.Entry<Integer, Tool> entry : session.getTools().entrySet()) {
if (tool instanceof BrushTool) { Tool tool = entry.getValue();
((BrushTool) tool).clear(getPlayer()); if (tool instanceof BrushTool) {
((BrushTool) tool).clear(getPlayer());
}
} }
} } catch (NoCapablePlatformException ignore) {}
} }
Fawe.get().unregister(getName()); Fawe.get().unregister(getName());
} }