Remove FawePlayer and API modifications

This commit is contained in:
MattBDev
2019-09-13 23:05:16 -04:00
parent c65e06cb1b
commit 14ed3f1d9c
105 changed files with 1614 additions and 2407 deletions

View File

@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.object.brush.BrushSettings;
import com.boydti.fawe.object.brush.MovableTool;
@ -584,7 +583,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
this.visualMode = visualMode;
if (visualMode != VisualMode.NONE) {
try {
queueVisualization(FawePlayer.wrap(player));
queueVisualization(player);
} catch (Throwable e) {
WorldEdit.getInstance().getPlatformManager().handleThrowable(e, player);
}
@ -614,7 +613,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
if (tmp.increment(player, amount)) {
if (visualMode != VisualMode.NONE) {
try {
queueVisualization(FawePlayer.wrap(player));
queueVisualization(player);
} catch (Throwable e) {
WorldEdit.getInstance().getPlatformManager().handleThrowable(e, player);
}
@ -628,7 +627,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
return false;
}
public void queueVisualization(FawePlayer fp) {
public void queueVisualization(Player fp) {
Fawe.get().getVisualQueue().queue(fp);
}
@ -641,9 +640,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
BrushSettings current = getContext();
Brush brush = current.getBrush();
if (brush == null) return;
FawePlayer<Object> fp = FawePlayer.wrap(player);
EditSessionBuilder builder = new EditSessionBuilder(player.getWorld())
.player(fp)
.player(player)
.allowedRegionsEverywhere()
.autoQueue(false)
.blockBag(null)
@ -674,8 +672,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
}
public void clear(Player player) {
FawePlayer<Object> fp = FawePlayer.wrap(player);
Fawe.get().getVisualQueue().dequeue(fp);
Fawe.get().getVisualQueue().dequeue(player);
if (visualExtent != null) {
visualExtent.clear();
}
@ -684,7 +681,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
@Override
public boolean move(Player player) {
if (visualMode != VisualMode.NONE) {
queueVisualization(FawePlayer.wrap(player));
queueVisualization(player);
return true;
}
return false;

View File

@ -82,7 +82,7 @@ public class FloatingTreeRemover implements BlockTool {
try {
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
if (blockSet == null) {
BBC.TOOL_DELTREE_FLOATING_ERROR.send(player);
player.printError(BBC.TOOL_DELTREE_FLOATING_ERROR.s());
return true;
}

View File

@ -23,7 +23,6 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -36,20 +35,19 @@ public class GravityBrush implements Brush {
}
@Override
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
int size = (int) sizeDouble;
int endY = position.getBlockY() + size;
int startPerformY = Math.max(0, position.getBlockY() - size);
int startCheckY = fullHeight ? 0 : startPerformY;
for (int x = position.getBlockX() + size; x > position.getBlockX() - size; --x) {
for (int z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) {
int freeSpot = startCheckY;
for (int y = startCheckY; y <= endY; y++) {
BlockStateHolder block = editSession.getBlock(x, y, z);
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
double endY = position.getY() + size;
double startPerformY = Math.max(0, position.getY() - size);
double startCheckY = fullHeight ? 0 : startPerformY;
for (double x = position.getX() + size; x > position.getX() - size; --x) {
for (double z = position.getZ() + size; z > position.getZ() - size; --z) {
double freeSpot = startCheckY;
for (double y = startCheckY; y <= endY; y++) {
BlockStateHolder block = editSession.getBlock((int)x, (int)y, (int)z);
if (!block.getBlockType().getMaterial().isAir()) {
if (y != freeSpot) {
editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
editSession.setBlock(x, freeSpot, z, block);
editSession.setBlock((int)x, (int)y, (int)z, BlockTypes.AIR.getDefaultState());
editSession.setBlock((int)x, (int)freeSpot, (int)z, block);
}
freeSpot = y + 1;
}