geforkt von Mirrors/FastAsyncWorldEdit
Fixed compile issues and disabled plotsquared hook
Dieser Commit ist enthalten in:
Ursprung
f3e0109be2
Commit
05760c49cd
@ -10,7 +10,6 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import java.io.File;
|
||||
@ -76,7 +75,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @see #wrap(World)
|
||||
* @see #create(WorldCreator)
|
||||
*/
|
||||
public class AsyncWorld extends PassthroughExtent implements World {
|
||||
public class AsyncWorld
|
||||
extends PassthroughExtent implements World {
|
||||
|
||||
private World parent;
|
||||
private BukkitImplAdapter adapter;
|
||||
@ -181,13 +181,13 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, double v, double v1, double v2, int i, T t) {
|
||||
parent.spawnParticle(particle, v, v1, v2, i, t);
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data) {
|
||||
parent.spawnParticle(particle, x, y, z, count, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2) {
|
||||
parent.spawnParticle(particle, location, i, v, v1, v2);
|
||||
public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ) {
|
||||
parent.spawnParticle(particle, location, count, offsetX, offsetY, offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -830,22 +830,43 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
return adapter.adapt(getExtent().getBiomeType(x, 0, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Biome getBiome(int x, int y, int z) {
|
||||
return adapter.adapt(getExtent().getBiomeType(x,y,z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiome(int x, int z, Biome bio) {
|
||||
BiomeType biome = adapter.adapt(bio);
|
||||
getExtent().setBiome(x, 0, z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiome(int x, int y, int z, @NotNull Biome bio) {
|
||||
BiomeType biome = adapter.adapt(bio);
|
||||
getExtent().setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTemperature(int x, int z) {
|
||||
return parent.getTemperature(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTemperature(int x, int y, int z) {
|
||||
return parent.getTemperature(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHumidity(int x, int z) {
|
||||
return parent.getHumidity(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHumidity(int x, int y, int z) {
|
||||
return parent.getHumidity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return parent.getMaxHeight();
|
||||
@ -1143,19 +1164,19 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult rayTraceBlocks(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3) {
|
||||
return parent.rayTraceBlocks(arg0, arg1, arg2, arg3);
|
||||
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode) {
|
||||
return parent.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult rayTraceBlocks(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3,
|
||||
boolean arg4) {
|
||||
return parent.rayTraceBlocks(arg0, arg1, arg2, arg3, arg4);
|
||||
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double arg2, FluidCollisionMode fluidCollisionMode,
|
||||
boolean ignorePassableBlocks) {
|
||||
return parent.rayTraceBlocks(start, direction, arg2, fluidCollisionMode, ignorePassableBlocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult rayTraceEntities(Location arg0, Vector arg1, double arg2) {
|
||||
return parent.rayTraceEntities(arg0, arg1, arg2);
|
||||
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance) {
|
||||
return parent.rayTraceEntities(start, direction, maxDistance);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1174,16 +1195,11 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
return parent.rayTraceEntities(arg0, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle arg0, Location arg1, int arg2, double arg3, double arg4, double arg5,
|
||||
double arg6, T arg7, boolean arg8) {
|
||||
parent.spawnParticle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle arg0, double arg1, double arg2, double arg3, int arg4, double arg5,
|
||||
double arg6, double arg7, double arg8, T arg9, boolean arg10) {
|
||||
parent.spawnParticle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
|
||||
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z,
|
||||
int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data,
|
||||
boolean force) {
|
||||
|
||||
}
|
||||
|
||||
@ -1340,4 +1356,11 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
public <T> void spawnParticle(Particle particle, List<Player> list, Player player, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6, T t, boolean b) {
|
||||
parent.spawnParticle(particle, list, player, v, v1, v2, i, v3, v4, v5, v6, t, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count,
|
||||
double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data,
|
||||
boolean force) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class Settings extends Config {
|
||||
@Ignore
|
||||
public boolean PROTOCOL_SUPPORT_FIX = false;
|
||||
@Ignore
|
||||
public boolean PLOTSQUARED_HOOK = true;
|
||||
public boolean PLOTSQUARED_HOOK = false;
|
||||
|
||||
@Comment("These first 6 aren't configurable") // This is a comment
|
||||
@Final // Indicates that this value isn't configurable
|
||||
|
@ -15,12 +15,10 @@ import com.sk89q.jnbt.ShortTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.Stack;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class JSON2NBT {
|
||||
private static final Pattern INT_ARRAY_MATCHER = Pattern.compile("\\[[-+\\d|,\\s]+\\]");
|
||||
@ -42,7 +40,7 @@ public class JSON2NBT {
|
||||
public static int topTagsCount(String str) throws NBTException {
|
||||
int i = 0;
|
||||
boolean flag = false;
|
||||
Stack<Character> stack = new Stack<>();
|
||||
Stack stack = new Stack();
|
||||
|
||||
for (int j = 0; j < str.length(); ++j) {
|
||||
char c0 = str.charAt(j);
|
||||
@ -56,11 +54,11 @@ public class JSON2NBT {
|
||||
}
|
||||
} else if (!flag) {
|
||||
if (c0 != 123 && c0 != 91) {
|
||||
if (c0 == 125 && (stack.isEmpty() || stack.pop() != 123)) {
|
||||
if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) {
|
||||
throw new NBTException("Unbalanced curly brackets {}: " + str);
|
||||
}
|
||||
|
||||
if (c0 == 93 && (stack.isEmpty() || stack.pop() != 91)) {
|
||||
if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) {
|
||||
throw new NBTException("Unbalanced square brackets []: " + str);
|
||||
}
|
||||
} else {
|
||||
@ -68,7 +66,7 @@ public class JSON2NBT {
|
||||
++i;
|
||||
}
|
||||
|
||||
stack.push(c0);
|
||||
stack.push(Character.valueOf(c0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -93,6 +91,7 @@ public class JSON2NBT {
|
||||
private static JSON2NBT.Any nameValueToNBT(String key, String value) throws NBTException {
|
||||
value = value.trim();
|
||||
String s;
|
||||
boolean c0;
|
||||
char c01;
|
||||
if (value.startsWith("{")) {
|
||||
value = value.substring(1, value.length() - 1);
|
||||
@ -101,6 +100,7 @@ public class JSON2NBT {
|
||||
for (JSON2NBT$list1 = new JSON2NBT.Compound(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
||||
s = nextNameValuePair(value, true);
|
||||
if (s.length() > 0) {
|
||||
c0 = false;
|
||||
JSON2NBT$list1.tagList.add(getTagFromNameValue(s, false));
|
||||
}
|
||||
|
||||
@ -122,6 +122,7 @@ public class JSON2NBT {
|
||||
for (JSON2NBT$list = new JSON2NBT.List(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
||||
s = nextNameValuePair(value, false);
|
||||
if (s.length() > 0) {
|
||||
c0 = true;
|
||||
JSON2NBT$list.tagList.add(getTagFromNameValue(s, true));
|
||||
}
|
||||
|
||||
@ -144,7 +145,7 @@ public class JSON2NBT {
|
||||
private static JSON2NBT.Any getTagFromNameValue(String str, boolean isArray) throws NBTException {
|
||||
String s = locateName(str, isArray);
|
||||
String s1 = locateValue(str, isArray);
|
||||
return joinStrToNBT(s, s1);
|
||||
return joinStrToNBT(new String[]{s, s1});
|
||||
}
|
||||
|
||||
private static String nextNameValuePair(String str, boolean isCompound) throws NBTException {
|
||||
@ -166,7 +167,7 @@ public class JSON2NBT {
|
||||
}
|
||||
|
||||
private static String locateValueAt(String str, int index) throws NBTException {
|
||||
Stack<Character> stack = new Stack<>();
|
||||
Stack stack = new Stack();
|
||||
int i = index + 1;
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
@ -191,11 +192,11 @@ public class JSON2NBT {
|
||||
}
|
||||
} else if (!flag) {
|
||||
if (c0 != 123 && c0 != 91) {
|
||||
if (c0 == 125 && (stack.isEmpty() || stack.pop() != 123)) {
|
||||
if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) {
|
||||
throw new NBTException("Unbalanced curly brackets {}: " + str);
|
||||
}
|
||||
|
||||
if (c0 == 93 && (stack.isEmpty() || stack.pop() != 91)) {
|
||||
if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) {
|
||||
throw new NBTException("Unbalanced square brackets []: " + str);
|
||||
}
|
||||
|
||||
@ -203,7 +204,7 @@ public class JSON2NBT {
|
||||
return str.substring(0, i);
|
||||
}
|
||||
} else {
|
||||
stack.push(c0);
|
||||
stack.push(Character.valueOf(c0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,11 +343,14 @@ public class JSON2NBT {
|
||||
|
||||
if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) {
|
||||
String var7 = this.jsonValue.substring(1, this.jsonValue.length() - 1);
|
||||
String[] var8 = Iterables.toArray(SPLITTER.split(var7), String.class);
|
||||
String[] var8 = (String[]) ((String[]) Iterables.toArray(SPLITTER.split(var7), String.class));
|
||||
|
||||
try {
|
||||
int[] var5 = Arrays.stream(var8).mapToInt(s -> Integer.parseInt(s.trim()))
|
||||
.toArray();
|
||||
int[] var5 = new int[var8.length];
|
||||
|
||||
for (int j = 0; j < var8.length; ++j) {
|
||||
var5[j] = Integer.parseInt(var8[j].trim());
|
||||
}
|
||||
|
||||
return new IntArrayTag(var5);
|
||||
} catch (NumberFormatException var51) {
|
||||
@ -375,23 +379,27 @@ public class JSON2NBT {
|
||||
}
|
||||
|
||||
private static class List extends JSON2NBT.Any {
|
||||
protected List<JSON2NBT.Any> tagList = Lists.newArrayList();
|
||||
protected java.util.List<JSON2NBT.Any> tagList = Lists.newArrayList();
|
||||
|
||||
public List(String json) {
|
||||
this.json = json;
|
||||
}
|
||||
|
||||
public Tag parse() throws NBTException {
|
||||
ArrayList<Tag> list = this.tagList.stream().map(Any::parse)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
ArrayList<Tag> list = new ArrayList<>();
|
||||
Iterator var2 = this.tagList.iterator();
|
||||
|
||||
while (var2.hasNext()) {
|
||||
JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any) var2.next();
|
||||
list.add(JSON2NBT$any.parse());
|
||||
}
|
||||
Class<? extends Tag> tagType = list.isEmpty() ? CompoundTag.class : list.get(0).getClass();
|
||||
return new ListTag(tagType, list);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Compound extends JSON2NBT.Any {
|
||||
protected List<JSON2NBT.Any> tagList = Lists.newArrayList();
|
||||
protected java.util.List<JSON2NBT.Any> tagList = Lists.newArrayList();
|
||||
|
||||
public Compound(String jsonIn) {
|
||||
this.json = jsonIn;
|
||||
@ -399,8 +407,10 @@ public class JSON2NBT {
|
||||
|
||||
public Tag parse() throws NBTException {
|
||||
HashMap<String, Tag> map = new HashMap<>();
|
||||
Iterator var2 = this.tagList.iterator();
|
||||
|
||||
for (Any JSON2NBT$any : this.tagList) {
|
||||
while (var2.hasNext()) {
|
||||
JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any) var2.next();
|
||||
map.put(JSON2NBT$any.json, JSON2NBT$any.parse());
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -31,6 +32,7 @@ import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Identifiable;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||
@ -46,11 +48,13 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
@ -313,40 +317,44 @@ public class HistorySubCommands {
|
||||
player.setMeta(pageCommand, new SoftReference<>(list));
|
||||
}
|
||||
|
||||
PaginationBox pages = PaginationBox.fromStrings("Edits:", pageCommand, list, input -> {
|
||||
RollbackOptimizedHistory edit = input.get();
|
||||
UUID uuid = edit.getUUID();
|
||||
int index = edit.getIndex();
|
||||
if (!edit.isEmpty()) {
|
||||
database.delete(uuid, index);
|
||||
return TextComponent.empty();
|
||||
PaginationBox pages = PaginationBox.fromStrings("Edits:", pageCommand, list, new Function<Supplier<RollbackOptimizedHistory>, Component>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Component apply(@Nullable Supplier<RollbackOptimizedHistory> input) {
|
||||
RollbackOptimizedHistory edit = input.get();
|
||||
UUID uuid = edit.getUUID();
|
||||
int index = edit.getIndex();
|
||||
if (!edit.isEmpty()) {
|
||||
database.delete(uuid, index);
|
||||
return TextComponent.empty();
|
||||
}
|
||||
String name = Fawe.imp().getName(edit.getUUID());
|
||||
|
||||
String cmd = edit.getCommand();
|
||||
BlockVector3 pos1 = edit.getMinimumPoint();
|
||||
BlockVector3 pos2 = edit.getMaximumPoint();
|
||||
|
||||
double distanceX = Math.min(Math.abs(pos1.getX() - origin.getX()), Math.abs(pos2.getX() - origin.getX()));
|
||||
double distanceZ = Math.min(Math.abs(pos1.getZ() - origin.getZ()), Math.abs(pos2.getZ() - origin.getZ()));
|
||||
int distance = (int) Math.sqrt(distanceX * distanceX + distanceZ * distanceZ);
|
||||
|
||||
BlockVector2 dirVec = BlockVector2.at(edit.getOriginX() - origin.getX(), edit.getOriginZ() - origin.getZ());
|
||||
Direction direction = Direction.findClosest(dirVec.toVector3(), Direction.Flag.ALL);
|
||||
|
||||
long seconds = (System.currentTimeMillis() - edit.getBDFile().lastModified()) / 1000;
|
||||
String timeStr = MainUtil.secToTime(seconds);
|
||||
|
||||
int size = edit.size();
|
||||
|
||||
TranslatableComponent elem = Caption.of("fawe.worldedit.history.find.element", name, timeStr, distance, direction.name(), cmd);
|
||||
|
||||
String infoCmd = "//history summary " + uuid + " " + index;
|
||||
TranslatableComponent hover = Caption.of("fawe.worldedit.history.find.hover", size);
|
||||
elem = elem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, hover));
|
||||
elem = elem.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, infoCmd));
|
||||
|
||||
return elem;
|
||||
}
|
||||
String name = Fawe.imp().getName(edit.getUUID());
|
||||
|
||||
String cmd = edit.getCommand();
|
||||
BlockVector3 pos1 = edit.getMinimumPoint();
|
||||
BlockVector3 pos2 = edit.getMaximumPoint();
|
||||
|
||||
double distanceX = Math.min(Math.abs(pos1.getX() - origin.getX()), Math.abs(pos2.getX() - origin.getX()));
|
||||
double distanceZ = Math.min(Math.abs(pos1.getZ() - origin.getZ()), Math.abs(pos2.getZ() - origin.getZ()));
|
||||
int distance = (int) Math.sqrt(distanceX * distanceX + distanceZ * distanceZ);
|
||||
|
||||
BlockVector2 dirVec = BlockVector2.at(edit.getOriginX() - origin.getX(), edit.getOriginZ() - origin.getZ());
|
||||
Direction direction = Direction.findClosest(dirVec.toVector3(), Direction.Flag.ALL);
|
||||
|
||||
long seconds = (System.currentTimeMillis() - edit.getBDFile().lastModified()) / 1000;
|
||||
String timeStr = MainUtil.secToTime(seconds);
|
||||
|
||||
int size = edit.size();
|
||||
|
||||
TranslatableComponent elem = Caption.of("fawe.worldedit.history.find.element", name, timeStr, distance, direction.name(), cmd);
|
||||
|
||||
String infoCmd = "//history summary " + uuid + " " + index;
|
||||
TranslatableComponent hover = Caption.of("fawe.worldedit.history.find.hover", size);
|
||||
elem = elem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, hover));
|
||||
elem = elem.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, infoCmd));
|
||||
|
||||
return elem;
|
||||
});
|
||||
player.print(pages.create(page));
|
||||
}
|
||||
|
@ -23,11 +23,14 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.DelegateConsumer;
|
||||
import com.boydti.fawe.object.function.QuadFunction;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.image.ImageUtil;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -42,7 +45,6 @@ import com.sk89q.worldedit.command.util.CreatureButcher;
|
||||
import com.sk89q.worldedit.command.util.EntityRemover;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.command.util.PrintCommandHelp;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.command.util.annotation.SkipQueue;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -50,16 +52,19 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.function.EntityFunction;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.expression.EvaluationException;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||
@ -67,7 +72,6 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -77,9 +81,8 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Files;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
@ -88,9 +91,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
@ -712,12 +713,11 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
public static List<Map.Entry<URI, String>> filesToEntry(final File root, final List<File> files, final UUID uuid) {
|
||||
return files.stream()
|
||||
.map(input -> { // Keep this functional, as transform is evaluated lazily
|
||||
URI uri = input.toURI();
|
||||
String path = getPath(root, input, uuid);
|
||||
return new SimpleEntry<>(uri, path);
|
||||
}).collect(Collectors.toList());
|
||||
return Lists.transform(files, input -> { // Keep this functional, as transform is evaluated lazily
|
||||
URI uri = input.toURI();
|
||||
String path = getPath(root, input, uuid);
|
||||
return new AbstractMap.SimpleEntry<>(uri, path);
|
||||
});
|
||||
}
|
||||
|
||||
public static enum URIType {
|
||||
@ -728,7 +728,7 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
public static List<Component> entryToComponent(File root, List<Map.Entry<URI, String>> entries, Function<URI, Boolean> isLoaded, QuadFunction<String, String, URIType, Boolean, Component> adapter) {
|
||||
return entries.stream().map(input -> {
|
||||
return Lists.transform(entries, input -> {
|
||||
URI uri = input.getKey();
|
||||
String path = input.getValue();
|
||||
|
||||
@ -745,13 +745,11 @@ public class UtilityCommands {
|
||||
if (file.isDirectory()) {
|
||||
type = URIType.DIRECTORY;
|
||||
} else {
|
||||
if (name.indexOf('.') != -1)
|
||||
name = name.substring(0, name.lastIndexOf('.'));
|
||||
if (name.indexOf('.') != -1) name = name.substring(0, name.lastIndexOf('.'));
|
||||
}
|
||||
try {
|
||||
if (!MainUtil.isInSubDirectory(root, file)) {
|
||||
throw new RuntimeException(
|
||||
new StopExecutionException(TextComponent.of("Invalid path")));
|
||||
throw new RuntimeException(new StopExecutionException(TextComponent.of("Invalid path")));
|
||||
}
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
@ -762,7 +760,7 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
return adapter.apply(name, path, type, loaded);
|
||||
}).collect(Collectors.toList());
|
||||
});
|
||||
}
|
||||
|
||||
public static List<File> getFiles(File dir, Actor actor, List<String> args, String formatName, boolean playerFolder, boolean oldFirst, boolean newFirst) {
|
||||
@ -812,7 +810,8 @@ public class UtilityCommands {
|
||||
boolean listMine = false;
|
||||
boolean listGlobal = !Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS;
|
||||
if (len > 0) {
|
||||
for (String arg : args) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
String arg = args.get(i);
|
||||
switch (arg.toLowerCase()) {
|
||||
case "me":
|
||||
case "mine":
|
||||
@ -832,10 +831,7 @@ public class UtilityCommands {
|
||||
if (arg.endsWith("/") || arg.endsWith(File.separator)) {
|
||||
arg = arg.replace("/", File.separator);
|
||||
String newDirFilter = dirFilter + arg;
|
||||
boolean exists =
|
||||
new File(dir, newDirFilter).exists() || playerFolder && MainUtil
|
||||
.resolveRelative(
|
||||
new File(dir, actor.getUniqueId() + newDirFilter)).exists();
|
||||
boolean exists = new File(dir, newDirFilter).exists() || playerFolder && MainUtil.resolveRelative(new File(dir, actor.getUniqueId() + newDirFilter)).exists();
|
||||
if (!exists) {
|
||||
arg = arg.substring(0, arg.length() - File.separator.length());
|
||||
if (arg.length() > 3 && arg.length() <= 16) {
|
||||
@ -847,7 +843,8 @@ public class UtilityCommands {
|
||||
}
|
||||
}
|
||||
dirFilter = newDirFilter;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
filters.add(arg);
|
||||
}
|
||||
break;
|
||||
|
@ -19,18 +19,23 @@
|
||||
|
||||
package com.sk89q.worldedit.util.formatting.component;
|
||||
|
||||
import com.boydti.fawe.object.collection.AdaptedSetCollection;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Lists;
|
||||
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 javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class PaginationBox extends MessageBox {
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren