geforkt von Mirrors/FastAsyncWorldEdit
Minor changes
Dieser Commit ist enthalten in:
Ursprung
0b5eb903b6
Commit
614f5e1c16
@ -9,19 +9,9 @@ import java.util.Locale;
|
|||||||
|
|
||||||
public class FaweException extends RuntimeException {
|
public class FaweException extends RuntimeException {
|
||||||
// DEBUG
|
// DEBUG
|
||||||
public static final FaweException _enableQueue;
|
public static final FaweException _enableQueue = new FaweException("enableQueue");
|
||||||
public static final FaweException _disableQueue;
|
public static final FaweException _disableQueue = new 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Component message;
|
private final Component message;
|
||||||
|
|
||||||
public FaweException(String reason) {
|
public FaweException(String reason) {
|
||||||
|
@ -19,12 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit;
|
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.FaweCache;
|
||||||
import com.boydti.fawe.config.Caption;
|
import com.boydti.fawe.config.Caption;
|
||||||
import com.boydti.fawe.config.Settings;
|
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.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
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.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -139,11 +137,15 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.jetbrains.annotations.Range;
|
import org.jetbrains.annotations.Range;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An {@link Extent} that handles history, {@link BlockBag}s, change limits,
|
* An {@link Extent} that handles history, {@link BlockBag}s, change limits,
|
||||||
@ -338,6 +340,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
* chunk batching}.
|
* chunk batching}.
|
||||||
*/
|
*/
|
||||||
public void enableStandardMode() {
|
public void enableStandardMode() {
|
||||||
|
setBatchingChunks(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit;
|
package com.sk89q.worldedit;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweInputStream;
|
import com.boydti.fawe.object.FaweInputStream;
|
||||||
@ -99,6 +97,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores session information.
|
* Stores session information.
|
||||||
*/
|
*/
|
||||||
@ -919,6 +919,14 @@ public class LocalSession implements TextureHolder {
|
|||||||
return selector.getPrimaryPosition();
|
return selector.getPrimaryPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPlaceAtPos1(boolean placeAtPos1) {
|
||||||
|
this.placeAtPos1 = placeAtPos1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPlaceAtPos1() {
|
||||||
|
return placeAtPos1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle placement position.
|
* Toggle placement position.
|
||||||
*
|
*
|
||||||
@ -1086,7 +1094,8 @@ public class LocalSession implements TextureHolder {
|
|||||||
public void setTool(ItemType item, @Nullable Tool tool) throws InvalidToolBindException {
|
public void setTool(ItemType item, @Nullable Tool tool) throws InvalidToolBindException {
|
||||||
if (item.hasBlockType()) {
|
if (item.hasBlockType()) {
|
||||||
throw new InvalidToolBindException(item, "Blocks can't be used");
|
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);
|
changeTool(this.wandItem, this.wandItem = item, tool);
|
||||||
setDirty();
|
setDirty();
|
||||||
return;
|
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 {
|
public void setTool(BaseItem item, @Nullable Tool tool, Player player) throws InvalidToolBindException {
|
||||||
ItemType type = item.getType();
|
ItemType type = item.getType();
|
||||||
if (type.hasBlockType() && type.getBlockType().getMaterial().isAir()) {
|
if (type.hasBlockType() && type.getBlockType().getMaterial().isAir()) {
|
||||||
|
@ -28,7 +28,6 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
|||||||
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
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.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
@ -58,14 +57,14 @@ public class HistoryCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "undo",
|
name = "undo",
|
||||||
aliases = { "/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"})
|
@CommandPermissions({"worldedit.history.undo", "worldedit.history.undo.self"})
|
||||||
public void undo(Player player, LocalSession session,
|
public void undo(Player player, LocalSession session,
|
||||||
@Confirm(Confirm.Processor.LIMIT) @Arg(desc = "Number of undoes to perform", def = "1")
|
@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 = "")
|
@Arg(name = "player", desc = "Undo this player's operations", def = "")
|
||||||
String playerName) throws WorldEditException {
|
String playerName) throws WorldEditException {
|
||||||
times = Math.max(1, times);
|
times = Math.max(1, times);
|
||||||
LocalSession undoSession = session;
|
LocalSession undoSession = session;
|
||||||
if (session.hasFastMode()) {
|
if (session.hasFastMode()) {
|
||||||
@ -136,13 +135,14 @@ public class HistoryCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "clearhistory",
|
name = "clearhistory",
|
||||||
aliases = { "/clearhistory" },
|
aliases = { "/clearhistory" },
|
||||||
desc = "Clear your history"
|
desc = "Clear your history"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.history.clear")
|
@CommandPermissions("worldedit.history.clear")
|
||||||
public void clearHistory(Actor actor, LocalSession session) {
|
public void clearHistory(Actor actor, LocalSession session) {
|
||||||
session.clearHistory();
|
session.clearHistory();
|
||||||
actor.printInfo(TranslatableComponent.of("worldedit.clearhistory.cleared"));
|
actor.printInfo(TranslatableComponent.of("worldedit.clearhistory.cleared"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ public class UtilityCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("fawe.admin")
|
@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 {
|
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 srcFolder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP);
|
||||||
|
|
||||||
File webSrc = new File(Fawe.imp().getDirectory(), "web" + File.separator + "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 img = MainUtil.readImage(file);
|
||||||
BufferedImage minImg = ImageUtil.getScaledInstance(img, min, min, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
|
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);
|
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 minFile = new File(minImages, name);
|
||||||
File maxFile = new File(maxImages, name);
|
File maxFile = new File(maxImages, name);
|
||||||
minFile.getParentFile().mkdirs();
|
minFile.getParentFile().mkdirs();
|
||||||
@ -175,9 +175,9 @@ public class UtilityCommands {
|
|||||||
config.append("// The local source for the image (used in commands)\n");
|
config.append("// The local source for the image (used in commands)\n");
|
||||||
config.append("var src_local = \"file://\";\n");
|
config.append("var src_local = \"file://\";\n");
|
||||||
File configFile = new File(webSrc, "config.js");
|
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());
|
Files.write(configFile.toPath(), config.toString().getBytes());
|
||||||
player.print("Done! See: `FastAsyncWorldEdit/web/heightmap`");
|
player.print(TextComponent.of("Done! See: `FastAsyncWorldEdit/web/heightmap`"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -201,9 +201,9 @@ public class UtilityCommands {
|
|||||||
public int fill(Actor actor, LocalSession session, EditSession editSession,
|
public int fill(Actor actor, LocalSession session, EditSession editSession,
|
||||||
@Arg(desc = "The blocks to fill with")
|
@Arg(desc = "The blocks to fill with")
|
||||||
Pattern pattern,
|
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,
|
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,
|
int depth,
|
||||||
@Arg(desc = "The direction to move", def = "down")
|
@Arg(desc = "The direction to move", def = "down")
|
||||||
@Direction BlockVector3 direction) throws WorldEditException, EvaluationException {
|
@Direction BlockVector3 direction) throws WorldEditException, EvaluationException {
|
||||||
@ -612,10 +612,10 @@ public class UtilityCommands {
|
|||||||
@CommandPermissions("worldedit.remove")
|
@CommandPermissions("worldedit.remove")
|
||||||
@Logging(PLACEMENT)
|
@Logging(PLACEMENT)
|
||||||
public int remove(Actor actor,
|
public int remove(Actor actor,
|
||||||
@Arg(desc = "The type of entity to remove")
|
@Arg(desc = "The type of entity to remove")
|
||||||
EntityRemover remover,
|
EntityRemover remover,
|
||||||
@Arg(desc = "The radius of the cuboid to remove from")
|
@Arg(desc = "The radius of the cuboid to remove from")
|
||||||
int radius) throws WorldEditException {
|
int radius) throws WorldEditException {
|
||||||
if (radius < -1) {
|
if (radius < -1) {
|
||||||
actor.printError(TranslatableComponent.of("worldedit.remove.explain-all"));
|
actor.printError(TranslatableComponent.of("worldedit.remove.explain-all"));
|
||||||
return 0;
|
return 0;
|
||||||
@ -627,7 +627,7 @@ public class UtilityCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int killMatchingEntities(Integer radius, Actor actor, Supplier<EntityFunction> func) throws IncompleteRegionException,
|
private int killMatchingEntities(Integer radius, Actor actor, Supplier<EntityFunction> func) throws IncompleteRegionException,
|
||||||
MaxChangedBlocksException {
|
MaxChangedBlocksException {
|
||||||
List<EntityVisitor> visitors = new ArrayList<>();
|
List<EntityVisitor> visitors = new ArrayList<>();
|
||||||
|
|
||||||
LocalSession session = we.getSessionManager().get(actor);
|
LocalSession session = we.getSessionManager().get(actor);
|
||||||
@ -653,22 +653,6 @@ public class UtilityCommands {
|
|||||||
return killed;
|
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) {
|
private DecimalFormat formatForLocale(Locale locale) {
|
||||||
DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(locale);
|
DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(locale);
|
||||||
format.applyPattern("#,##0.#####");
|
format.applyPattern("#,##0.#####");
|
||||||
@ -699,6 +683,23 @@ public class UtilityCommands {
|
|||||||
}, (Component) null);
|
}, (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(
|
@Command(
|
||||||
name = "/confirm",
|
name = "/confirm",
|
||||||
desc = "Confirm a command"
|
desc = "Confirm a command"
|
||||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.function;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies a function to entities.
|
* Applies a function to entities.
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren