3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-08 04:20:06 +01:00

Cleanup unused code.

Dieser Commit ist enthalten in:
MattBDev 2020-03-05 16:07:20 -05:00
Ursprung 417cbd585f
Commit 915ab43f6e
31 geänderte Dateien mit 192 neuen und 358 gelöschten Zeilen

Datei anzeigen

@ -28,7 +28,9 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.util.formatting.WorldEditText; import com.sk89q.worldedit.util.formatting.WorldEditText;
import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter; import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -72,6 +74,26 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
} }
} }
@Override
public void print(String msg) {
for (String part : msg.split("\n")) {
print(TextComponent.of(part, TextColor.LIGHT_PURPLE));
}
}
@Override
public void printDebug(String msg) {
for (String part : msg.split("\n")) {
print(TextComponent.of(part, TextColor.GRAY));
}
}
@Override
public void printError(String msg) {
for (String part : msg.split("\n")) {
print(TextComponent.of(part, TextColor.RED));
}
}
@Override @Override
public void print(Component component) { public void print(Component component) {
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale())); TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));

Datei anzeigen

@ -74,6 +74,26 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
} }
} }
@Override
public void print(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage("\u00A7d" + part);
}
}
@Override
public void printDebug(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage("\u00A77" + part);
}
}
@Override
public void printError(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage("\u00A7c" + part);
}
}
@Override @Override
public void print(Component component) { public void print(Component component) {
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale())); TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
@ -118,7 +138,7 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
public boolean isActive() { public boolean isActive() {
if (sender instanceof Entity) { if (sender instanceof Entity) {
Entity entity = (Entity) sender; Entity entity = (Entity) sender;
return (entity.isValid() && !entity.isDead()); return entity.isValid() && !entity.isDead();
} }
return true; return true;
} }

Datei anzeigen

