Flush / unbuffer more tools

Dieser Commit ist enthalten in:
Kenzie Togami 2018-10-30 18:06:00 -07:00
Ursprung 93de97dc19
Commit 3b5972b7f2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 5D200B325E157A81
5 geänderte Dateien mit 56 neuen und 54 gelöschten Zeilen

Datei anzeigen

@ -79,7 +79,8 @@ public class BlockDataCyler implements DoubleActionBlockTool {
index = (index + 1) % currentProperty.getValues().size(); index = (index + 1) % currentProperty.getValues().size();
BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index)); BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index));
EditSession editSession = session.createEditSession(player); try (EditSession editSession = session.createEditSession(player)) {
editSession.disableBuffering();
try { try {
editSession.setBlock(clicked.toVector(), newBlock); editSession.setBlock(clicked.toVector(), newBlock);
@ -89,6 +90,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
} finally { } finally {
session.remember(editSession); session.remember(editSession);
} }
}
} else { } else {
List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet()); List<Property<?>> properties = Lists.newArrayList(block.getStates().keySet());
int index = properties.indexOf(currentProperty); int index = properties.indexOf(currentProperty);

Datei anzeigen

@ -76,8 +76,7 @@ public class FloatingTreeRemover implements BlockTool {
return true; return true;
} }
final EditSession editSession = session.createEditSession(player); try (EditSession editSession = session.createEditSession(player)) {
try { try {
final Set<Vector> blockSet = bfs(world, clicked.toVector()); final Set<Vector> blockSet = bfs(world, clicked.toVector());
if (blockSet == null) { if (blockSet == null) {
@ -96,6 +95,7 @@ public class FloatingTreeRemover implements BlockTool {
} finally { } finally {
session.remember(editSession); session.remember(editSession);
} }
}
return true; return true;
} }

Datei anzeigen

@ -69,8 +69,7 @@ public class FloodFillTool implements BlockTool {
return true; return true;
} }
EditSession editSession = session.createEditSession(player); try (EditSession editSession = session.createEditSession(player)) {
try { try {
recurse(editSession, clicked.toVector().toBlockVector(), recurse(editSession, clicked.toVector().toBlockVector(),
clicked.toVector(), range, initialType, new HashSet<>()); clicked.toVector(), range, initialType, new HashSet<>());
@ -79,6 +78,7 @@ public class FloodFillTool implements BlockTool {
} finally { } finally {
session.remember(editSession); session.remember(editSession);
} }
}
return true; return true;
} }

Datei anzeigen

@ -53,8 +53,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) { public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
Location pos = getTargetFace(player); Location pos = getTargetFace(player);
if (pos == null) return false; if (pos == null) return false;
EditSession eS = session.createEditSession(player); try (EditSession eS = session.createEditSession(player)) {
try { eS.disableBuffering();
BlockStateHolder applied = secondary.apply(pos.toVector()); BlockStateHolder applied = secondary.apply(pos.toVector());
if (applied.getBlockType().getMaterial().isAir()) { if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(pos.toVector(), secondary); eS.setBlock(pos.toVector(), secondary);
@ -73,8 +73,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
Location pos = getTargetFace(player); Location pos = getTargetFace(player);
if (pos == null) return false; if (pos == null) return false;
EditSession eS = session.createEditSession(player); try (EditSession eS = session.createEditSession(player)) {
try { eS.disableBuffering();
BlockStateHolder applied = primary.apply(pos.toVector()); BlockStateHolder applied = primary.apply(pos.toVector());
if (applied.getBlockType().getMaterial().isAir()) { if (applied.getBlockType().getMaterial().isAir()) {
eS.setBlock(pos.toVector(), primary); eS.setBlock(pos.toVector(), primary);

Datei anzeigen

@ -48,8 +48,7 @@ public class TreePlanter implements BlockTool {
@Override @Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
EditSession editSession = session.createEditSession(player); try (EditSession editSession = session.createEditSession(player)) {
try { try {
boolean successful = false; boolean successful = false;
@ -68,6 +67,7 @@ public class TreePlanter implements BlockTool {
} finally { } finally {
session.remember(editSession); session.remember(editSession);
} }
}
return true; return true;
} }