Added //fast mode, which allows the server to skip the dirtying of chunks. This means that you have to rejoin to see changes though, but most operations are doubled in speed.

This commit is contained in:
sk89q
2011-06-04 10:30:45 -07:00
parent d397460026
commit d881c14e2d
11 changed files with 514 additions and 23 deletions

View File

@ -73,6 +73,7 @@ public class LocalSession {
private String lastScript;
private boolean beenToldVersion = false;
private boolean hasCUISupport = false;
private boolean fastMode = false;
private TimeZone timezone = TimeZone.getDefault();
/**
@ -144,6 +145,7 @@ public class LocalSession {
EditSession newEditSession =
new EditSession(editSession.getWorld(), -1, newBlockBag);
newEditSession.enableQueue();
newEditSession.setFastMode(fastMode);
editSession.undo(newEditSession);
return editSession;
} else {
@ -164,6 +166,7 @@ public class LocalSession {
EditSession newEditSession =
new EditSession(editSession.getWorld(), -1, newBlockBag);
newEditSession.enableQueue();
newEditSession.setFastMode(fastMode);
editSession.redo(newEditSession);
historyPointer++;
return editSession;
@ -642,4 +645,40 @@ public class LocalSession {
public boolean hasExpired() {
return System.currentTimeMillis() - expirationTime > EXPIRATION_GRACE;
}
/**
* Construct a new edit session.
*
* @param player
* @return
*/
public EditSession createEditSession(LocalPlayer player) {
BlockBag blockBag = getBlockBag(player);
// Create an edit session
EditSession editSession =
new EditSession(player.getWorld(),
getBlockChangeLimit(), blockBag);
editSession.setFastMode(fastMode);
return editSession;
}
/**
* Checks if the session has fast mode enabled.
*
* @return
*/
public boolean hasFastMode() {
return fastMode;
}
/**
* Set fast mode.
*
* @param fastMode
*/
public void setFastMode(boolean fastMode) {
this.fastMode = fastMode;
}
}