This commit is contained in:
Jesse Boyd 2016-09-24 15:30:16 +10:00
parent f9ee91f192
commit 6d52e47d3f

View File

@ -83,6 +83,7 @@ public class Sniper {
// Added
public AsyncWorld getWorld() {
synchronized (this) {
if (permanentWorld == null) {
permanentWorld = new AsyncWorld(null, null);
}
@ -104,6 +105,13 @@ public class Sniper {
}
return permanentWorld;
}
}
public void resetMask() {
synchronized (this) {
maskQueue = null;
}
}
public Player getPlayer() {
return Bukkit.getPlayer(player);
@ -122,7 +130,7 @@ public class Sniper {
try {
Player player = getPlayer();
FawePlayer<Player> fp = FawePlayer.wrap(player);
maskQueue = null;
resetMask();
if (clickedBlock != null) {
clickedBlock = getWorld().getBlockAt(clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
}
@ -296,7 +304,7 @@ public class Sniper {
performerBrush.initP(snipeData);
}
final FawePlayer<Player> fp = FawePlayer.wrap(getPlayer());
fp.runAction(new RunnableVal<Boolean>() {
fp.runAsyncIfFree(new RunnableVal<Boolean>() {
@Override
public void run(Boolean value) {
boolean result = brush.perform(snipeAction, snipeData, targetBlock, lastBlock);
@ -305,7 +313,7 @@ public class Sniper {
}
world.commit();
}
}, true, true);
});
return true;
}
}
@ -375,6 +383,7 @@ public class Sniper {
}
public void storeUndo(Undo undo) {
synchronized (this) {
if (changeQueue != null) {
FaweChangeSet changeSet = changeQueue.getChangeSet();
FawePlayer<Object> fp = FawePlayer.wrap(getPlayer());
@ -389,6 +398,7 @@ public class Sniper {
changeQueue = null;
}
}
}
public void undo() {
undo(1);