Flush or disable buffers in tools

This commit is contained in:
Kenzie Togami
2018-10-20 18:54:58 -07:00
parent dd2fcbac23
commit 1fa1ff895b
10 changed files with 44 additions and 18 deletions

View File

@ -460,7 +460,7 @@ public class UtilityCommands {
if (editSession != null) {
session.remember(editSession);
editSession.flushQueue();
editSession.flushSession();
}
}
@ -520,7 +520,7 @@ public class UtilityCommands {
if (editSession != null) {
session.remember(editSession);
editSession.flushQueue();
editSession.flushSession();
}
}

View File

@ -83,7 +83,7 @@ public class AreaPickaxe implements BlockTool {
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached.");
} finally {
editSession.flushQueue();
editSession.flushSession();
session.remember(editSession);
}

View File

@ -53,16 +53,17 @@ public class BlockReplacer implements DoubleActionBlockTool {
BlockBag bag = session.getBlockBag(player);
EditSession editSession = session.createEditSession(player);
editSession.disableBuffering();
try {
Vector position = clicked.toVector();
editSession.setBlock(position, pattern.apply(position));
} catch (MaxChangedBlocksException ignored) {
} finally {
session.remember(editSession);
if (bag != null) {
bag.flushChanges();
}
session.remember(editSession);
}
return true;

View File

@ -193,10 +193,11 @@ public class BrushTool implements TraceTool {
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached.");
} finally {
session.remember(editSession);
editSession.flushSession();
if (bag != null) {
bag.flushChanges();
}
session.remember(editSession);
}
return true;

View File

@ -75,7 +75,7 @@ public class RecursivePickaxe implements BlockTool {
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached.");
} finally {
editSession.flushQueue();
editSession.flushSession();
session.remember(editSession);
}

View File

@ -57,7 +57,7 @@ public class SinglePickaxe implements BlockTool {
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached.");
} finally {
editSession.flushQueue();
editSession.flushSession();
}
world.playEffect(clicked.toVector(), 2001, blockType.getLegacyId());