Fix VS brushes which require multiple clicks
This commit is contained in:
parent
f31c4fda82
commit
6818ff28ba
|
@ -22,4 +22,4 @@ gradle.log
|
||||||
/bukkit19/build
|
/bukkit19/build
|
||||||
/bukkit18/build
|
/bukkit18/build
|
||||||
build
|
build
|
||||||
mvn/com/boydti/fawe-api/unknown/fawe-api-unknown.jar
|
/mvn
|
|
@ -16,7 +16,6 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import org.bukkit.BlockChangeDelegate;
|
import org.bukkit.BlockChangeDelegate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
@ -60,8 +59,8 @@ import org.bukkit.util.Vector;
|
||||||
*/
|
*/
|
||||||
public class AsyncWorld implements World {
|
public class AsyncWorld implements World {
|
||||||
|
|
||||||
private final World parent;
|
private World parent;
|
||||||
private final FaweQueue queue;
|
private FaweQueue queue;
|
||||||
private BukkitImplAdapter adapter;
|
private BukkitImplAdapter adapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,6 +108,12 @@ public class AsyncWorld implements World {
|
||||||
return new AsyncWorld(world, false);
|
return new AsyncWorld(world, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeWorld(World world, FaweQueue queue) {
|
||||||
|
flush();
|
||||||
|
this.parent = world;
|
||||||
|
this.queue = queue;
|
||||||
|
}
|
||||||
|
|
||||||
public World getParent() {
|
public World getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
@ -117,8 +122,6 @@ public class AsyncWorld implements World {
|
||||||
return queue;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AtomicBoolean loading = new AtomicBoolean(false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a world async (untested)
|
* Create a world async (untested)
|
||||||
* - Only optimized for 1.10
|
* - Only optimized for 1.10
|
||||||
|
@ -140,8 +143,10 @@ public class AsyncWorld implements World {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flush() {
|
public void flush() {
|
||||||
|
if (queue != null) {
|
||||||
queue.flush();
|
queue.flush();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorldBorder getWorldBorder() {
|
public WorldBorder getWorldBorder() {
|
||||||
|
|
|
@ -75,14 +75,17 @@ public class Sniper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Added
|
// Added
|
||||||
private AsyncWorld tmpWorld;
|
private AsyncWorld permanentWorld;
|
||||||
private MaskedFaweQueue maskQueue;
|
private MaskedFaweQueue maskQueue;
|
||||||
private ChangeSetFaweQueue changeQueue;
|
private ChangeSetFaweQueue changeQueue;
|
||||||
private FaweQueue baseQueue;
|
private FaweQueue baseQueue;
|
||||||
|
|
||||||
// Added
|
// Added
|
||||||
public AsyncWorld getWorld() {
|
public AsyncWorld getWorld() {
|
||||||
if (this.tmpWorld == null) {
|
if (permanentWorld == null) {
|
||||||
|
permanentWorld = new AsyncWorld(null, null);
|
||||||
|
}
|
||||||
|
if (this.maskQueue == null) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
FawePlayer<Player> fp = FawePlayer.wrap(player);
|
FawePlayer<Player> fp = FawePlayer.wrap(player);
|
||||||
if (this.baseQueue == null || !StringMan.isEqual(baseQueue.getWorldName(), player.getWorld().getName())) {
|
if (this.baseQueue == null || !StringMan.isEqual(baseQueue.getWorldName(), player.getWorld().getName())) {
|
||||||
|
@ -96,9 +99,9 @@ public class Sniper {
|
||||||
changeSet = LoggingChangeSet.wrap(fp, changeSet);
|
changeSet = LoggingChangeSet.wrap(fp, changeSet);
|
||||||
}
|
}
|
||||||
this.changeQueue = new ChangeSetFaweQueue(changeSet, maskQueue);
|
this.changeQueue = new ChangeSetFaweQueue(changeSet, maskQueue);
|
||||||
tmpWorld = new AsyncWorld(player.getWorld(), changeQueue);
|
permanentWorld.changeWorld(player.getWorld(), changeQueue);
|
||||||
}
|
}
|
||||||
return tmpWorld;
|
return permanentWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
|
@ -123,7 +126,7 @@ public class Sniper {
|
||||||
if (fp.getMeta("fawe_action") != null) {
|
if (fp.getMeta("fawe_action") != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
tmpWorld = null;
|
maskQueue = null;
|
||||||
if (clickedBlock != null) {
|
if (clickedBlock != null) {
|
||||||
clickedBlock = getWorld().getBlockAt(clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
|
clickedBlock = getWorld().getBlockAt(clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
|
||||||
}
|
}
|
||||||
|
@ -155,7 +158,6 @@ public class Sniper {
|
||||||
getPlayer().sendMessage("No Brush selected.");
|
getPlayer().sendMessage("No Brush selected.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getPlayer().hasPermission(sniperTool.getCurrentBrush().getPermissionNode())) {
|
if (!getPlayer().hasPermission(sniperTool.getCurrentBrush().getPermissionNode())) {
|
||||||
getPlayer().sendMessage("You are not allowed to use this brush. You're missing the permission node '" + sniperTool.getCurrentBrush().getPermissionNode() + "'");
|
getPlayer().sendMessage("You are not allowed to use this brush. You're missing the permission node '" + sniperTool.getCurrentBrush().getPermissionNode() + "'");
|
||||||
return true;
|
return true;
|
||||||
|
@ -293,16 +295,6 @@ public class Sniper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (sniperTool.getCurrentBrush() instanceof PerformBrush) {
|
|
||||||
// PerformBrush performerBrush = (PerformBrush) sniperTool.getCurrentBrush();
|
|
||||||
// performerBrush.initP(snipeData);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// boolean result = sniperTool.getCurrentBrush().perform(snipeAction, snipeData, targetBlock, lastBlock);
|
|
||||||
// if (result) {
|
|
||||||
// MetricsManager.increaseBrushUsage(sniperTool.getCurrentBrush().getName());
|
|
||||||
// }
|
|
||||||
// return result;
|
|
||||||
final IBrush brush = sniperTool.getCurrentBrush();
|
final IBrush brush = sniperTool.getCurrentBrush();
|
||||||
if (sniperTool.getCurrentBrush() instanceof PerformBrush) {
|
if (sniperTool.getCurrentBrush() instanceof PerformBrush) {
|
||||||
PerformBrush performerBrush = (PerformBrush) sniperTool.getCurrentBrush();
|
PerformBrush performerBrush = (PerformBrush) sniperTool.getCurrentBrush();
|
||||||
|
@ -401,7 +393,7 @@ public class Sniper {
|
||||||
changeSet = FaweChangeSet.getDefaultChangeSet(worldEditWorld, fp.getUUID());
|
changeSet = FaweChangeSet.getDefaultChangeSet(worldEditWorld, fp.getUUID());
|
||||||
changeQueue.setChangeSet(changeSet);
|
changeQueue.setChangeSet(changeSet);
|
||||||
// NEW QUEUE?
|
// NEW QUEUE?
|
||||||
tmpWorld = null;
|
maskQueue = null;
|
||||||
baseQueue = null;
|
baseQueue = null;
|
||||||
changeQueue = null;
|
changeQueue = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue