mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Allow scatter command brush to use FAWE commands. Best for scatter sphere, etc.
This commit is contained in:
parent
51aa500857
commit
34301b446a
@ -65,6 +65,7 @@ public class ScatterBrush implements Brush {
|
|||||||
visited.add(position);
|
visited.add(position);
|
||||||
}
|
}
|
||||||
LocalBlockVectorSet placed = new LocalBlockVectorSet();
|
LocalBlockVectorSet placed = new LocalBlockVectorSet();
|
||||||
|
placed.setOffset(position.getX(), position.getZ());
|
||||||
int maxFails = 1000;
|
int maxFails = 1000;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
int index = ThreadLocalRandom.current().nextInt(length);
|
int index = ThreadLocalRandom.current().nextInt(length);
|
||||||
|
@ -2,6 +2,7 @@ package com.fastasyncworldedit.core.command.tool.brush;
|
|||||||
|
|
||||||
import com.fastasyncworldedit.core.math.LocalBlockVectorSet;
|
import com.fastasyncworldedit.core.math.LocalBlockVectorSet;
|
||||||
import com.fastasyncworldedit.core.util.StringMan;
|
import com.fastasyncworldedit.core.util.StringMan;
|
||||||
|
import com.fastasyncworldedit.core.wrappers.LocationMaskedPlayerWrapper;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
@ -41,7 +42,10 @@ public class ScatterCommand extends ScatterBrush {
|
|||||||
player.setSelection(selector);
|
player.setSelection(selector);
|
||||||
List<String> cmds = StringMan.split(replaced, ';');
|
List<String> cmds = StringMan.split(replaced, ';');
|
||||||
for (String cmd : cmds) {
|
for (String cmd : cmds) {
|
||||||
CommandEvent event = new CommandEvent(player, cmd);
|
CommandEvent event = new CommandEvent(
|
||||||
|
new LocationMaskedPlayerWrapper(player, player.getLocation().setPosition(position.toVector3()), false),
|
||||||
|
cmd
|
||||||
|
);
|
||||||
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,14 @@ public class LocationMaskedPlayerWrapper extends AsyncPlayer {
|
|||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPosition(final Vector3 pos) {
|
||||||
|
if (allowTeleport) {
|
||||||
|
super.setPosition(pos);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void update() {
|
private void update() {
|
||||||
this.position = super.getLocation();
|
this.position = super.getLocation();
|
||||||
}
|
}
|
||||||
|
@ -206,6 +206,51 @@ public class PlayerProxy extends AbstractPlayerActor {
|
|||||||
basePlayer.sendFakeBlock(pos, block);
|
basePlayer.sendFakeBlock(pos, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void findFreePosition(final Location searchPos) {
|
||||||
|
basePlayer.findFreePosition(searchPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOnGround(final Location searchPos) {
|
||||||
|
basePlayer.setOnGround(searchPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void findFreePosition() {
|
||||||
|
basePlayer.findFreePosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ascendLevel() {
|
||||||
|
return basePlayer.ascendLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean descendLevel() {
|
||||||
|
return basePlayer.descendLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ascendToCeiling(final int clearance) {
|
||||||
|
return basePlayer.ascendToCeiling(clearance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ascendToCeiling(final int clearance, final boolean alwaysGlass) {
|
||||||
|
return basePlayer.ascendToCeiling(clearance, alwaysGlass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ascendUpwards(final int distance) {
|
||||||
|
return basePlayer.ascendUpwards(distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ascendUpwards(final int distance, final boolean alwaysGlass) {
|
||||||
|
return basePlayer.ascendUpwards(distance, alwaysGlass);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
||||||
basePlayer.floatAt(x, y, z, alwaysGlass);
|
basePlayer.floatAt(x, y, z, alwaysGlass);
|
||||||
|
Loading…
Reference in New Issue
Block a user