mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 20:56:41 +00:00
Add tracing feature to EditSessions (Upstream 1301) (#1112)
Co-authored-by: Octavia Togami <octavia.togami@gmail.com> Co-authored-by: dordsor21 <dordsor21@gmail.com> Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
@ -194,6 +194,8 @@ public class Fawe {
|
||||
case OTHER:
|
||||
logger.catching(e);
|
||||
throw e;
|
||||
case PLAYER_ONLY:
|
||||
case ACTOR_REQUIRED:
|
||||
case LOW_MEMORY:
|
||||
if (!faweExceptionReasonsUsed[type.ordinal()]) {
|
||||
logger.warn("FaweException: " + e.getMessage());
|
||||
|
@ -64,9 +64,9 @@ public class FaweAPI {
|
||||
* Offers a lot of options for building an EditSession.
|
||||
*
|
||||
* @return A new EditSessionBuilder
|
||||
* @see EditSessionBuilder
|
||||
* @deprecated See {@link WorldEdit#newEditSessionBuilder()}
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(forRemoval = true)
|
||||
public static EditSessionBuilder getEditSessionBuilder(World world) {
|
||||
return new EditSessionBuilder(world);
|
||||
}
|
||||
|
@ -172,6 +172,16 @@ public enum FaweCache implements Trimable {
|
||||
"fawe.cancel.worldedit.cancel.reason.max.iterations"),
|
||||
Type.MAX_ITERATIONS
|
||||
);
|
||||
public static final FaweException PLAYER_ONLY = new FaweException(
|
||||
Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason.player-only"),
|
||||
Type.PLAYER_ONLY
|
||||
);
|
||||
public static final FaweException ACTOR_REQUIRED = new FaweException(
|
||||
Caption.of(
|
||||
"fawe.cancel.worldedit.cancel.reason.actor-required"),
|
||||
Type.ACTOR_REQUIRED
|
||||
);
|
||||
|
||||
/*
|
||||
thread cache
|
||||
|
@ -60,7 +60,7 @@ public class AnvilCommands {
|
||||
// boolean copy = false;
|
||||
// if (FaweAPI.getWorld(folder) != null) {
|
||||
// if (!force) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.anvil.world.is.loaded"))
|
||||
// player.print(Caption.of("fawe.worldedit.anvil.world.is.loaded"))
|
||||
// return null;
|
||||
// }
|
||||
// copy = true;
|
||||
@ -88,7 +88,7 @@ public class AnvilCommands {
|
||||
// @Deprecated
|
||||
// public static <G, T extends MCAFilter<G>> T runWithSelection(Player player, EditSession editSession, Region selection, T filter) {
|
||||
// if (!(selection instanceof CuboidRegion)) {
|
||||
// player.print(TranslatableComponent.of("fawe.error.no.region"))
|
||||
// player.print(Caption.of("fawe.error.no.region"))
|
||||
// return null;
|
||||
// }
|
||||
// CuboidRegion cuboid = (CuboidRegion) selection;
|
||||
@ -111,7 +111,7 @@ public class AnvilCommands {
|
||||
// } else {
|
||||
// AnvilHistory history = new AnvilHistory(world.getName(), fp.getUUID());
|
||||
// run.accept(history);
|
||||
// session.remember(fp.getPlayer(), world, history, fp.getLimit());
|
||||
// session.remember(fp.getActor(), world, history, fp.getLimit());
|
||||
// }
|
||||
// }
|
||||
|
||||
@ -141,7 +141,7 @@ public class AnvilCommands {
|
||||
// final FaweBlockMatcher matchTo = FaweBlockMatcher.setBlocks(worldEdit.getBlocks(player, to, true));
|
||||
// ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
|
||||
// ReplaceSimpleFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// if (result != null) player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -158,7 +158,7 @@ public class AnvilCommands {
|
||||
// RemapFilter filter = new RemapFilter(from, to);
|
||||
// RemapFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ public class AnvilCommands {
|
||||
// DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
|
||||
// DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ public class AnvilCommands {
|
||||
// }
|
||||
// DeleteUnclaimedFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ public class AnvilCommands {
|
||||
// }
|
||||
// DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ public class AnvilCommands {
|
||||
// DeleteOldFilter filter = new DeleteOldFilter(duration);
|
||||
// DeleteOldFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ public class AnvilCommands {
|
||||
// MCAQueue queue = new MCAQueue(defaultQueue);
|
||||
// PlotTrimFilter result = queue.filterWorld(filter);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ public class AnvilCommands {
|
||||
// DeleteBiomeFilterSimple filter = new DeleteBiomeFilterSimple(biome); TODO NOT IMPLEMENTED
|
||||
// DeleteBiomeFilterSimple result = runWithWorld(player, folder, filter, true, unsafe);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ public class AnvilCommands {
|
||||
// TrimAirFilter filter = new TrimAirFilter(); TODO NOT IMPLEMENTED
|
||||
// TrimAirFilter result = runWithWorld(player, folder, filter, true, unsafe);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ public class AnvilCommands {
|
||||
// DebugFixP2Roads filter = new DebugFixP2Roads(); TODO NOT IMPLEMENTED
|
||||
// DebugFixP2Roads result = runWithWorld(player, folder, filter, true, true);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ public class AnvilCommands {
|
||||
// filter = new ReplacePatternFilter(matchFrom, to);
|
||||
// }
|
||||
// MCAFilterCounter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// if (result != null) player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
}
|
||||
|
||||
//
|
||||
@ -389,7 +389,7 @@ public class AnvilCommands {
|
||||
// filter = counter;
|
||||
// }
|
||||
// MCAFilterCounter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
|
||||
// if (result != null) player.print(Caption.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -441,7 +441,7 @@ public class AnvilCommands {
|
||||
// };
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ public class AnvilCommands {
|
||||
// filter = counter;
|
||||
// }
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
|
||||
// if (result != null) player.print(Caption.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
|
||||
}
|
||||
|
||||
//
|
||||
@ -576,7 +576,7 @@ public class AnvilCommands {
|
||||
// ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -616,7 +616,7 @@ public class AnvilCommands {
|
||||
// }
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ public class AnvilCommands {
|
||||
// MCAFilterCounter filter = new SetPatternFilter(to); TODO NOT IMPLEMENTED
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -650,7 +650,7 @@ public class AnvilCommands {
|
||||
// RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id);
|
||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||
// if (result != null) {
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// player.print(Caption.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
|
||||
// }
|
||||
}
|
||||
|
||||
@ -663,7 +663,7 @@ public class AnvilCommands {
|
||||
public void copy(Player player, LocalSession session, EditSession editSession, @Selection Region selection) throws
|
||||
WorldEditException {
|
||||
// if (!(selection instanceof CuboidRegion)) { TODO NOT IMPLEMENTED
|
||||
// player.print(TranslatableComponent.of("fawe.error.no.region"))
|
||||
// player.print(Caption.of("fawe.error.no.region"))
|
||||
// return;
|
||||
// }
|
||||
// CuboidRegion cuboid = (CuboidRegion) selection;
|
||||
@ -674,7 +674,7 @@ public class AnvilCommands {
|
||||
// MCAClipboard clipboard = new MCAClipboard(queue, cuboid, origin);
|
||||
// FawePlayer fp = FawePlayer.wrap(player);
|
||||
// fp.setMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD, clipboard);
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy", selection.getArea()));
|
||||
// player.print(Caption.of("fawe.worldedit.copy.command.copy", selection.getArea()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -714,7 +714,7 @@ public class AnvilCommands {
|
||||
// pasteQueue.pasteRegion(copyQueue, copyRegion, offset, iAnvilHistory);
|
||||
// } catch (IOException e) { throw new RuntimeException(e); }
|
||||
// });
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.paste.command.paste", player.getPosition().toBlockVector()));
|
||||
// player.print(Caption.of("fawe.worldedit.paste.command.paste", player.getPosition().toBlockVector()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package com.fastasyncworldedit.core.command.tool.brush;
|
||||
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.command.tool.ResettableTool;
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.internal.exception.FaweException;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
@ -35,19 +38,20 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
@Override
|
||||
public void build(EditSession editSession, BlockVector3 pos2, final Pattern pattern, double size) throws
|
||||
MaxChangedBlocksException {
|
||||
Player player = editSession.getPlayer();
|
||||
if (player == null) {
|
||||
return; //todo throw error
|
||||
Actor actor = editSession.getActor();
|
||||
if (!(actor instanceof Player)) {
|
||||
throw FaweCache.PLAYER_ONLY;
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
if (pos1 == null || pos2.equals(pos1)) {
|
||||
pos1 = pos2;
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.line.primary", pos2));
|
||||
actor.print(Caption.of("fawe.worldedit.brush.brush.line.primary", pos2));
|
||||
return;
|
||||
}
|
||||
if (this.vertex == null) {
|
||||
vertex = getVertex(pos1.toVector3(), pos2.toVector3(), slack);
|
||||
if (this.direction) {
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.catenary.direction", 2));
|
||||
actor.print(Caption.of("fawe.worldedit.brush.brush.catenary.direction", 2));
|
||||
return;
|
||||
}
|
||||
} else if (this.direction) {
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.fastasyncworldedit.core.command.tool.brush;
|
||||
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
@ -21,10 +23,11 @@ public class CircleBrush implements Brush {
|
||||
@Override
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws
|
||||
MaxChangedBlocksException {
|
||||
Player player = editSession.getPlayer();
|
||||
if (player == null) {
|
||||
return;
|
||||
Actor actor = editSession.getActor();
|
||||
if (!(actor instanceof Player)) {
|
||||
throw FaweCache.PLAYER_ONLY;
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
Vector3 normal = position.toVector3().subtract(player.getLocation());
|
||||
editSession.makeCircle(position, pattern, size, size, size, filled, normal);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fastasyncworldedit.core.command.tool.brush;
|
||||
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.util.StringMan;
|
||||
import com.fastasyncworldedit.core.wrappers.AsyncPlayer;
|
||||
import com.fastasyncworldedit.core.wrappers.LocationMaskedPlayerWrapper;
|
||||
@ -9,6 +10,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -40,7 +42,11 @@ public class CommandBrush implements Brush {
|
||||
.replace("{world}", editSession.getWorld().getName())
|
||||
.replace("{size}", Integer.toString(radius));
|
||||
|
||||
Player player = editSession.getPlayer();
|
||||
Actor actor = editSession.getActor();
|
||||
if (!(actor instanceof Player)) {
|
||||
throw FaweCache.PLAYER_ONLY;
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
//Use max world height to allow full coverage of the world height
|
||||
Location face = player.getBlockTraceFace(editSession.getWorld().getMaxY(), true);
|
||||
if (face == null) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fastasyncworldedit.core.command.tool.brush;
|
||||
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.command.tool.ResettableTool;
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.extent.clipboard.ResizableClipboardBuilder;
|
||||
@ -10,6 +11,7 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
@ -51,10 +53,11 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
||||
@Override
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws
|
||||
MaxChangedBlocksException {
|
||||
Player player = editSession.getPlayer();
|
||||
if (player == null) {
|
||||
return;
|
||||
Actor actor = editSession.getActor();
|
||||
if (!(actor instanceof Player)) {
|
||||
throw FaweCache.PLAYER_ONLY;
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
ClipboardHolder clipboard = session.getExistingClipboard();
|
||||
if (clipboard == null) {
|
||||
Mask mask = editSession.getMask();
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.fastasyncworldedit.core.command.tool.brush;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.internal.exception.FaweException;
|
||||
import com.fastasyncworldedit.core.math.heightmap.HeightMap;
|
||||
import com.fastasyncworldedit.core.math.heightmap.RotatableHeightMap;
|
||||
import com.fastasyncworldedit.core.math.heightmap.ScalableHeightMap;
|
||||
import com.fastasyncworldedit.core.internal.exception.FaweException;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fastasyncworldedit.core.command.tool.brush;
|
||||
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.function.mask.ImageBrushMask;
|
||||
import com.fastasyncworldedit.core.function.mask.SurfaceMask;
|
||||
import com.fastasyncworldedit.core.util.TextureUtil;
|
||||
@ -8,6 +9,8 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
@ -85,7 +88,12 @@ public class ImageBrush implements Brush {
|
||||
|
||||
double scale = Math.max(width, height) / sizeDouble;
|
||||
|
||||
Location loc = editSession.getPlayer().getLocation();
|
||||
Actor actor = editSession.getActor();
|
||||
if (!(actor instanceof Player)) {
|
||||
throw FaweCache.PLAYER_ONLY;
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
Location loc = player.getLocation();
|
||||
float yaw = loc.getYaw();
|
||||
float pitch = loc.getPitch();
|
||||
AffineTransform transform = new AffineTransform().rotateY((-yaw) % 360).rotateX((pitch - 90) % 360).inverse();
|
||||
|
@ -26,11 +26,11 @@ public class LineBrush implements Brush, ResettableTool {
|
||||
MaxChangedBlocksException {
|
||||
if (pos1 == null) {
|
||||
pos1 = position;
|
||||
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.brush.line.primary", position));
|
||||
editSession.getActor().print(Caption.of("fawe.worldedit.brush.brush.line.primary", position));
|
||||
return;
|
||||
}
|
||||
editSession.drawLine(pattern, pos1, position, size, !shell, flat);
|
||||
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.brush.line.secondary"));
|
||||
editSession.getActor().print(Caption.of("fawe.worldedit.brush.brush.line.secondary"));
|
||||
if (!select) {
|
||||
pos1 = null;
|
||||
} else {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fastasyncworldedit.core.command.tool.brush;
|
||||
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.math.LocalBlockVectorSet;
|
||||
import com.fastasyncworldedit.core.util.StringMan;
|
||||
import com.fastasyncworldedit.core.wrappers.LocationMaskedPlayerWrapper;
|
||||
@ -7,6 +8,7 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -47,7 +49,11 @@ public class ScatterCommand extends ScatterBrush {
|
||||
.replace("{world}", editSession.getWorld().getName())
|
||||
.replace("{size}", Integer.toString(radius));
|
||||
|
||||
Player player = editSession.getPlayer();
|
||||
Actor actor = editSession.getActor();
|
||||
if (!(actor instanceof Player)) {
|
||||
throw FaweCache.PLAYER_ONLY;
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
player.setSelection(selector);
|
||||
List<String> cmds = StringMan.split(replaced, ';');
|
||||
for (String cmd : cmds) {
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.fastasyncworldedit.core.command.tool.brush;
|
||||
|
||||
import com.fastasyncworldedit.core.math.heightmap.HeightMap;
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.function.mask.StencilBrushMask;
|
||||
import com.fastasyncworldedit.core.math.heightmap.HeightMap;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
@ -47,7 +50,12 @@ public class StencilBrush extends HeightBrush {
|
||||
int cutoff = onlyWhite ? maxY - minY : 0;
|
||||
final SolidBlockMask solid = new SolidBlockMask(editSession);
|
||||
|
||||
Location loc = editSession.getPlayer().getLocation();
|
||||
Actor actor = editSession.getActor();
|
||||
if (!(actor instanceof Player)) {
|
||||
throw FaweCache.PLAYER_ONLY;
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
Location loc = player.getLocation();
|
||||
float yaw = loc.getYaw();
|
||||
float pitch = loc.getPitch();
|
||||
AffineTransform transform = new AffineTransform().rotateY((-yaw) % 360).rotateX(pitch - 90).inverse();
|
||||
|
@ -49,7 +49,9 @@ public class SurfaceSpline implements Brush {
|
||||
return;
|
||||
}
|
||||
path.add(BlockVector3.at(pos.getBlockX(), max, pos.getBlockZ()));
|
||||
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
|
||||
if (editSession.getActor() != null) {
|
||||
editSession.getActor().print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
final List<Node> nodes = new ArrayList<>(path.size());
|
||||
@ -105,7 +107,9 @@ public class SurfaceSpline implements Brush {
|
||||
editSession.setBlocks(newSet, pattern);
|
||||
path.clear();
|
||||
}
|
||||
editSession.getPlayer().print(Caption.of("fawe.worldedit.brush.spline.secondary"));
|
||||
if (editSession.getActor() != null) {
|
||||
editSession.getActor().print(Caption.of("fawe.worldedit.brush.spline.secondary"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fastasyncworldedit.core.command.tool.sweep;
|
||||
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.command.tool.ResettableTool;
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
@ -8,6 +9,7 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -44,19 +46,18 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
|
||||
boolean newPos = !position.equals(this.position);
|
||||
this.position = position;
|
||||
Player player = editSession.getPlayer();
|
||||
if (player == null) {
|
||||
//TODO Insert Error Message here or modify EditSession to not require a player.
|
||||
return;
|
||||
Actor actor = editSession.getActor();
|
||||
if (!(actor instanceof Player)) {
|
||||
throw FaweCache.ACTOR_REQUIRED;
|
||||
}
|
||||
if (newPos) {
|
||||
player.print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
|
||||
actor.print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
|
||||
positions.add(position);
|
||||
return;
|
||||
}
|
||||
|
||||
if (positions.size() < 2) {
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.spline.secondary.error"));
|
||||
actor.print(Caption.of("fawe.worldedit.brush.brush.spline.secondary.error"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -70,7 +71,7 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
}).collect(Collectors.toList());
|
||||
interpol.setNodes(nodes);
|
||||
|
||||
LocalSession session = player.getSession();
|
||||
LocalSession session = actor.getSession();
|
||||
ClipboardHolder holder = session.getExistingClipboard();
|
||||
if (holder == null) {
|
||||
throw new RuntimeException(new EmptyClipboardException());
|
||||
@ -108,7 +109,7 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
break;
|
||||
}
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.brush.spline.secondary"));
|
||||
actor.print(Caption.of("fawe.worldedit.brush.spline.secondary"));
|
||||
reset();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fastasyncworldedit.core.extension.factory.parser.transform;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.extension.factory.parser.RichParser;
|
||||
import com.fastasyncworldedit.core.extent.ResettableExtent;
|
||||
import com.fastasyncworldedit.core.extent.transform.OffsetTransform;
|
||||
@ -9,9 +10,8 @@ import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class OffsetTransformParser extends RichParser<ResettableExtent> {
|
||||
@ -36,9 +36,9 @@ public class OffsetTransformParser extends RichParser<ResettableExtent> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResettableExtent parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
|
||||
protected ResettableExtent parseFromInput(@Nonnull String[] arguments, ParserContext context) throws InputParseException {
|
||||
if (arguments.length != 3 && arguments.length != 4) {
|
||||
throw new InputParseException(TranslatableComponent.of(
|
||||
throw new InputParseException(Caption.of(
|
||||
"fawe.error.command.syntax",
|
||||
TextComponent.of("#offset[x][y][z]")
|
||||
));
|
||||
|
@ -129,7 +129,7 @@
|
||||
// URI uri = file.toURI();
|
||||
// ClipboardFormat format = ClipboardFormats.findByFile(file);
|
||||
// format.hold(player, uri, new FileInputStream(file));
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.loaded", filename));
|
||||
// player.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename));
|
||||
// session.setVirtualWorld(null);
|
||||
// return;
|
||||
// }
|
||||
@ -157,7 +157,7 @@
|
||||
// session.setClipboard(null);
|
||||
// }
|
||||
// select.put(clicked, false);
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.clipboard.clipboard.cleared"))
|
||||
// player.print(Caption.of("fawe.worldedit.clipboard.clipboard.cleared"))
|
||||
// }
|
||||
// } else {
|
||||
// // Add it
|
||||
@ -165,7 +165,7 @@
|
||||
// MultiClipboardHolder multi = new MultiClipboardHolder(URI.create(""), new LazyClipboardHolder(uri, source, format, null));
|
||||
// session.addClipboard(multi);
|
||||
// select.put(clicked, true);
|
||||
// player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.loaded", file.getName()));
|
||||
// player.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", file.getName()));
|
||||
// }
|
||||
// }
|
||||
// // Resend relevant chunks
|
||||
@ -501,7 +501,7 @@
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public FawePlayer getPlayer() {
|
||||
// public FawePlayer getActor() {
|
||||
// return player;
|
||||
// }
|
||||
//
|
||||
@ -567,7 +567,7 @@
|
||||
// clear();
|
||||
// chunks.clear();
|
||||
// files.clear();
|
||||
// player.getPlayer().setPosition(origin, origin.getPitch(), origin.getYaw());
|
||||
// player.getActor().setPosition(origin, origin.getPitch(), origin.getYaw());
|
||||
// if (update) {
|
||||
// IQueueExtent packetQueue = SetQueue.IMP.getNewQueue(player.getWorld(), true, false);
|
||||
//
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.fastasyncworldedit.core.function.mask;
|
||||
|
||||
import com.fastasyncworldedit.core.math.heightmap.HeightMap;
|
||||
import com.fastasyncworldedit.core.math.MutableVector3;
|
||||
import com.fastasyncworldedit.core.math.heightmap.HeightMap;
|
||||
import com.fastasyncworldedit.core.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
@ -8,13 +8,14 @@ import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
import com.fastasyncworldedit.core.queue.IChunk;
|
||||
import com.fastasyncworldedit.core.queue.IChunkGet;
|
||||
import com.fastasyncworldedit.core.queue.IChunkSet;
|
||||
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
||||
import com.fastasyncworldedit.core.util.MainUtil;
|
||||
import com.fastasyncworldedit.core.util.TaskManager;
|
||||
import com.fastasyncworldedit.core.world.block.BlockID;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EditSessionBuilder;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
@ -253,9 +254,8 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
|
||||
}
|
||||
|
||||
public EditSession toEditSession(Player player, Region[] regions) {
|
||||
EditSessionBuilder builder =
|
||||
new EditSessionBuilder(getWorld()).player(player).autoQueue(false).fastmode(false)
|
||||
.checkMemory(false).limitUnlimited();
|
||||
EditSessionBuilder builder = WorldEdit.getInstance().newEditSessionBuilder().world(getWorld()).actor(player).
|
||||
fastMode(false).checkMemory(false).changeSet(this).limitUnlimited();
|
||||
if (regions != null) {
|
||||
builder.allowedRegions(regions);
|
||||
} else {
|
||||
|
@ -88,6 +88,8 @@ public class FaweException extends RuntimeException {
|
||||
MAX_ITERATIONS,
|
||||
BLOCK_BAG,
|
||||
CHUNK,
|
||||
PLAYER_ONLY,
|
||||
ACTOR_REQUIRED,
|
||||
OTHER
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
||||
* Initialize the queue (for reusability)
|
||||
*
|
||||
* @param extent extent to use
|
||||
* @param get cache of chunk GET
|
||||
* @param set cache of chunk SET
|
||||
* @param get cache of chunk GET
|
||||
* @param set cache of chunk SET
|
||||
*/
|
||||
void init(Extent extent, IChunkCache<IChunkGet> get, IChunkCache<IChunkSet> set);
|
||||
|
||||
|
@ -3,12 +3,12 @@ package com.fastasyncworldedit.core.regions.selector;
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.extent.PassthroughExtent;
|
||||
import com.fastasyncworldedit.core.regions.FuzzyRegion;
|
||||
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
||||
import com.fastasyncworldedit.core.util.ExtentTraverser;
|
||||
import com.fastasyncworldedit.core.util.MaskTraverser;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -31,11 +31,10 @@ public class FuzzyRegionSelector extends PassthroughExtent implements RegionSele
|
||||
private final ArrayList<BlockVector3> positions;
|
||||
|
||||
public FuzzyRegionSelector(Player player, @Nullable World world, Mask mask) {
|
||||
super(new EditSessionBuilder(world)
|
||||
.player(player)
|
||||
super(WorldEdit.getInstance().newEditSessionBuilder().world(world)
|
||||
.actor(player)
|
||||
.changeSetNull()
|
||||
.checkMemory(false)
|
||||
.autoQueue(false)
|
||||
.build());
|
||||
this.player = player;
|
||||
this.region = new FuzzyRegion(world, getExtent(), mask);
|
||||
@ -51,11 +50,10 @@ public class FuzzyRegionSelector extends PassthroughExtent implements RegionSele
|
||||
|
||||
@Override
|
||||
public void setWorld(@Nullable World world) {
|
||||
EditSession extent = new EditSessionBuilder(world)
|
||||
.player(player)
|
||||
EditSession extent = WorldEdit.getInstance().newEditSessionBuilder().world(world)
|
||||
.actor(player)
|
||||
.changeSetNull()
|
||||
.checkMemory(false)
|
||||
.autoQueue(true)
|
||||
.build();
|
||||
new ExtentTraverser(this).setNext(extent);
|
||||
this.region.setWorld(world);
|
||||
|
@ -43,14 +43,15 @@ import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public class EditSessionBuilder {
|
||||
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
@ -73,6 +74,12 @@ public class EditSessionBuilder {
|
||||
private RelightMode relightMode;
|
||||
private Relighter relighter;
|
||||
private Boolean wnaMode;
|
||||
private AbstractChangeSet changeTask;
|
||||
private Extent bypassHistory;
|
||||
private Extent bypassAll;
|
||||
private Extent extent;
|
||||
private boolean compiled;
|
||||
private boolean wrapped;
|
||||
|
||||
/**
|
||||
* An EditSession builder<br>
|
||||
@ -89,7 +96,7 @@ public class EditSessionBuilder {
|
||||
*
|
||||
* @param world A world must be provided for all EditSession(s)
|
||||
*/
|
||||
public EditSessionBuilder(@Nonnull World world) {
|
||||
public EditSessionBuilder(World world) {
|
||||
checkNotNull(world);
|
||||
this.world = world;
|
||||
}
|
||||
@ -271,13 +278,6 @@ public class EditSessionBuilder {
|
||||
return extent;
|
||||
}
|
||||
|
||||
private AbstractChangeSet changeTask;
|
||||
private Extent bypassHistory;
|
||||
private Extent bypassAll;
|
||||
private Extent extent;
|
||||
private boolean compiled;
|
||||
private boolean wrapped;
|
||||
|
||||
public EditSessionBuilder compile() {
|
||||
if (compiled) {
|
||||
return this;
|
||||
@ -326,9 +326,9 @@ public class EditSessionBuilder {
|
||||
if (extent == null) {
|
||||
IQueueExtent<IQueueChunk> queue = null;
|
||||
World unwrapped = WorldWrapper.unwrap(world);
|
||||
boolean placeChunks = this.fastmode || this.limit.FAST_PLACEMENT;
|
||||
boolean placeChunks = (this.fastmode || this.limit.FAST_PLACEMENT) && (wnaMode == null || !wnaMode);
|
||||
|
||||
if (placeChunks && (wnaMode == null || !wnaMode)) {
|
||||
if (placeChunks) {
|
||||
wnaMode = false;
|
||||
if (unwrapped instanceof IQueueExtent) {
|
||||
extent = queue = (IQueueExtent) unwrapped;
|
||||
@ -413,18 +413,18 @@ public class EditSessionBuilder {
|
||||
}
|
||||
} else {
|
||||
allowedRegions = new Region[]{RegionWrapper.GLOBAL()};
|
||||
// this.extent = new HeightBoundExtent(this.extent, this.limit, 0, world.getMaxY());
|
||||
}
|
||||
// There's no need to do lighting (and it'll also just be a pain to implement) if we're not placing chunks
|
||||
if (placeChunks && ((relightMode != null && relightMode != RelightMode.NONE) || (relightMode == null && Settings.IMP.LIGHTING.MODE > 0))) {
|
||||
relighter = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.WORLD_EDITING)
|
||||
.getRelighterFactory().createRelighter(relightMode, world, queue);
|
||||
extent.addProcessor(new RelightProcessor(relighter));
|
||||
} else {
|
||||
if (placeChunks) {
|
||||
if (((relightMode != null && relightMode != RelightMode.NONE) || (relightMode == null && Settings.IMP.LIGHTING.MODE > 0))) {
|
||||
relighter = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.WORLD_EDITING)
|
||||
.getRelighterFactory().createRelighter(relightMode, world, queue);
|
||||
extent.addProcessor(new RelightProcessor(relighter));
|
||||
}
|
||||
extent.addProcessor(new HeightmapProcessor(world.getMinY(), world.getMaxY()));
|
||||
relighter = NullRelighter.INSTANCE;
|
||||
}
|
||||
extent.addProcessor(new HeightmapProcessor(world.getMinY(), world.getMaxY()));
|
||||
if (limit != null && !limit.isUnlimited() && regionExtent != null) {
|
||||
this.extent = new LimitExtent(regionExtent, limit);
|
||||
} else if (limit != null && !limit.isUnlimited()) {
|
||||
@ -496,4 +496,5 @@ public class EditSessionBuilder {
|
||||
return allowedRegions;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ package com.fastasyncworldedit.core.wrappers;
|
||||
|
||||
import com.fastasyncworldedit.core.Fawe;
|
||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||
import com.fastasyncworldedit.core.util.EditSessionBuilder;
|
||||
import com.fastasyncworldedit.core.util.TaskManager;
|
||||
import com.fastasyncworldedit.core.util.task.RunnableVal;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.PlayerProxy;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -151,8 +151,8 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
if (alwaysGlass || !isAllowedToFly()) {
|
||||
RuntimeException caught = null;
|
||||
try {
|
||||
EditSession edit =
|
||||
new EditSessionBuilder(WorldWrapper.unwrap(getWorld())).player(unwrap(getBasePlayer())).build();
|
||||
EditSession edit = WorldEdit.getInstance().newEditSessionBuilder().world(WorldWrapper.unwrap(getWorld())).actor(
|
||||
unwrap(getBasePlayer())).build();
|
||||
edit.setBlock(BlockVector3.at(x, y - 1, z), BlockTypes.GLASS);
|
||||
edit.flushQueue();
|
||||
LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this);
|
||||
|
Reference in New Issue
Block a user