mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Remove FawePlayer and API modifications
This commit is contained in:
@ -109,7 +109,7 @@ public class BiomeCommands {
|
||||
descFooter = "By default, uses all blocks in your selection."
|
||||
)
|
||||
@CommandPermissions("worldedit.biome.info")
|
||||
public void biomeInfo(Player player, LocalSession session, EditSession editSession,
|
||||
public void biomeInfo(Player player, LocalSession session,
|
||||
@Switch(name = 't', desc = "Use the block you are looking at.")
|
||||
boolean useLineOfSight,
|
||||
@Switch(name = 'p', desc = "Use the block you are currently in.")
|
||||
|
@ -25,7 +25,6 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.brush.BlendBall;
|
||||
import com.boydti.fawe.object.brush.BlobBrush;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
@ -127,7 +126,6 @@ import java.net.URI;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.util.List;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -647,8 +645,7 @@ public class BrushCommands {
|
||||
Mask maskOpt, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
FaweLimit limit = Settings.IMP.getLimit(fp);
|
||||
FaweLimit limit = Settings.IMP.getLimit(player);
|
||||
iterations = Math.min(limit.MAX_ITERATIONS, iterations);
|
||||
|
||||
set(session, context,
|
||||
|
@ -27,7 +27,6 @@ import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||
@ -116,7 +115,7 @@ public class ClipboardCommands {
|
||||
desc = "Copy the selection to the clipboard"
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.copy")
|
||||
public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void copy(Player player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Switch(name = 'e', desc = "Skip copy entities")
|
||||
boolean skipEntities,
|
||||
@ -129,11 +128,11 @@ public class ClipboardCommands {
|
||||
|
||||
long volume =
|
||||
((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
FaweLimit limit = player.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweException.MAX_CHECKS;
|
||||
}
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
session.setClipboard(null);
|
||||
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
||||
@ -178,7 +177,7 @@ public class ClipboardCommands {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
FaweLimit limit = player.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
@ -210,7 +209,7 @@ public class ClipboardCommands {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
FaweLimit limit = player.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweException.MAX_CHECKS;
|
||||
}
|
||||
@ -234,7 +233,7 @@ public class ClipboardCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.cut")
|
||||
@Logging(REGION)
|
||||
public void cut(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void cut(Player player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "Pattern to leave in place of the selection", def = "air")
|
||||
Pattern leavePattern,
|
||||
@ -249,14 +248,14 @@ public class ClipboardCommands {
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(player).getLimit();
|
||||
FaweLimit limit = player.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweException.MAX_CHECKS;
|
||||
}
|
||||
if (volume >= limit.MAX_CHANGES) {
|
||||
throw FaweException.MAX_CHANGES;
|
||||
}
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
session.setClipboard(null);
|
||||
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
||||
|
@ -28,7 +28,6 @@ import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgum
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
@ -92,7 +91,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.caves")
|
||||
@Logging(PLACEMENT)
|
||||
public void caves(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region,
|
||||
public void caves(Player fp, LocalSession session, EditSession editSession, @Selection Region region,
|
||||
@Arg(name = "size", desc = "TODO", def = "8") int sizeOpt,
|
||||
@Arg(name = "frequency", desc = "TODO", def = "40") int frequencyOpt,
|
||||
@Arg(name = "rarity", desc = "TODO", def = "7") int rarityOpt,
|
||||
@ -117,7 +116,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.ore")
|
||||
@Logging(PLACEMENT)
|
||||
public void ores(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, InjectedValueAccess context) throws WorldEditException {
|
||||
public void ores(Player fp, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
editSession.addOres(region, mask);
|
||||
BBC.VISITOR_BLOCK.send(fp, editSession.getBlockChangeCount());
|
||||
@ -171,7 +170,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.ore")
|
||||
@Logging(PLACEMENT)
|
||||
public void ore(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, Pattern material, @Arg(name="size", desc="Ore vein size") @Range(min = 0) int size, int freq, @Range(min = 0, max = 100) int rarity, @Range(min = 0, max = 255) int minY, @Range(min = 0, max = 255) int maxY, InjectedValueAccess context) throws WorldEditException {
|
||||
public void ore(Player fp, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, Pattern material, @Arg(name="size", desc="Ore vein size") @Range(min = 0) int size, int freq, @Range(min = 0, max = 100) int rarity, @Range(min = 0, max = 255) int minY, @Range(min = 0, max = 255) int maxY, InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY);
|
||||
BBC.VISITOR_BLOCK.send(fp, editSession.getBlockChangeCount());
|
||||
@ -184,7 +183,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.cylinder")
|
||||
@Logging(PLACEMENT)
|
||||
public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void hcyl(Player fp, Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The pattern of blocks to generate")
|
||||
Pattern pattern,
|
||||
BlockVector2 radius,
|
||||
@ -206,7 +205,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.cylinder")
|
||||
@Logging(PLACEMENT)
|
||||
public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void cyl(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The pattern of blocks to generate")
|
||||
Pattern pattern,
|
||||
BlockVector2 radius,
|
||||
@ -217,9 +216,9 @@ public class GenerationCommands {
|
||||
double max = Math.max(radius.getBlockX(), radius.getBlockZ());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
player.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makeCylinder(pos, pattern, radius.getX(), radius.getZ(), Math.min(256, height), !hollow);
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
}, "/cyl", (int) max, context);
|
||||
}
|
||||
|
||||
@ -229,14 +228,14 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.sphere")
|
||||
@Logging(PLACEMENT)
|
||||
public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void hsphere(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The pattern of blocks to generate")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The radii of the sphere. Order is N/S, U/D, E/W") BlockVector3 radii,
|
||||
@Switch(name = 'r', desc = "Raise the bottom of the sphere to the placement position")
|
||||
boolean raised,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
sphere(fp, player, session, editSession, pattern, radii, raised, true, context);
|
||||
sphere(player, session, editSession, pattern, radii, raised, true, context);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -245,7 +244,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.sphere")
|
||||
@Logging(PLACEMENT)
|
||||
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void sphere(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The pattern of blocks to generate")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The radii of the sphere. Order is N/S, U/D, E/W")
|
||||
@ -258,10 +257,10 @@ public class GenerationCommands {
|
||||
worldEdit.checkMaxRadius(max);
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
BlockVector3 finalPos = raised ? pos.add(0, radii.getY(), 0) : pos;
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
player.checkConfirmationRadius(() -> {
|
||||
int affected = editSession.makeSphere(finalPos, pattern, radii.getX(), radii.getY(), radii.getZ(), !hollow);
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
}, "sphere", (int) max, context);
|
||||
}
|
||||
|
||||
@ -310,7 +309,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.pyramid")
|
||||
@Logging(PLACEMENT)
|
||||
public void hollowPyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void hollowPyramid(Player fp, Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The size of the pyramid")
|
||||
@ -324,7 +323,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.pyramid")
|
||||
@Logging(PLACEMENT)
|
||||
public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void pyramid(Player fp, Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The size of the pyramid")
|
||||
@ -349,7 +348,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.shape")
|
||||
@Logging(ALL)
|
||||
public void generate(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||
public void generate(Player fp, Player player, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern,
|
||||
@ -415,7 +414,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.shape.biome")
|
||||
@Logging(ALL)
|
||||
public void generateBiome(FawePlayer fp, LocalSession session, EditSession editSession,
|
||||
public void generateBiome(Player fp, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The biome type to set")
|
||||
BiomeType target,
|
||||
@ -437,7 +436,7 @@ public class GenerationCommands {
|
||||
zero = Vector3.ZERO;
|
||||
unit = Vector3.ONE;
|
||||
} else if (offset) {
|
||||
zero = session.getPlacementPosition(fp.toWorldEditPlayer()).toVector3();
|
||||
zero = session.getPlacementPosition(fp).toVector3();
|
||||
unit = Vector3.ONE;
|
||||
} else if (offsetCenter) {
|
||||
final Vector3 min = region.getMinimumPoint().toVector3();
|
||||
|
@ -20,7 +20,6 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.MethodCommands.getArguments;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
@ -29,7 +28,6 @@ import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.database.DBHandler;
|
||||
import com.boydti.fawe.database.RollbackDatabase;
|
||||
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
@ -146,8 +144,8 @@ public class HistoryCommands {
|
||||
UUID uuid = player.getUniqueId();
|
||||
DiskStorageHistory file = new DiskStorageHistory(world, uuid, index);
|
||||
if (file.getBDFile().exists()) {
|
||||
if (restore) file.redo(FawePlayer.wrap(player));
|
||||
else file.undo(FawePlayer.wrap(player));
|
||||
if (restore) file.redo(player);
|
||||
else file.undo(player);
|
||||
BBC.ROLLBACK_ELEMENT.send(player, world.getName() + "/" + user + "-" + index);
|
||||
} else {
|
||||
BBC.TOOL_INSPECT_INFO_FOOTER.send(player, 0);
|
||||
@ -177,11 +175,10 @@ public class HistoryCommands {
|
||||
bot = bot.withY(Math.min(255, top.getY()));
|
||||
RollbackDatabase database = DBHandler.IMP.getDatabase(world);
|
||||
final AtomicInteger count = new AtomicInteger();
|
||||
final FawePlayer fp = FawePlayer.wrap(player);
|
||||
|
||||
Region[] allowedRegions = fp.getCurrentRegions(FaweMaskManager.MaskType.OWNER);
|
||||
Region[] allowedRegions = player.getCurrentRegions(FaweMaskManager.MaskType.OWNER);
|
||||
if (allowedRegions == null) {
|
||||
BBC.NO_REGION.send(fp);
|
||||
BBC.NO_REGION.send(player);
|
||||
return;
|
||||
}
|
||||
// TODO mask the regions bot / top to the bottom and top coord in the allowedRegions
|
||||
@ -194,7 +191,7 @@ public class HistoryCommands {
|
||||
database.getPotentialEdits(other, System.currentTimeMillis() - timeDiff, bot, top, new RunnableVal<DiskStorageHistory>() {
|
||||
@Override
|
||||
public void run(DiskStorageHistory edit) {
|
||||
edit.undo(fp, allowedRegions);
|
||||
edit.undo(player, allowedRegions);
|
||||
BBC.ROLLBACK_ELEMENT.send(player, edit.getWorld().getName() + "/" + user + "-" + edit.getIndex());
|
||||
count.incrementAndGet();
|
||||
}
|
||||
@ -242,7 +239,7 @@ public class HistoryCommands {
|
||||
undoSession = session;
|
||||
}
|
||||
int finalTimes = times;
|
||||
FawePlayer.wrap(player).checkConfirmation(() -> {
|
||||
player.checkConfirmation(() -> {
|
||||
EditSession undone = null;
|
||||
int i = 0;
|
||||
for (; i < finalTimes; ++i) {
|
||||
|
@ -1,16 +1,41 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.object.DataAnglePattern;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.collection.RandomCollection;
|
||||
import com.boydti.fawe.object.pattern.*;
|
||||
import com.boydti.fawe.object.pattern.AngleColorPattern;
|
||||
import com.boydti.fawe.object.pattern.AverageColorPattern;
|
||||
import com.boydti.fawe.object.pattern.BiomePattern;
|
||||
import com.boydti.fawe.object.pattern.BufferedPattern;
|
||||
import com.boydti.fawe.object.pattern.BufferedPattern2D;
|
||||
import com.boydti.fawe.object.pattern.DataPattern;
|
||||
import com.boydti.fawe.object.pattern.DesaturatePattern;
|
||||
import com.boydti.fawe.object.pattern.ExistingPattern;
|
||||
import com.boydti.fawe.object.pattern.ExpressionPattern;
|
||||
import com.boydti.fawe.object.pattern.FullClipboardPattern;
|
||||
import com.boydti.fawe.object.pattern.IdDataMaskPattern;
|
||||
import com.boydti.fawe.object.pattern.IdPattern;
|
||||
import com.boydti.fawe.object.pattern.Linear2DBlockPattern;
|
||||
import com.boydti.fawe.object.pattern.Linear3DBlockPattern;
|
||||
import com.boydti.fawe.object.pattern.LinearBlockPattern;
|
||||
import com.boydti.fawe.object.pattern.MaskedPattern;
|
||||
import com.boydti.fawe.object.pattern.NoXPattern;
|
||||
import com.boydti.fawe.object.pattern.NoYPattern;
|
||||
import com.boydti.fawe.object.pattern.NoZPattern;
|
||||
import com.boydti.fawe.object.pattern.OffsetPattern;
|
||||
import com.boydti.fawe.object.pattern.PropertyPattern;
|
||||
import com.boydti.fawe.object.pattern.RandomFullClipboardPattern;
|
||||
import com.boydti.fawe.object.pattern.RandomOffsetPattern;
|
||||
import com.boydti.fawe.object.pattern.RelativePattern;
|
||||
import com.boydti.fawe.object.pattern.SaturatePattern;
|
||||
import com.boydti.fawe.object.pattern.ShadePattern;
|
||||
import com.boydti.fawe.object.pattern.SolidRandomOffsetPattern;
|
||||
import com.boydti.fawe.object.pattern.SurfaceRandomOffsetPattern;
|
||||
import com.boydti.fawe.object.random.SimplexRandom;
|
||||
import com.boydti.fawe.util.ColorUtil;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -21,21 +46,21 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.ClipboardPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
//@Command(aliases = {"patterns"},
|
||||
// desc = "Help for the various patterns. [More Info](https://git.io/vSPmA)",
|
||||
@ -184,7 +209,7 @@ public class PatternCommands {
|
||||
"Use with a brush when you don't want to apply to the same spot twice"
|
||||
)
|
||||
public Pattern buffer(Actor actor, Pattern pattern) {
|
||||
return new BufferedPattern(FawePlayer.wrap(actor), pattern);
|
||||
return new BufferedPattern(actor, pattern);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -192,7 +217,7 @@ public class PatternCommands {
|
||||
desc = "Only place a block once in a column while a pattern is in use"
|
||||
)
|
||||
public Pattern buffer2d(Actor actor, Pattern pattern) {
|
||||
return new BufferedPattern2D(FawePlayer.wrap(actor), pattern);
|
||||
return new BufferedPattern2D(actor, pattern);
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -32,7 +32,6 @@ import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
@ -108,7 +107,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.set")
|
||||
@Logging(REGION)
|
||||
public void set(FawePlayer fp, EditSession editSession,
|
||||
public void set(Player fp, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
||||
@ -128,16 +127,15 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.fix")
|
||||
public void fixLighting(Player player) throws WorldEditException {
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
final Location loc = player.getLocation();
|
||||
Region selection = fp.getSelection();
|
||||
Region selection = player.getSelection();
|
||||
if (selection == null) {
|
||||
final int cx = loc.getBlockX() >> 4;
|
||||
final int cz = loc.getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection,null);
|
||||
BBC.LIGHTING_PROPAGATE_SELECTION.send(fp, count);
|
||||
BBC.LIGHTING_PROPAGATE_SELECTION.send(player, count);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -146,11 +144,10 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.fix")
|
||||
public void getLighting(Player player, EditSession editSession) throws WorldEditException {
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
final Location loc = player.getLocation();
|
||||
int block = editSession.getBlockLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
int sky = editSession.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
fp.sendMessage("Light: " + block + " | " + sky);
|
||||
player.print("Light: " + block + " | " + sky);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -159,15 +156,14 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.remove")
|
||||
public void removeLighting(Player player) {
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
Region selection = fp.getSelection();
|
||||
Region selection = player.getSelection();
|
||||
if (selection == null) {
|
||||
final int cx = player.getLocation().getBlockX() >> 4;
|
||||
final int cz = player.getLocation().getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection, null);
|
||||
BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
|
||||
BBC.UPDATED_LIGHTING_SELECTION.send(player, count);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -244,7 +240,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.curve")
|
||||
@Logging(REGION)
|
||||
public void curve(FawePlayer fp, EditSession editSession,
|
||||
public void curve(Player fp, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to place")
|
||||
Pattern patternArg,
|
||||
@ -275,7 +271,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.replace")
|
||||
@Logging(REGION)
|
||||
public void replace(FawePlayer fp, EditSession editSession, @Selection Region region,
|
||||
public void replace(Player fp, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The mask representing blocks to replace", def = "")
|
||||
Mask from,
|
||||
@Arg(desc = "The pattern of blocks to replace with")
|
||||
@ -302,7 +298,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.overlay")
|
||||
@Logging(REGION)
|
||||
public void overlay(FawePlayer fp, EditSession editSession, @Selection Region region,
|
||||
public void overlay(Player fp, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to overlay")
|
||||
Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
@ -317,7 +313,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.overlay")
|
||||
@Logging(REGION)
|
||||
public void lay(FawePlayer fp, EditSession editSession, @Selection Region region, @Arg(name = "pattern", desc = "The pattern of blocks to lay") Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
||||
public void lay(Player fp, EditSession editSession, @Selection Region region, @Arg(name = "pattern", desc = "The pattern of blocks to lay") Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
int maxY = max.getBlockY();
|
||||
@ -357,7 +353,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.naturalize")
|
||||
@Logging(REGION)
|
||||
public void naturalize(FawePlayer fp, EditSession editSession, @Selection Region region, InjectedValueAccess context) throws WorldEditException {
|
||||
public void naturalize(Player fp, EditSession editSession, @Selection Region region, InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.naturalizeCuboidBlocks(region);
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
@ -370,7 +366,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.walls")
|
||||
@Logging(REGION)
|
||||
public void walls(FawePlayer fp, EditSession editSession, @Selection Region region,
|
||||
public void walls(Player fp, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
@ -386,7 +382,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.faces")
|
||||
@Logging(REGION)
|
||||
public void faces(FawePlayer fp, EditSession editSession, @Selection Region region,
|
||||
public void faces(Player fp, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
@ -402,7 +398,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.smooth")
|
||||
@Logging(REGION)
|
||||
public void smooth(FawePlayer fp, EditSession editSession, @Selection Region region,
|
||||
public void smooth(Player fp, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "# of iterations to perform", def = "1")
|
||||
int iterations,
|
||||
@Arg(desc = "The mask of blocks to use as the height map", def = "")
|
||||
@ -411,7 +407,7 @@ public class RegionCommands {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
FaweLimit limit = FawePlayer.wrap(fp).getLimit();
|
||||
FaweLimit limit = fp.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweException.MAX_CHECKS;
|
||||
}
|
||||
@ -449,7 +445,7 @@ public class RegionCommands {
|
||||
descFooter = "Select your current allowed region"
|
||||
)
|
||||
@CommandPermissions("fawe.worldeditregion")
|
||||
public void wer(FawePlayer fp) throws WorldEditException {
|
||||
public void wer(Player fp) throws WorldEditException {
|
||||
final Region region = fp.getLargestRegion();
|
||||
if (region == null) {
|
||||
BBC.NO_REGION.send(fp);
|
||||
@ -466,7 +462,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.move")
|
||||
@Logging(ORIENTATION_REGION)
|
||||
public void move(FawePlayer fp, World world, EditSession editSession, LocalSession session,
|
||||
public void move(Player player, World world, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "# of blocks to move", def = "1")
|
||||
int count,
|
||||
@ -485,7 +481,7 @@ public class RegionCommands {
|
||||
boolean skipEntities,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
checkCommandArgument(count >= 1, "Count must be >= 1");
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.moveRegion(region, direction, count, !ignoreAirBlocks, !skipEntities, copyBiomes, replace);
|
||||
|
||||
if (moveSelection) {
|
||||
@ -493,13 +489,13 @@ public class RegionCommands {
|
||||
region.shift(direction.multiply(count));
|
||||
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
session.getRegionSelector(world).explainRegionAdjust(fp.getPlayer(), session);
|
||||
session.getRegionSelector(world).explainRegionAdjust(player, session);
|
||||
} catch (RegionOperationException e) {
|
||||
fp.printError(e.getMessage());
|
||||
player.printError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
}, getArguments(context), region, context);
|
||||
}
|
||||
|
||||
@ -511,14 +507,14 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.fall")
|
||||
@Logging(ORIENTATION_REGION)
|
||||
public void fall(FawePlayer fp, EditSession editSession, LocalSession session,
|
||||
public void fall(Player player, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(name = "replace", desc = "BlockStateHolder", def = "air") BlockStateHolder replace,
|
||||
@Switch(name = 'm', desc = "TODO") boolean notFullHeight,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.fall(region, !notFullHeight, replace);
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
}, getArguments(context), region, context);
|
||||
}
|
||||
|
||||
@ -528,7 +524,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.stack")
|
||||
@Logging(ORIENTATION_REGION)
|
||||
public void stack(FawePlayer fp, EditSession editSession, LocalSession session,
|
||||
public void stack(Player player, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "# of copies to stack", def = "1")
|
||||
int count,
|
||||
@ -546,7 +542,7 @@ public class RegionCommands {
|
||||
@ArgFlag(name = 'm', desc = "Source mask")
|
||||
Mask sourceMask,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
fp.checkConfirmationStack(() -> {
|
||||
player.checkConfirmationStack(() -> {
|
||||
if (sourceMask != null) {
|
||||
editSession.addSourceMask(sourceMask);
|
||||
}
|
||||
@ -559,14 +555,14 @@ public class RegionCommands {
|
||||
final BlockVector3 shiftVector = direction.toVector3().multiply(count * (Math.abs(direction.dot(size)) + 1)).toBlockPoint();
|
||||
region.shift(shiftVector);
|
||||
|
||||
session.getRegionSelector(fp.getWorld()).learnChanges();
|
||||
session.getRegionSelector(fp.getWorld()).explainRegionAdjust(fp.getPlayer(), session);
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
} catch (RegionOperationException e) {
|
||||
fp.toWorldEditPlayer().printError(e.getMessage());
|
||||
player.printError(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
}, getArguments(context), region, count, context);
|
||||
}
|
||||
|
||||
@ -579,7 +575,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.deform")
|
||||
@Logging(ALL)
|
||||
public void deform(FawePlayer fp, Player player, LocalSession session, EditSession editSession, InjectedValueAccess context,
|
||||
public void deform(Player player, LocalSession session, EditSession editSession, InjectedValueAccess context,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The expression to use", variable = true)
|
||||
List<String> expression,
|
||||
@ -609,11 +605,11 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
fp.checkConfirmationRegion(() -> {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
try {
|
||||
final int affected = editSession.deformRegion(region, zero, unit1, String.join(" ", expression), session.getTimeout());
|
||||
player.findFreePosition();
|
||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
} catch (ExpressionException e) {
|
||||
player.printError(e.getMessage());
|
||||
}
|
||||
@ -630,7 +626,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.regen")
|
||||
@Logging(REGION)
|
||||
public void regenerateChunk(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region,
|
||||
public void regenerateChunk(Player fp, LocalSession session, EditSession editSession, @Selection Region region,
|
||||
@Arg(def = "", desc = "Regenerate with biome") BiomeType biome,
|
||||
@Arg(def = "", desc = "Regenerate with seed") Long seed,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
@ -667,7 +663,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.hollow")
|
||||
@Logging(REGION)
|
||||
public void hollow(FawePlayer fp, EditSession editSession,
|
||||
public void hollow(Player fp, EditSession editSession,
|
||||
@Selection Region region,
|
||||
@Range(min = 0) @Arg(desc = "Thickness of the shell to leave", def = "0")
|
||||
int thickness,
|
||||
@ -706,7 +702,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.flora")
|
||||
@Logging(REGION)
|
||||
public void flora(FawePlayer fp, EditSession editSession, @Selection Region region,
|
||||
public void flora(Player fp, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The density of the forest", def = "5")
|
||||
double density, InjectedValueAccess context) throws WorldEditException {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||
|
@ -19,16 +19,17 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
|
||||
import com.boydti.fawe.object.clipboard.remap.ClipboardRemapper;
|
||||
import com.boydti.fawe.object.schematic.MinecraftStructure;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -51,9 +52,11 @@ import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.SchematicPaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.util.io.Closer;
|
||||
import com.sk89q.worldedit.util.io.file.FilenameException;
|
||||
import java.io.BufferedInputStream;
|
||||
@ -83,7 +86,6 @@ import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -570,7 +572,7 @@ public class SchematicCommands {
|
||||
descFooter = "Note: Format is not fully verified until loading."
|
||||
)
|
||||
@CommandPermissions("worldedit.schematic.list")
|
||||
public void list(FawePlayer fp, Actor actor, InjectedValueAccess args,
|
||||
public void list(Actor actor,
|
||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "1")
|
||||
int page,
|
||||
@Switch(name = 'd', desc = "Sort by date, oldest first")
|
||||
@ -796,4 +798,46 @@ public class SchematicCommands {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class SchematicPaginationBox extends PaginationBox {
|
||||
private final String prefix;
|
||||
private final File[] files;
|
||||
|
||||
SchematicPaginationBox(String rootDir, File[] files, String pageCommand) {
|
||||
super("Available schematics", pageCommand);
|
||||
this.prefix = rootDir == null ? "" : rootDir;
|
||||
this.files = files;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getComponent(int number) {
|
||||
checkArgument(number < files.length && number >= 0);
|
||||
File file = files[number];
|
||||
Multimap<String, ClipboardFormat> exts = ClipboardFormats.getFileExtensionMap();
|
||||
String format = exts.get(com.google.common.io.Files.getFileExtension(file.getName()))
|
||||
.stream().findFirst().map(ClipboardFormat::getName).orElse("Unknown");
|
||||
boolean inRoot = file.getParentFile().getName().equals(prefix);
|
||||
|
||||
String path = inRoot ? file.getName() : file.getPath().split(Pattern.quote(prefix + File.separator))[1];
|
||||
|
||||
return TextComponent.builder()
|
||||
.content("")
|
||||
.append(TextComponent.of("[L]")
|
||||
.color(TextColor.GOLD)
|
||||
.clickEvent(ClickEvent
|
||||
.of(ClickEvent.Action.RUN_COMMAND, "/schem load \"" + path + "\""))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to load"))))
|
||||
.append(TextComponent.space())
|
||||
.append(TextComponent.of(path)
|
||||
.color(TextColor.DARK_GREEN)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(format))))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComponentsSize() {
|
||||
return files.length;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -32,29 +30,14 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptContext;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptEngine;
|
||||
import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.script.ScriptException;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.mozilla.javascript.NativeJavaObject;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
|
||||
/**
|
||||
@ -80,7 +63,7 @@ public class ScriptingCommands {
|
||||
desc = ""
|
||||
)
|
||||
@CommandPermissions("fawe.setupdispatcher")
|
||||
public void setupdispatcher(Player player, LocalSession session, final InjectedValueAccess args) throws WorldEditException {
|
||||
public void setupdispatcher(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
||||
PlatformCommandManager.getInstance().registerAllCommands();
|
||||
}
|
||||
|
||||
@ -96,7 +79,7 @@ public class ScriptingCommands {
|
||||
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
|
||||
List<String> commandStr) throws WorldEditException {
|
||||
if (!player.hasPermission("worldedit.scripting.execute." + filename)) {
|
||||
BBC.SCRIPTING_NO_PERM.send(player);
|
||||
player.printError(BBC.SCRIPTING_NO_PERM.s());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -122,12 +105,12 @@ public class ScriptingCommands {
|
||||
String lastScript = session.getLastScript();
|
||||
|
||||
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {
|
||||
BBC.SCRIPTING_NO_PERM.send(player);
|
||||
player.printError(BBC.SCRIPTING_NO_PERM.s());
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastScript == null) {
|
||||
BBC.SCRIPTING_CS.send(player);
|
||||
player.printError(BBC.SCRIPTING_CS.s());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.DelegateConsumer;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RunnableVal3;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -41,7 +40,6 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.CommandQueued;
|
||||
import com.sk89q.worldedit.command.util.CommandQueuedConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.CreatureButcher;
|
||||
import com.sk89q.worldedit.command.util.EntityRemover;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
@ -50,8 +48,6 @@ import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.function.EntityFunction;
|
||||
@ -92,7 +88,6 @@ import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -180,7 +175,7 @@ public class UtilityCommands {
|
||||
)
|
||||
@CommandPermissions("fawe.cancel")
|
||||
@CommandQueued(false)
|
||||
public void cancel(FawePlayer fp) {
|
||||
public void cancel(Player fp) {
|
||||
int cancelled = fp.cancel(false);
|
||||
BBC.WORLDEDIT_CANCEL_COUNT.send(fp, cancelled);
|
||||
}
|
||||
@ -679,7 +674,7 @@ public class UtilityCommands {
|
||||
desc = "Confirm a command"
|
||||
)
|
||||
@CommandPermissions("fawe.confirm")
|
||||
public void confirm(FawePlayer fp) throws WorldEditException {
|
||||
public void confirm(Player fp) throws WorldEditException {
|
||||
if (!fp.confirm()) {
|
||||
BBC.NOTHING_CONFIRMED.send(fp);
|
||||
}
|
||||
@ -697,7 +692,8 @@ public class UtilityCommands {
|
||||
int page,
|
||||
@Arg(desc = "The command to retrieve help for", def = "", variable = true)
|
||||
List<String> commandStr) throws WorldEditException {
|
||||
PrintCommandHelp.help(commandStr, page, listSubCommands, we, actor);
|
||||
PrintCommandHelp.help(commandStr, page, listSubCommands,
|
||||
we.getPlatformManager().getPlatformCommandManager().getCommandManager(), actor, "//help");
|
||||
}
|
||||
|
||||
public static void list(File dir, Actor actor, List<String> args, @Range(min = 0) int page, String formatName, boolean playerFolder, String onClickCmd) {
|
||||
|
@ -108,7 +108,7 @@ public class WorldEditCommands {
|
||||
}
|
||||
}
|
||||
actor.printDebug("");
|
||||
actor.printDebug("Wiki: " + "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/wiki");
|
||||
actor.printDebug("Wiki: https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/wiki");
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -197,6 +197,7 @@ public class WorldEditCommands {
|
||||
int page,
|
||||
@Arg(desc = "The command to retrieve help for", def = "", variable = true)
|
||||
List<String> commandStr) throws WorldEditException {
|
||||
PrintCommandHelp.help(commandStr, page, listSubCommands, we, actor);
|
||||
PrintCommandHelp.help(commandStr, page, listSubCommands,
|
||||
we.getPlatformManager().getPlatformCommandManager().getCommandManager(), actor, "/worldedit help");
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -19,26 +19,25 @@
|
||||
|
||||
package com.sk89q.worldedit.command.util;
|
||||
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.byCleanName;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.byCleanName;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands;
|
||||
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.CommandUsageBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.InvalidComponentException;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
|
||||
/**
|
||||
* Implementation of the //help command.
|
||||
@ -66,11 +65,11 @@ public class PrintCommandHelp {
|
||||
return mapping.orElse(null);
|
||||
}
|
||||
|
||||
public static void help(List<String> commandPath, int page, boolean listSubCommands, WorldEdit we, Actor actor) throws InvalidComponentException {
|
||||
CommandManager manager = we.getPlatformManager().getPlatformCommandManager().getCommandManager();
|
||||
public static void help(List<String> commandPath, int page, boolean listSubCommands,
|
||||
CommandManager manager, Actor actor, String helpRootCommand) throws InvalidComponentException {
|
||||
|
||||
if (commandPath.isEmpty()) {
|
||||
printCommands(page, manager.getAllCommands(), actor, ImmutableList.of());
|
||||
printCommands(page, manager.getAllCommands(), actor, ImmutableList.of(), helpRootCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -92,7 +91,7 @@ public class PrintCommandHelp {
|
||||
toCommandString(visited), subCommand));
|
||||
// full help for single command
|
||||
CommandUsageBox box = new CommandUsageBox(visited, visited.stream()
|
||||
.map(Command::getName).collect(Collectors.joining(" ")));
|
||||
.map(Command::getName).collect(Collectors.joining(" ")), helpRootCommand);
|
||||
actor.print(box.create());
|
||||
return;
|
||||
}
|
||||
@ -104,7 +103,7 @@ public class PrintCommandHelp {
|
||||
actor.printError(String.format("The sub-command '%s' under '%s' could not be found.",
|
||||
subCommand, toCommandString(visited)));
|
||||
// list subcommands for currentCommand
|
||||
printCommands(page, getSubCommands(Iterables.getLast(visited)).values().stream(), actor, visited);
|
||||
printCommands(page, getSubCommands(Iterables.getLast(visited)).values().stream(), actor, visited, helpRootCommand);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -113,10 +112,10 @@ public class PrintCommandHelp {
|
||||
|
||||
if (subCommands.isEmpty() || !listSubCommands) {
|
||||
// Create the message
|
||||
CommandUsageBox box = new CommandUsageBox(visited, toCommandString(visited));
|
||||
CommandUsageBox box = new CommandUsageBox(visited, toCommandString(visited), helpRootCommand);
|
||||
actor.print(box.create());
|
||||
} else {
|
||||
printCommands(page, subCommands.values().stream(), actor, visited);
|
||||
printCommands(page, subCommands.values().stream(), actor, visited, helpRootCommand);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,7 +124,7 @@ public class PrintCommandHelp {
|
||||
}
|
||||
|
||||
private static void printCommands(int page, Stream<Command> commandStream, Actor actor,
|
||||
List<Command> commandList) throws InvalidComponentException {
|
||||
List<Command> commandList, String helpRootCommand) throws InvalidComponentException {
|
||||
// Get a list of aliases
|
||||
List<Command> commands = commandStream
|
||||
.sorted(byCleanName())
|
||||
@ -134,7 +133,8 @@ public class PrintCommandHelp {
|
||||
String used = commandList.isEmpty() ? null : toCommandString(commandList);
|
||||
CommandListBox box = new CommandListBox(
|
||||
(used == null ? "Help" : "Subcommands: " + used),
|
||||
"//help -s -p %page%" + (used == null ? "" : " " + used));
|
||||
helpRootCommand + " -s -p %page%" + (used == null ? "" : " " + used),
|
||||
helpRootCommand);
|
||||
if (!actor.isPlayer()) {
|
||||
box.formatForConsole();
|
||||
}
|
||||
|
Reference in New Issue
Block a user