Possibly fixes #335

This commit is contained in:
Jesse Boyd 2016-10-22 04:07:41 +11:00
parent bbb6346aff
commit b71c3ec43e
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
6 changed files with 28 additions and 3 deletions

View File

@ -46,7 +46,9 @@ public class Reload extends FaweCommand {
Fawe.debug(elem);
}
}
if (player != null) {
player.sendMessage("&cSee console.");
}
return true;
}
case "debugpaste":

View File

@ -87,6 +87,16 @@ public class CPUOptimizedChangeSet extends FaweChangeSet {
return changes.iterator();
}
@Override
public boolean isEmpty() {
if (changes.size() == 0) {
flush();
return changes.size() == 0;
} else {
return false;
}
}
@Override
public int size() {
return changes.size() * 65536; // num chunks * 65536 (guess of 65536 changes per chunk)

View File

@ -170,6 +170,10 @@ public abstract class FaweChangeSet implements ChangeSet {
}
}
public boolean isEmpty() {
return size() == 0;
}
public void add(int x, int y, int z, int combinedFrom, BaseBlock to) {
try {
if (to.hasNbtData()) {

View File

@ -221,6 +221,15 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
return MainUtil.getCompressedOS(os, compression);
}
@Override
public boolean isEmpty() {
if (blockSize > 0) {
return false;
}
flush();
return blockSize == 0;
}
@Override
public int size() {
// Flush so we can accurately get the size

View File

@ -449,7 +449,7 @@ public class LocalSession {
return;
}
FaweChangeSet changeSet = (FaweChangeSet) editSession.getChangeSet();
if (changeSet.size() == 0) {
if (changeSet.isEmpty()) {
return;
}
FawePlayer fp = editSession.getPlayer();

View File

@ -300,7 +300,7 @@ public class Sniper {
if (clickedBlock != null) {
targetBlock = clickedBlock;
lastBlock = clickedBlock.getRelative(clickedFace);
if (lastBlock == null) {
if (lastBlock == null || targetBlock == null) {
getPlayer().sendMessage(ChatColor.RED + "Snipe target block must be visible.");
return true;
}