From eb94bd17732349134a7635c21250de96e4fea866 Mon Sep 17 00:00:00 2001 From: KasaneKona Date: Sat, 28 Dec 2019 22:44:22 +0000 Subject: [PATCH 01/10] Add LZ4 bindings for AARCH64 --- .../main/resources/linux/aarch64/liblz4-java.so | Bin 0 -> 77859 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 worldedit-core/src/main/resources/linux/aarch64/liblz4-java.so diff --git a/worldedit-core/src/main/resources/linux/aarch64/liblz4-java.so b/worldedit-core/src/main/resources/linux/aarch64/liblz4-java.so new file mode 100644 index 0000000000000000000000000000000000000000..2dc715613b40cf42ffbad013258e1bba078c2caf GIT binary patch literal 77859 zcmeFa349ghxj+8S%t>;xh=GJPv^ghXP2CNew6vL=fCPdTLfTsG@8)EKB!@*7EkZC0 zL7~UCM6`Ipdy}vx5tml2IchIq5ruRS@LI3+mLz}>qgBC$qtNsJerMhZlL(alZ}0Ny zz2P&=ywAMzzR&x-&;GtMr*iW2TU136)}JPx7c8wEXF_y&<1Y1l9bKe}aG{F?G0dnN zChJ`2boPu1wa&tL!u&rRw>r+5_dCv+?OW%inh9Sk&(?D)zse>k<=@QXON!aw<^ILWin(}>ZCq@8E)E2L*4d&ipNYr8VNbd3 zJ7UiA*}m^MMulH9{6NFTKa^S9;oOq{=i<91p8 zzC82v104T=qmTvsmEb5duFn7G!{t02ci~uwV+jua-EE%4J@U-cz4Ce)&K2@{13 zsKil&qZY?19QWgR0LK~}{PW{z{Lz@leVM7QQzLE56{KD+PEcYf_F zyfgLCpdGgif4#eOhxg<7Eywn?J&^X))2}JZANl@?d-5he{Pj0i-jR3n;(vSo&D)+2 zJ-)iL(*3Ks;;Gb=Lx2AEgjc%bN7a{pXVtQgK7G0@_^sl`-``W_*?KJTAA=pEryl+w z>vw>?^e+#`4|J^g=d*8p^yVYq`(@XdMIW!(mAN7}Yx2LoH>GRF!uH42&hCQ+4Nc!& znZ4+Z`*LUG{KkFtogbv_?|y#UhN*i_e|_ffmwf+&_4jtZ+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D58wa%rdvsqzFPKdtPp6etA{2QdftEXnCZfAbMx? zo^{+sZHl?Y%2!7#7l*4OMKSrZ%M0d3t3O?grs$WR3e2<#`&d-5wz{}1TpACy zoI|$g8A8ci8?LNorD&vdg;1WEHDl^c$}49h$q=$aphnuE(A?$Oi*FCzzGMz+YjoJ% z7gSY*io)duFd;POGfT1;&(9^rip9Au^}Iz(bFvqOmd>4f=j|&(E3$JI-5wGmLkKon zeP?xLG+dUKt60bzS-UY9oVRFxPHt#==Cqrwy69x`x~yV-H0Hh07Arwe7}XO!oLgB@ zmK!dwC@-cp>%t-wQynGI0@f9W&R1XE3Ur>r%4oEYJ}ImUjjkv(pgXIQjD>Q$_VlX@F0sqCEXc5O?3899rK+;!L-$|Vi7^_7>Rn@2l0+yf*Qv+?naGyI=cP`nzv8jBc|7!EpZ&7qMOTo_6$#x%hbQw?e?R2GKUS5(gFGZRpH z=h|pg%w=RlxX;kUD2x|$1SgJ{o%*U-bXs#4nf z{Bk6mgVTss+PYSS*GK0d4jv7ojY{{|!X;4J7|Fy+qEAa>iY!`fMEG&_F=~z;uP&=7k1Two$miUe74 zl8#kk^xxQUQ!T5rMu9bH1NF&cjf9{+T?kE!;h6Oh+Usi)gyHagfPTi~^R&}xBKa8l z2jNj{siq#bMf_Q139nNCogwf*+WFzEcOj@9>gw`)rBG#XeV?DXh^@x32g2d6B9 z@pdrBFf$AH6I!r7wA^+Nb4$ZjRrC#|cvD5lD)Z>5M2AJQz7OBhfa8hS;Cf2gGpB8U45kqB+9>odIM&{zGbSV6>fiU(? zlVJm0VNHLmE5*jk+0yBP3`!b6xz|_6uqNgK85D-su>ickry=qqcwde;G%=qxvi}=D CyB7Wc literal 0 HcmV?d00001 From 0d1e32efcb83622f9c295f556c1141f605aaa222 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 2 Jan 2020 16:30:44 -0500 Subject: [PATCH 02/10] Upstream and debugging changes. --- .../cli/schematic/ClipboardWorld.java | 18 +-- .../src/main/java/com/boydti/fawe/Fawe.java | 1 - .../com/boydti/fawe/beta/IQueueChunk.java | 2 +- .../plotquared/PlotSquaredFeature.java | 7 +- .../java/com/boydti/fawe/util/WEManager.java | 4 + .../worldedit/function/factory/Deform.java | 20 +-- .../function/operation/Operation.java | 12 +- .../com/sk89q/worldedit/util/io/Closer.java | 21 ++++ .../util/translation/TranslationManager.java | 12 +- .../worldedit/world/chunk/AnvilChunk.java | 6 +- .../worldedit/world/chunk/AnvilChunk13.java | 2 +- .../sk89q/worldedit/world/chunk/OldChunk.java | 7 +- .../worldedit/world/storage/ChunkStore.java | 56 +-------- .../world/storage/ChunkStoreHelper.java | 117 ++++++++++++++++++ .../world/storage/LegacyChunkStore.java | 18 +-- .../src/main/resources/lang/strings.json | 10 +- 16 files changed, 196 insertions(+), 117 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStoreHelper.java diff --git a/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/schematic/ClipboardWorld.java b/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/schematic/ClipboardWorld.java index 5e1a26b96..69d1cb1c9 100644 --- a/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/schematic/ClipboardWorld.java +++ b/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/schematic/ClipboardWorld.java @@ -108,11 +108,6 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld return false; } - @Override - public List getEntities(Region region) { - return clipboard.getEntities(region); - } - @Override public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException { @@ -120,13 +115,18 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld } @Override - public List getEntities() { - return clipboard.getEntities(); + public BlockVector3 getSpawnPosition() { + return clipboard.getOrigin(); } @Override - public BlockVector3 getSpawnPosition() { - return clipboard.getOrigin(); + public List getEntities(Region region) { + return clipboard.getEntities(region); + } + + @Override + public List getEntities() { + return clipboard.getEntities(); } @Nullable diff --git a/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java b/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java index 8e8ba17c6..492c2362a 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java @@ -1,7 +1,6 @@ package com.boydti.fawe; import com.boydti.fawe.beta.implementation.queue.QueueHandler; -import com.boydti.fawe.config.Caption; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.brush.visualization.VisualQueue; import com.boydti.fawe.regions.general.integrations.plotquared.PlotSquaredFeature; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueChunk.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueChunk.java index f60556029..c512edd9e 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueChunk.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueChunk.java @@ -10,7 +10,7 @@ public interface IQueueChunk> extends IChunk, Callable { * @return */ @Override - default IQueueChunk reset() { + default IQueueChunk reset() { init(null, getX(), getZ()); return this; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/PlotSquaredFeature.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/PlotSquaredFeature.java index 0d3f11a0b..c0d24887c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/PlotSquaredFeature.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/integrations/plotquared/PlotSquaredFeature.java @@ -97,7 +97,12 @@ public class PlotSquaredFeature extends FaweMaskManager { return false; } UUID uid = player.getUniqueId(); - return !Flags.NO_WORLDEDIT.isTrue(plot) && ((plot.isOwner(uid) || (type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE) || ((plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player.hasPermission("fawe.plotsquared.member"))))) || player.hasPermission("fawe.plotsquared.admin")); + return !Flags.NO_WORLDEDIT.isTrue(plot) && (plot.isOwner(uid) + || type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted() + .contains(DBFunc.EVERYONE) + || (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) + && player.hasPermission("fawe.plotsquared.member")) || player + .hasPermission("fawe.plotsquared.admin")); } @Override diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java b/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java index 6183518f3..82f01dcfc 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/WEManager.java @@ -13,6 +13,7 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.formatting.text.TextComponent; import java.lang.reflect.Field; import java.util.ArrayDeque; import java.util.HashSet; @@ -92,6 +93,7 @@ public class WEManager { backupRegions.add(region); } } else { + player.printDebug(TextComponent.of("Invalid Mask")); removed = true; iterator.remove(); } @@ -115,6 +117,8 @@ public class WEManager { } catch (Throwable e) { e.printStackTrace(); } + } else { + player.printError(TextComponent.of("Missing permission " + "fawe." + manager.getKey())); } } regions.addAll(backupRegions); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java index 9bb608bba..aab9adb8d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.function.factory; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; + import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; @@ -39,9 +42,6 @@ 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 static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; - public class Deform implements Contextual { private Extent destination; @@ -157,12 +157,6 @@ public class Deform implements Contextual { session == null ? WorldEdit.getInstance().getConfiguration().calculationTimeout : session.getTimeout()); } - public enum Mode { - RAW_COORD, - OFFSET, - UNIT_CUBE - } - private static final class DeformOperation implements Operation { private final Extent destination; private final Region region; @@ -199,9 +193,15 @@ public class Deform implements Contextual { @Override public Iterable getStatusMessages() { return ImmutableList.of(TranslatableComponent.of("worldedit.operation.deform.expression", - TextComponent.of(expression).color(TextColor.GRAY))); + TextComponent.of(expression).color(TextColor.LIGHT_PURPLE))); } } + public enum Mode { + RAW_COORD, + OFFSET, + UNIT_CUBE + } + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operation.java index c21f2a6f7..85b0631f3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operation.java @@ -38,11 +38,6 @@ import java.util.stream.Collectors; */ public interface Operation { - /** - * This is an internal field, and should not be touched. - */ - Set warnedDeprecatedClasses = new HashSet<>(); - /** * Complete the next step. If this method returns true, then the method may * be called again in the future, or possibly never. If this method @@ -74,6 +69,11 @@ public interface Operation { default void addStatusMessages(List messages) { } + /** + * This is an internal field, and should not be touched. + */ + Set warnedDeprecatedClasses = new HashSet<>(); + /** * Gets an iterable of messages that describe the current status of the * operation. @@ -87,7 +87,7 @@ public interface Operation { if (oldMessages.size() > 0) { String className = getClass().getName(); if (!warnedDeprecatedClasses.contains(className)) { - WorldEdit.logger.warn("An operation is using the old status message API. This will be removed in further versions. Class: " + className); + WorldEdit.logger.warn("An operation is using the old status message API. This will be removed in WorldEdit 8. Class: " + className); warnedDeprecatedClasses.add(className); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java index 1b7aceda3..85e3f10a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/Closer.java @@ -86,6 +86,27 @@ public final class Closer implements Closeable { return zipFile; } + /** + * Call {@link #rethrow(Throwable)} with the given exception, but before throwing the exception, + * also close this Closer. Exceptions from closing are added to {@code t} as suppressed + * exceptions. + * + * @param t the throwable that should be re-thrown + * @throws IOException if {@code t} is an IOException, or one occurs + */ + public RuntimeException rethrowAndClose(Throwable t) throws IOException { + // bit of a hack here + try { + throw rethrow(t); + } finally { + try { + close(); + } catch (Throwable closeThrown) { + t.addSuppressed(closeThrown); + } + } + } + /** * Stores the given throwable and rethrows it. It will be rethrown as is if it is an * {@code IOException}, {@code RuntimeException} or {@code Error}. Otherwise, it will be rethrown diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java index 46a582736..79ad5d6b2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.util.translation; +import static java.util.stream.Collectors.toMap; + +import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -26,7 +29,6 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.renderer.FriendlyComponentRenderer; import com.sk89q.worldedit.util.io.ResourceLoader; - import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -76,8 +78,10 @@ public class TranslationManager { } private Map filterTranslations(Map translations) { - translations.entrySet().removeIf(entry -> entry.getValue().isEmpty()); - return translations; + return translations.entrySet().stream() + .filter(e -> !e.getValue().isEmpty()) + .map(e -> Maps.immutableEntry(e.getKey(), e.getValue().replace("'", "''"))) + .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); } private Map parseTranslationFile(InputStream inputStream) { @@ -156,4 +160,4 @@ public class TranslationManager { public Locale getDefaultLocale() { return defaultLocale; } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java index 3a2336754..f42997187 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java @@ -29,7 +29,6 @@ import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; -import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; @@ -55,11 +54,10 @@ public class AnvilChunk implements Chunk { /** * Construct the chunk with a compound tag. * - * @param world the world to construct the chunk for * @param tag the tag to read * @throws DataException on a data error */ - public AnvilChunk(World world, CompoundTag tag) throws DataException { + public AnvilChunk(CompoundTag tag) throws DataException { rootTag = tag; rootX = NBTUtils.getChildTag(rootTag.getValue(), "xPos", IntTag.class).getValue(); @@ -261,13 +259,11 @@ public class AnvilChunk implements Chunk { WorldEdit.logger.warn("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk."); return BlockTypes.AIR.getDefaultState().toBaseBlock(); } - if (state.getMaterial().hasContainer()) { CompoundTag tileEntity = getBlockTileEntity(position); if (tileEntity != null) { return state.toBaseBlock(tileEntity); } - } return state.toBaseBlock(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java index daf291e8c..e0717c0e2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java @@ -226,9 +226,9 @@ public class AnvilChunk13 implements Chunk { BlockState[] sectionBlocks = blocks[section]; BlockState state = sectionBlocks != null ? sectionBlocks[(yIndex << 8) | (z << 4) | x] : BlockTypes.AIR.getDefaultState(); - if (state.getMaterial().hasContainer()) { CompoundTag tileEntity = getBlockTileEntity(position); + if (tileEntity != null) { return state.toBaseBlock(tileEntity); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java index 3cc7e002d..540197cee 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java @@ -28,7 +28,6 @@ import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; -import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; @@ -55,11 +54,10 @@ public class OldChunk implements Chunk { /** * Construct the chunk with a compound tag. * - * @param world the world * @param tag the tag * @throws DataException */ - public OldChunk(World world, CompoundTag tag) throws DataException { + public OldChunk(CompoundTag tag) throws DataException { rootTag = tag; blocks = NBTUtils.getChildTag(rootTag.getValue(), "Blocks", ByteArrayTag.class).getValue(); @@ -185,13 +183,12 @@ public class OldChunk implements Chunk { WorldEdit.logger.warn("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk."); return BlockTypes.AIR.getDefaultState().toBaseBlock(); } - if (state.getBlockType().getMaterial().hasContainer()) { + CompoundTag tileEntity = getBlockTileEntity(position); if (tileEntity != null) { return state.toBaseBlock(tileEntity); } - } return state.toBaseBlock(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java index 1b89c8b09..e975a200f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java @@ -20,34 +20,19 @@ package com.sk89q.worldedit.world.storage; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.platform.Capability; -import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.DataException; -import com.sk89q.worldedit.world.DataFixer; import com.sk89q.worldedit.world.World; -import com.sk89q.worldedit.world.chunk.AnvilChunk; -import com.sk89q.worldedit.world.chunk.AnvilChunk13; import com.sk89q.worldedit.world.chunk.Chunk; -import com.sk89q.worldedit.world.chunk.OldChunk; - import java.io.Closeable; import java.io.IOException; -import java.util.Map; /** * Represents chunk storage mechanisms. */ public abstract class ChunkStore implements Closeable { - /** - * The DataVersion for Minecraft 1.13 - */ - private static final int DATA_VERSION_MC_1_13 = 1519; - /** * {@code >>} - to chunk * {@code <<} - from chunk @@ -85,46 +70,7 @@ public abstract class ChunkStore implements Closeable { */ public Chunk getChunk(BlockVector2 position, World world) throws DataException, IOException { CompoundTag rootTag = getChunkTag(position, world); - - Map children = rootTag.getValue(); - CompoundTag tag = null; - - // Find Level tag - for (Map.Entry entry : children.entrySet()) { - if (entry.getKey().equals("Level")) { - if (entry.getValue() instanceof CompoundTag) { - tag = (CompoundTag) entry.getValue(); - break; - } else { - throw new ChunkStoreException("CompoundTag expected for 'Level'; got " + entry.getValue().getClass().getName()); - } - } - } - - if (tag == null) { - throw new ChunkStoreException("Missing root 'Level' tag"); - } - - int dataVersion = rootTag.getInt("DataVersion"); - if (dataVersion == 0) dataVersion = -1; - final Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING); - final int currentDataVersion = platform.getDataVersion(); - if (tag.getValue().containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks - final DataFixer dataFixer = platform.getDataFixer(); - if (dataFixer != null) { - return new AnvilChunk13((CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level")); - } - } - if (dataVersion >= DATA_VERSION_MC_1_13) { - return new AnvilChunk13(tag); - } - - Map tags = tag.getValue(); - if (tags.containsKey("Sections")) { - return new AnvilChunk(world, tag); - } - - return new OldChunk(world, tag); + return ChunkStoreHelper.getChunk(rootTag); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStoreHelper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStoreHelper.java new file mode 100644 index 000000000..083f868b2 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStoreHelper.java @@ -0,0 +1,117 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.world.storage; + +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.NBTInputStream; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.world.DataException; +import com.sk89q.worldedit.world.DataFixer; +import com.sk89q.worldedit.world.chunk.AnvilChunk; +import com.sk89q.worldedit.world.chunk.AnvilChunk13; +import com.sk89q.worldedit.world.chunk.Chunk; +import com.sk89q.worldedit.world.chunk.OldChunk; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +public class ChunkStoreHelper { + + @FunctionalInterface + public interface ChunkDataInputSupplier { + + InputStream openInputStream() throws DataException, IOException; + + } + + public static CompoundTag readCompoundTag(ChunkDataInputSupplier input) throws DataException, IOException { + try (InputStream stream = input.openInputStream(); + NBTInputStream nbt = new NBTInputStream(stream)) { + Tag tag = nbt.readNamedTag().getTag(); + if (!(tag instanceof CompoundTag)) { + throw new ChunkStoreException("CompoundTag expected for chunk; got " + + tag.getClass().getName()); + } + + return (CompoundTag) tag; + } + } + + /** + * The DataVersion for Minecraft 1.13 + */ + private static final int DATA_VERSION_MC_1_13 = 1519; + + /** + * Convert a chunk NBT tag into a {@link Chunk} implementation. + * + * @param rootTag the root tag of the chunk + * @return a Chunk implementation + * @throws DataException if the rootTag is not valid chunk data + */ + public static Chunk getChunk(CompoundTag rootTag) throws DataException { + Map children = rootTag.getValue(); + CompoundTag tag = null; + + // Find Level tag + for (Map.Entry entry : children.entrySet()) { + if (entry.getKey().equals("Level")) { + if (entry.getValue() instanceof CompoundTag) { + tag = (CompoundTag) entry.getValue(); + break; + } else { + throw new ChunkStoreException("CompoundTag expected for 'Level'; got " + entry.getValue().getClass().getName()); + } + } + } + + if (tag == null) { + throw new ChunkStoreException("Missing root 'Level' tag"); + } + + int dataVersion = rootTag.getInt("DataVersion"); + if (dataVersion == 0) dataVersion = -1; + final Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING); + final int currentDataVersion = platform.getDataVersion(); + if (tag.getValue().containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks + final DataFixer dataFixer = platform.getDataFixer(); + if (dataFixer != null) { + return new AnvilChunk13((CompoundTag) dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag, dataVersion).getValue().get("Level")); + } + } + if (dataVersion >= DATA_VERSION_MC_1_13) { + return new AnvilChunk13(tag); + } + + Map tags = tag.getValue(); + if (tags.containsKey("Sections")) { + return new AnvilChunk(tag); + } + + return new OldChunk(tag); + } + + private ChunkStoreHelper() { + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java index b3b5728fe..af302ff62 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java @@ -20,12 +20,9 @@ package com.sk89q.worldedit.world.storage; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.NBTInputStream; -import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -78,18 +75,9 @@ public abstract class LegacyChunkStore extends ChunkStore { String filename = "c." + Integer.toString(x, 36) + "." + Integer.toString(z, 36) + ".dat"; - InputStream stream = getInputStream(folder1, folder2, filename); - Tag tag; - - try (NBTInputStream nbt = new NBTInputStream(new GZIPInputStream(stream))) { - tag = nbt.readNamedTag().getTag(); - if (!(tag instanceof CompoundTag)) { - throw new ChunkStoreException("CompoundTag expected for chunk; got " - + tag.getClass().getName()); - } - - return (CompoundTag) tag; - } + return ChunkStoreHelper.readCompoundTag(() -> + new GZIPInputStream(getInputStream(folder1, folder2, filename)) + ); } private static int divisorMod(int a, int n) { diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index deb5d268a..85a9d8dbf 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -6,11 +6,11 @@ "fawe.worldedit.history.find.element": "&8 - &2{0}: {1} &7ago &3{2}m &6{3} &c/{4}", "fawe.worldedit.history.find.hover": "{0} blocks changed, click for more info", - + "fawe.info.lighting.propagate.selection": "Lighting has been propogated in {0} chunks. (Note: To remove light use //removelight)", "fawe.info.updated.lighting.selection": "Lighting has been updated in {0} chunks. (It may take a second for the packets to send)", "fawe.info.set.region": "Selection set to your current allowed region", - + "fawe.info.worldedit.command.limit": "Please wait until your current action completes", "fawe.info.worldedit.delayed": "Please wait while we process your FAWE action...", "fawe.info.worldedit.run": "Apologies for the delay. Now executing: {0}", @@ -331,7 +331,7 @@ "fawe.tips.tip.regen.1": "Tip: Use a seed with /regen [biome] [seed]", "fawe.tips.tip.biome.pattern": "Tip: The #biome[forest] pattern can be used in any command", "fawe.tips.tip.biome.mask": "Tip: Restrict to a biome with the `$jungle` mask", - + "worldedit.expand.description.vert": "Vertically expand the selection to world limits.", "worldedit.expand.expanded": "Region expanded {0} blocks", "worldedit.expand.expanded.vert": "Region expanded {0} blocks (top-to-bottom).", @@ -408,6 +408,7 @@ "worldedit.restore.failed": "Failed to load snapshot: {0}", "worldedit.restore.loaded": "Snapshot '{0}' loaded; now restoring...", "worldedit.restore.restored": "Restored; {0} missing chunks and {1} other errors.", + "worldedit.restore.none-for-specific-world": "No snapshots were found for world '{0}'.", "worldedit.restore.none-for-world": "No snapshots were found for this world.", "worldedit.restore.none-found": "No snapshots were found.", "worldedit.restore.none-found-console": "No snapshots were found. See console for details.", @@ -502,7 +503,7 @@ "worldedit.paste.pasted": "The clipboard has been pasted at {0}", "worldedit.paste.selected": "Selected clipboard paste region.", - + "worldedit.rotate.no-interpolation": "Note: Interpolation is not yet supported, so angles that are multiples of 90 is recommended.", "worldedit.rotate.rotated": "The clipboard copy has been rotated.", "worldedit.flip.flipped": "The clipboard copy has been flipped.", @@ -517,6 +518,7 @@ "worldedit.replace.replaced": "{0} blocks have been replaced.", "worldedit.stack.changed": "{0} blocks changed. Undo with //undo", "worldedit.regen.regenerated": "Region regenerated.", + "worldedit.regen.failed": "Unable to regenerate chunks. Check console for details.", "worldedit.walls.changed": "{0} blocks have been changed.", "worldedit.faces.changed": "{0} blocks have been changed.", "worldedit.overlay.overlaid": "{0} blocks have been overlaid.", From 3fb5ac6be879c976431b813bc41beeb1e7393cb3 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 3 Jan 2020 14:48:44 +0100 Subject: [PATCH 03/10] Rename debugpaste value names --- .../com/boydti/fawe/bukkit/FaweBukkit.java | 2 +- .../com/boydti/fawe/util/IncendoPaster.java | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java index a7a97f2cd..3a4041b2c 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java @@ -214,7 +214,7 @@ public class FaweBukkit implements IFawe, Listener { @Override public String getDebugInfo() { StringBuilder msg = new StringBuilder(); - msg.append("server.version: ").append(Bukkit.getVersion()).append("\n"); + msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n"); msg.append("Plugins: \n"); for (Plugin p : Bukkit.getPluginManager().getPlugins()) { msg.append(" - ").append(p.getName()).append(": ") diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java b/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java index 1d6a0b7e5..dabeee99c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java @@ -7,12 +7,15 @@ import com.google.gson.JsonParser; import com.sk89q.worldedit.util.paste.Paster; import java.io.*; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.nio.file.Files; import java.util.*; import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; /** * Single class paster for the Incendo paste service @@ -212,18 +215,20 @@ public final class IncendoPaster implements Paster { "# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your " + "problem\n"); b.append("\n# Server Information\n"); - b.append("server.platform: ").append(Fawe.imp().getPlatform()).append('\n'); + b.append("Server Platform: ").append(Fawe.imp().getPlatform()).append('\n'); b.append(Fawe.imp().getDebugInfo()).append('\n'); b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); Runtime runtime = Runtime.getRuntime(); - b.append("memory.free: ").append(runtime.freeMemory()).append('\n'); - b.append("memory.max: ").append(runtime.maxMemory()).append('\n'); - b.append("java.specification.version: '").append(System.getProperty("java.specification.version")).append("'\n"); - b.append("java.vendor: '").append(System.getProperty("java.vendor")).append("'\n"); - b.append("java.version: '").append(System.getProperty("java.version")).append("'\n"); - b.append("os.arch: '").append(System.getProperty("os.arch")).append("'\n"); - b.append("os.name: '").append(System.getProperty("os.name")).append("'\n"); - b.append("os.version: '").append(System.getProperty("os.version")).append("'\n\n"); + RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); + b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n'); + b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n'); + b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n'); + b.append("Java Name: ").append(rb.getVmName()).append('\n'); + b.append("Java Version: '").append(System.getProperty("java.version")).append("'\n"); + b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n"); + b.append("Operating System: '").append(System.getProperty("os.name")).append("'\n"); + b.append("OS Version: ").append(System.getProperty("os.version")).append('\n'); + b.append("OS Arch: ").append(System.getProperty("os.arch")).append('\n'); b.append("# Okay :D Great. You are now ready to create your bug report!"); b.append("\n# You can do so at https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues"); b.append("\n# or via our Discord at https://discord.gg/ngZCzbU"); From cd7133b199bab0990e0483adbb6cf35601d451e8 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 3 Jan 2020 17:53:22 +0100 Subject: [PATCH 04/10] Fix up debugpaste spaces --- .../src/main/java/com/boydti/fawe/util/IncendoPaster.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java b/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java index dabeee99c..12e0e76f2 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/IncendoPaster.java @@ -215,9 +215,8 @@ public final class IncendoPaster implements Paster { "# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your " + "problem\n"); b.append("\n# Server Information\n"); - b.append("Server Platform: ").append(Fawe.imp().getPlatform()).append('\n'); - b.append(Fawe.imp().getDebugInfo()).append('\n'); - b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n"); + b.append(Fawe.imp().getDebugInfo()); + b.append("\n# YAY! Now, let's see what we can find in your JVM\n"); Runtime runtime = Runtime.getRuntime(); RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean(); b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n'); From cfb6e3bca472ce99bf97348c686b881053462fc3 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 3 Jan 2020 12:02:18 -0500 Subject: [PATCH 05/10] Various debugging and cleaning --- .../main/java/com/boydti/fawe/FaweAPI.java | 17 +-- .../main/java/com/boydti/fawe/FaweCache.java | 11 +- .../com/boydti/fawe/beta/IBatchProcessor.java | 7 +- .../java/com/boydti/fawe/beta/IBlocks.java | 3 - .../implementation/blocks/BitSetBlocks.java | 3 - .../implementation/blocks/CharBlocks.java | 13 +- .../implementation/chunk/ChunkHolder.java | 12 +- .../queue/SingleThreadQueueExtent.java | 4 +- .../com/boydti/fawe/jnbt/anvil/MCAChunk.java | 18 +-- .../com/boydti/fawe/jnbt/anvil/MCAFile.java | 7 +- .../object/clipboard/LinearClipboard.java | 1 - .../collection/VariableThreadLocal.java | 3 - .../object/io/LittleEndianOutputStream.java | 67 +++++---- .../fawe/object/regions/PolyhedralRegion.java | 3 +- .../worldedit/command/UtilityCommands.java | 100 +++++++------- .../platform/PlatformCommandManager.java | 130 +++++++++++------- .../platform/binding/ConsumeBindings.java | 11 +- .../platform/binding/PrimitiveBindings.java | 37 ++--- .../regions/ConvexPolyhedralRegion.java | 6 +- .../sk89q/worldedit/regions/CuboidRegion.java | 40 ++---- .../net/jpountz/lz4/LZ4JNICompressor.java | 7 +- 21 files changed, 247 insertions(+), 253 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java index c2ac04cd8..0855f47ae 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java @@ -1,8 +1,6 @@ package com.boydti.fawe; import com.boydti.fawe.beta.IQueueExtent; -import com.boydti.fawe.config.Caption; -import com.sk89q.worldedit.util.formatting.text.Component; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.RegionWrapper; import com.boydti.fawe.object.changeset.DiskStorageHistory; @@ -31,6 +29,7 @@ import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.world.World; import java.io.File; import java.io.IOException; @@ -152,13 +151,12 @@ public class FaweAPI { * Remember to commit when you're done!
* * @param world The name of the world - * @param autoqueue If it should start dispatching before you enqueue it. - * @return - * @see IQueueExtent#enqueue() + * @param autoQueue If it should start dispatching before you enqueue it. + * @return the queue extent */ - public static IQueueExtent createQueue(World world, boolean autoqueue) { + public static IQueueExtent createQueue(World world, boolean autoQueue) { IQueueExtent queue = Fawe.get().getQueueHandler().getQueue(world); - if (!autoqueue) { + if (!autoQueue) { queue.disableQueue(); } return queue; @@ -189,10 +187,9 @@ public class FaweAPI { /** * Just forwards to ClipboardFormat.SCHEMATIC.load(file) * - * @param file - * @return + * @param file the file to load + * @return a clipboard containing the schematic * @see ClipboardFormat - * @see Schematic */ public static Clipboard load(File file) throws IOException { return ClipboardFormats.findByFile(file).load(file); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java index 5084da323..694ad2959 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java @@ -4,11 +4,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static org.slf4j.LoggerFactory.getLogger; import com.boydti.fawe.beta.Trimable; -import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.collection.BitArray4096; import com.boydti.fawe.object.collection.CleanableThreadLocal; @@ -18,6 +13,9 @@ import com.boydti.fawe.object.exception.FaweChunkLoadException; import com.boydti.fawe.object.exception.FaweException; import com.boydti.fawe.util.IOUtil; import com.boydti.fawe.util.MathMan; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; import com.sk89q.jnbt.ByteArrayTag; import com.sk89q.jnbt.ByteTag; import com.sk89q.jnbt.CompoundTag; @@ -34,6 +32,7 @@ import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.math.MutableVector3; +import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.world.block.BlockTypesCache; import java.lang.reflect.Field; import java.util.ArrayList; @@ -192,7 +191,7 @@ public enum FaweCache implements Trimable { } else { pool = cache::get; } - Pool previous = REGISTERED_POOLS.putIfAbsent(clazz, pool); + Pool previous = REGISTERED_POOLS.putIfAbsent(clazz, pool); if (previous != null) { throw new IllegalStateException("Previous key"); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IBatchProcessor.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IBatchProcessor.java index 8bd9b9e33..c07a60fa2 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IBatchProcessor.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IBatchProcessor.java @@ -1,9 +1,6 @@ package com.boydti.fawe.beta; import com.boydti.fawe.FaweCache; -import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock; -import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock; -import com.boydti.fawe.beta.implementation.filter.block.FilterBlock; import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor; import com.boydti.fawe.beta.implementation.processors.MultiBatchProcessor; import com.sk89q.jnbt.CompoundTag; @@ -68,10 +65,12 @@ public interface IBatchProcessor { } } } - for (int layer = (minY - 15) >> 4; layer < (maxY + 15) >> 4; layer++) { + int layer = (minY - 15) >> 4; + while (layer < (maxY + 15) >> 4) { if (set.hasSection(layer)) { return true; } + layer++; } return false; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IBlocks.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IBlocks.java index 2356fd840..79fb0bc08 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IBlocks.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IBlocks.java @@ -8,12 +8,9 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.BlockRegistry; - import java.io.IOException; import java.util.Map; import java.util.Set; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/BitSetBlocks.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/BitSetBlocks.java index 0c5bb0eff..4989bbb64 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/BitSetBlocks.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/BitSetBlocks.java @@ -4,13 +4,10 @@ import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.IChunkSet; import com.boydti.fawe.object.collection.MemBlockSet; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; - import java.util.Arrays; import java.util.Collections; import java.util.Map; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/CharBlocks.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/CharBlocks.java index d4b0582c3..76156ecaa 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/CharBlocks.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/CharBlocks.java @@ -1,9 +1,11 @@ package com.boydti.fawe.beta.implementation.blocks; +import com.boydti.fawe.Fawe; import com.boydti.fawe.beta.IBlocks; import com.boydti.fawe.beta.IChunkSet; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypesCache; +import org.jetbrains.annotations.Range; public abstract class CharBlocks implements IBlocks { @@ -66,7 +68,7 @@ public abstract class CharBlocks implements IBlocks { return null; } - public void reset(int layer) { + public void reset(@Range(from = 0, to = 15) int layer) { sections[layer] = EMPTY; } @@ -81,12 +83,12 @@ public abstract class CharBlocks implements IBlocks { } @Override - public boolean hasSection(int layer) { + public boolean hasSection(@Range(from = 0, to = 15) int layer) { return sections[layer] == FULL; } @Override - public char[] load(int layer) { + public char[] load(@Range(from = 0, to = 15) int layer) { return sections[layer].get(this, layer); } @@ -102,6 +104,7 @@ public abstract class CharBlocks implements IBlocks { } public void set(int x, int y, int z, char value) { + Fawe.imp().debug("Setting Block at x:" + x + ", y:" + y + " , z:" + z); final int layer = y >> 4; final int index = (y & 15) << 8 | z << 4 | x; set(layer, index, value); @@ -111,11 +114,11 @@ public abstract class CharBlocks implements IBlocks { Section */ - public final char get(int layer, int index) { + public final char get(@Range(from = 0, to = 15)int layer, int index) { return sections[layer].get(this, layer, index); } - public final void set(int layer, int index, char value) { + public final void set(@Range(from = 0, to = 15) int layer, int index, char value) { sections[layer].set(this, layer, index, value); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java index 2468ec128..2ce534b9b 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java @@ -250,16 +250,14 @@ public class ChunkHolder> implements IQueueChunk { } @Override - public boolean setBiome(ChunkHolder chunk, int x, int y, int z, - BiomeType biome) { + public boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome) { chunk.getOrCreateSet(); chunk.delegate = SET; return chunk.setBiome(x, y, z, biome); } @Override - public boolean setBlock(ChunkHolder chunk, int x, int y, int z, - BlockStateHolder block) { + public boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder block) { chunk.getOrCreateSet(); chunk.delegate = SET; return chunk.setBlock(x, y, z, block); @@ -471,11 +469,9 @@ public class ChunkHolder> implements IQueueChunk { IChunkGet get(ChunkHolder chunk); IChunkSet set(ChunkHolder chunk); - boolean setBiome(ChunkHolder chunk, int x, int y, int z, - BiomeType biome); + boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome); - boolean setBlock(ChunkHolder chunk, int x, int y, int z, - BlockStateHolder holder); + boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder holder); BiomeType getBiome(ChunkHolder chunk, int x, int y, int z); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/SingleThreadQueueExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/SingleThreadQueueExtent.java index e7cbd42bf..acf2357ee 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/SingleThreadQueueExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/SingleThreadQueueExtent.java @@ -33,8 +33,8 @@ import java.util.concurrent.Future; */ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent { -// // Pool discarded chunks for reuse (can safely be cleared by another thread) -// private static final ConcurrentLinkedQueue CHUNK_POOL = new ConcurrentLinkedQueue<>(); + // Pool discarded chunks for reuse (can safely be cleared by another thread) + // private static final ConcurrentLinkedQueue CHUNK_POOL = new ConcurrentLinkedQueue<>(); // Chunks currently being queued / worked on private final Long2ObjectLinkedOpenHashMap chunks = new Long2ObjectLinkedOpenHashMap<>(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java index 66997ed4e..34b07dc47 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java @@ -142,7 +142,7 @@ public class MCAChunk implements IChunk { for (Map.Entry entry : properties.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); - Property property = type.getProperty(key); + Property property = type.getProperty(key); state = state.with(property, property.getValueFor(value)); } } @@ -246,8 +246,8 @@ public class MCAChunk implements IChunk { int type = NBTConstants.TYPE_BYTE_ARRAY; out.writeNamedTagName("Biomes", type); out.writeInt(biomes.length); - for (int i = 0; i < biomes.length; i++) { - out.write(biomes[i].getLegacyId()); + for (BiomeType biome : biomes) { + out.write(biome.getLegacyId()); } } int len = 0; @@ -430,9 +430,7 @@ public class MCAChunk implements IChunk { if (tile != null) { tiles.put(x, y, z, tile); } else { - if (tiles.remove(x, y, z) == null) { - return false; - } + return tiles.remove(x, y, z) != null; } return true; } @@ -520,18 +518,14 @@ public class MCAChunk implements IChunk { @Override public void setBlocks(int layer, char[] data) { int offset = layer << 12; - for (int i = 0; i < 4096; i++) { - blocks[offset + i] = data[i]; - } + System.arraycopy(data, 0, blocks, offset, 4096); } @Override public char[] load(int layer) { char[] tmp = FaweCache.IMP.SECTION_BITS_TO_CHAR.get(); int offset = layer << 12; - for (int i = 0; i < 4096; i++) { - tmp[i] = blocks[offset + i]; - } + System.arraycopy(blocks, offset, tmp, 0, 4096); return tmp; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAFile.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAFile.java index db5aed22c..f8ceb5f10 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAFile.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAFile.java @@ -34,6 +34,7 @@ import java.util.concurrent.ForkJoinTask; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; +import java.util.stream.IntStream; import java.util.zip.Deflater; import java.util.zip.Inflater; import java.util.zip.InflaterInputStream; @@ -397,10 +398,8 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh } public List getCachedChunks() { - int size = 0; - for (int i = 0; i < chunks.length; i++) { - if (chunks[i] != null && this.chunkInitialized[i]) size++; - } + int size = (int) IntStream.range(0, chunks.length) + .filter(i -> chunks[i] != null && this.chunkInitialized[i]).count(); ArrayList list = new ArrayList<>(size); for (int i = 0; i < chunks.length; i++) { MCAChunk chunk = chunks[i]; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LinearClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LinearClipboard.java index 380ea5301..6c4b1278f 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LinearClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LinearClipboard.java @@ -41,7 +41,6 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa * The locations provided are relative to the clipboard min * * @param task - * @param air */ public abstract void streamBiomes(IntValueReader task); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/VariableThreadLocal.java b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/VariableThreadLocal.java index 921eef0ac..8c5da3c55 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/VariableThreadLocal.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/VariableThreadLocal.java @@ -1,8 +1,5 @@ package com.boydti.fawe.object.collection; -import java.util.function.Function; -import java.util.function.Supplier; - public class VariableThreadLocal extends CleanableThreadLocal { public VariableThreadLocal() { super(() -> null); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/io/LittleEndianOutputStream.java b/worldedit-core/src/main/java/com/boydti/fawe/object/io/LittleEndianOutputStream.java index bc9060ce6..7c46fdbf4 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/io/LittleEndianOutputStream.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/io/LittleEndianOutputStream.java @@ -5,6 +5,7 @@ import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.UTFDataFormatException; +import org.jetbrains.annotations.NotNull; public class LittleEndianOutputStream extends FilterOutputStream implements DataOutput { @@ -18,7 +19,7 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data * output stream specified by the out argument. * * @param out the underlying output stream. - * @see java.io.FilterOutputStream#out + * @see FilterOutputStream#out */ public LittleEndianOutputStream(OutputStream out) { super(out); @@ -27,24 +28,26 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data /** * Writes the specified byte value to the underlying output stream. * - * @param b the byte value to be written. + * @param b the {@code byte} value to be written. * @exception IOException if the underlying stream throws an IOException. */ + @Override public synchronized void write(int b) throws IOException { out.write(b); written++; } /** - * Writes length bytes from the specified byte array - * starting at offset to the underlying output stream. + * Writes {@code length} bytes from the specified byte array + * starting at {@code offset} to the underlying output stream. * * @param data the data. * @param offset the start offset in the data. * @param length the number of bytes to write. * @exception IOException if the underlying stream throws an IOException. */ - public synchronized void write(byte[] data, int offset, int length) + @Override + public synchronized void write(@NotNull byte[] data, int offset, int length) throws IOException { out.write(data, offset, length); written += length; @@ -52,13 +55,14 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data /** - * Writes a boolean to the underlying output stream as + * Writes a {@code boolean} to the underlying output stream as * a single byte. If the argument is true, the byte value 1 is written. - * If the argument is false, the byte value 0 in written. + * If the argument is false, the byte value {@code 0} in written. * - * @param b the boolean value to be written. + * @param b the {@code boolean} value to be written. * @exception IOException if the underlying stream throws an IOException. */ + @Override public void writeBoolean(boolean b) throws IOException { if (b) this.write(1); @@ -67,23 +71,25 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data } /** - * Writes out a byte to the underlying output stream + * Writes out a {@code byte} to the underlying output stream * - * @param b the byte value to be written. + * @param b the {@code byte} value to be written. * @exception IOException if the underlying stream throws an IOException. */ + @Override public void writeByte(int b) throws IOException { out.write(b); written++; } /** - * Writes a two byte short to the underlying output stream in + * Writes a two byte {@code short} to the underlying output stream in * little endian order, low byte first. * - * @param s the short to be written. + * @param s the {@code short} to be written. * @exception IOException if the underlying stream throws an IOException. */ + @Override public void writeShort(int s) throws IOException { out.write(s & 0xFF); @@ -93,12 +99,13 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data } /** - * Writes a two byte char to the underlying output stream + * Writes a two byte {@code char} to the underlying output stream * in little endian order, low byte first. * - * @param c the char value to be written. + * @param c the {@code char} value to be written. * @exception IOException if the underlying stream throws an IOException. */ + @Override public void writeChar(int c) throws IOException { out.write(c & 0xFF); @@ -108,12 +115,13 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data } /** - * Writes a four-byte int to the underlying output stream + * Writes a four-byte {@code int} to the underlying output stream * in little endian order, low byte first, high byte last * - * @param i the int to be written. + * @param i the {@code int} to be written. * @exception IOException if the underlying stream throws an IOException. */ + @Override public void writeInt(int i) throws IOException { out.write(i & 0xFF); @@ -125,12 +133,13 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data } /** - * Writes an eight-byte long to the underlying output stream + * Writes an eight-byte {@code long} to the underlying output stream * in little endian order, low byte first, high byte last * - * @param l the long to be written. + * @param l the {@code long} to be written. * @exception IOException if the underlying stream throws an IOException. */ + @Override public void writeLong(long l) throws IOException { out.write((int) l & 0xFF); @@ -149,9 +158,10 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data * Writes a 4 byte Java float to the underlying output stream in * little endian order. * - * @param f the float value to be written. + * @param f the {@code float} value to be written. * @exception IOException if an I/O error occurs. */ + @Override public final void writeFloat(float f) throws IOException { this.writeInt(Float.floatToIntBits(f)); @@ -162,9 +172,10 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data * Writes an 8 byte Java double to the underlying output stream in * little endian order. * - * @param d the double value to be written. + * @param d the {@code double} value to be written. * @exception IOException if an I/O error occurs. */ + @Override public final void writeDouble(double d) throws IOException { this.writeLong(Double.doubleToLongBits(d)); @@ -174,13 +185,14 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data /** * Writes a string to the underlying output stream as a sequence of * bytes. Each character is written to the data output stream as - * if by the writeByte() method. + * if by the {@code writeByte()} method. * - * @param s the String value to be written. + * @param s the {@code String} value to be written. * @exception IOException if the underlying stream throws an IOException. * @see java.io.DataOutputStream#writeByte(int) * @see java.io.DataOutputStream#out */ + @Override public void writeBytes(String s) throws IOException { int length = s.length(); @@ -193,13 +205,14 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data /** * Writes a string to the underlying output stream as a sequence of * characters. Each character is written to the data output stream as - * if by the writeChar method. + * if by the {@code writeChar} method. * - * @param s a String value to be written. + * @param s a {@code String} value to be written. * @exception IOException if the underlying stream throws an IOException. * @see java.io.DataOutputStream#writeChar(int) * @see java.io.DataOutputStream#out */ + @Override public void writeChars(String s) throws IOException { int length = s.length(); @@ -227,6 +240,7 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data * 65,535 characters. * @exception IOException if the underlying stream throws an IOException. */ + @Override public void writeUTF(String s) throws IOException { int numchars = s.length(); @@ -270,11 +284,10 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data * (This class is not thread-safe with respect to this method. It is * possible that this number is temporarily less than the actual * number of bytes written.) - * @return the value of the written field. - * @see java.io.DataOutputStream#written + * @return the value of the {@code written} field. */ public int size() { return this.written; } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/regions/PolyhedralRegion.java b/worldedit-core/src/main/java/com/boydti/fawe/object/regions/PolyhedralRegion.java index 8f2500fbe..1a52f3ba3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/regions/PolyhedralRegion.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/regions/PolyhedralRegion.java @@ -33,7 +33,6 @@ import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import java.util.Vector; import javax.annotation.Nullable; public class PolyhedralRegion extends AbstractRegion { @@ -69,7 +68,7 @@ public class PolyhedralRegion extends AbstractRegion { private BlockVector3 centerAccum = BlockVector3.ZERO; /** - * The last triangle that caused a {@link #contains(Vector)} to classify a point as "outside". Used for optimization. + * The last triangle that caused a {@link #contains(BlockVector3)} to classify a point as "outside". Used for optimization. */ private Triangle lastTriangle; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index 8d5028505..7c9e02a09 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -520,33 +520,6 @@ public class UtilityCommands { return affected; } - private int killMatchingEntities(Integer radius, Actor actor, Supplier func) throws IncompleteRegionException, - MaxChangedBlocksException { - List visitors = new ArrayList<>(); - - LocalSession session = we.getSessionManager().get(actor); - BlockVector3 center = session.getPlacementPosition(actor); - EditSession editSession = session.createEditSession(actor); - List entities; - if (radius >= 0) { - CylinderRegion region = CylinderRegion.createRadius(editSession, center, radius); - entities = editSession.getEntities(region); - } else { - entities = editSession.getEntities(); - } - visitors.add(new EntityVisitor(entities.iterator(), func.get())); - - int killed = 0; - for (EntityVisitor visitor : visitors) { - Operations.completeLegacy(visitor); - killed += visitor.getAffected(); - } - - session.remember(editSession); - editSession.flushSession(); - return killed; - } - @Command( name = "extinguish", aliases = { "/ex", "/ext", "/extinguish", "ex", "ext" }, @@ -632,6 +605,55 @@ public class UtilityCommands { return killed; } + @Command( + name = "remove", + aliases = { "rem", "rement" }, + desc = "Remove all entities of a type" + ) + @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 { + if (radius < -1) { + actor.printError(TranslatableComponent.of("worldedit.remove.explain-all")); + return 0; + } + + int removed = killMatchingEntities(radius, actor, remover::createFunction); + actor.printInfo(TranslatableComponent.of("worldedit.remove.removed", TextComponent.of(removed))); + return removed; + } + + private int killMatchingEntities(Integer radius, Actor actor, Supplier func) throws IncompleteRegionException, + MaxChangedBlocksException { + List visitors = new ArrayList<>(); + + LocalSession session = we.getSessionManager().get(actor); + BlockVector3 center = session.getPlacementPosition(actor); + EditSession editSession = session.createEditSession(actor); + List entities; + if (radius >= 0) { + CylinderRegion region = CylinderRegion.createRadius(editSession, center, radius); + entities = editSession.getEntities(region); + } else { + entities = editSession.getEntities(); + } + visitors.add(new EntityVisitor(entities.iterator(), func.get())); + + int killed = 0; + for (EntityVisitor visitor : visitors) { + Operations.completeLegacy(visitor); + killed += visitor.getAffected(); + } + + session.remember(editSession); + editSession.flushSession(); + return killed; + } + @Command( name = "/help", desc = "Displays help for WorldEdit commands" @@ -648,28 +670,6 @@ public class UtilityCommands { we.getPlatformManager().getPlatformCommandManager().getCommandManager(), actor, "//help"); } - @Command( - name = "remove", - aliases = { "rem", "rement" }, - desc = "Remove all entities of a type" - ) - @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 { - if (radius < -1) { - actor.printError(TranslatableComponent.of("worldedit.remove.explain-all")); - return 0; - } - - int removed = killMatchingEntities(radius, actor, remover::createFunction); - actor.printInfo(TranslatableComponent.of("worldedit.remove.removed", TextComponent.of(removed))); - return removed; - } - private DecimalFormat formatForLocale(Locale locale) { DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(locale); format.applyPattern("#,##0.#####"); @@ -696,7 +696,7 @@ public class UtilityCommands { double result = expression.evaluate( new double[]{}, WorldEdit.getInstance().getSessionManager().get(actor).getTimeout()); String formatted = Double.isNaN(result) ? "NaN" : formatForLocale(actor.getLocale()).format(result); - return SubtleFormat.wrap(input + " = ").append(TextComponent.of(formatted, TextColor.GRAY)); + return SubtleFormat.wrap(input + " = ").append(TextComponent.of(formatted, TextColor.LIGHT_PURPLE)); }, (Component) null); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java index 01d8a644a..f4e7d013b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java @@ -19,21 +19,20 @@ package com.sk89q.worldedit.extension.platform; +import static com.google.common.base.Preconditions.checkNotNull; + import com.boydti.fawe.Fawe; import com.boydti.fawe.command.AnvilCommands; import com.boydti.fawe.command.AnvilCommandsRegistration; import com.boydti.fawe.command.CFICommands; import com.boydti.fawe.command.CFICommandsRegistration; import com.boydti.fawe.config.Caption; -import com.boydti.fawe.util.StringMan; -import com.sk89q.worldedit.command.HistorySubCommands; -import com.sk89q.worldedit.command.HistorySubCommandsRegistration; -import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator; import com.boydti.fawe.object.changeset.CFIChangeSet; import com.boydti.fawe.object.exception.FaweException; import com.boydti.fawe.object.task.ThrowableSupplier; +import com.boydti.fawe.util.StringMan; import com.boydti.fawe.util.TaskManager; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -61,6 +60,8 @@ import com.sk89q.worldedit.command.GenerationCommands; import com.sk89q.worldedit.command.GenerationCommandsRegistration; import com.sk89q.worldedit.command.HistoryCommands; import com.sk89q.worldedit.command.HistoryCommandsRegistration; +import com.sk89q.worldedit.command.HistorySubCommands; +import com.sk89q.worldedit.command.HistorySubCommandsRegistration; import com.sk89q.worldedit.command.MaskCommands; import com.sk89q.worldedit.command.MaskCommandsRegistration; import com.sk89q.worldedit.command.NavigationCommands; @@ -135,10 +136,26 @@ import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.util.eventbus.Subscribe; 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.util.logging.DynamicStreamHandler; import com.sk89q.worldedit.util.logging.LogFormat; import com.sk89q.worldedit.world.World; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.logging.FileHandler; +import java.util.logging.Level; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import javax.annotation.Nullable; import org.enginehub.piston.Command; import org.enginehub.piston.CommandManager; import org.enginehub.piston.converter.ArgumentConverter; @@ -160,27 +177,10 @@ import org.enginehub.piston.part.SubCommandPart; import org.enginehub.piston.suggestion.Suggestion; import org.enginehub.piston.util.HelpGenerator; import org.enginehub.piston.util.ValueProvider; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.function.BiConsumer; -import java.util.function.Consumer; -import java.util.logging.FileHandler; -import java.util.logging.Level; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkNotNull; - /** * Handles the registration and invocation of commands. @@ -333,15 +333,41 @@ public final class PlatformCommandManager { } private void registerSubCommands(String name, List aliases, String desc, - CommandManager commandManager, - Consumer> handlerInstance) { - registerSubCommands(name, aliases, desc, commandManager, handlerInstance, m -> {}); + CommandRegistration registration, CI instance) { + registerSubCommands(name, aliases, desc, registration, instance, m -> {}); + } + + private void registerSubCommands(String name, List aliases, String desc, + CommandRegistration registration, CI instance, + Consumer additionalConfig) { + commandManager.register(name, cmd -> { + cmd.aliases(aliases); + cmd.description(TextComponent.of(desc)); + cmd.action(Command.Action.NULL_ACTION); + + CommandManager manager = commandManagerService.newCommandManager(); + this.registration.register( + manager, + registration, + instance + ); + additionalConfig.accept(manager); + + final List subCommands = manager.getAllCommands().collect(Collectors.toList()); + cmd.addPart(SubCommandPart.builder(TranslatableComponent.of("worldedit.argument.action"), + TextComponent.of("Sub-command to run.")) + .withCommands(subCommands) + .required() + .build()); + + cmd.condition(new SubCommandPermissionCondition.Generator(subCommands).build()); + }); } private void registerSubCommands(String name, List aliases, String desc, CommandManager commandManager, Consumer> handlerInstance, - Consumer additionalConfig) { + @NotNull Consumer additionalConfig) { commandManager.register(name, cmd -> { cmd.aliases(aliases); cmd.description(TextComponent.of(desc)); @@ -356,7 +382,7 @@ public final class PlatformCommandManager { instance ); }); - if (additionalConfig != null) additionalConfig.accept(manager); + additionalConfig.accept(manager); final List subCommands = manager.getAllCommands().collect(Collectors.toList()); cmd.addPart(SubCommandPart.builder(TranslatableComponent.of("worldedit.argument.action"), @@ -369,26 +395,21 @@ public final class PlatformCommandManager { }); } - public void registerSubCommands(String name, List aliases, String desc, - CommandRegistration registration, CI instance) { - registerSubCommands(name, aliases, desc, commandManager, c -> c.accept(registration, instance)); - } - public void registerAllCommands() { if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) { registerSubCommands( - "patterns", - ImmutableList.of(), - "Patterns determine what blocks are placed", - PatternCommandsRegistration.builder(), - new PatternCommands() + "patterns", + ImmutableList.of(), + "Patterns determine what blocks are placed", + PatternCommandsRegistration.builder(), + new PatternCommands() ); registerSubCommands( - "masks", - ImmutableList.of(), - "Masks determine which blocks are placed", - MaskCommandsRegistration.builder(), - new MaskCommands(worldEdit) + "masks", + ImmutableList.of(), + "Masks determine which blocks are placed", + MaskCommandsRegistration.builder(), + new MaskCommands(worldEdit) ); registerSubCommands( "transforms", @@ -486,11 +507,11 @@ public final class PlatformCommandManager { history ); registerSubCommands( - "/history", - ImmutableList.of("/frb"), - "Manage your history", - HistorySubCommandsRegistration.builder(), - new HistorySubCommands(history) + "/history", + ImmutableList.of("/frb"), + "Manage your history", + HistorySubCommandsRegistration.builder(), + new HistorySubCommands(history) ); this.registration.register( commandManager, @@ -718,7 +739,7 @@ public final class PlatformCommandManager { if (msg != TextComponent.empty()) { actor.print(TextComponent.builder("") .color(TextColor.RED) - .append(msg) + .append(e.getRichMessage()) .build()); List argList = parseArgs(event.getArguments()).map(Substring::getSubstring).collect(Collectors.toList()); printUsage(actor, argList); @@ -736,13 +757,16 @@ public final class PlatformCommandManager { editSession.flushQueue(); session.remember(editSession); - long timems = System.currentTimeMillis() - start; - if (timems > 1000) { + long time = System.currentTimeMillis() - start; + double timeS = (time / 1000.0); + int changed = editSession.getBlockChangeCount(); + double throughput = timeS == 0 ? changed : changed / timeS; + if (time > 1000) { actor.printDebug(TranslatableComponent.of( "worldedit.command.time-elapsed", - TextComponent.of(timems + "m"), - TextComponent.of(-1), - TextComponent.of(Math.round(-1)) + TextComponent.of(timeS), + TextComponent.of(changed), + TextComponent.of(Math.round(throughput)) )); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ConsumeBindings.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ConsumeBindings.java index c9fcb251b..0d6d40693 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ConsumeBindings.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ConsumeBindings.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Identifiable; import com.sk89q.worldedit.util.TreeGenerator; +import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; @@ -168,11 +169,10 @@ public class ConsumeBindings extends Bindings { } /** - * Gets an {@link TreeType} from a {@link ArgumentStack}. + * Gets an {@link TreeType} from a {@link Binding}. * - * @param context the context + * @param argument the context * @return a TreeType - * @throws ParameterException on error * @throws WorldEditException on error */ @Binding @@ -192,11 +192,10 @@ public class ConsumeBindings extends Bindings { } /** - * Gets an {@link BiomeType} from a {@link ArgumentStack}. + * Gets an {@link BiomeType} from a {@link Binding}. * - * @param context the context + * @param argument the context * @return a BiomeType - * @throws ParameterException on error * @throws WorldEditException on error */ @Binding diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java index aefda48f0..b24868c9c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java @@ -18,13 +18,8 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.World; -import org.enginehub.piston.CommandManager; -import org.enginehub.piston.annotation.Command; -import org.enginehub.piston.inject.InjectedValueStore; - -import javax.annotation.Nullable; -import java.lang.annotation.Annotation; import java.util.Locale; +import javax.annotation.Nullable; public class PrimitiveBindings extends Bindings { public PrimitiveBindings(WorldEdit worldEdit) { @@ -50,9 +45,9 @@ public class PrimitiveBindings extends Bindings { } /** - * Gets an {@link com.sk89q.worldedit.extent.Extent} from a {@link ArgumentStack}. + * Gets an {@link Extent} from a {@link Binding}. * - * @param context the context + * @param argument the context * @return an extent * @throws InputParseException on other error */ @@ -74,9 +69,9 @@ public class PrimitiveBindings extends Bindings { } /** - * Gets a type from a {@link ArgumentStack}. + * Gets a type from a {@link Binding}. * - * @param context the context + * @param argument the context * @return the requested type * @throws InputParseException on error */ @@ -105,16 +100,15 @@ public class PrimitiveBindings extends Bindings { } /** - * Gets a type from a {@link ArgumentStack}. + * Gets a type from a {@link Binding}. * - * @param context the context + * @param argument the context * @return the requested type * @throws InputParseException on error */ @Binding public Vector3 getVector3(String argument) { - String radiusString = argument; - String[] radii = radiusString.split(","); + String[] radii = argument.split(","); final double radiusX, radiusY, radiusZ; switch (radii.length) { case 1: @@ -135,9 +129,9 @@ public class PrimitiveBindings extends Bindings { /** - * Gets a type from a {@link ArgumentStack}. + * Gets a type from a {@link Binding}. * - * @param context the context + * @param argument the context * @return the requested type * @throws InputParseException on error */ @@ -163,9 +157,9 @@ public class PrimitiveBindings extends Bindings { } /** - * Gets a type from a {@link ArgumentStack}. + * Gets a type from a {@link Binding}. * - * @param context the context + * @param argument the context * @return the requested type * @throws InputParseException on error */ @@ -193,16 +187,15 @@ public class PrimitiveBindings extends Bindings { /** - * Gets a type from a {@link ArgumentStack}. + * Gets a type from a {@link Binding}. * - * @param context the context + * @param argument the context * @return the requested type * @throws InputParseException on error */ @Binding public BlockVector2 getBlockVector2(String argument) { - String radiusString = argument; - String[] radii = radiusString.split(","); + String[] radii = argument.split(","); final double radiusX, radiusZ; switch (radii.length) { case 1: diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java index 68fe98b8f..9e21a24a8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java @@ -69,7 +69,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { private BlockVector3 centerAccum = BlockVector3.ZERO; /** - * The last triangle that caused a {@link #contains(Vector3)} to classify a point as "outside". Used for optimization. + * The last triangle that caused a {@link #contains(BlockVector3)} to classify a point as "outside". Used for optimization. */ private Triangle lastTriangle; @@ -196,7 +196,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { } if (!vertexBacklog.isEmpty()) { - // Remove the new vertex + // Remove the new vertex vertices.remove(vertex); // Clone, clear and work through the backlog @@ -226,7 +226,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion { public BlockVector3 getMaximumPoint() { return maximumPoint; } - + @Override public Vector3 getCenter() { return centerAccum.toVector3().divide(vertices.size()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 09f6ad2ee..03b6fdc6c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -49,10 +49,7 @@ import org.jetbrains.annotations.NotNull; public class CuboidRegion extends AbstractRegion implements FlatRegion { - private boolean useOldIterator; private int minX, minY, minZ, maxX, maxY, maxZ; - private BlockVector3 min; - private BlockVector3 max; private BlockVector3 pos1; private BlockVector3 pos2; @@ -82,10 +79,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { recalculate(); } - public void setUseOldIterator(boolean useOldIterator) { - this.useOldIterator = useOldIterator; - } - /** * Get the first cuboid-defining corner. * @@ -139,8 +132,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { maxX = Math.max(pos1.getX(), pos2.getX()); maxY = Math.max(pos1.getY(), pos2.getY()); maxZ = Math.max(pos1.getZ(), pos2.getZ()); - this.min = BlockVector3.at(minX, minY, minZ); - this.max = BlockVector3.at(maxX, maxY, maxZ); } /** @@ -188,12 +179,22 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public BlockVector3 getMinimumPoint() { - return min; + return pos1.getMinimum(pos2); } @Override public BlockVector3 getMaximumPoint() { - return max; + return pos1.getMaximum(pos2); + } + + @Override + public int getMinimumY() { + return minY; + } + + @Override + public int getMaximumY() { + return maxY; } @Override @@ -448,7 +449,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public Iterator iterator() { - if (Settings.IMP.HISTORY.COMPRESSION_LEVEL >= 9 || useOldIterator) { + if (Settings.IMP.HISTORY.COMPRESSION_LEVEL >= 9) { return iterator_old(); } return new Iterator() { @@ -644,16 +645,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { return new CuboidRegion(origin.subtract(size), origin.add(size)); } - @Override - public int getMinimumY() { - return minY; - } - - @Override - public int getMaximumY() { - return maxY; - } - public int getMinimumX() { return minX; } @@ -724,7 +715,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { trimNBT(set, this::contains); return set; } - else if (tx >= minX && bx <= maxX && tz >= minZ && bz <= maxZ) { + if (tx >= minX && bx <= maxX && tz >= minZ && bz <= maxZ) { trimY(set, minY, maxY); final int lowerX = Math.max(0, minX - bx); final int upperX = Math.min(15, 15 + maxX - tx); @@ -781,9 +772,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } trimNBT(set, this::contains); return set; - } else { - return null; } + return null; } diff --git a/worldedit-core/src/main/java/net/jpountz/lz4/LZ4JNICompressor.java b/worldedit-core/src/main/java/net/jpountz/lz4/LZ4JNICompressor.java index e0225751b..83295ec2f 100644 --- a/worldedit-core/src/main/java/net/jpountz/lz4/LZ4JNICompressor.java +++ b/worldedit-core/src/main/java/net/jpountz/lz4/LZ4JNICompressor.java @@ -14,15 +14,14 @@ package net.jpountz.lz4; * limitations under the License. */ -import java.nio.ByteBuffer; - - import static net.jpountz.util.ByteBufferUtils.checkNotReadOnly; import static net.jpountz.util.ByteBufferUtils.checkRange; import static net.jpountz.util.SafeUtils.checkRange; +import java.nio.ByteBuffer; + /** - * Fast {@link LZ4FastCompressor}s implemented with JNI bindings to the original C + * Fast {@link LZ4Compressor} implemented with JNI bindings to the original C * implementation of LZ4. */ final class LZ4JNICompressor extends LZ4Compressor { From dfa3f457d68e2f7b95fe3b8d72b6c7245d20bdd6 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 3 Jan 2020 12:30:46 -0500 Subject: [PATCH 06/10] New debugging to generate less console messages. --- .../implementation/blocks/CharBlocks.java | 11 ++++-- .../worldedit/command/GenerationCommands.java | 34 ++++++++----------- .../worldedit/command/HistorySubCommands.java | 29 ++++++++-------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/CharBlocks.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/CharBlocks.java index 76156ecaa..1b2aa0039 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/CharBlocks.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/blocks/CharBlocks.java @@ -104,10 +104,15 @@ public abstract class CharBlocks implements IBlocks { } public void set(int x, int y, int z, char value) { - Fawe.imp().debug("Setting Block at x:" + x + ", y:" + y + " , z:" + z); final int layer = y >> 4; final int index = (y & 15) << 8 | z << 4 | x; - set(layer, index, value); + try { + set(layer, index, value); + } catch (ArrayIndexOutOfBoundsException exception) { + Fawe.imp().debug("Tried Setting Block at x:" + x + ", y:" + y + " , z:" + z); + Fawe.imp().debug("Layer variable was = " + layer); + exception.printStackTrace(); + } } /* @@ -118,7 +123,7 @@ public abstract class CharBlocks implements IBlocks { return sections[layer].get(this, layer, index); } - public final void set(@Range(from = 0, to = 15) int layer, int index, char value) { + public final void set(@Range(from = 0, to = 15) int layer, int index, char value) throws ArrayIndexOutOfBoundsException { sections[layer].set(this, layer, index, value); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index 201ad394f..77fe4b5c2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -18,6 +18,7 @@ */ package com.sk89q.worldedit.command; +import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL; import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT; import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION; @@ -25,7 +26,6 @@ import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgum import com.boydti.fawe.Fawe; import com.boydti.fawe.config.Caption; -import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.TextureUtil; @@ -41,8 +41,6 @@ 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.function.generator.CavesGen; - -import java.util.List; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; @@ -53,23 +51,21 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator.TreeType; +import com.sk89q.worldedit.util.formatting.text.TextComponent; +import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockType; - import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; +import java.util.List; 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.Switch; - -import static com.google.common.base.Preconditions.checkNotNull; - import org.jetbrains.annotations.Range; /** @@ -98,17 +94,17 @@ public class GenerationCommands { @Logging(PLACEMENT) @Confirm(Confirm.Processor.REGION) public void caves(Actor actor, 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, - @Arg(name = "minY", desc = "TODO", def = "8") int minYOpt, - @Arg(name = "maxY", desc = "TODO", def = "127") int maxYOpt, - @Arg(name = "systemFrequency", desc = "TODO", def = "1") int systemFrequencyOpt, - @Arg(name = "individualRarity", desc = "TODO", def = "25") int individualRarityOpt, - @Arg(name = "pocketChance", desc = "TODO", def = "0") int pocketChanceOpt, - @Arg(name = "pocketMin", desc = "TODO", def = "0") int pocketMinOpt, - @Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMaxOpt) throws WorldEditException { - CavesGen gen = new CavesGen(sizeOpt, frequencyOpt, rarityOpt, minYOpt, maxYOpt, systemFrequencyOpt, individualRarityOpt, pocketChanceOpt, pocketMinOpt, pocketMaxOpt); + @Arg(name = "size", desc = "TODO", def = "8") int size, + @Arg(name = "frequency", desc = "TODO", def = "40") int frequency, + @Arg(name = "rarity", desc = "TODO", def = "7") int rarity, + @Arg(name = "minY", desc = "TODO", def = "8") int minY, + @Arg(name = "maxY", desc = "TODO", def = "127") int maxY, + @Arg(name = "systemFrequency", desc = "TODO", def = "1") int systemFrequency, + @Arg(name = "individualRarity", desc = "TODO", def = "25") int individualRarity, + @Arg(name = "pocketChance", desc = "TODO", def = "0") int pocketChance, + @Arg(name = "pocketMin", desc = "TODO", def = "0") int pocketMin, + @Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMax) throws WorldEditException { + CavesGen gen = new CavesGen(size, frequency, rarity, minY, maxY, systemFrequency, individualRarity, pocketChance, pocketMin, pocketMax); editSession.generate(region, gen); actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount())); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java index b9fa1743b..284f66488 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java @@ -1,5 +1,7 @@ package com.sk89q.worldedit.command; +import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument; + import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweAPI; import com.boydti.fawe.config.Caption; @@ -37,14 +39,6 @@ import com.sk89q.worldedit.util.formatting.text.event.ClickEvent; import com.sk89q.worldedit.util.formatting.text.event.HoverEvent; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockState; -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.Range; - -import javax.annotation.Nullable; import java.io.File; import java.lang.ref.Reference; import java.lang.ref.SoftReference; @@ -54,8 +48,14 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.LongAdder; import java.util.function.Supplier; - -import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument; +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) public class HistorySubCommands { @@ -79,7 +79,7 @@ public class HistorySubCommands { @AllowedRegion Region[] allowedRegions, @ArgFlag(name = 'u', desc = "String user", def="me") UUID other, @ArgFlag(name = 'r', def = "0", desc = "radius") - @Range(from = 0, to=Integer.MAX_VALUE) int radius, + @Range(from = 0, to = Integer.MAX_VALUE) int radius, @ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0") @Time long timeDiff) throws WorldEditException { rollback(player, world, database, allowedRegions, other, radius, timeDiff, true); @@ -96,7 +96,7 @@ public class HistorySubCommands { @AllowedRegion Region[] allowedRegions, @ArgFlag(name = 'u', desc = "String user", def = "") UUID other, @ArgFlag(name = 'r', def = "0", desc = "radius") - @Range(from = 0, to=Integer.MAX_VALUE) int radius, + @Range(from = 0, to = Integer.MAX_VALUE) int radius, @ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0") @Time long timeDiff, @Switch(name = 'f', desc = "Restore instead of rollback") boolean restore) throws WorldEditException { if (!Settings.IMP.HISTORY.USE_DATABASE) { @@ -277,8 +277,7 @@ public class HistorySubCommands { @CommandPermissions("worldedit.history.find") public synchronized void find(Player player, World world, RollbackDatabase database, Arguments arguments, @ArgFlag(name = 'u', desc = "String user") UUID other, - @ArgFlag(name = 'r', def = "0", desc = "radius") - @Range(from = 0, to=Integer.MAX_VALUE) int radius, + @ArgFlag(name = 'r', def = "0", desc = "radius") int radius, @ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0") @Time long timeDiff, @ArgFlag(name = 'p', desc = "Page to view.", def = "1") int page) throws WorldEditException { @@ -318,7 +317,7 @@ public class HistorySubCommands { } PaginationBox pages = PaginationBox.fromStrings("Edits:", pageCommand, list, new Function, Component>() { - @Nullable + @NotNull @Override public Component apply(@Nullable Supplier input) { RollbackOptimizedHistory edit = input.get(); From 6cb2d7cd5cba4778dc58ddfba7f8a0b4b2c68bac Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 3 Jan 2020 12:36:00 -0500 Subject: [PATCH 07/10] Stupid Piston --- .../worldedit/command/GenerationCommands.java | 22 +++++++++---------- .../worldedit/command/HistorySubCommands.java | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index 77fe4b5c2..ad3b18034 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -94,17 +94,17 @@ public class GenerationCommands { @Logging(PLACEMENT) @Confirm(Confirm.Processor.REGION) public void caves(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, - @Arg(name = "size", desc = "TODO", def = "8") int size, - @Arg(name = "frequency", desc = "TODO", def = "40") int frequency, - @Arg(name = "rarity", desc = "TODO", def = "7") int rarity, - @Arg(name = "minY", desc = "TODO", def = "8") int minY, - @Arg(name = "maxY", desc = "TODO", def = "127") int maxY, - @Arg(name = "systemFrequency", desc = "TODO", def = "1") int systemFrequency, - @Arg(name = "individualRarity", desc = "TODO", def = "25") int individualRarity, - @Arg(name = "pocketChance", desc = "TODO", def = "0") int pocketChance, - @Arg(name = "pocketMin", desc = "TODO", def = "0") int pocketMin, - @Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMax) throws WorldEditException { - CavesGen gen = new CavesGen(size, frequency, rarity, minY, maxY, systemFrequency, individualRarity, pocketChance, pocketMin, pocketMax); + @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, + @Arg(name = "minY", desc = "TODO", def = "8") int minYOpt, + @Arg(name = "maxY", desc = "TODO", def = "127") int maxYOpt, + @Arg(name = "systemFrequency", desc = "TODO", def = "1") int systemFrequencyOpt, + @Arg(name = "individualRarity", desc = "TODO", def = "25") int individualRarityOpt, + @Arg(name = "pocketChance", desc = "TODO", def = "0") int pocketChanceOpt, + @Arg(name = "pocketMin", desc = "TODO", def = "0") int pocketMinOpt, + @Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMaxOpt) throws WorldEditException { + CavesGen gen = new CavesGen(sizeOpt, frequencyOpt, rarityOpt, minYOpt, maxYOpt, systemFrequencyOpt, individualRarityOpt, pocketChanceOpt, pocketMinOpt, pocketMaxOpt); editSession.generate(region, gen); actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount())); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java index 284f66488..200b1d3ca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java @@ -277,7 +277,8 @@ public class HistorySubCommands { @CommandPermissions("worldedit.history.find") public synchronized void find(Player player, World world, RollbackDatabase database, Arguments arguments, @ArgFlag(name = 'u', desc = "String user") UUID other, - @ArgFlag(name = 'r', def = "0", desc = "radius") int radius, + @ArgFlag(name = 'r', def = "0", desc = "radius") + @Range(from = 0, to = Integer.MAX_VALUE) int radius, @ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0") @Time long timeDiff, @ArgFlag(name = 'p', desc = "Page to view.", def = "1") int page) throws WorldEditException { From f3e0109be2228a0094f13af223ff778b99d5ddd4 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 3 Jan 2020 15:38:30 -0500 Subject: [PATCH 08/10] A lot of small changes --- buildSrc/src/main/kotlin/PlatformConfig.kt | 2 +- worldedit-bukkit/build.gradle.kts | 6 +- .../com/boydti/fawe/bukkit/FaweBukkit.java | 3 - .../adapter/mc1_13/BukkitGetBlocks_1_13.java | 196 ++++++++---------- .../adapter/mc1_14/BukkitGetBlocks_1_14.java | 192 +++++++---------- .../adapter/mc1_15/BukkitGetBlocks_1_15.java | 131 +++++++----- .../implementation/chunk/ChunkHolder.java | 3 +- .../fawe/database/RollbackDatabase.java | 2 +- .../java/com/boydti/fawe/jnbt/JSON2NBT.java | 50 ++--- .../com/boydti/fawe/jnbt/anvil/MCAChunk.java | 2 +- .../cfi/HeightMapMCAGenerator.java | 8 +- .../object/clipboard/LinearClipboard.java | 3 + .../collection/AdaptedSetCollection.java | 2 - .../object/io/FastByteArrayOutputStream.java | 11 +- .../fawe/object/task/AsyncNotifyQueue.java | 4 - .../com/boydti/fawe/util/ReflectionUtils.java | 8 +- .../boydti/fawe/util/ReflectionUtils9.java | 2 +- .../java/com/sk89q/worldedit/EditSession.java | 70 +++---- .../worldedit/command/ClipboardCommands.java | 1 + .../worldedit/command/HistorySubCommands.java | 74 +++---- .../worldedit/command/SchematicCommands.java | 14 +- .../worldedit/command/UtilityCommands.java | 47 +++-- .../worldedit/command/tool/BrushTool.java | 2 +- .../platform/AbstractPlayerActor.java | 2 +- .../extent/clipboard/BlockArrayClipboard.java | 2 + .../worldedit/extent/clipboard/Clipboard.java | 81 +++----- .../extent/clipboard/io/ClipboardFormats.java | 8 +- .../function/mask/BlockMaskBuilder.java | 8 +- .../formatting/component/PaginationBox.java | 9 +- .../src/main/resources/lang/strings.json | 10 +- 30 files changed, 420 insertions(+), 533 deletions(-) diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt index f7a39851a..f8c764d40 100644 --- a/buildSrc/src/main/kotlin/PlatformConfig.kt +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -43,7 +43,7 @@ fun Project.applyPlatformAndCoreConfiguration() { } dependencies { - "compileOnly"("org.jetbrains:annotations:17.0.0") + "compileOnly"("org.jetbrains:annotations:18.0.0") "testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}") "testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}") "testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}") diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index ac72a3689..8107be45d 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -40,17 +40,17 @@ dependencies { "compile"("org.spigotmcv1_14_r1:spigotmcv1_14_r1:1_14_r1") "compile"("org.spigotmcv1_15_r1:spigotmcv1_15_r1:1_15_r1") "compile"("it.unimi.dsi:fastutil:8.2.1") - "api"("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") { + "api"("com.destroystokyo.paper:paper-api:1.15.1-R0.1-SNAPSHOT") { exclude("junit", "junit") isTransitive = false } "compileOnly"("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT") - "compileOnly"("org.spigotmc:spigot:1.15-R0.1-SNAPSHOT") + "compileOnly"("org.spigotmc:spigot:1.15.1-R0.1-SNAPSHOT") "implementation"("io.papermc:paperlib:1.0.2") "compileOnly"("com.sk89q:dummypermscompat:1.10") "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") "testCompile"("org.mockito:mockito-core:1.9.0-rc1") - "compileOnly"("com.sk89q.worldguard:worldguard-bukkit:7.0.0") { + "compileOnly"("com.sk89q.worldguard:worldguard-bukkit:7.0.1") { exclude("com.sk89q.worldedit", "worldedit-bukkit") exclude("com.sk89q.worldedit", "worldedit-core") exclude("com.sk89q.worldedit.worldedit-libs", "bukkit") diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java index 3a4041b2c..78eeec0b2 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java @@ -41,7 +41,6 @@ import java.util.function.Supplier; import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -50,7 +49,6 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.java.JavaPlugin; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -353,7 +351,6 @@ public class FaweBukkit implements IFawe, Listener { return null; } return null; -// return ((BlocksHubBukkit) blocksHubPlugin).getApi(); } @Override diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_13/BukkitGetBlocks_1_13.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_13/BukkitGetBlocks_1_13.java index f1423f29a..98513aeb4 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_13/BukkitGetBlocks_1_13.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_13/BukkitGetBlocks_1_13.java @@ -1,5 +1,7 @@ package com.boydti.fawe.bukkit.adapter.mc1_13; +import static org.slf4j.LoggerFactory.getLogger; + import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.IChunkSet; @@ -24,6 +26,19 @@ import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; +import java.util.AbstractSet; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import java.util.function.Function; +import javax.annotation.Nullable; import net.minecraft.server.v1_13_R2.BiomeBase; import net.minecraft.server.v1_13_R2.BlockPosition; import net.minecraft.server.v1_13_R2.Chunk; @@ -47,22 +62,6 @@ import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock; import org.bukkit.event.entity.CreatureSpawnEvent; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; -import java.util.AbstractSet; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; -import java.util.function.Function; - -import static org.slf4j.LoggerFactory.getLogger; - public class BukkitGetBlocks_1_13 extends CharGetBlocks { public ChunkSection[] sections; public Chunk nmsChunk; @@ -102,19 +101,9 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks { return new LazyCompoundTag_1_13(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); } - private static final Function posNms2We = new Function() { - @Override - public BlockVector3 apply(BlockPosition v) { - return BlockVector3.at(v.getX(), v.getY(), v.getZ()); - } - }; + private static final Function posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ()); - private final static Function nmsTile2We = new Function() { - @Override - public CompoundTag apply(TileEntity tileEntity) { - return new LazyCompoundTag_1_13(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); - } - }; + private final static Function nmsTile2We = tileEntity -> new LazyCompoundTag_1_13(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); @Override public Map getTiles() { @@ -243,9 +232,7 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks { { Map tiles = nmsChunk.getTileEntities(); if (!tiles.isEmpty()) { - final Iterator> iterator = tiles.entrySet().iterator(); - while (iterator.hasNext()) { - final Map.Entry entry = iterator.next(); + for (Map.Entry entry : tiles.entrySet()) { final BlockPosition pos = entry.getKey(); final int lx = pos.getX() & 15; final int ly = pos.getY(); @@ -345,8 +332,7 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks { public void run() { final List[] entities = nmsChunk.getEntitySlices(); - for (int i = 0; i < entities.length; i++) { - final Collection ents = entities[i]; + for (final Collection ents : entities) { if (!ents.isEmpty()) { final Iterator iter = ents.iterator(); while (iter.hasNext()) { @@ -366,43 +352,40 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks { if (entities != null && !entities.isEmpty()) { if (syncTasks == null) syncTasks = new Runnable[2]; - syncTasks[1] = new Runnable() { - @Override - public void run() { - for (final CompoundTag nativeTag : entities) { - final Map entityTagMap = ReflectionUtils.getMap(nativeTag.getValue()); - final StringTag idTag = (StringTag) entityTagMap.get("Id"); - final ListTag posTag = (ListTag) entityTagMap.get("Pos"); - final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); - if (idTag == null || posTag == null || rotTag == null) { - getLogger(BukkitGetBlocks_1_13.class).debug("Unknown entity tag: " + nativeTag); - continue; - } - final double x = posTag.getDouble(0); - final double y = posTag.getDouble(1); - final double z = posTag.getDouble(2); - final float yaw = rotTag.getFloat(0); - final float pitch = rotTag.getFloat(1); - final String id = idTag.getValue(); + syncTasks[1] = () -> { + for (final CompoundTag nativeTag : entities) { + final Map entityTagMap = ReflectionUtils.getMap(nativeTag.getValue()); + final StringTag idTag = (StringTag) entityTagMap.get("Id"); + final ListTag posTag = (ListTag) entityTagMap.get("Pos"); + final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); + if (idTag == null || posTag == null || rotTag == null) { + getLogger(BukkitGetBlocks_1_13.class).debug("Unknown entity tag: " + nativeTag); + continue; + } + final double x = posTag.getDouble(0); + final double y = posTag.getDouble(1); + final double z = posTag.getDouble(2); + final float yaw = rotTag.getFloat(0); + final float pitch = rotTag.getFloat(1); + final String id = idTag.getValue(); - EntityTypes type = EntityTypes.a(id); - if (type != null) { - Entity entity = type.a(nmsWorld); - if (entity != null) { - UUID uuid = entity.getUniqueID(); - entityTagMap.put("UUIDMost", new LongTag(uuid.getMostSignificantBits())); - entityTagMap.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits())); - if (nativeTag != null) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); - for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - entity.f(tag); + EntityTypes type = EntityTypes.a(id); + if (type != null) { + Entity entity = type.a(nmsWorld); + if (entity != null) { + UUID uuid = entity.getUniqueID(); + entityTagMap.put("UUIDMost", new LongTag(uuid.getMostSignificantBits())); + entityTagMap.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits())); + if (nativeTag != null) { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); + for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { + tag.remove(name); } - entity.setLocation(x, y, z, yaw, pitch); - nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM); + entity.f(tag); } + entity.setLocation(x, y, z, yaw, pitch); + nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM); } } } @@ -415,31 +398,28 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks { if (tiles != null && !tiles.isEmpty()) { if (syncTasks == null) syncTasks = new Runnable[1]; - syncTasks[0] = new Runnable() { - @Override - public void run() { - for (final Map.Entry entry : tiles.entrySet()) { - final CompoundTag nativeTag = entry.getValue(); - final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; - final BlockPosition pos = new BlockPosition(x, y, z); + syncTasks[0] = () -> { + for (final Map.Entry entry : tiles.entrySet()) { + final CompoundTag nativeTag = entry.getValue(); + final BlockVector3 blockHash = entry.getKey(); + final int x = blockHash.getX() + bx; + final int y = blockHash.getY(); + final int z = blockHash.getZ() + bz; + final BlockPosition pos = new BlockPosition(x, y, z); - synchronized (nmsWorld) { - TileEntity tileEntity = nmsWorld.getTileEntity(pos); - if (tileEntity == null || tileEntity.x()) { - nmsWorld.n(pos); - tileEntity = nmsWorld.getTileEntity(pos); - } - if (tileEntity != null) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); - tag.set("x", new NBTTagInt(x)); - tag.set("y", new NBTTagInt(y)); - tag.set("z", new NBTTagInt(z)); - tileEntity.load(tag); - } + synchronized (nmsWorld) { + TileEntity tileEntity = nmsWorld.getTileEntity(pos); + if (tileEntity == null || tileEntity.x()) { + nmsWorld.n(pos); + tileEntity = nmsWorld.getTileEntity(pos); + } + if (tileEntity != null) { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); + tag.set("x", new NBTTagInt(x)); + tag.set("y", new NBTTagInt(y)); + tag.set("z", new NBTTagInt(z)); + tileEntity.load(tag); } } } @@ -473,27 +453,23 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks { Runnable[] finalSyncTasks = syncTasks; // Chain the sync tasks and the callback - Callable chain = new Callable() { - @Override - public Future call() { - try { - // Run the sync tasks - for (int i = 0; i < finalSyncTasks.length; i++) { - Runnable task = finalSyncTasks[i]; - if (task != null) { - task.run(); - } + Callable chain = () -> { + try { + // Run the sync tasks + for (Runnable task : finalSyncTasks) { + if (task != null) { + task.run(); } - if (callback == null) { - if (finalizer != null) finalizer.run(); - return null; - } else { - return queueHandler.async(callback, null); - } - } catch (Throwable e) { - e.printStackTrace(); - throw e; } + if (callback == null) { + if (finalizer != null) finalizer.run(); + return null; + } else { + return queueHandler.async(callback, null); + } + } catch (Throwable e) { + e.printStackTrace(); + throw e; } }; return (T) (Future) queueHandler.sync(chain); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java index 15c9eb04f..a78d322e7 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java @@ -1,9 +1,7 @@ package com.boydti.fawe.bukkit.adapter.mc1_14; -import static com.google.common.base.Preconditions.checkNotNull; import static org.slf4j.LoggerFactory.getLogger; -import com.bekvon.bukkit.residence.commands.set; import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.IChunkSet; @@ -14,7 +12,6 @@ import com.boydti.fawe.bukkit.adapter.mc1_14.nbt.LazyCompoundTag_1_14; import com.boydti.fawe.object.collection.AdaptedMap; import com.boydti.fawe.object.collection.BitArray4096; import com.boydti.fawe.util.ReflectionUtils; -import com.boydti.fawe.util.TaskManager; import com.google.common.base.Suppliers; import com.google.common.collect.Iterables; import com.sk89q.jnbt.CompoundTag; @@ -42,13 +39,11 @@ import java.util.UUID; import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.function.Function; -import java.util.function.Supplier; import javax.annotation.Nullable; import net.minecraft.server.v1_14_R1.BiomeBase; import net.minecraft.server.v1_14_R1.BlockPosition; import net.minecraft.server.v1_14_R1.Chunk; import net.minecraft.server.v1_14_R1.ChunkSection; -import net.minecraft.server.v1_14_R1.ChunkStatus; import net.minecraft.server.v1_14_R1.DataBits; import net.minecraft.server.v1_14_R1.DataPalette; import net.minecraft.server.v1_14_R1.DataPaletteBlock; @@ -57,7 +52,6 @@ import net.minecraft.server.v1_14_R1.DataPaletteLinear; import net.minecraft.server.v1_14_R1.Entity; import net.minecraft.server.v1_14_R1.EntityTypes; import net.minecraft.server.v1_14_R1.IBlockData; -import net.minecraft.server.v1_14_R1.LightEngine; import net.minecraft.server.v1_14_R1.LightEngineThreaded; import net.minecraft.server.v1_14_R1.NBTTagCompound; import net.minecraft.server.v1_14_R1.NBTTagInt; @@ -109,19 +103,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { return new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); } - private static final Function posNms2We = new Function() { - @Override - public BlockVector3 apply(BlockPosition v) { - return BlockVector3.at(v.getX(), v.getY(), v.getZ()); - } - }; + private static final Function posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ()); - private final static Function nmsTile2We = new Function() { - @Override - public CompoundTag apply(TileEntity tileEntity) { - return new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); - } - }; + private final static Function nmsTile2We = tileEntity -> new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); @Override public Map getTiles() { @@ -249,9 +233,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { { Map tiles = nmsChunk.getTileEntities(); if (!tiles.isEmpty()) { - final Iterator> iterator = tiles.entrySet().iterator(); - while (iterator.hasNext()) { - final Map.Entry entry = iterator.next(); + for (Map.Entry entry : tiles.entrySet()) { final BlockPosition pos = entry.getKey(); final int lx = pos.getX() & 15; final int ly = pos.getY(); @@ -346,21 +328,17 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { if (entityRemoves != null && !entityRemoves.isEmpty()) { if (syncTasks == null) syncTasks = new Runnable[3]; - syncTasks[2] = new Runnable() { - @Override - public void run() { - final List[] entities = nmsChunk.getEntitySlices(); + syncTasks[2] = () -> { + final List[] entities = nmsChunk.getEntitySlices(); - for (int i = 0; i < entities.length; i++) { - final Collection ents = entities[i]; - if (!ents.isEmpty()) { - final Iterator iter = ents.iterator(); - while (iter.hasNext()) { - final Entity entity = iter.next(); - if (entityRemoves.contains(entity.getUniqueID())) { - iter.remove(); - removeEntity(entity); - } + for (final Collection ents : entities) { + if (!ents.isEmpty()) { + final Iterator iter = ents.iterator(); + while (iter.hasNext()) { + final Entity entity = iter.next(); + if (entityRemoves.contains(entity.getUniqueID())) { + iter.remove(); + removeEntity(entity); } } } @@ -372,43 +350,40 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { if (entities != null && !entities.isEmpty()) { if (syncTasks == null) syncTasks = new Runnable[2]; - syncTasks[1] = new Runnable() { - @Override - public void run() { - for (final CompoundTag nativeTag : entities) { - final Map entityTagMap = ReflectionUtils.getMap(nativeTag.getValue()); - final StringTag idTag = (StringTag) entityTagMap.get("Id"); - final ListTag posTag = (ListTag) entityTagMap.get("Pos"); - final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); - if (idTag == null || posTag == null || rotTag == null) { - getLogger(BukkitGetBlocks_1_14.class).debug("Unknown entity tag: " + nativeTag); - continue; - } - final double x = posTag.getDouble(0); - final double y = posTag.getDouble(1); - final double z = posTag.getDouble(2); - final float yaw = rotTag.getFloat(0); - final float pitch = rotTag.getFloat(1); - final String id = idTag.getValue(); + syncTasks[1] = () -> { + for (final CompoundTag nativeTag : entities) { + final Map entityTagMap = ReflectionUtils.getMap(nativeTag.getValue()); + final StringTag idTag = (StringTag) entityTagMap.get("Id"); + final ListTag posTag = (ListTag) entityTagMap.get("Pos"); + final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); + if (idTag == null || posTag == null || rotTag == null) { + getLogger(BukkitGetBlocks_1_14.class).debug("Unknown entity tag: " + nativeTag); + continue; + } + final double x = posTag.getDouble(0); + final double y = posTag.getDouble(1); + final double z = posTag.getDouble(2); + final float yaw = rotTag.getFloat(0); + final float pitch = rotTag.getFloat(1); + final String id = idTag.getValue(); - EntityTypes type = EntityTypes.a(id).orElse(null); - if (type != null) { - Entity entity = type.a(nmsWorld); - if (entity != null) { - UUID uuid = entity.getUniqueID(); - entityTagMap.put("UUIDMost", new LongTag(uuid.getMostSignificantBits())); - entityTagMap.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits())); - if (nativeTag != null) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); - for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - entity.f(tag); + EntityTypes type = EntityTypes.a(id).orElse(null); + if (type != null) { + Entity entity = type.a(nmsWorld); + if (entity != null) { + UUID uuid = entity.getUniqueID(); + entityTagMap.put("UUIDMost", new LongTag(uuid.getMostSignificantBits())); + entityTagMap.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits())); + if (nativeTag != null) { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); + for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { + tag.remove(name); } - entity.setLocation(x, y, z, yaw, pitch); - nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM); + entity.f(tag); } + entity.setLocation(x, y, z, yaw, pitch); + nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM); } } } @@ -421,31 +396,28 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { if (tiles != null && !tiles.isEmpty()) { if (syncTasks == null) syncTasks = new Runnable[1]; - syncTasks[0] = new Runnable() { - @Override - public void run() { - for (final Map.Entry entry : tiles.entrySet()) { - final CompoundTag nativeTag = entry.getValue(); - final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; - final BlockPosition pos = new BlockPosition(x, y, z); + syncTasks[0] = () -> { + for (final Map.Entry entry : tiles.entrySet()) { + final CompoundTag nativeTag = entry.getValue(); + final BlockVector3 blockHash = entry.getKey(); + final int x = blockHash.getX() + bx; + final int y = blockHash.getY(); + final int z = blockHash.getZ() + bz; + final BlockPosition pos = new BlockPosition(x, y, z); - synchronized (nmsWorld) { - TileEntity tileEntity = nmsWorld.getTileEntity(pos); - if (tileEntity == null || tileEntity.isRemoved()) { - nmsWorld.removeTileEntity(pos); - tileEntity = nmsWorld.getTileEntity(pos); - } - if (tileEntity != null) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); - tag.set("x", new NBTTagInt(x)); - tag.set("y", new NBTTagInt(y)); - tag.set("z", new NBTTagInt(z)); - tileEntity.load(tag); - } + synchronized (nmsWorld) { + TileEntity tileEntity = nmsWorld.getTileEntity(pos); + if (tileEntity == null || tileEntity.isRemoved()) { + nmsWorld.removeTileEntity(pos); + tileEntity = nmsWorld.getTileEntity(pos); + } + if (tileEntity != null) { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); + tag.set("x", new NBTTagInt(x)); + tag.set("y", new NBTTagInt(y)); + tag.set("z", new NBTTagInt(z)); + tileEntity.load(tag); } } } @@ -478,27 +450,23 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { Runnable[] finalSyncTasks = syncTasks; // Chain the sync tasks and the callback - Callable chain = new Callable() { - @Override - public Future call() { - try { - // Run the sync tasks - for (int i = 0; i < finalSyncTasks.length; i++) { - Runnable task = finalSyncTasks[i]; - if (task != null) { - task.run(); - } + Callable chain = () -> { + try { + // Run the sync tasks + for (Runnable task : finalSyncTasks) { + if (task != null) { + task.run(); } - if (callback == null) { - if (finalizer != null) finalizer.run(); - return null; - } else { - return queueHandler.async(callback, null); - } - } catch (Throwable e) { - e.printStackTrace(); - throw e; } + if (callback == null) { + if (finalizer != null) finalizer.run(); + return null; + } else { + return queueHandler.async(callback, null); + } + } catch (Throwable e) { + e.printStackTrace(); + throw e; } }; return (T) (Future) queueHandler.sync(chain); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java index 2f24897b3..02caa2818 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java @@ -1,5 +1,7 @@ package com.boydti.fawe.bukkit.adapter.mc1_15; +import static org.slf4j.LoggerFactory.getLogger; + import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.IChunkSet; @@ -12,8 +14,11 @@ import com.boydti.fawe.object.collection.BitArray4096; import com.boydti.fawe.util.ReflectionUtils; import com.google.common.base.Suppliers; import com.google.common.collect.Iterables; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.ListTag; +import com.sk89q.jnbt.LongTag; +import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; -import com.sk89q.jnbt.*; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; @@ -22,7 +27,37 @@ import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockTypes; -import net.minecraft.server.v1_15_R1.*; +import java.util.AbstractSet; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import java.util.function.Function; +import javax.annotation.Nullable; +import net.minecraft.server.v1_15_R1.BiomeBase; +import net.minecraft.server.v1_15_R1.BiomeStorage; +import net.minecraft.server.v1_15_R1.BlockPosition; +import net.minecraft.server.v1_15_R1.Chunk; +import net.minecraft.server.v1_15_R1.ChunkSection; +import net.minecraft.server.v1_15_R1.DataBits; +import net.minecraft.server.v1_15_R1.DataPalette; +import net.minecraft.server.v1_15_R1.DataPaletteBlock; +import net.minecraft.server.v1_15_R1.DataPaletteHash; +import net.minecraft.server.v1_15_R1.DataPaletteLinear; +import net.minecraft.server.v1_15_R1.Entity; +import net.minecraft.server.v1_15_R1.EntityTypes; +import net.minecraft.server.v1_15_R1.IBlockData; +import net.minecraft.server.v1_15_R1.LightEngineThreaded; +import net.minecraft.server.v1_15_R1.NBTTagCompound; +import net.minecraft.server.v1_15_R1.NBTTagInt; +import net.minecraft.server.v1_15_R1.TileEntity; +import net.minecraft.server.v1_15_R1.WorldServer; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; @@ -30,14 +65,6 @@ import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlock; import org.bukkit.event.entity.CreatureSpawnEvent; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; -import java.util.*; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; -import java.util.function.Function; - -import static org.slf4j.LoggerFactory.getLogger; - public class BukkitGetBlocks_1_15 extends CharGetBlocks { private static final Function posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ()); private final static Function nmsTile2We = tileEntity -> new LazyCompoundTag_1_15(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); @@ -214,9 +241,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks { { Map tiles = nmsChunk.getTileEntities(); if (!tiles.isEmpty()) { - final Iterator> iterator = tiles.entrySet().iterator(); - while (iterator.hasNext()) { - final Map.Entry entry = iterator.next(); + for (Map.Entry entry : tiles.entrySet()) { final BlockPosition pos = entry.getKey(); final int lx = pos.getX() & 15; final int ly = pos.getY(); @@ -319,8 +344,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks { syncTasks[2] = () -> { final List[] entities = nmsChunk.getEntitySlices(); - for (int i = 0; i < entities.length; i++) { - final Collection ents = entities[i]; + for (final Collection ents : entities) { if (!ents.isEmpty()) { final Iterator iter = ents.iterator(); while (iter.hasNext()) { @@ -339,43 +363,40 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks { if (entities != null && !entities.isEmpty()) { if (syncTasks == null) syncTasks = new Runnable[2]; - syncTasks[1] = new Runnable() { - @Override - public void run() { - for (final CompoundTag nativeTag : entities) { - final Map entityTagMap = ReflectionUtils.getMap(nativeTag.getValue()); - final StringTag idTag = (StringTag) entityTagMap.get("Id"); - final ListTag posTag = (ListTag) entityTagMap.get("Pos"); - final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); - if (idTag == null || posTag == null || rotTag == null) { - getLogger(BukkitGetBlocks_1_15.class).debug("Unknown entity tag: " + nativeTag); - continue; - } - final double x = posTag.getDouble(0); - final double y = posTag.getDouble(1); - final double z = posTag.getDouble(2); - final float yaw = rotTag.getFloat(0); - final float pitch = rotTag.getFloat(1); - final String id = idTag.getValue(); + syncTasks[1] = () -> { + for (final CompoundTag nativeTag : entities) { + final Map entityTagMap = ReflectionUtils.getMap(nativeTag.getValue()); + final StringTag idTag = (StringTag) entityTagMap.get("Id"); + final ListTag posTag = (ListTag) entityTagMap.get("Pos"); + final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); + if (idTag == null || posTag == null || rotTag == null) { + getLogger(BukkitGetBlocks_1_15.class).debug("Unknown entity tag: " + nativeTag); + continue; + } + final double x = posTag.getDouble(0); + final double y = posTag.getDouble(1); + final double z = posTag.getDouble(2); + final float yaw = rotTag.getFloat(0); + final float pitch = rotTag.getFloat(1); + final String id = idTag.getValue(); - EntityTypes type = EntityTypes.a(id).orElse(null); - if (type != null) { - Entity entity = type.a(nmsWorld); - if (entity != null) { - UUID uuid = entity.getUniqueID(); - entityTagMap.put("UUIDMost", new LongTag(uuid.getMostSignificantBits())); - entityTagMap.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits())); - if (nativeTag != null) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); - for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - entity.f(tag); + EntityTypes type = EntityTypes.a(id).orElse(null); + if (type != null) { + Entity entity = type.a(nmsWorld); + if (entity != null) { + UUID uuid = entity.getUniqueID(); + entityTagMap.put("UUIDMost", new LongTag(uuid.getMostSignificantBits())); + entityTagMap.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits())); + if (nativeTag != null) { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag); + for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { + tag.remove(name); } - entity.setLocation(x, y, z, yaw, pitch); - nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM); + entity.f(tag); } + entity.setLocation(x, y, z, yaw, pitch); + nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM); } } } @@ -416,11 +437,10 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks { }; } - {//Lighting - // TODO optimize, cause this is really slow - LightEngineThreaded engine = (LightEngineThreaded) nmsChunk.e(); - engine.a(nmsChunk, false); - } + //Lighting + // TODO optimize, cause this is really slow + LightEngineThreaded engine = (LightEngineThreaded) nmsChunk.e(); + engine.a(nmsChunk, false); Runnable callback; if (bitMask == 0 && biomes == null) { @@ -445,8 +465,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks { Callable chain = () -> { try { // Run the sync tasks - for (int i = 0; i < finalSyncTasks.length; i++) { - Runnable task = finalSyncTasks[i]; + for (Runnable task : finalSyncTasks) { if (task != null) { task.run(); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java index 2ce534b9b..c70a9490c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java @@ -207,8 +207,7 @@ public class ChunkHolder> implements IQueueChunk { } @Override - public boolean setBlock(ChunkHolder chunk, int x, int y, int z, - BlockStateHolder block) { + public boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder block) { return chunk.chunkSet.setBlock(x, y, z, block); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/database/RollbackDatabase.java b/worldedit-core/src/main/java/com/boydti/fawe/database/RollbackDatabase.java index 0b9028476..604e8b641 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/database/RollbackDatabase.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/database/RollbackDatabase.java @@ -48,7 +48,7 @@ public class RollbackDatabase extends AsyncNotifyQueue { private @Language("SQLite") String GET_EDITS_USER = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? AND `player`=? ORDER BY `time` DESC, `id` DESC"; private @Language("SQLite") String GET_EDITS_USER_ASC = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? AND `player`=? ORDER BY `time` ASC, `id` ASC"; private @Language("SQLite") String GET_EDITS = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? ORDER BY `time` DESC, `id` DESC"; - private @Language("SQLite") String GET_EDITS_ASC = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? ORDER BY `time` ASC, `id` ASC"; + private @Language("SQLite") String GET_EDITS_ASC = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? ORDER BY `time` , `id` "; private @Language("SQLite") String GET_EDIT_USER = "SELECT * FROM `{0}edits` WHERE `player`=? AND `id`=?"; private @Language("SQLite") String DELETE_EDITS_USER = "DELETE FROM `{0}edits` WHERE `player`=? AND `time`>? AND `x2`>=? AND `x1`<=? AND `y2`>=? AND `y1`<=? AND `z2`>=? AND `z1`<=?"; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/JSON2NBT.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/JSON2NBT.java index 9d53caec8..0fc9281c7 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/JSON2NBT.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/JSON2NBT.java @@ -15,10 +15,12 @@ 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.Iterator; +import java.util.List; 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]+\\]"); @@ -40,7 +42,7 @@ public class JSON2NBT { public static int topTagsCount(String str) throws NBTException { int i = 0; boolean flag = false; - Stack stack = new Stack(); + Stack stack = new Stack<>(); for (int j = 0; j < str.length(); ++j) { char c0 = str.charAt(j); @@ -54,11 +56,11 @@ public class JSON2NBT { } } else if (!flag) { if (c0 != 123 && c0 != 91) { - if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) { + if (c0 == 125 && (stack.isEmpty() || stack.pop() != 123)) { throw new NBTException("Unbalanced curly brackets {}: " + str); } - if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) { + if (c0 == 93 && (stack.isEmpty() || stack.pop() != 91)) { throw new NBTException("Unbalanced square brackets []: " + str); } } else { @@ -66,7 +68,7 @@ public class JSON2NBT { ++i; } - stack.push(Character.valueOf(c0)); + stack.push(c0); } } } @@ -91,7 +93,6 @@ 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); @@ -100,7 +101,6 @@ 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,7 +122,6 @@ 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)); } @@ -145,7 +144,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(new String[]{s, s1}); + return joinStrToNBT(s, s1); } private static String nextNameValuePair(String str, boolean isCompound) throws NBTException { @@ -167,7 +166,7 @@ public class JSON2NBT { } private static String locateValueAt(String str, int index) throws NBTException { - Stack stack = new Stack(); + Stack stack = new Stack<>(); int i = index + 1; boolean flag = false; boolean flag1 = false; @@ -192,11 +191,11 @@ public class JSON2NBT { } } else if (!flag) { if (c0 != 123 && c0 != 91) { - if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) { + if (c0 == 125 && (stack.isEmpty() || stack.pop() != 123)) { throw new NBTException("Unbalanced curly brackets {}: " + str); } - if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) { + if (c0 == 93 && (stack.isEmpty() || stack.pop() != 91)) { throw new NBTException("Unbalanced square brackets []: " + str); } @@ -204,7 +203,7 @@ public class JSON2NBT { return str.substring(0, i); } } else { - stack.push(Character.valueOf(c0)); + stack.push(c0); } } @@ -343,14 +342,11 @@ public class JSON2NBT { if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) { String var7 = this.jsonValue.substring(1, this.jsonValue.length() - 1); - String[] var8 = (String[]) ((String[]) Iterables.toArray(SPLITTER.split(var7), String.class)); + String[] var8 = Iterables.toArray(SPLITTER.split(var7), String.class); try { - int[] var5 = new int[var8.length]; - - for (int j = 0; j < var8.length; ++j) { - var5[j] = Integer.parseInt(var8[j].trim()); - } + int[] var5 = Arrays.stream(var8).mapToInt(s -> Integer.parseInt(s.trim())) + .toArray(); return new IntArrayTag(var5); } catch (NumberFormatException var51) { @@ -379,27 +375,23 @@ public class JSON2NBT { } private static class List extends JSON2NBT.Any { - protected java.util.List tagList = Lists.newArrayList(); + protected List tagList = Lists.newArrayList(); public List(String json) { this.json = json; } public Tag parse() throws NBTException { - ArrayList list = new ArrayList<>(); - Iterator var2 = this.tagList.iterator(); + ArrayList list = this.tagList.stream().map(Any::parse) + .collect(Collectors.toCollection(ArrayList::new)); - while (var2.hasNext()) { - JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any) var2.next(); - list.add(JSON2NBT$any.parse()); - } Class tagType = list.isEmpty() ? CompoundTag.class : list.get(0).getClass(); return new ListTag(tagType, list); } } private static class Compound extends JSON2NBT.Any { - protected java.util.List tagList = Lists.newArrayList(); + protected List tagList = Lists.newArrayList(); public Compound(String jsonIn) { this.json = jsonIn; @@ -407,10 +399,8 @@ public class JSON2NBT { public Tag parse() throws NBTException { HashMap map = new HashMap<>(); - Iterator var2 = this.tagList.iterator(); - while (var2.hasNext()) { - JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any) var2.next(); + for (Any JSON2NBT$any : this.tagList) { map.put(JSON2NBT$any.json, JSON2NBT$any.parse()); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java index 34b07dc47..efe224081 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java @@ -51,7 +51,7 @@ public class MCAChunk implements IChunk { public final char[] blocks = new char[65536]; - public final BlockVector3ChunkMap tiles = new BlockVector3ChunkMap(); + public final BlockVector3ChunkMap tiles = new BlockVector3ChunkMap<>(); public final Map entities = new HashMap<>(); public long inhabitedTime = System.currentTimeMillis(); public long lastUpdate; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/HeightMapMCAGenerator.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/HeightMapMCAGenerator.java index b32ff5a5e..431086b0e 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/HeightMapMCAGenerator.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/visualization/cfi/HeightMapMCAGenerator.java @@ -7,8 +7,8 @@ import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.IBlocks; import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkSet; -import com.boydti.fawe.beta.implementation.packet.ChunkPacket; import com.boydti.fawe.beta.implementation.blocks.FallbackChunkGet; +import com.boydti.fawe.beta.implementation.packet.ChunkPacket; import com.boydti.fawe.jnbt.anvil.MCAChunk; import com.boydti.fawe.object.FaweInputStream; import com.boydti.fawe.object.FaweOutputStream; @@ -46,7 +46,6 @@ import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.Identifiable; import com.sk89q.worldedit.util.Location; @@ -60,7 +59,6 @@ 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.block.BlockTypesCache; - import java.awt.image.BufferedImage; import java.io.File; import java.io.FileNotFoundException; @@ -1556,9 +1554,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr } public void setHeights(int value) { - heights.record(() -> { - Arrays.fill(heights.get(), (byte) value); - }); + heights.record(() -> Arrays.fill(heights.get(), (byte) value)); } @Override diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LinearClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LinearClipboard.java index 6c4b1278f..131eb8bd6 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LinearClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/LinearClipboard.java @@ -17,6 +17,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import java.io.Closeable; import java.util.Collection; import java.util.Iterator; +import org.jetbrains.annotations.NotNull; /** * Best used when clipboard selections are small, or using legacy formats @@ -46,6 +47,7 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa public abstract Collection getTileEntities(); + @Override public void close() {} public void flush() {} @@ -55,6 +57,7 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa close(); } + @NotNull @Override public Iterator iterator() { return iterator(Order.YZX); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/AdaptedSetCollection.java b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/AdaptedSetCollection.java index 24e4272dc..d51dbd921 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/collection/AdaptedSetCollection.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/collection/AdaptedSetCollection.java @@ -9,8 +9,6 @@ import java.util.Spliterator; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.stream.Stream; - -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; /** diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/io/FastByteArrayOutputStream.java b/worldedit-core/src/main/java/com/boydti/fawe/object/io/FastByteArrayOutputStream.java index af08dd700..05be47f90 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/io/FastByteArrayOutputStream.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/io/FastByteArrayOutputStream.java @@ -6,7 +6,6 @@ import java.io.RandomAccessFile; import java.io.Writer; import java.util.ArrayDeque; import java.util.Arrays; -import java.util.Iterator; /** @@ -156,10 +155,8 @@ public class FastByteArrayOutputStream extends OutputStream { public void writeTo(OutputStream out) throws IOException { // Check if we have a list of buffers if (buffers != null) { - Iterator iter = buffers.iterator(); - while (iter.hasNext()) { - byte[] bytes = (byte[]) iter.next(); + for (byte[] bytes : buffers) { out.write(bytes, 0, blockSize); } } @@ -171,10 +168,8 @@ public class FastByteArrayOutputStream extends OutputStream { public void writeTo(RandomAccessFile out) throws IOException { // Check if we have a list of buffers if (buffers != null) { - Iterator iter = buffers.iterator(); - while (iter.hasNext()) { - byte[] bytes = (byte[]) iter.next(); + for (byte[] bytes : buffers) { out.write(bytes, 0, blockSize); } } @@ -231,4 +226,4 @@ public class FastByteArrayOutputStream extends OutputStream { size = 0; buffers.clear(); } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/task/AsyncNotifyQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/object/task/AsyncNotifyQueue.java index 16c19b471..e9400454b 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/task/AsyncNotifyQueue.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/task/AsyncNotifyQueue.java @@ -1,13 +1,9 @@ package com.boydti.fawe.object.task; import com.boydti.fawe.Fawe; -import com.boydti.fawe.util.TaskManager; - import java.io.Closeable; -import java.io.IOException; import java.util.concurrent.Callable; import java.util.concurrent.Future; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Supplier; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java index e5144d642..f751f18a3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java @@ -52,7 +52,7 @@ public class ReflectionUtils { // 2. Copy it T[] previousValues = (T[]) valuesField.get(enumType); - List values = new ArrayList(Arrays.asList(previousValues)); + List values = new ArrayList<>(Arrays.asList(previousValues)); // 3. build new enum T newValue = (T) makeEnum(enumType, // The target enum class @@ -176,7 +176,7 @@ public class ReflectionUtils { public static List getList(List list) { try { - Class clazz = (Class) Class.forName("java.util.Collections$UnmodifiableList"); + Class> clazz = (Class>) Class.forName("java.util.Collections$UnmodifiableList"); if (!clazz.isInstance(list)) return list; Field m = clazz.getDeclaredField("list"); m.setAccessible(true); @@ -566,10 +566,10 @@ public class ReflectionUtils { * @throws RuntimeException if constructor not found */ public RefConstructor findConstructor(int number) { - final List constructors = new ArrayList<>(); + final List> constructors = new ArrayList<>(); Collections.addAll(constructors, this.clazz.getConstructors()); Collections.addAll(constructors, this.clazz.getDeclaredConstructors()); - for (Constructor m : constructors) { + for (Constructor m : constructors) { if (m.getParameterTypes().length == number) { return new RefConstructor(m); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils9.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils9.java index 7f3b44907..09582039d 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils9.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils9.java @@ -32,7 +32,7 @@ public class ReflectionUtils9 { // 2. Copy it T[] previousValues = (T[]) valuesField.get(enumType); - List values = new ArrayList<>(Arrays.asList(previousValues)); + List values = new ArrayList<>(Arrays.asList(previousValues)); // 3. build new enum T newValue = (T) makeEnum(enumType, // The target enum class diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index bd504fab7..bcb4d6e98 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -19,9 +19,14 @@ 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.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.FaweLimit; import com.boydti.fawe.object.RegionWrapper; @@ -87,11 +92,11 @@ import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.internal.expression.EvaluationException; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; +import com.sk89q.worldedit.internal.expression.ExpressionTimeoutException; +import com.sk89q.worldedit.internal.expression.LocalSlot.Variable; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.MathUtils; -import com.sk89q.worldedit.internal.expression.ExpressionTimeoutException; -import com.sk89q.worldedit.internal.expression.LocalSlot.Variable; import com.sk89q.worldedit.math.MutableBlockVector2; import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.math.Vector2; @@ -114,6 +119,7 @@ import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.eventbus.EventBus; +import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; @@ -124,11 +130,6 @@ 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.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -138,12 +139,10 @@ 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.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * An {@link Extent} that handles history, {@link BlockBag}s, change limits, @@ -192,15 +191,14 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } } - private final World world; + @SuppressWarnings("ProtectedField") + protected final World world; private final String worldName; private boolean wrapped; - private Extent bypassHistory; - private Extent bypassAll; private final FaweLimit originalLimit; private final FaweLimit limit; private final Player player; - private FaweChangeSet changeTask; + private FaweChangeSet changeSet; private boolean history; private final MutableBlockVector3 mutablebv = new MutableBlockVector3(); @@ -208,6 +206,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { private int changes = -1; private final BlockBag blockBag; + private Extent bypassHistory; + private Extent bypassAll; + private final int maxY; @Deprecated @@ -229,10 +230,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { this.originalLimit = builder.getLimit(); this.limit = builder.getLimit().copy(); this.player = builder.getPlayer(); - this.changeTask = builder.getChangeTask(); + this.changeSet = builder.getChangeTask(); this.maxY = builder.getMaxY(); this.blockBag = builder.getBlockBag(); - this.history = changeTask != null; + this.history = changeSet != null; } /** @@ -244,7 +245,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @param blockBag an optional {@link BlockBag} to use, otherwise null * @param event the event to call with the extent */ - public EditSession(EventBus eventBus, World world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) { + public EditSession(EventBus eventBus, @NotNull World world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) { this(world, null, null, null, null, true, null, null, null, blockBag, eventBus, event); } @@ -384,15 +385,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return the change set */ public ChangeSet getChangeSet() { - return changeTask; - } - - /** - * Will be removed very soon. Use getChangeSet() - */ - @Deprecated - public FaweChangeSet getChangeTask() { - return changeTask; + return changeSet; } /** @@ -401,7 +394,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @param set */ public void setRawChangeSet(@Nullable FaweChangeSet set) { - changeTask = set; + changeSet = set; changes++; } @@ -432,7 +425,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return whether the queue is enabled * @deprecated Use {@link EditSession#getReorderMode()} with MULTI_STAGE instead. */ - @Override @Deprecated public boolean isQueueEnabled() { return true; @@ -444,7 +436,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * Uses {@link ReorderMode#MULTI_STAGE} * @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with MULTI_STAGE instead. */ - @Override @Deprecated public void enableQueue() { super.enableQueue(); @@ -453,7 +444,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { /** * Disable the queue. This will close the queue. */ - @Override @Deprecated public void disableQueue() { super.disableQueue(); @@ -599,10 +589,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } } else { if (this.history) { - if (this.changeTask == null) { + if (this.changeSet == null) { throw new IllegalArgumentException("History was never provided, cannot enable"); } - enableHistory(this.changeTask); + enableHistory(this.changeSet); } } } @@ -634,6 +624,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @param blockBag the block bag to set, or null to use none */ public void setBlockBag(BlockBag blockBag) { + //Not Supported in FAWE throw new UnsupportedOperationException("TODO - this is never called anyway"); } @@ -728,21 +719,16 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return {@code true} if any watchdog extent is enabled */ public boolean isTickingWatchdog() { - /* return watchdogExtents.stream().anyMatch(WatchdogTickingExtent::isEnabled); - */ - return false; } /** * Set all watchdog extents to the given mode. */ public void setTickingWatchdog(boolean active) { - /* for (WatchdogTickingExtent extent : watchdogExtents) { extent.setEnabled(active); } - */ } /** @@ -777,7 +763,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @param maxY maximal height * @return height of highest block found or 'minY' */ - @Override public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { for (int y = maxY; y >= minY; --y) { if (getBlock(x, y, z).getBlockType().getMaterial().isMovementBlocker()) { @@ -797,7 +782,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @param filter a mask of blocks to consider, or null to consider any solid (movement-blocking) block * @return height of highest block found or 'minY' */ - @Override public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) { for (int y = maxY; y >= minY; --y) { if (filter.test(mutablebv.setComponents(x, y, z))) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index 121edf00e..6c747999d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -483,6 +483,7 @@ public class ClipboardCommands { } else { actor.printInfo(TranslatableComponent.of("worldedit.paste.pasted", TextComponent.of(to.toString()))); } + messages.forEach(actor::print); } private void checkPaste(Actor player, EditSession editSession, BlockVector3 to, ClipboardHolder holder, Clipboard clipboard) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java index 200b1d3ca..78faeeb9c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java @@ -12,7 +12,6 @@ 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; @@ -32,7 +31,6 @@ 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; @@ -48,13 +46,11 @@ 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) @@ -317,44 +313,40 @@ public class HistorySubCommands { player.setMeta(pageCommand, new SoftReference<>(list)); } - PaginationBox pages = PaginationBox.fromStrings("Edits:", pageCommand, list, new Function, Component>() { - @NotNull - @Override - public Component apply(@Nullable Supplier 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; + 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(); } + 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)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 8e3aa6ea8..2c6ecd9cb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -223,7 +223,7 @@ public class SchematicCommands { URI uri; if (filename.startsWith("url:")) { if (!actor.hasPermission("worldedit.schematic.load.web")) { - actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.web")); + actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.web")); return; } UUID uuid = UUID.fromString(filename.substring(4)); @@ -250,7 +250,7 @@ public class SchematicCommands { } } else { if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !actor.hasPermission("worldedit.schematic.load.other") && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(filename).find()) { - actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.other")); + actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other")); return; } if (format == null && filename.matches(".*\\.[\\w].*")) { @@ -329,7 +329,7 @@ public class SchematicCommands { if (filename.contains("../")) { other = true; if (!actor.hasPermission("worldedit.schematic.save.other")) { - actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.save.other")); + actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.save.other")); return; } if (filename.startsWith("../")) { @@ -347,7 +347,7 @@ public class SchematicCommands { } if (other) { if (!actor.hasPermission("worldedit.schematic.delete.other")) { - actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.delete.other")); + actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.delete.other")); return; } } @@ -393,7 +393,7 @@ public class SchematicCommands { return; } if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) { - player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.move.other")); + player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.move.other")); return; } ClipboardHolder clipboard = session.getClipboard(); @@ -414,7 +414,7 @@ public class SchematicCommands { } if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && (!MainUtil.isInSubDirectory(dir, destFile) || !MainUtil.isInSubDirectory(dir, source)) && !player.hasPermission("worldedit.schematic.delete.other")) { player.print(Caption.of("fawe.worldedit.schematic.schematic.move.failed", destFile, - Caption.of("fawe.error.no.perm", ("worldedit.schematic.move.other")))); + Caption.of("fawe.error.no-perm", ("worldedit.schematic.move.other")))); continue; } try { @@ -829,7 +829,7 @@ public class SchematicCommands { continue; } if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission("worldedit.schematic.delete.other")) { - actor.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.delete.other")); + actor.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.delete.other")); continue; } if (!deleteFile(f)) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index 7c9e02a09..bbd9be8b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -23,14 +23,11 @@ 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; @@ -45,6 +42,7 @@ 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; @@ -52,19 +50,16 @@ 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; @@ -72,6 +67,7 @@ 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; @@ -81,8 +77,9 @@ 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; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; @@ -91,7 +88,9 @@ 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; @@ -713,11 +712,12 @@ public class UtilityCommands { } public static List> filesToEntry(final File root, final List files, final UUID uuid) { - 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); - }); + 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()); } public static enum URIType { @@ -728,7 +728,7 @@ public class UtilityCommands { } public static List entryToComponent(File root, List> entries, Function isLoaded, QuadFunction adapter) { - return Lists.transform(entries, input -> { + return entries.stream().map(input -> { URI uri = input.getKey(); String path = input.getValue(); @@ -745,11 +745,13 @@ 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) { } @@ -760,7 +762,7 @@ public class UtilityCommands { } return adapter.apply(name, path, type, loaded); - }); + }).collect(Collectors.toList()); } public static List getFiles(File dir, Actor actor, List args, String formatName, boolean playerFolder, boolean oldFirst, boolean newFirst) { @@ -810,8 +812,7 @@ public class UtilityCommands { boolean listMine = false; boolean listGlobal = !Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS; if (len > 0) { - for (int i = 0; i < len; i++) { - String arg = args.get(i); + for (String arg : args) { switch (arg.toLowerCase()) { case "me": case "mine": @@ -831,7 +832,10 @@ 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) { @@ -843,8 +847,7 @@ public class UtilityCommands { } } dirFilter = newDirFilter; - } - else { + } else { filters.add(arg); } break; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java index c87a1b909..ce02f08e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java @@ -491,7 +491,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool if (brush == null) return false; if (current.setWorld(player.getWorld().getName()) && !current.canUse(player)) { - player.print(Caption.of("fawe.error.no.perm" , StringMan.join(current.getPermissions(), ","))); + player.print(Caption.of("fawe.error.no-perm" , StringMan.join(current.getPermissions(), ","))); return false; } try (EditSession editSession = session.createEditSession(player, current.toString())) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index c3719a0b1..a28338a40 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -619,7 +619,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public void checkPermission(String permission) throws AuthorizationException { if (!hasPermission(permission)) { - throw new AuthorizationException(Caption.toString(Caption.of("fawe.error.no.perm", permission))); + throw new AuthorizationException(Caption.toString(Caption.of("fawe.error.no-perm", permission))); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index a6088581e..6bda89355 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -44,6 +44,7 @@ import java.io.Closeable; import java.util.Iterator; import java.util.List; import java.util.UUID; +import org.jetbrains.annotations.NotNull; import static com.google.common.base.Preconditions.checkNotNull; @@ -240,6 +241,7 @@ public class BlockArrayClipboard extends DelegateClipboard implements Clipboard, return getParent().getBiomeType(x, y, z); } + @NotNull @Override public Iterator iterator() { OffsetBlockVector3 mutable = new OffsetBlockVector3(offset); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java index ddd438ac9..21ddee061 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.extent.clipboard; +import static com.google.common.base.Preconditions.checkNotNull; + import com.boydti.fawe.beta.Filter; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.clipboard.CPUOptimizedClipboard; @@ -29,20 +31,16 @@ import com.boydti.fawe.util.EditSessionBuilder; import com.boydti.fawe.util.MaskTraverser; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; import com.sk89q.worldedit.extent.transform.BlockTransformExtent; -import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; -import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.visitor.Order; -import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.MutableBlockVector2; @@ -52,9 +50,6 @@ import com.sk89q.worldedit.regions.Regions; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; - -import javax.annotation.Nullable; import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; @@ -63,19 +58,20 @@ import java.io.OutputStream; import java.net.URI; import java.util.Iterator; import java.util.UUID; - -import static com.google.common.base.Preconditions.checkNotNull; +import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; /** * Specifies an object that implements something suitable as a "clipboard." */ public interface Clipboard extends Extent, Iterable, Closeable { + static Clipboard create(Region region) { checkNotNull(region); checkNotNull(region.getWorld(), - "World cannot be null (use the other constructor for the region)"); + "World cannot be null (use the other constructor for the region)"); EditSession session = new EditSessionBuilder(region.getWorld()).allowedRegionsEverywhere() - .autoQueue(false).build(); + .autoQueue(false).build(); return ReadOnlyClipboard.of(session, region); } @@ -120,10 +116,11 @@ public interface Clipboard extends Extent, Iterable, Closeable { void setOrigin(BlockVector3 origin); /** - * Returns true if the clipboard has biome data. This can be checked since {@link Extent#getBiome(BlockVector2)} - * strongly suggests returning {@link com.sk89q.worldedit.world.biome.BiomeTypes#OCEAN} instead of {@code null} - * if biomes aren't present. However, it might not be desired to set areas to ocean if the clipboard is defaulting - * to ocean, instead of having biomes explicitly set. + * Returns true if the clipboard has biome data. This can be checked since {@link + * Extent#getBiome(BlockVector2)} strongly suggests returning {@link + * com.sk89q.worldedit.world.biome.BiomeTypes#OCEAN} instead of {@code null} if biomes aren't + * present. However, it might not be desired to set areas to ocean if the clipboard is + * defaulting to ocean, instead of having biomes explicitly set. * * @return true if the clipboard has biome data set */ @@ -133,7 +130,6 @@ public interface Clipboard extends Extent, Iterable, Closeable { /** * Remove entity from clipboard - * @param entity */ void removeEntity(Entity entity); @@ -161,6 +157,8 @@ public interface Clipboard extends Extent, Iterable, Closeable { return order.create(getRegion()); } + @Override + @NotNull default Iterator iterator() { return getRegion().iterator(); } @@ -173,35 +171,20 @@ public interface Clipboard extends Extent, Iterable, Closeable { return null; } -// default void paste(Extent other, BlockVector3 to) { -// TODO FIXME -// } - @Override default T apply(Region region, T filter, boolean full) { if (region.equals(getRegion())) { return apply(this, filter); - } else { - return apply((Iterable) region, filter); } + return apply(region, filter); } @Override default void close() { - } - - /* - Utility methods - */ - /** * Forwards to paste(world, to, true, true, null) - * - * @param world - * @param to - * @return */ default EditSession paste(World world, BlockVector3 to) { return paste(world, to, true, true, null); @@ -222,10 +205,6 @@ public interface Clipboard extends Extent, Iterable, Closeable { /** * Save this schematic to a stream - * - * @param stream - * @param format - * @throws IOException */ default void save(OutputStream stream, ClipboardFormat format) throws IOException { checkNotNull(stream); @@ -236,22 +215,15 @@ public interface Clipboard extends Extent, Iterable, Closeable { } default EditSession paste(World world, BlockVector3 to, boolean allowUndo, boolean pasteAir, - @Nullable Transform transform) { + @Nullable Transform transform) { return paste(world, to, allowUndo, pasteAir, true, transform); } /** * Paste this schematic in a world - * - * @param world - * @param to - * @param allowUndo - * @param pasteAir - * @param transform - * @return */ default EditSession paste(World world, BlockVector3 to, boolean allowUndo, boolean pasteAir, - boolean copyEntities, @Nullable Transform transform) { + boolean copyEntities, @Nullable Transform transform) { checkNotNull(world); checkNotNull(to); EditSession editSession; @@ -259,7 +231,7 @@ public interface Clipboard extends Extent, Iterable, Closeable { editSession = (EditSession) world; } else { EditSessionBuilder builder = new EditSessionBuilder(world).autoQueue(true) - .checkMemory(false).allowedRegionsEverywhere().limitUnlimited(); + .checkMemory(false).allowedRegionsEverywhere().limitUnlimited(); if (allowUndo) { editSession = builder.build(); } else { @@ -276,7 +248,7 @@ public interface Clipboard extends Extent, Iterable, Closeable { return editSession; } ForwardExtentCopy copy = new ForwardExtentCopy(extent, this.getRegion(), - this.getOrigin(), editSession, to); + this.getOrigin(), editSession, to); if (transform != null && !transform.isIdentity()) { copy.setTransform(transform); } @@ -298,12 +270,14 @@ public interface Clipboard extends Extent, Iterable, Closeable { return editSession; } - default void paste(Extent extent, BlockVector3 to, boolean pasteAir, @Nullable Transform transform) { + default void paste(Extent extent, BlockVector3 to, boolean pasteAir, + @Nullable Transform transform) { Extent source = this; if (transform != null && !transform.isIdentity()) { source = new BlockTransformExtent(this, transform); } - ForwardExtentCopy copy = new ForwardExtentCopy(source, this.getRegion(), this.getOrigin(), extent, to); + ForwardExtentCopy copy = new ForwardExtentCopy(source, this.getRegion(), this.getOrigin(), + extent, to); if (transform != null) { copy.setTransform(transform); } @@ -345,6 +319,9 @@ public interface Clipboard extends Extent, Iterable, Closeable { if (!pasteAir && block.getBlockType().getMaterial().isAir()) { continue; } + if (pos.getY() < 0) { + throw new RuntimeException("Y-Position cannot be less than 0!"); + } extent.setBlock(xx, pos.getY() + rely, zz, block); } // Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin) @@ -355,13 +332,13 @@ public interface Clipboard extends Extent, Iterable, Closeable { for (Entity entity : this.getEntities()) { // skip players on pasting schematic if (entity.getState() != null && entity.getState().getType().getId() - .equals("minecraft:player")) { + .equals("minecraft:player")) { continue; } Location pos = entity.getLocation(); Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX, - pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(), - pos.getPitch()); + pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(), + pos.getPitch()); extent.createEntity(newPos, entity.getState()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java index 3cac0a0d2..aaad5bfa1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java @@ -170,7 +170,7 @@ public class ClipboardFormats { LocalConfiguration config = worldEdit.getConfiguration(); if (input.startsWith("url:")) { if (!player.hasPermission("worldedit.schematic.load.web")) { - if (message) player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.web")); + if (message) player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.web")); return null; } URL base = new URL(Settings.IMP.WEB.URL); @@ -178,7 +178,7 @@ public class ClipboardFormats { } if (input.startsWith("http")) { if (!player.hasPermission("worldedit.schematic.load.asset")) { - if (message) player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.asset")); + if (message) player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.asset")); return null; } URL url = new URL(input); @@ -190,7 +190,7 @@ public class ClipboardFormats { return loadAllFromUrl(url); } else { if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find() && !player.hasPermission("worldedit.schematic.load.other")) { - player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.other")); + player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other")); return null; } File working = worldEdit.getWorkingDirectoryFile(config.saveDir); @@ -210,7 +210,7 @@ public class ClipboardFormats { } } else { if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(input).find() && !player.hasPermission("worldedit.schematic.load.other")) { - if (message) player.print(Caption.of("fawe.error.no.perm", "worldedit.schematic.load.other")); + if (message) player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.load.other")); return null; } if (format == null && input.matches(".*\\.[\\w].*")) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java index c84af2122..a2cda3611 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java @@ -262,9 +262,7 @@ public class BlockMaskBuilder { } public BlockMaskBuilder addAll() { - for (int i = 0; i < bitSets.length; i++) { - bitSets[i] = ALL; - } + Arrays.fill(bitSets, ALL); reset(true); return this; } @@ -275,9 +273,7 @@ public class BlockMaskBuilder { } public BlockMaskBuilder clear() { - for (int i = 0; i < bitSets.length; i++) { - bitSets[i] = null; - } + Arrays.fill(bitSets, null); reset(true); return this; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java index ddaa49f9a..fcbb54201 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java @@ -19,23 +19,18 @@ 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 { @@ -196,4 +191,4 @@ public abstract class PaginationBox extends MessageBox { return lines.size(); } } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index 85a9d8dbf..1f5c2135a 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -7,7 +7,7 @@ "fawe.worldedit.history.find.element": "&8 - &2{0}: {1} &7ago &3{2}m &6{3} &c/{4}", "fawe.worldedit.history.find.hover": "{0} blocks changed, click for more info", - "fawe.info.lighting.propagate.selection": "Lighting has been propogated in {0} chunks. (Note: To remove light use //removelight)", + "fawe.info.lighting.propagate.selection": "Lighting has been propagated in {0} chunks. (Note: To remove light use //removelight)", "fawe.info.updated.lighting.selection": "Lighting has been updated in {0} chunks. (It may take a second for the packets to send)", "fawe.info.set.region": "Selection set to your current allowed region", @@ -216,7 +216,7 @@ "fawe.worldedit.cycler.block.cycler.cannot.cycle": "That block's data cannot be cycled!", "fawe.worldedit.cycler.block.cycler.limit": "Max blocks change limit reached.", - "fawe.worldedit.cycler.block.cycler.no.perm": "You are not permitted to cycle the data value of that block.", + "fawe.worldedit.cycler.block.cycler.no-perm": "You are not permitted to cycle the data value of that block.", "fawe.worldedit.command.command.invalid.syntax": "The command was not used properly (no more help available).", @@ -236,7 +236,7 @@ "fawe.progress.progress.finished": "[ Done! ]", "fawe.error.command.syntax": "Usage: {0}", - "fawe.error.no.perm": "You are lacking the permission node: {0}", + "fawe.error.no-perm": "You are lacking the permission node: {0}", "fawe.error.block.not.allowed": "You are not allowed to use", "fawe.error.setting.disable": "Lacking setting: {0}", "fawe.error.brush.not.found": "Available brushes: {0}", @@ -291,9 +291,9 @@ "fawe.selection.sel.list": "For a list of selection types use: //sel list", "fawe.selection.sel.modes": "Select one of the modes below:", - "fawe.worldedit.scripting.scripting.no.perm": "You do not have permission to execute this craft script", + "fawe.worldedit.scripting.scripting.no-perm": "You do not have permission to execute this craft script", "fawe.worldedit.scripting.scripting.cs": "Use /cs with a script name first.", - "fawe.worldedit.scripting.scripting.error": "An error occured while executing a craft script", + "fawe.worldedit.scripting.scripting.error": "An error occurred while executing a craft script", "fawe.tips.tip.sel.list": "Tip: See the different selection modes with //sel list", "fawe.tips.tip.select.connected": "Tip: Select all connected blocks with //sel fuzzy", From 05760c49cd9355eb8d08e2619b630d9b292f8388 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 3 Jan 2020 16:05:25 -0500 Subject: [PATCH 09/10] Fixed compile issues and disabled plotsquared hook --- .../fawe/bukkit/wrapper/AsyncWorld.java | 65 ++++++++++------ .../java/com/boydti/fawe/config/Settings.java | 2 +- .../java/com/boydti/fawe/jnbt/JSON2NBT.java | 50 ++++++++----- .../worldedit/command/HistorySubCommands.java | 74 ++++++++++--------- .../worldedit/command/UtilityCommands.java | 47 ++++++------ .../formatting/component/PaginationBox.java | 7 +- 6 files changed, 144 insertions(+), 101 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java index 8a880d103..a63296229 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java @@ -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 void spawnParticle(Particle particle, double v, double v1, double v2, int i, T t) { - parent.spawnParticle(particle, v, v1, v2, i, t); + public 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 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 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 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 void spawnParticle(Particle particle, List 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 void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, + double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, + boolean force) { + + } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java b/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java index a02b6a7e9..382d01e08 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java @@ -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 diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/JSON2NBT.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/JSON2NBT.java index 0fc9281c7..9d53caec8 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/JSON2NBT.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/JSON2NBT.java @@ -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 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 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 tagList = Lists.newArrayList(); + protected java.util.List tagList = Lists.newArrayList(); public List(String json) { this.json = json; } public Tag parse() throws NBTException { - ArrayList list = this.tagList.stream().map(Any::parse) - .collect(Collectors.toCollection(ArrayList::new)); + ArrayList 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 tagType = list.isEmpty() ? CompoundTag.class : list.get(0).getClass(); return new ListTag(tagType, list); } } private static class Compound extends JSON2NBT.Any { - protected List tagList = Lists.newArrayList(); + protected java.util.List tagList = Lists.newArrayList(); public Compound(String jsonIn) { this.json = jsonIn; @@ -399,8 +407,10 @@ public class JSON2NBT { public Tag parse() throws NBTException { HashMap 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()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java index 78faeeb9c..200b1d3ca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java @@ -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, Component>() { + @NotNull + @Override + public Component apply(@Nullable Supplier 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)); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index bbd9be8b3..7c9e02a09 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -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> filesToEntry(final File root, final List 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 entryToComponent(File root, List> entries, Function isLoaded, QuadFunction 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 getFiles(File dir, Actor actor, List 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; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java index fcbb54201..944c253e6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java @@ -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 { From 0bf6cfad8d6a2d06648045393a872bc1d31a2893 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Fri, 3 Jan 2020 16:51:23 -0500 Subject: [PATCH 10/10] Debug message for arrayoutofbounds --- .../com/boydti/fawe/beta/IBatchProcessor.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IBatchProcessor.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IBatchProcessor.java index c07a60fa2..6af9d4591 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IBatchProcessor.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IBatchProcessor.java @@ -1,5 +1,6 @@ package com.boydti.fawe.beta; +import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweCache; import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor; import com.boydti.fawe.beta.implementation.processors.MultiBatchProcessor; @@ -65,12 +66,18 @@ public interface IBatchProcessor { } } } - int layer = (minY - 15) >> 4; - while (layer < (maxY + 15) >> 4) { - if (set.hasSection(layer)) { - return true; + try { + int layer = (minY - 15) >> 4; + while (layer < (maxY + 15) >> 4) { + if (set.hasSection(layer)) { + return true; + } + layer++; } - layer++; + } catch (ArrayIndexOutOfBoundsException exception) { + Fawe.imp().debug("minY = " + minY); + Fawe.imp().debug("layer = " + ((minY - 15) >> 4)); + exception.printStackTrace(); } return false; }