@ -84,10 +84,6 @@ public class BukkitPlayer extends AbstractPlayerActor {
public BukkitPlayer(WorldEditPlugin plugin, Player player) { public BukkitPlayer(WorldEditPlugin plugin, Player player) {
this.plugin = plugin; this.plugin = plugin;
this.player = player; this.player = player;
init();
}
private void init() {
if (Settings.IMP.CLIPBOARD.USE_DISK) { if (Settings.IMP.CLIPBOARD.USE_DISK) {
loadClipboardFromDisk(); loadClipboardFromDisk();
} }
@ -170,6 +166,26 @@ public class BukkitPlayer extends AbstractPlayerActor {
} }
} }
@Override
public void print(String msg) {
for (String part : msg.split("\n")) {
player.sendMessage("\u00A7d" + part);
}
}
@Override
public void printDebug(String msg) {
for (String part : msg.split("\n")) {
player.sendMessage("\u00A77" + part);
}
}
@Override
public void printError(String msg) {
for (String part : msg.split("\n")) {
player.sendMessage("\u00A7c" + part);
}
}
@Override @Override
public void print(Component component) { public void print(Component component) {
component = Caption.color(TranslatableComponent.of("prefix", component), getLocale()); component = Caption.color(TranslatableComponent.of("prefix", component), getLocale());

Datei anzeigen

@ -145,13 +145,13 @@ public class Fawe {
* *
* @param s * @param s
*/ */
public static void debug(Object s) { public static void debug(String s) {
Actor actor = Request.request().getActor(); Actor actor = Request.request().getActor();
if (actor != null && actor.isPlayer()) { if (actor != null && actor.isPlayer()) {
actor.print((String)s); actor.printInfo(TextComponent.of(s));
return; return;
} }
debugPlain((String) s); debugPlain(s);
} }
/** /**

Datei anzeigen

@ -399,6 +399,7 @@ public class FaweAPI {
* @return * @return
*/ */
public static int fixLighting(World world, Region selection, @Nullable IQueueExtent queue) { public static int fixLighting(World world, Region selection, @Nullable IQueueExtent queue) {
//TODO NONE OF THIS CODE WORKS AS OF 2020-03-05
final BlockVector3 bot = selection.getMinimumPoint(); final BlockVector3 bot = selection.getMinimumPoint();
final BlockVector3 top = selection.getMaximumPoint(); final BlockVector3 top = selection.getMaximumPoint();

Datei anzeigen

@ -227,10 +227,10 @@ public enum FaweCache implements Trimable {
long[] blockStates = BLOCK_STATES.get(); long[] blockStates = BLOCK_STATES.get();
int[] blocksCopy = SECTION_BLOCKS.get(); int[] blocksCopy = SECTION_BLOCKS.get();
try {
int num_palette = 0;
int blockIndexStart = layerOffset << 12; int blockIndexStart = layerOffset << 12;
int blockIndexEnd = blockIndexStart + 4096; int blockIndexEnd = blockIndexStart + 4096;
int num_palette = 0;
try {
if (blocksChars != null) { if (blocksChars != null) {
for (int i = blockIndexStart, j = 0; i < blockIndexEnd; i++, j++) { for (int i = blockIndexStart, j = 0; i < blockIndexEnd; i++, j++) {
int ordinal = blocksChars[i]; int ordinal = blocksChars[i];

Datei anzeigen

@ -1,33 +0,0 @@
package com.boydti.fawe.beta.implementation.chunk;
import com.boydti.fawe.beta.IQueueChunk;
import com.boydti.fawe.beta.IQueueExtent;
/**
* Used by {@link ReferenceChunk} to allow the chunk to be garbage collected. - When the object is
* finalized, add it to the queue
*/
public class FinalizedChunk<T extends IQueueChunk> extends DelegateChunk<T> {
private final IQueueExtent queueExtent;
public FinalizedChunk(T parent, IQueueExtent queueExtent) {
super(parent);
this.queueExtent = queueExtent;
}
/**
* Submit the chunk to the queue
*
* @throws Throwable
*/
@Override
protected void finalize() throws Throwable {
if (getParent() != null) {
// TODO apply safely
// apply();
setParent(null);
}
super.finalize();
}
}

Datei anzeigen

@ -1,29 +0,0 @@
package com.boydti.fawe.beta.implementation.chunk;
import com.boydti.fawe.beta.IChunk;
import com.boydti.fawe.beta.IDelegateChunk;
import com.boydti.fawe.beta.IQueueChunk;
import com.boydti.fawe.beta.IQueueExtent;
import java.lang.ref.Reference;
/**
* An {@link IChunk} may be wrapped by a ReferenceChunk if there is low memory. This class stores a
* reference for garbage collection purposes. If it cleaned by garbage collection, the {@link
* FinalizedChunk} logic is run.
*/
public abstract class ReferenceChunk implements IDelegateChunk {
private final Reference<FinalizedChunk> reference;
public ReferenceChunk(IQueueChunk parent, IQueueExtent queueExtent) {
this.reference = toReference(new FinalizedChunk(parent, queueExtent));
}
protected abstract Reference<FinalizedChunk> toReference(FinalizedChunk parent);
@Override
public IQueueChunk getParent() {
final FinalizedChunk finalized = reference.get();
return finalized != null ? finalized.getParent() : null;
}
}

Datei anzeigen

@ -1,22 +0,0 @@
package com.boydti.fawe.beta.implementation.chunk;
import com.boydti.fawe.beta.IChunk;
import com.boydti.fawe.beta.IQueueChunk;
import com.boydti.fawe.beta.IQueueExtent;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
/**
* Soft reference implementation of {@link ReferenceChunk}
*/
public class SoftChunk extends ReferenceChunk {
public SoftChunk(IQueueChunk parent, IQueueExtent queueExtent) {
super(parent, queueExtent);
}
@Override
protected Reference<FinalizedChunk> toReference(FinalizedChunk parent) {
return new SoftReference<>(parent);
}
}

Datei anzeigen

@ -1,23 +0,0 @@
package com.boydti.fawe.beta.implementation.chunk;
import com.boydti.fawe.beta.IChunk;
import com.boydti.fawe.beta.IQueueChunk;
import com.boydti.fawe.beta.IQueueExtent;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
/**
* A {@link ReferenceChunk} using {@link WeakReference} to hold the chunk.
*/
public class WeakChunk extends ReferenceChunk {
public WeakChunk(IQueueChunk parent, IQueueExtent queueExtent) {
super(parent, queueExtent);
}
@Override
protected Reference<FinalizedChunk> toReference(FinalizedChunk parent) {
return new WeakReference<>(parent);
}
}

Datei anzeigen

@ -4,6 +4,7 @@ import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.function.mask.ABlockMask; import com.sk89q.worldedit.function.mask.ABlockMask;
import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
@ -94,10 +95,10 @@ public class DistrFilter extends ForkedFilter<DistrFilter> {
for (Countable c : getDistribution()) { for (Countable c : getDistribution()) {
final String name = c.getID().toString(); final String name = c.getID().toString();
final String str = String.format("%-7s (%.3f%%) %s", final String str = String.format("%-7s (%.3f%%) %s",
String.valueOf(c.getAmount()), c.getAmount(),
c.getAmount() / (double) size * 100, c.getAmount() / (double) size * 100,
name); name);
actor.print(str); actor.printInfo(TextComponent.of(str));
} }
} }
} }

Datei anzeigen

@ -10,7 +10,6 @@ import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.beta.implementation.blocks.CharSetBlocks; import com.boydti.fawe.beta.implementation.blocks.CharSetBlocks;
import com.boydti.fawe.beta.implementation.chunk.ChunkHolder; import com.boydti.fawe.beta.implementation.chunk.ChunkHolder;
import com.boydti.fawe.beta.implementation.chunk.NullChunk; import com.boydti.fawe.beta.implementation.chunk.NullChunk;
import com.boydti.fawe.beta.implementation.chunk.ReferenceChunk;
import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock; 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.ChunkFilterBlock;
import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor; import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
@ -210,9 +209,6 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
return NullChunk.INSTANCE; return NullChunk.INSTANCE;
} }
IQueueChunk chunk = chunks.get(pair); IQueueChunk chunk = chunks.get(pair);
if (chunk instanceof ReferenceChunk) {
chunk = ((ReferenceChunk) chunk).getParent();
}
if (chunk != null) { if (chunk != null) {
lastPair = pair; lastPair = pair;
lastChunk = chunk; lastChunk = chunk;

Datei anzeigen

@ -49,6 +49,7 @@ public class RegionWrapper extends CuboidRegion {
this.maxY = Math.max(pos1.getBlockY(), pos2.getBlockY()); this.maxY = Math.max(pos1.getBlockY(), pos2.getBlockY());
} }
@Override
public RegionWrapper[] toArray() { public RegionWrapper[] toArray() {
return new RegionWrapper[]{this}; return new RegionWrapper[]{this};
} }

Datei anzeigen

@ -46,7 +46,7 @@ public class BlendBall implements Brush {
continue; continue;
} }
BlockState state = editSession.getBlock(x0 + ox, y0 + oy, z0 + oz); BlockState state = editSession.getBlock(x0 + ox, y0 + oy, z0 + oz);
Integer count = frequency[state.getInternalBlockTypeId()]; int count = frequency[state.getInternalBlockTypeId()];
count++; count++;
if (count > highest) { if (count > highest) {
highest = count; highest = count;

Datei anzeigen

@ -135,7 +135,4 @@ public class ImageBrush implements Brush {
Operations.completeBlindly(visitor); Operations.completeBlindly(visitor);
} }
private void apply(double val) {
}
} }

Datei anzeigen

@ -2,7 +2,6 @@ package com.boydti.fawe.object.change;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.DoubleTag; import com.sk89q.jnbt.DoubleTag;
@ -89,7 +88,4 @@ public class MutableEntityChange implements Change {
context.getExtent().createEntity(location, entity); context.getExtent().createEntity(location, entity);
} }
public void perform(IQueueExtent queue) {
}
} }

Datei anzeigen

@ -2,17 +2,17 @@ package com.boydti.fawe.object.collection;
public final class BitArray4096 { public final class BitArray4096 {
private final long[] data;
private final int bitsPerEntry; private final int bitsPerEntry;
private final int maxSeqLocIndex; private final int maxSeqLocIndex;
private final int maxEntryValue; private final int maxEntryValue;
private final long[] data;
private final int longLen; private final int longLen;
public BitArray4096(long[] buffer, int bitsPerEntry) { public BitArray4096(long[] buffer, int bitsPerEntry) {
this.bitsPerEntry = bitsPerEntry; this.bitsPerEntry = bitsPerEntry;
this.maxSeqLocIndex = 64 - bitsPerEntry; this.maxSeqLocIndex = 64 - bitsPerEntry;
maxEntryValue = (1 << bitsPerEntry) - 1; maxEntryValue = (1 << bitsPerEntry) - 1;
this.longLen = (this.bitsPerEntry * 4096) >> 6; this.longLen = (this.bitsPerEntry << 12) >> 6;
if (buffer.length < longLen) { if (buffer.length < longLen) {
this.data = new long[longLen]; this.data = new long[longLen];
} else { } else {
@ -32,7 +32,7 @@ public final class BitArray4096 {
return data; return data;
} }
public final void setAt(int index, int value) { public final void set(int index, int value) {
if (longLen == 0) return; if (longLen == 0) return;
int bitIndexStart = index * bitsPerEntry; int bitIndexStart = index * bitsPerEntry;
int longIndexStart = bitIndexStart >> 6; int longIndexStart = bitIndexStart >> 6;
@ -47,7 +47,7 @@ public final class BitArray4096 {
} }
} }
public final int getAt(int index) { public final int get(int index) {
if (longLen == 0) return 0; if (longLen == 0) return 0;
int bitIndexStart = index * bitsPerEntry; int bitIndexStart = index * bitsPerEntry;
@ -68,7 +68,7 @@ public final class BitArray4096 {
public final void fromRawSlow(char[] arr) { public final void fromRawSlow(char[] arr) {
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
setAt(i, arr[i]); set(i, arr[i]);
} }
} }
@ -112,7 +112,7 @@ public final class BitArray4096 {
public BitArray4096 growSlow(int bitsPerEntry) { public BitArray4096 growSlow(int bitsPerEntry) {
BitArray4096 newBitArray = new BitArray4096(bitsPerEntry); BitArray4096 newBitArray = new BitArray4096(bitsPerEntry);
for (int i = 0; i < 4096; i++) { for (int i = 0; i < 4096; i++) {
newBitArray.setAt(i, getAt(i)); newBitArray.set(i, get(i));
} }
return newBitArray; return newBitArray;
} }
@ -120,7 +120,7 @@ public final class BitArray4096 {
public final char[] toRawSlow() { public final char[] toRawSlow() {
char[] arr = new char[4096]; char[] arr = new char[4096];
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
arr[i] = (char) getAt(i); arr[i] = (char) get(i);
} }
return arr; return arr;
} }

Datei anzeigen

@ -1,138 +0,0 @@
package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.world.block.BaseBlock;
import java.util.Set;
// TODO FIXME
public abstract class FaweBlockMatcher {
public abstract boolean apply(BaseBlock block);
public static FaweBlockMatcher ALWAYS_TRUE = new FaweBlockMatcher() {
@Override
public boolean apply(BaseBlock block) {
return true;
}
};
public static FaweBlockMatcher NOT_AIR = new FaweBlockMatcher() {
@Override
public boolean apply(BaseBlock block) {
return !block.getBlockType().getMaterial().isAir();
}
};
public static FaweBlockMatcher setBlock(BaseBlock block) {
return null;
// final int id = block.getId();
// final int data = block.getData();
// if (data == 0) {
// return new FaweBlockMatcher() {
// @Override
// public boolean apply(BaseBlock oldBlock) {
// int currentId = oldBlock.getId();
// oldBlock.setId(id);
// if (FaweCache.IMP.hasData(currentId)) {
// oldBlock.setData(0);
// }
// if (FaweCache.IMP.hasNBT(currentId)) {
// oldBlock.setNbtData(null);
// }
// return true;
// }
// };
// }
// return new FaweBlockMatcher() {
// @Override
// public boolean apply(BaseBlock oldBlock) {
// int currentId = oldBlock.getId();
// oldBlock.setId(id);
// oldBlock.setData(data);
// if (FaweCache.IMP.hasNBT(currentId)) {
// oldBlock.setNbtData(null);
// }
// return true;
// }
// };
}
public static FaweBlockMatcher setBlocks(Set<BaseBlock> blocks) {
// if (blocks.size() == 1) {
// return setBlock(blocks.iterator().next());
// }
// final BaseBlock[] array = blocks.toArray(new BaseBlock[blocks.size()]);
// final int size = array.length;
// return new FaweBlockMatcher() {
// @Override
// public boolean apply(BaseBlock block) {
// BaseBlock replace = array[random.random(size)];
// int currentId = block.getId();
// block.setId(replace.getId());
// if (FaweCache.IMP.hasNBT(currentId)) {
// block.setNbtData(null);
// }
// if (FaweCache.IMP.hasData(currentId) || replace.getData() != 0) {
// block.setData(replace.getData());
// }
// return true;
// }
// };
return null;
}
public static FaweBlockMatcher fromBlock(BaseBlock block, boolean checkData) {
// final int id = block.getId();
// final int data = block.getData();
// if (checkData && FaweCache.IMP.hasData(id)) {
// return new FaweBlockMatcher() {
// @Override
// public boolean apply(BaseBlock block) {
// return (block.getId() == id && block.getData() == data);
// }
// };
// } else {
// return new FaweBlockMatcher() {
// @Override
// public boolean apply(BaseBlock block) {
// return (block.getId() == id);
// }
// };
// }
return null;
}
public static FaweBlockMatcher fromBlocks(Set<BaseBlock> searchBlocks, boolean checkData) {
// if (searchBlocks.size() == 1) {
// return fromBlock(searchBlocks.iterator().next(), checkData);
// }
// final boolean[] allowedId = new boolean[FaweCache.IMP.getId(Character.MAX_VALUE)];
// for (BaseBlock block : searchBlocks) {
// allowedId[block.getId()] = true;
// }
// final boolean[] allowed = new boolean[Character.MAX_VALUE];
// for (BaseBlock block : searchBlocks) {
// allowed[FaweCache.IMP.getCombined(block)] = true;
// }
// if (checkData) {
// return new FaweBlockMatcher() {
// @Override
// public boolean apply(BaseBlock block) {
// int id = block.getId();
// if (allowedId[id]) {
// if (FaweCache.IMP.hasData(id)) {
// return allowed[(id << 4) + block.getData()];
// }
// return true;
// }
// return false;
// }
// };
// }
// return new FaweBlockMatcher() {
// @Override
// public boolean apply(BaseBlock block) {
// return allowedId[block.getId()];
// }
// };
return null;
}
}

Datei anzeigen

@ -33,6 +33,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits; import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -161,7 +162,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
session.describeCUI(player); session.describeCUI(player);
player.print("Started new selection with vertex " + pos + "."); player.print(TextComponent.of("Started new selection with vertex " + pos + "."));
} }
@Override @Override
@ -172,7 +173,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
session.describeCUI(player); session.describeCUI(player);
player.print("Added vertex " + pos + " to the selection."); player.print(TextComponent.of("Added vertex " + pos + " to the selection."));
} }
@Override @Override

Datei anzeigen

@ -237,10 +237,6 @@ public class EditSessionBuilder {
if(toReturn instanceof com.sk89q.worldedit.extent.NullExtent) { if(toReturn instanceof com.sk89q.worldedit.extent.NullExtent) {
return new NullExtent(toReturn, FaweCache.MANUAL); return new NullExtent(toReturn, FaweCache.MANUAL);
} }
// if (!(toReturn instanceof AbstractDelegateExtent)) {
// Fawe.debug("Extent " + toReturn + " must be AbstractDelegateExtent");
// return extent;
// }
if (toReturn != extent) { if (toReturn != extent) {
String className = toReturn.getClass().getName().toLowerCase(); String className = toReturn.getClass().getName().toLowerCase();
for (String allowed : Settings.IMP.EXTENT.ALLOWED_PLUGINS) { for (String allowed : Settings.IMP.EXTENT.ALLOWED_PLUGINS) {

Datei anzeigen

@ -1,5 +1,6 @@
package com.boydti.fawe.util; package com.boydti.fawe.util;
import com.boydti.fawe.Fawe;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.lang.reflect.AccessibleObject; import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -13,8 +14,10 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jetbrains.annotations.NotNull;
public class ReflectionUtils { public class ReflectionUtils {
public static <T> T as(Class<T> t, Object o) { public static <T> T as(Class<T> t, Object o) {
return t.isInstance(o) ? t.cast(o) : null; return t.isInstance(o) ? t.cast(o) : null;
} }
@ -50,7 +53,7 @@ public class ReflectionUtils {
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException { throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
setAccessibleNonFinal(field); setAccessibleNonFinal(field);
field.set(target,value); field.set(target, value);
} }
private static void blankField(Class<?> enumClass, String fieldName) private static void blankField(Class<?> enumClass, String fieldName)
@ -70,12 +73,16 @@ public class ReflectionUtils {
blankField(enumClass, "enumConstants"); // IBM JDK blankField(enumClass, "enumConstants"); // IBM JDK
} }
private static Class<?> UNMODIFIABLE_MAP = Collections.unmodifiableMap(Collections.emptyMap()).getClass(); private static Class<?> UNMODIFIABLE_MAP = Collections.unmodifiableMap(Collections.emptyMap())
.getClass();
public static <T, V> Map<T, V> getMap(Map<T, V> map) { public static <T, V> Map<T, V> getMap(Map<T, V> map) {
try { try {
Class<? extends Map> clazz = map.getClass(); Class<? extends Map> clazz = map.getClass();
if (clazz != UNMODIFIABLE_MAP) return map; if (clazz != UNMODIFIABLE_MAP) {
Fawe.debug("getMap is unused. Please report this to MattBDev on Github or Discord");
return map;
}
Field m = clazz.getDeclaredField("m"); Field m = clazz.getDeclaredField("m");
m.setAccessible(true); m.setAccessible(true);
return (Map<T, V>) m.get(map); return (Map<T, V>) m.get(map);
@ -87,8 +94,11 @@ public class ReflectionUtils {
public static <T> List<T> getList(List<T> list) { public static <T> List<T> getList(List<T> list) {
try { try {
Class<? extends List<T>> clazz = (Class<? extends List<T>>) Class.forName("java.util.Collections$UnmodifiableList"); Class<? extends List<T>> clazz = (Class<? extends List<T>>) Class
if (!clazz.isInstance(list)) return list; .forName("java.util.Collections$UnmodifiableList");
if (!clazz.isInstance(list)) {
return list;
}
Field m = clazz.getDeclaredField("list"); Field m = clazz.getDeclaredField("list");
m.setAccessible(true); m.setAccessible(true);
return (List<T>) m.get(list); return (List<T>) m.get(list);
@ -189,25 +199,32 @@ public class ReflectionUtils {
return findMethod(clazz, 0, returnType, params); return findMethod(clazz, 0, returnType, params);
} }
public static Method findMethod(Class<?> clazz, int index, int hasMods, int noMods, Class<?> returnType, Class... params) { public static Method findMethod(Class<?> clazz, int index, int hasMods, int noMods,
Class<?> returnType, Class... params) {
outer: outer:
for (Method method : sortMethods(clazz.getDeclaredMethods())) { for (Method method : sortMethods(clazz.getDeclaredMethods())) {
if (returnType == null || method.getReturnType() == returnType) { if (returnType == null || method.getReturnType() == returnType) {
Class<?>[] mp = method.getParameterTypes(); Class<?>[] mp = method.getParameterTypes();
int mods = method.getModifiers(); int mods = method.getModifiers();
if ((mods & hasMods) != hasMods || (mods & noMods) != 0) continue; if ((mods & hasMods) != hasMods || (mods & noMods) != 0) {
continue;
}
if (params == null) { if (params == null) {
if (index-- == 0) return setAccessible(method); if (index-- == 0) {
else { return setAccessible(method);
} else {
continue; continue;
} }
} }
if (mp.length == params.length) { if (mp.length == params.length) {
for (int i = 0; i < mp.length; i++) { for (int i = 0; i < mp.length; i++) {
if (mp[i] != params[i]) continue outer; if (mp[i] != params[i]) {
continue outer;
} }
if (index-- == 0) return setAccessible(method); }
else { if (index-- == 0) {
return setAccessible(method);
} else {
continue; continue;
} }
} }
@ -226,7 +243,8 @@ public class ReflectionUtils {
return fields; return fields;
} }
public static Method findMethod(Class<?> clazz, int index, Class<?> returnType, Class... params) { public static Method findMethod(Class<?> clazz, int index, Class<?> returnType,
Class<?>... params) {
return findMethod(clazz, index, 0, 0, returnType, params); return findMethod(clazz, index, 0, 0, returnType, params);
} }
@ -236,10 +254,7 @@ public class ReflectionUtils {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> T getField(Field field, Object instance) { public static <T> T getField(@NotNull Field field, Object instance) {
if (field == null) {
throw new RuntimeException("No such field");
}
field.setAccessible(true); field.setAccessible(true);
try { try {
return (T) field.get(instance); return (T) field.get(instance);
@ -248,10 +263,7 @@ public class ReflectionUtils {
} }
} }
public static void setField(Field field, Object instance, Object value) { public static void setField(@NotNull Field field, Object instance, Object value) {
if (field == null) {
throw new RuntimeException("No such field");
}
field.setAccessible(true); field.setAccessible(true);
try { try {
field.set(instance, value); field.set(instance, value);
@ -283,7 +295,7 @@ public class ReflectionUtils {
* @param clazz class * @param clazz class
* @return RefClass based on passed class * @return RefClass based on passed class
*/ */
public static RefClass getRefClass(Class clazz) { public static RefClass getRefClass(Class<?> clazz) {
return new RefClass(clazz); return new RefClass(clazz);
} }
@ -291,6 +303,7 @@ public class ReflectionUtils {
* RefClass - utility to simplify work with reflections. * RefClass - utility to simplify work with reflections.
*/ */
public static class RefClass { public static class RefClass {
private final Class<?> clazz; private final Class<?> clazz;
private RefClass(Class<?> clazz) { private RefClass(Class<?> clazz) {
@ -454,9 +467,9 @@ public class ReflectionUtils {
* @return RefMethod * @return RefMethod
* @throws RuntimeException if method not found * @throws RuntimeException if method not found
*/ */
public RefMethod findMethodByReturnType(Class type) { public RefMethod findMethodByReturnType(Class<?> type) {
if (type == null) { if (type == null) {
type = void.class; type = void.class.getComponentType();
} }
final List<Method> methods = new ArrayList<>(); final List<Method> methods = new ArrayList<>();
Collections.addAll(methods, this.clazz.getMethods()); Collections.addAll(methods, this.clazz.getMethods());
@ -525,7 +538,7 @@ public class ReflectionUtils {
* @return RefField * @return RefField
* @throws RuntimeException if field not found * @throws RuntimeException if field not found
*/ */
public RefField findField(Class type) { public RefField findField(Class<?> type) {
if (type == null) { if (type == null) {
type = void.class; type = void.class;
} }
@ -545,6 +558,7 @@ public class ReflectionUtils {
* Method wrapper * Method wrapper
*/ */
public static class RefMethod { public static class RefMethod {
private final Method method; private final Method method;
private RefMethod(Method method) { private RefMethod(Method method) {
@ -598,6 +612,7 @@ public class ReflectionUtils {
} }
public class RefExecutor { public class RefExecutor {
final Object e; final Object e;
public RefExecutor(Object e) { public RefExecutor(Object e) {
@ -625,6 +640,7 @@ public class ReflectionUtils {
* Constructor wrapper * Constructor wrapper
*/ */
public static class RefConstructor { public static class RefConstructor {
private final Constructor<?> constructor; private final Constructor<?> constructor;
private RefConstructor(Constructor<?> constructor) { private RefConstructor(Constructor<?> constructor) {
@ -663,6 +679,7 @@ public class ReflectionUtils {
} }
public static class RefField { public static class RefField {
private final Field field; private final Field field;
private RefField(Field field) { private RefField(Field field) {
@ -702,6 +719,7 @@ public class ReflectionUtils {
} }
public class RefExecutor { public class RefExecutor {
final Object e; final Object e;
public RefExecutor(Object e) { public RefExecutor(Object e) {

Datei anzeigen

@ -18,6 +18,7 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
public class AsyncPlayer extends PlayerProxy { public class AsyncPlayer extends PlayerProxy {
public AsyncPlayer(Player parent) { public AsyncPlayer(Player parent) {
super(parent); super(parent);
} }
@ -81,7 +82,7 @@ public class AsyncPlayer extends PlayerProxy {
@Override @Override
public boolean ascendToCeiling(int clearance, boolean alwaysGlass) { public boolean ascendToCeiling(int clearance, boolean alwaysGlass) {
Location pos = getBlockIn(); Location pos = getBlockLocation();
int x = pos.getBlockX(); int x = pos.getBlockX();
int initialY = Math.max(0, pos.getBlockY()); int initialY = Math.max(0, pos.getBlockY());
int y = Math.max(0, pos.getBlockY() + 2); int y = Math.max(0, pos.getBlockY() + 2);
@ -95,7 +96,8 @@ public class AsyncPlayer extends PlayerProxy {
while (y <= world.getMaximumPoint().getY()) { while (y <= world.getMaximumPoint().getY()) {
// Found a ceiling! // Found a ceiling!
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial()
.isMovementBlocker()) {
int platformY = Math.max(initialY, y - 3 - clearance); int platformY = Math.max(initialY, y - 3 - clearance);
floatAt(x, platformY + 1, z, alwaysGlass); floatAt(x, platformY + 1, z, alwaysGlass);
return true; return true;
@ -114,7 +116,7 @@ public class AsyncPlayer extends PlayerProxy {
@Override @Override
public boolean ascendUpwards(int distance, boolean alwaysGlass) { public boolean ascendUpwards(int distance, boolean alwaysGlass) {
final Location pos = getBlockIn(); final Location pos = getBlockLocation();
final int x = pos.getBlockX(); final int x = pos.getBlockX();
final int initialY = Math.max(0, pos.getBlockY()); final int initialY = Math.max(0, pos.getBlockY());
int y = Math.max(0, pos.getBlockY() + 1); int y = Math.max(0, pos.getBlockY() + 1);
@ -123,7 +125,8 @@ public class AsyncPlayer extends PlayerProxy {
final Extent world = getLocation().getExtent(); final Extent world = getLocation().getExtent();
while (y <= world.getMaximumPoint().getY() + 2) { while (y <= world.getMaximumPoint().getY() + 2) {
if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial()
.isMovementBlocker()) {
break; // Hit something break; // Hit something
} else if (y > maxY + 1) { } else if (y > maxY + 1) {
break; break;
@ -142,7 +145,8 @@ public class AsyncPlayer extends PlayerProxy {
public void floatAt(int x, int y, int z, boolean alwaysGlass) { public void floatAt(int x, int y, int z, boolean alwaysGlass) {
RuntimeException caught = null; RuntimeException caught = null;
try { try {
EditSession edit = new EditSessionBuilder(WorldWrapper.unwrap(getWorld())).player(unwrap(getBasePlayer())).build(); EditSession edit = new EditSessionBuilder(WorldWrapper.unwrap(getWorld()))
.player(unwrap(getBasePlayer())).build();
edit.setBlock(BlockVector3.at(x, y - 1, z), BlockTypes.GLASS); edit.setBlock(BlockVector3.at(x, y - 1, z), BlockTypes.GLASS);
edit.flushQueue(); edit.flushQueue();
LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this); LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this);
@ -204,7 +208,9 @@ public class AsyncPlayer extends PlayerProxy {
boolean inFree = false; boolean inFree = false;
while ((block = hitBlox.getNextBlock()) != null) { while ((block = hitBlox.getNextBlock()) != null) {
boolean free = !world.getBlock(BlockVector3.at(block.getBlockX(), block.getBlockY(), block.getBlockZ())).getBlockType().getMaterial().isMovementBlocker(); boolean free = !world.getBlock(
BlockVector3.at(block.getBlockX(), block.getBlockY(), block.getBlockZ()))
.getBlockType().getMaterial().isMovementBlocker();
if (firstBlock) { if (firstBlock) {
firstBlock = false; firstBlock = false;

Datei anzeigen

@ -1052,7 +1052,7 @@ public class BrushCommands {
tool.setFill(null); tool.setFill(null);
tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission); tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
player.print("Set brush to " + factory); player.print(TextComponent.of("Set brush to " + factory));
} }
@Command( @Command(

Datei anzeigen

@ -161,11 +161,11 @@ public class ChunkCommands {
throw new StopExecutionException(TextComponent.of("Failed to write chunk list: " + e.getMessage())); throw new StopExecutionException(TextComponent.of("Failed to write chunk list: " + e.getMessage()));
} }
actor.print(String.format("%d chunk(s) have been marked for deletion the next time the server starts.", actor.print(TextComponent.of(String.format("%d chunk(s) have been marked for deletion the next time the server starts.",
newBatch.getChunkCount())); newBatch.getChunkCount())));
if (currentInfo.batches.size() > 1) { if (currentInfo.batches.size() > 1) {
actor.printDebug(String.format("%d chunks total marked for deletion. (May have overlaps).", actor.printDebug(TextComponent.of(String.format("%d chunks total marked for deletion. (May have overlaps).",
currentInfo.batches.stream().mapToInt(ChunkDeletionInfo.ChunkBatch::getChunkCount).sum())); currentInfo.batches.stream().mapToInt(ChunkDeletionInfo.ChunkBatch::getChunkCount).sum())));
} }
actor.print(TextComponent.of("You can mark more chunks for deletion, or to stop now, run: ", TextColor.LIGHT_PURPLE) actor.print(TextComponent.of("You can mark more chunks for deletion, or to stop now, run: ", TextColor.LIGHT_PURPLE)
.append(TextComponent.of("/stop", TextColor.AQUA) .append(TextComponent.of("/stop", TextColor.AQUA)

Datei anzeigen

@ -182,7 +182,7 @@ public class HistorySubCommands {
RollbackDatabase db = DBHandler.IMP RollbackDatabase db = DBHandler.IMP
.getDatabase(world); .getDatabase(world);
db.logEdit(rollback); db.logEdit(rollback);
actor.print("Logging: " + historyFile); actor.print(TextComponent.of("Logging: " + historyFile));
} }
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
@ -192,7 +192,7 @@ public class HistorySubCommands {
} }
} }
} }
actor.print("Done import!"); actor.print(TextComponent.of("Done import!"));
} }
} }
@ -289,7 +289,7 @@ public class HistorySubCommands {
return elem; return elem;
} else { } else {
// TODO // TODO
return TextComponent.of(""); return TextComponent.empty();
} }
} }
}); });

Datei anzeigen

@ -27,7 +27,6 @@ import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY; import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY; import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Caption; import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.FaweLimit; import com.boydti.fawe.object.FaweLimit;
@ -71,7 +70,6 @@ import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.ArrayList; import java.util.ArrayList;
@ -132,7 +130,7 @@ public class RegionCommands {
@CommandPermissions("worldedit.region.test") @CommandPermissions("worldedit.region.test")
@Logging(REGION) @Logging(REGION)
public void test(Player player, EditSession editSession, @Arg(desc = "test") double testValue) throws WorldEditException { public void test(Player player, EditSession editSession, @Arg(desc = "test") double testValue) throws WorldEditException {
player.print("" + testValue); player.print(TextComponent.of(testValue));
} }
@Command( @Command(
@ -141,7 +139,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.light.fix") @CommandPermissions("worldedit.light.fix")
public void fixLighting(Player player) throws WorldEditException { public void fixLighting(Player player) throws WorldEditException {
player.print("Temporarily not working"); player.print(TextComponent.of("Temporarily not working"));
// final Location loc = player.getLocation(); // final Location loc = player.getLocation();
// Region selection = player.getSelection(); // Region selection = player.getSelection();
// if (selection == null) { // if (selection == null) {
@ -162,7 +160,7 @@ public class RegionCommands {
final Location loc = player.getLocation(); final Location loc = player.getLocation();
int block = editSession.getBlockLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); int block = editSession.getBlockLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
int sky = editSession.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); int sky = editSession.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
player.print("Light: " + block + " | " + sky); player.print(TextComponent.of("Light: " + block + " | " + sky));
} }
@Command( @Command(
@ -171,7 +169,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.light.remove") @CommandPermissions("worldedit.light.remove")
public void removeLighting(Player player) { public void removeLighting(Player player) {
player.print("Temporarily not working"); player.print(TextComponent.of("Temporarily not working"));
// Region selection = player.getSelection(); // Region selection = player.getSelection();
// if (selection == null) { // if (selection == null) {
// final int cx = player.getLocation().getBlockX() >> 4; // final int cx = player.getLocation().getBlockX() >> 4;
@ -196,7 +194,7 @@ public class RegionCommands {
} }
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData(); CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
if (nbt != null) { if (nbt != null) {
player.print(nbt.getValue().toString()); player.print(TextComponent.of(nbt.getValue().toString()));
} else { } else {
player.printError(TranslatableComponent.of("fawe.navigation.no.block")); player.printError(TranslatableComponent.of("fawe.navigation.no.block"));
} }
@ -208,7 +206,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.light.set") @CommandPermissions("worldedit.light.set")
public void setlighting(Player player, EditSession editSession, @Selection Region region, @Range(from = 0, to = 15) int value) { public void setlighting(Player player, EditSession editSession, @Selection Region region, @Range(from = 0, to = 15) int value) {
player.print("Temporarily not working"); player.print(TextComponent.of("Temporarily not working"));
} }
@Command( @Command(
@ -217,7 +215,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.light.set") @CommandPermissions("worldedit.light.set")
public void setskylighting(Player player, @Selection Region region, @Range(from = 0, to= 15) int value) { public void setskylighting(Player player, @Selection Region region, @Range(from = 0, to= 15) int value) {
player.print("Temporarily not working"); player.printInfo(TextComponent.of("Temporarily not working"));
} }
@Command( @Command(

Datei anzeigen

@ -76,7 +76,7 @@ public class WorldEditCommands {
public void version(Actor actor) { public void version(Actor actor) {
FaweVersion fVer = Fawe.get().getVersion(); FaweVersion fVer = Fawe.get().getVersion();
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build; String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
actor.print("FastAsyncWorldEdit" + fVerStr + " created by Empire92"); actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr + " created by Empire92"));
if (fVer != null) { if (fVer != null) {
FaweVersion version = Fawe.get().getVersion(); FaweVersion version = Fawe.get().getVersion();
@ -170,7 +170,7 @@ public class WorldEditCommands {
name = "cui", name = "cui",
desc = "Complete CUI handshake (internal usage)" desc = "Complete CUI handshake (internal usage)"
) )
@CommandPermissions({}) @CommandPermissions()
public void cui(Player player, LocalSession session) { public void cui(Player player, LocalSession session) {
session.setCUISupport(true); session.setCUISupport(true);
session.dispatchCUISetup(player); session.dispatchCUISetup(player);

Datei anzeigen

@ -78,9 +78,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
* @deprecated Use component-based functions (printDebug) * @deprecated Use component-based functions (printDebug)
*/ */
@Deprecated @Deprecated
default void printDebug(String msg) { void printDebug(String msg);
printDebug(TextComponent.of(msg));
}
/** /**
* Print a WorldEdit message. * Print a WorldEdit message.
@ -89,9 +87,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
* @deprecated Use component-based functions (printInfo) * @deprecated Use component-based functions (printInfo)
*/ */
@Deprecated @Deprecated
default void print(String msg) { void print(String msg);
printInfo(TextComponent.of(msg));
}
/** /**
* Print a WorldEdit error. * Print a WorldEdit error.
@ -100,9 +96,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
* @deprecated Use component-based functions (printError) * @deprecated Use component-based functions (printError)
*/ */
@Deprecated @Deprecated
default void printError(String msg) { void printError(String msg);
printError(TextComponent.of(msg));
}
/** /**

Datei anzeigen

@ -33,6 +33,7 @@ import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -141,7 +142,22 @@ public class PlayerProxy extends AbstractPlayerActor {
@Override @Override
public void printRaw(String msg) { public void printRaw(String msg) {
basePlayer.printRaw(msg); basePlayer.print(TextComponent.of(msg));
}
@Override
public void printDebug(String msg) {
basePlayer.printDebug(TextComponent.of(msg));
}
@Override
public void print(String msg) {
basePlayer.printInfo(TextComponent.of(msg));
}
@Override
public void printError(String msg) {
basePlayer.printError(TextComponent.of(msg));
} }
@Override @Override

Datei anzeigen

@ -280,9 +280,9 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
BlockVector3 min = getMinimumPoint(); BlockVector3 min = getMinimumPoint();
BlockVector3 max = getMaximumPoint(); BlockVector3 max = getMaximumPoint();
boolean processExtra = false;
if (tx >= min.getX() && bx <= max.getX() && tz >= min.getZ() && bz <= max.getZ()) { if (tx >= min.getX() && bx <= max.getX() && tz >= min.getZ() && bz <= max.getZ()) {
// contains some // contains some
boolean processExtra = false;
for (int layer = 0; layer < 16; layer++) { for (int layer = 0; layer < 16; layer++) {
int by = layer << 4; int by = layer << 4;
int ty = by + 15; int ty = by + 15;

Datei anzeigen

@ -54,7 +54,7 @@ public final class ActorCallbackPaste {
AsyncCommandBuilder.wrap(task, sender) AsyncCommandBuilder.wrap(task, sender)
.registerWithSupervisor(supervisor, "Submitting content to a pastebin service.") .registerWithSupervisor(supervisor, "Submitting content to a pastebin service.")
.sendMessageAfterDelay("(Please wait... sending output to pastebin...)") .sendMessageAfterDelay("(Please wait... sending output to pastebin...)")
.onSuccess((String) null, url -> sender.print(String.format(successMessage, url))) .onSuccess((String) null, url -> sender.print(TextComponent.of(String.format(successMessage, url))))
.onFailure("Failed to submit paste", null) .onFailure("Failed to submit paste", null)
.buildAndExec(Pasters.getExecutor()); .buildAndExec(Pasters.getExecutor());
} }