split ClosePath
This commit is contained in:
parent
53f5408d91
commit
f808f34330
|
@ -17,12 +17,15 @@ public class ClearPoints implements CommandExecutor {
|
|||
|
||||
public static void clear() {
|
||||
Camera.broadlog("Clearing points and path:");
|
||||
|
||||
ListPoints.listPoints();
|
||||
|
||||
while (Camera.controlPoints.size() > 0) {
|
||||
NewPoint.rm(new String[] { "", "0" }, null, null);
|
||||
}
|
||||
|
||||
ClosePath.closed = false;
|
||||
|
||||
Camera.compute();
|
||||
|
||||
Camera.broadlog("All cleared !");
|
||||
|
|
|
@ -12,24 +12,28 @@ public class ClosePath implements CommandExecutor {
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!closed && Camera.controlPoints.size() >= 4) {
|
||||
closed = true;
|
||||
NewPoint.add(null, Camera.controlPoints.get(0), player.getWorld());
|
||||
NewPoint.set(new String[] { "", "" + (Camera.controlPoints.size() - 2) },
|
||||
Camera.controlPoints.get(0).clone().multiply(2)
|
||||
.subtract(Camera.controlPoints.get(1)),
|
||||
player.getWorld());
|
||||
} else if (closed) {
|
||||
closed = false;
|
||||
NewPoint.rm(new String[] { "", "" + (Camera.controlPoints.size() - 1) }, null, null);
|
||||
}
|
||||
|
||||
Camera.compute();
|
||||
close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
if (!closed && Camera.controlPoints.size() >= 4) {
|
||||
closed = true;
|
||||
|
||||
NewPoint.add(null, Camera.controlPoints.get(0), Camera.controlPoints.get(0).getWorld());
|
||||
|
||||
NewPoint.set(new String[] { "", "" + (Camera.controlPoints.size() - 2) },
|
||||
Camera.controlPoints.get(0).clone().multiply(2).subtract(Camera.controlPoints.get(1)),
|
||||
Camera.controlPoints.get(0).getWorld());
|
||||
} else if (closed) {
|
||||
closed = false;
|
||||
|
||||
NewPoint.rm(new String[] { "", "" + (Camera.controlPoints.size() - 1) }, null, null);
|
||||
}
|
||||
|
||||
Camera.compute();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue