Dieser Commit ist enthalten in:
MattBDev 2020-02-06 16:33:31 -05:00
Ursprung 0b5eb903b6
Commit 614f5e1c16
6 geänderte Dateien mit 63 neuen und 67 gelöschten Zeilen

Datei anzeigen

@ -9,19 +9,9 @@ import java.util.Locale;
public class FaweException extends RuntimeException {
// DEBUG
public static final FaweException _enableQueue;
public static final FaweException _disableQueue;
static {
try {
_enableQueue = new FaweException(Extent.class.getDeclaredMethod("enableQueue").toString());
_disableQueue = new FaweException(Extent.class.getDeclaredMethod("disableQueue").toString());
} catch (NoSuchMethodException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
public static final FaweException _enableQueue = new FaweException("enableQueue");
public static final FaweException _disableQueue = new FaweException("disableQueue");
private final Component message;
public FaweException(String reason) {

Datei anzeigen

@ -19,12 +19,6 @@
package com.sk89q.worldedit;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
@ -130,6 +124,10 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@ -139,11 +137,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Range;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* An {@link Extent} that handles history, {@link BlockBag}s, change limits,
@ -338,6 +340,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* chunk batching}.
*/
public void enableStandardMode() {
setBatchingChunks(true);
}
/**

Datei anzeigen

@ -19,8 +19,6 @@
package com.sk89q.worldedit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweInputStream;
@ -99,6 +97,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Stores session information.
*/
@ -919,6 +919,14 @@ public class LocalSession implements TextureHolder {
return selector.getPrimaryPosition();
}
public void setPlaceAtPos1(boolean placeAtPos1) {
this.placeAtPos1 = placeAtPos1;
}
public boolean isPlaceAtPos1() {
return placeAtPos1;
}
/**
* Toggle placement position.
*
@ -1086,7 +1094,8 @@ public class LocalSession implements TextureHolder {
public void setTool(ItemType item, @Nullable Tool tool) throws InvalidToolBindException {
if (item.hasBlockType()) {
throw new InvalidToolBindException(item, "Blocks can't be used");
} else if (tool instanceof SelectionWand) {
}
if (tool instanceof SelectionWand) {
changeTool(this.wandItem, this.wandItem = item, tool);
setDirty();
return;
@ -1118,14 +1127,6 @@ public class LocalSession implements TextureHolder {
}
}
public void setPlaceAtPos1(boolean placeAtPos1) {
this.placeAtPos1 = placeAtPos1;
}
public boolean isPlaceAtPos1() {
return placeAtPos1;
}
public void setTool(BaseItem item, @Nullable Tool tool, Player player) throws InvalidToolBindException {
ItemType type = item.getType();
if (type.hasBlockType() && type.getBlockType().getMaterial().isAir()) {

Datei anzeigen

@ -28,7 +28,6 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.annotation.Confirm;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.enginehub.piston.annotation.Command;
@ -58,14 +57,14 @@ public class HistoryCommands {
@Command(
name = "undo",
aliases = { "/undo" },
desc = "Undoes the last action (from history)"
desc = "Undoes the last action (from history)"
)
@CommandPermissions({"worldedit.history.undo", "worldedit.history.undo.self"})
public void undo(Player player, LocalSession session,
@Confirm(Confirm.Processor.LIMIT) @Arg(desc = "Number of undoes to perform", def = "1")
int times,
int times,
@Arg(name = "player", desc = "Undo this player's operations", def = "")
String playerName) throws WorldEditException {
String playerName) throws WorldEditException {
times = Math.max(1, times);
LocalSession undoSession = session;
if (session.hasFastMode()) {
@ -136,13 +135,14 @@ public class HistoryCommands {
}
@Command(
name = "clearhistory",
aliases = { "/clearhistory" },
desc = "Clear your history"
name = "clearhistory",
aliases = { "/clearhistory" },
desc = "Clear your history"
)
@CommandPermissions("worldedit.history.clear")
public void clearHistory(Actor actor, LocalSession session) {
session.clearHistory();
actor.printInfo(TranslatableComponent.of("worldedit.clearhistory.cleared"));
}
}

Datei anzeigen

@ -128,7 +128,7 @@ public class UtilityCommands {
)
@CommandPermissions("fawe.admin")
public void heightmapInterface(Player player, @Arg(name = "min", desc = "int", def = "100") int min, @Arg(name = "max", desc = "int", def = "200") int max) throws IOException {
player.print("Please wait while we generate the minified heightmaps.");
player.print(TextComponent.of("Please wait while we generate the minified heightmaps."));
File srcFolder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP);
File webSrc = new File(Fawe.imp().getDirectory(), "web" + File.separator + "heightmap");
@ -150,7 +150,7 @@ public class UtilityCommands {
BufferedImage img = MainUtil.readImage(file);
BufferedImage minImg = ImageUtil.getScaledInstance(img, min, min, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
BufferedImage maxImg = max == -1 ? img : ImageUtil.getScaledInstance(img, max, max, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
player.print("Writing " + name);
player.print(TextComponent.of(String.format("Writing %s", name)));
File minFile = new File(minImages, name);
File maxFile = new File(maxImages, name);
minFile.getParentFile().mkdirs();
@ -175,9 +175,9 @@ public class UtilityCommands {
config.append("// The local source for the image (used in commands)\n");
config.append("var src_local = \"file://\";\n");
File configFile = new File(webSrc, "config.js");
player.print("Writing " + configFile);
player.print(TextComponent.of(String.format("Writing %s",configFile)));
Files.write(configFile.toPath(), config.toString().getBytes());
player.print("Done! See: `FastAsyncWorldEdit/web/heightmap`");
player.print(TextComponent.of("Done! See: `FastAsyncWorldEdit/web/heightmap`"));
}
@Command(
@ -201,9 +201,9 @@ public class UtilityCommands {
public int fill(Actor actor, LocalSession session, EditSession editSession,
@Arg(desc = "The blocks to fill with")
Pattern pattern,
@Range(from=1, to=Integer.MAX_VALUE) @Arg(desc = "The radius to fill in")
@Arg(desc = "The radius to fill in")
Expression radiusExp,
@Range(from=1, to=Integer.MAX_VALUE) @Arg(desc = "The depth to fill", def = "1")
@Arg(desc = "The depth to fill", def = "1")
int depth,
@Arg(desc = "The direction to move", def = "down")
@Direction BlockVector3 direction) throws WorldEditException, EvaluationException {
@ -612,10 +612,10 @@ public class UtilityCommands {
@CommandPermissions("worldedit.remove")
@Logging(PLACEMENT)
public int remove(Actor actor,
@Arg(desc = "The type of entity to remove")
EntityRemover remover,
@Arg(desc = "The radius of the cuboid to remove from")
int radius) throws WorldEditException {
@Arg(desc = "The type of entity to remove")
EntityRemover remover,
@Arg(desc = "The radius of the cuboid to remove from")
int radius) throws WorldEditException {
if (radius < -1) {
actor.printError(TranslatableComponent.of("worldedit.remove.explain-all"));
return 0;
@ -627,7 +627,7 @@ public class UtilityCommands {
}
private int killMatchingEntities(Integer radius, Actor actor, Supplier<EntityFunction> func) throws IncompleteRegionException,
MaxChangedBlocksException {
MaxChangedBlocksException {
List<EntityVisitor> visitors = new ArrayList<>();
LocalSession session = we.getSessionManager().get(actor);
@ -653,22 +653,6 @@ public class UtilityCommands {
return killed;
}
@Command(
name = "/help",
desc = "Displays help for WorldEdit commands"
)
@CommandPermissions("worldedit.help")
public void help(Actor actor,
@Switch(name = 's', desc = "List sub-commands of the given command, if applicable")
boolean listSubCommands,
@ArgFlag(name = 'p', desc = "The page to retrieve", def = "1")
int page,
@Arg(desc = "The command to retrieve help for", def = "", variable = true)
List<String> command) throws WorldEditException {
PrintCommandHelp.help(command, page, listSubCommands,
we.getPlatformManager().getPlatformCommandManager().getCommandManager(), actor, "//help");
}
private DecimalFormat formatForLocale(Locale locale) {
DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(locale);
format.applyPattern("#,##0.#####");
@ -699,6 +683,23 @@ public class UtilityCommands {
}, (Component) null);
}
@Command(
name = "/help",
desc = "Displays help for WorldEdit commands"
)
@CommandPermissions("worldedit.help")
public void help(Actor actor,
@Switch(name = 's', desc = "List sub-commands of the given command, if applicable")
boolean listSubCommands,
@ArgFlag(name = 'p', desc = "The page to retrieve", def = "1")
int page,
@Arg(desc = "The command to retrieve help for", def = "", variable = true)
List<String> command) throws WorldEditException {
PrintCommandHelp.help(command, page, listSubCommands,
we.getPlatformManager().getPlatformCommandManager().getCommandManager(), actor, "//help");
}
@Command(
name = "/confirm",
desc = "Confirm a command"

Datei anzeigen

@ -21,6 +21,7 @@ package com.sk89q.worldedit.function;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Entity;
import java.util.function.Predicate;
/**
* Applies a function to entities.