geforkt von Mirrors/FastAsyncWorldEdit
Cleanup unused code.
Dieser Commit ist enthalten in:
Ursprung
417cbd585f
Commit
915ab43f6e
@ -28,7 +28,9 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||
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.format.TextColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
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
|
||||
public void print(Component component) {
|
||||
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
|
||||
|
@ -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
|
||||
public void print(Component component) {
|
||||
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
|
||||
@ -118,7 +138,7 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
||||
public boolean isActive() {
|
||||
if (sender instanceof Entity) {
|
||||
Entity entity = (Entity) sender;
|
||||
return (entity.isValid() && !entity.isDead());
|
||||
return entity.isValid() && !entity.isDead();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -84,10 +84,6 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
public BukkitPlayer(WorldEditPlugin plugin, Player player) {
|
||||
this.plugin = plugin;
|
||||
this.player = player;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if (Settings.IMP.CLIPBOARD.USE_DISK) {
|
||||
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
|
||||
public void print(Component component) {
|
||||
component = Caption.color(TranslatableComponent.of("prefix", component), getLocale());
|
||||
|
@ -145,13 +145,13 @@ public class Fawe {
|
||||
*
|
||||
* @param s
|
||||
*/
|
||||
public static void debug(Object s) {
|
||||
public static void debug(String s) {
|
||||
Actor actor = Request.request().getActor();
|
||||
if (actor != null && actor.isPlayer()) {
|
||||
actor.print((String)s);
|
||||
actor.printInfo(TextComponent.of(s));
|
||||
return;
|
||||
}
|
||||
debugPlain((String) s);
|
||||
debugPlain(s);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -399,6 +399,7 @@ public class FaweAPI {
|
||||
* @return
|
||||
*/
|
||||
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 top = selection.getMaximumPoint();
|
||||
|
||||
|
@ -227,10 +227,10 @@ public enum FaweCache implements Trimable {
|
||||
long[] blockStates = BLOCK_STATES.get();
|
||||
int[] blocksCopy = SECTION_BLOCKS.get();
|
||||
|
||||
int blockIndexStart = layerOffset << 12;
|
||||
int blockIndexEnd = blockIndexStart + 4096;
|
||||
int num_palette = 0;
|
||||
try {
|
||||
int num_palette = 0;
|
||||
int blockIndexStart = layerOffset << 12;
|
||||
int blockIndexEnd = blockIndexStart + 4096;
|
||||
if (blocksChars != null) {
|
||||
for (int i = blockIndexStart, j = 0; i < blockIndexEnd; i++, j++) {
|
||||
int ordinal = blocksChars[i];
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.mask.ABlockMask;
|
||||
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.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -94,10 +95,10 @@ public class DistrFilter extends ForkedFilter<DistrFilter> {
|
||||
for (Countable c : getDistribution()) {
|
||||
final String name = c.getID().toString();
|
||||
final String str = String.format("%-7s (%.3f%%) %s",
|
||||
String.valueOf(c.getAmount()),
|
||||
c.getAmount(),
|
||||
c.getAmount() / (double) size * 100,
|
||||
name);
|
||||
actor.print(str);
|
||||
actor.printInfo(TextComponent.of(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.implementation.blocks.CharSetBlocks;
|
||||
import com.boydti.fawe.beta.implementation.chunk.ChunkHolder;
|
||||
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.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
|
||||
@ -210,9 +209,6 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
return NullChunk.INSTANCE;
|
||||
}
|
||||
IQueueChunk chunk = chunks.get(pair);
|
||||
if (chunk instanceof ReferenceChunk) {
|
||||
chunk = ((ReferenceChunk) chunk).getParent();
|
||||
}
|
||||
if (chunk != null) {
|
||||
lastPair = pair;
|
||||
lastChunk = chunk;
|
||||
|
@ -49,6 +49,7 @@ public class RegionWrapper extends CuboidRegion {
|
||||
this.maxY = Math.max(pos1.getBlockY(), pos2.getBlockY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionWrapper[] toArray() {
|
||||
return new RegionWrapper[]{this};
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class BlendBall implements Brush {
|
||||
continue;
|
||||
}
|
||||
BlockState state = editSession.getBlock(x0 + ox, y0 + oy, z0 + oz);
|
||||
Integer count = frequency[state.getInternalBlockTypeId()];
|
||||
int count = frequency[state.getInternalBlockTypeId()];
|
||||
count++;
|
||||
if (count > highest) {
|
||||
highest = count;
|
||||
|
@ -135,7 +135,4 @@ public class ImageBrush implements Brush {
|
||||
Operations.completeBlindly(visitor);
|
||||
}
|
||||
|
||||
private void apply(double val) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.boydti.fawe.object.change;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.DoubleTag;
|
||||
@ -89,7 +88,4 @@ public class MutableEntityChange implements Change {
|
||||
context.getExtent().createEntity(location, entity);
|
||||
}
|
||||
|
||||
public void perform(IQueueExtent queue) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,17 +2,17 @@ package com.boydti.fawe.object.collection;
|
||||
|
||||
public final class BitArray4096 {
|
||||
|
||||
private final long[] data;
|
||||
private final int bitsPerEntry;
|
||||
private final int maxSeqLocIndex;
|
||||
private final int maxEntryValue;
|
||||
private final long[] data;
|
||||
private final int longLen;
|
||||
|
||||
public BitArray4096(long[] buffer, int bitsPerEntry) {
|
||||
this.bitsPerEntry = bitsPerEntry;
|
||||
this.maxSeqLocIndex = 64 - bitsPerEntry;
|
||||
maxEntryValue = (1 << bitsPerEntry) - 1;
|
||||
this.longLen = (this.bitsPerEntry * 4096) >> 6;
|
||||
this.longLen = (this.bitsPerEntry << 12) >> 6;
|
||||
if (buffer.length < longLen) {
|
||||
this.data = new long[longLen];
|
||||
} else {
|
||||
@ -32,7 +32,7 @@ public final class BitArray4096 {
|
||||
return data;
|
||||
}
|
||||
|
||||
public final void setAt(int index, int value) {
|
||||
public final void set(int index, int value) {
|
||||
if (longLen == 0) return;
|
||||
int bitIndexStart = index * bitsPerEntry;
|
||||
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;
|
||||
int bitIndexStart = index * bitsPerEntry;
|
||||
|
||||
@ -68,7 +68,7 @@ public final class BitArray4096 {
|
||||
|
||||
public final void fromRawSlow(char[] arr) {
|
||||
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) {
|
||||
BitArray4096 newBitArray = new BitArray4096(bitsPerEntry);
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
newBitArray.setAt(i, getAt(i));
|
||||
newBitArray.set(i, get(i));
|
||||
}
|
||||
return newBitArray;
|
||||
}
|
||||
@ -120,7 +120,7 @@ public final class BitArray4096 {
|
||||
public final char[] toRawSlow() {
|
||||
char[] arr = new char[4096];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
arr[i] = (char) getAt(i);
|
||||
arr[i] = (char) get(i);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
@ -196,4 +196,4 @@ public final class BitArray4096 {
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -33,6 +33,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -161,7 +162,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
session.describeCUI(player);
|
||||
|
||||
player.print("Started new selection with vertex " + pos + ".");
|
||||
player.print(TextComponent.of("Started new selection with vertex " + pos + "."));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -172,7 +173,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
session.describeCUI(player);
|
||||
|
||||
player.print("Added vertex " + pos + " to the selection.");
|
||||
player.print(TextComponent.of("Added vertex " + pos + " to the selection."));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -237,10 +237,6 @@ public class EditSessionBuilder {
|
||||
if(toReturn instanceof com.sk89q.worldedit.extent.NullExtent) {
|
||||
return new NullExtent(toReturn, FaweCache.MANUAL);
|
||||
}
|
||||
// if (!(toReturn instanceof AbstractDelegateExtent)) {
|
||||
// Fawe.debug("Extent " + toReturn + " must be AbstractDelegateExtent");
|
||||
// return extent;
|
||||
// }
|
||||
if (toReturn != extent) {
|
||||
String className = toReturn.getClass().getName().toLowerCase();
|
||||
for (String allowed : Settings.IMP.EXTENT.ALLOWED_PLUGINS) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.AccessibleObject;
|
||||
import java.lang.reflect.Constructor;
|
||||
@ -13,8 +14,10 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReflectionUtils {
|
||||
|
||||
public static <T> T as(Class<T> t, Object o) {
|
||||
return t.isInstance(o) ? t.cast(o) : null;
|
||||
}
|
||||
@ -24,7 +27,7 @@ public class ReflectionUtils {
|
||||
}
|
||||
|
||||
public static void setAccessibleNonFinal(Field field)
|
||||
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
// let's make the field accessible
|
||||
field.setAccessible(true);
|
||||
|
||||
@ -38,7 +41,7 @@ public class ReflectionUtils {
|
||||
|
||||
// blank out the final bit in the modifiers int
|
||||
((MethodHandles.Lookup) lookupField.get(null))
|
||||
.findSetter(Field.class, "modifiers", int.class)
|
||||
.findSetter(Field.class, "modifiers", int.class)
|
||||
.invokeExact(field, field.getModifiers() & ~Modifier.FINAL);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
@ -47,14 +50,14 @@ public class ReflectionUtils {
|
||||
}
|
||||
|
||||
public static void setFailsafeFieldValue(Field field, Object target, Object value)
|
||||
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
|
||||
setAccessibleNonFinal(field);
|
||||
field.set(target,value);
|
||||
field.set(target, value);
|
||||
}
|
||||
|
||||
private static void blankField(Class<?> enumClass, String fieldName)
|
||||
throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
for (Field field : Class.class.getDeclaredFields()) {
|
||||
if (field.getName().contains(fieldName)) {
|
||||
AccessibleObject.setAccessible(new Field[]{field}, true);
|
||||
@ -65,17 +68,21 @@ public class ReflectionUtils {
|
||||
}
|
||||
|
||||
static void cleanEnumCache(Class<?> enumClass)
|
||||
throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
|
||||
blankField(enumClass, "enumConstantDirectory"); // Sun (Oracle?!?) JDK 1.5/6
|
||||
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) {
|
||||
try {
|
||||
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");
|
||||
m.setAccessible(true);
|
||||
return (Map<T, V>) m.get(map);
|
||||
@ -87,8 +94,11 @@ public class ReflectionUtils {
|
||||
|
||||
public static <T> List<T> getList(List<T> list) {
|
||||
try {
|
||||
Class<? extends List<T>> clazz = (Class<? extends List<T>>) Class.forName("java.util.Collections$UnmodifiableList");
|
||||
if (!clazz.isInstance(list)) return list;
|
||||
Class<? extends List<T>> clazz = (Class<? extends List<T>>) Class
|
||||
.forName("java.util.Collections$UnmodifiableList");
|
||||
if (!clazz.isInstance(list)) {
|
||||
return list;
|
||||
}
|
||||
Field m = clazz.getDeclaredField("list");
|
||||
m.setAccessible(true);
|
||||
return (List<T>) m.get(list);
|
||||
@ -189,25 +199,32 @@ public class ReflectionUtils {
|
||||
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:
|
||||
for (Method method : sortMethods(clazz.getDeclaredMethods())) {
|
||||
if (returnType == null || method.getReturnType() == returnType) {
|
||||
Class<?>[] mp = method.getParameterTypes();
|
||||
int mods = method.getModifiers();
|
||||
if ((mods & hasMods) != hasMods || (mods & noMods) != 0) continue;
|
||||
if ((mods & hasMods) != hasMods || (mods & noMods) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (params == null) {
|
||||
if (index-- == 0) return setAccessible(method);
|
||||
else {
|
||||
if (index-- == 0) {
|
||||
return setAccessible(method);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (mp.length == params.length) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -226,7 +243,8 @@ public class ReflectionUtils {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -236,10 +254,7 @@ public class ReflectionUtils {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getField(Field field, Object instance) {
|
||||
if (field == null) {
|
||||
throw new RuntimeException("No such field");
|
||||
}
|
||||
public static <T> T getField(@NotNull Field field, Object instance) {
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
return (T) field.get(instance);
|
||||
@ -248,10 +263,7 @@ public class ReflectionUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setField(Field field, Object instance, Object value) {
|
||||
if (field == null) {
|
||||
throw new RuntimeException("No such field");
|
||||
}
|
||||
public static void setField(@NotNull Field field, Object instance, Object value) {
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
field.set(instance, value);
|
||||
@ -283,7 +295,7 @@ public class ReflectionUtils {
|
||||
* @param clazz class
|
||||
* @return RefClass based on passed class
|
||||
*/
|
||||
public static RefClass getRefClass(Class clazz) {
|
||||
public static RefClass getRefClass(Class<?> clazz) {
|
||||
return new RefClass(clazz);
|
||||
}
|
||||
|
||||
@ -291,6 +303,7 @@ public class ReflectionUtils {
|
||||
* RefClass - utility to simplify work with reflections.
|
||||
*/
|
||||
public static class RefClass {
|
||||
|
||||
private final Class<?> clazz;
|
||||
|
||||
private RefClass(Class<?> clazz) {
|
||||
@ -319,7 +332,7 @@ public class ReflectionUtils {
|
||||
/**
|
||||
* get existing method by name and types
|
||||
*
|
||||
* @param name name
|
||||
* @param name name
|
||||
* @param types method parameters. can be Class or RefClass
|
||||
* @return RefMethod object
|
||||
* @throws RuntimeException if method not found
|
||||
@ -454,9 +467,9 @@ public class ReflectionUtils {
|
||||
* @return RefMethod
|
||||
* @throws RuntimeException if method not found
|
||||
*/
|
||||
public RefMethod findMethodByReturnType(Class type) {
|
||||
public RefMethod findMethodByReturnType(Class<?> type) {
|
||||
if (type == null) {
|
||||
type = void.class;
|
||||
type = void.class.getComponentType();
|
||||
}
|
||||
final List<Method> methods = new ArrayList<>();
|
||||
Collections.addAll(methods, this.clazz.getMethods());
|
||||
@ -525,7 +538,7 @@ public class ReflectionUtils {
|
||||
* @return RefField
|
||||
* @throws RuntimeException if field not found
|
||||
*/
|
||||
public RefField findField(Class type) {
|
||||
public RefField findField(Class<?> type) {
|
||||
if (type == null) {
|
||||
type = void.class;
|
||||
}
|
||||
@ -545,6 +558,7 @@ public class ReflectionUtils {
|
||||
* Method wrapper
|
||||
*/
|
||||
public static class RefMethod {
|
||||
|
||||
private final Method method;
|
||||
|
||||
private RefMethod(Method method) {
|
||||
@ -598,6 +612,7 @@ public class ReflectionUtils {
|
||||
}
|
||||
|
||||
public class RefExecutor {
|
||||
|
||||
final Object e;
|
||||
|
||||
public RefExecutor(Object e) {
|
||||
@ -625,6 +640,7 @@ public class ReflectionUtils {
|
||||
* Constructor wrapper
|
||||
*/
|
||||
public static class RefConstructor {
|
||||
|
||||
private final Constructor<?> constructor;
|
||||
|
||||
private RefConstructor(Constructor<?> constructor) {
|
||||
@ -663,6 +679,7 @@ public class ReflectionUtils {
|
||||
}
|
||||
|
||||
public static class RefField {
|
||||
|
||||
private final Field field;
|
||||
|
||||
private RefField(Field field) {
|
||||
@ -702,6 +719,7 @@ public class ReflectionUtils {
|
||||
}
|
||||
|
||||
public class RefExecutor {
|
||||
|
||||
final Object e;
|
||||
|
||||
public RefExecutor(Object e) {
|
||||
|
@ -18,6 +18,7 @@ import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
public AsyncPlayer(Player parent) {
|
||||
super(parent);
|
||||
}
|
||||
@ -81,7 +82,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public boolean ascendToCeiling(int clearance, boolean alwaysGlass) {
|
||||
Location pos = getBlockIn();
|
||||
Location pos = getBlockLocation();
|
||||
int x = pos.getBlockX();
|
||||
int initialY = Math.max(0, pos.getBlockY());
|
||||
int y = Math.max(0, pos.getBlockY() + 2);
|
||||
@ -95,7 +96,8 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
while (y <= world.getMaximumPoint().getY()) {
|
||||
// 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);
|
||||
floatAt(x, platformY + 1, z, alwaysGlass);
|
||||
return true;
|
||||
@ -114,7 +116,7 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
|
||||
@Override
|
||||
public boolean ascendUpwards(int distance, boolean alwaysGlass) {
|
||||
final Location pos = getBlockIn();
|
||||
final Location pos = getBlockLocation();
|
||||
final int x = pos.getBlockX();
|
||||
final int initialY = Math.max(0, pos.getBlockY());
|
||||
int y = Math.max(0, pos.getBlockY() + 1);
|
||||
@ -123,7 +125,8 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
final Extent world = getLocation().getExtent();
|
||||
|
||||
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
|
||||
} else if (y > maxY + 1) {
|
||||
break;
|
||||
@ -142,7 +145,8 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
||||
RuntimeException caught = null;
|
||||
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.flushQueue();
|
||||
LocalSession session = Fawe.get().getWorldEdit().getSessionManager().get(this);
|
||||
@ -166,17 +170,17 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
@Override
|
||||
public Location getBlockTrace(int range, boolean useLastBlock) {
|
||||
return TaskManager.IMP.sync(() -> {
|
||||
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
|
||||
return useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock();
|
||||
});
|
||||
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
|
||||
return useLastBlock ? tb.getAnyTargetBlock() : tb.getTargetBlock();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBlockTraceFace(int range, boolean useLastBlock) {
|
||||
return TaskManager.IMP.sync(() -> {
|
||||
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
|
||||
return useLastBlock ? tb.getAnyTargetBlockFace() : tb.getTargetBlockFace();
|
||||
});
|
||||
TargetBlock tb = new TargetBlock(AsyncPlayer.this, range, 0.2D);
|
||||
return useLastBlock ? tb.getAnyTargetBlockFace() : tb.getTargetBlockFace();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -204,7 +208,9 @@ public class AsyncPlayer extends PlayerProxy {
|
||||
boolean inFree = false;
|
||||
|
||||
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) {
|
||||
firstBlock = false;
|
||||
|
@ -1052,7 +1052,7 @@ public class BrushCommands {
|
||||
tool.setFill(null);
|
||||
tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
|
||||
|
||||
player.print("Set brush to " + factory);
|
||||
player.print(TextComponent.of("Set brush to " + factory));
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -161,11 +161,11 @@ public class ChunkCommands {
|
||||
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.",
|
||||
newBatch.getChunkCount()));
|
||||
actor.print(TextComponent.of(String.format("%d chunk(s) have been marked for deletion the next time the server starts.",
|
||||
newBatch.getChunkCount())));
|
||||
if (currentInfo.batches.size() > 1) {
|
||||
actor.printDebug(String.format("%d chunks total marked for deletion. (May have overlaps).",
|
||||
currentInfo.batches.stream().mapToInt(ChunkDeletionInfo.ChunkBatch::getChunkCount).sum()));
|
||||
actor.printDebug(TextComponent.of(String.format("%d chunks total marked for deletion. (May have overlaps).",
|
||||
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)
|
||||
.append(TextComponent.of("/stop", TextColor.AQUA)
|
||||
|
@ -182,7 +182,7 @@ public class HistorySubCommands {
|
||||
RollbackDatabase db = DBHandler.IMP
|
||||
.getDatabase(world);
|
||||
db.logEdit(rollback);
|
||||
actor.print("Logging: " + historyFile);
|
||||
actor.print(TextComponent.of("Logging: " + historyFile));
|
||||
}
|
||||
}
|
||||
} 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;
|
||||
} else {
|
||||
// TODO
|
||||
return TextComponent.of("");
|
||||
return TextComponent.empty();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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.minimumBlockY;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.config.Caption;
|
||||
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.TranslatableComponent;
|
||||
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.BlockTypes;
|
||||
import java.util.ArrayList;
|
||||
@ -132,7 +130,7 @@ public class RegionCommands {
|
||||
@CommandPermissions("worldedit.region.test")
|
||||
@Logging(REGION)
|
||||
public void test(Player player, EditSession editSession, @Arg(desc = "test") double testValue) throws WorldEditException {
|
||||
player.print("" + testValue);
|
||||
player.print(TextComponent.of(testValue));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -141,7 +139,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.fix")
|
||||
public void fixLighting(Player player) throws WorldEditException {
|
||||
player.print("Temporarily not working");
|
||||
player.print(TextComponent.of("Temporarily not working"));
|
||||
// final Location loc = player.getLocation();
|
||||
// Region selection = player.getSelection();
|
||||
// if (selection == null) {
|
||||
@ -162,7 +160,7 @@ public class RegionCommands {
|
||||
final Location loc = player.getLocation();
|
||||
int block = editSession.getBlockLight(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(
|
||||
@ -171,7 +169,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.remove")
|
||||
public void removeLighting(Player player) {
|
||||
player.print("Temporarily not working");
|
||||
player.print(TextComponent.of("Temporarily not working"));
|
||||
// Region selection = player.getSelection();
|
||||
// if (selection == null) {
|
||||
// final int cx = player.getLocation().getBlockX() >> 4;
|
||||
@ -196,7 +194,7 @@ public class RegionCommands {
|
||||
}
|
||||
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
|
||||
if (nbt != null) {
|
||||
player.print(nbt.getValue().toString());
|
||||
player.print(TextComponent.of(nbt.getValue().toString()));
|
||||
} else {
|
||||
player.printError(TranslatableComponent.of("fawe.navigation.no.block"));
|
||||
}
|
||||
@ -208,7 +206,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
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(
|
||||
@ -217,7 +215,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
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(
|
||||
|
@ -76,7 +76,7 @@ public class WorldEditCommands {
|
||||
public void version(Actor actor) {
|
||||
FaweVersion fVer = Fawe.get().getVersion();
|
||||
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) {
|
||||
FaweVersion version = Fawe.get().getVersion();
|
||||
@ -170,7 +170,7 @@ public class WorldEditCommands {
|
||||
name = "cui",
|
||||
desc = "Complete CUI handshake (internal usage)"
|
||||
)
|
||||
@CommandPermissions({})
|
||||
@CommandPermissions()
|
||||
public void cui(Player player, LocalSession session) {
|
||||
session.setCUISupport(true);
|
||||
session.dispatchCUISetup(player);
|
||||
|
@ -78,9 +78,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
* @deprecated Use component-based functions (printDebug)
|
||||
*/
|
||||
@Deprecated
|
||||
default void printDebug(String msg) {
|
||||
printDebug(TextComponent.of(msg));
|
||||
}
|
||||
void printDebug(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
@ -89,9 +87,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
* @deprecated Use component-based functions (printInfo)
|
||||
*/
|
||||
@Deprecated
|
||||
default void print(String msg) {
|
||||
printInfo(TextComponent.of(msg));
|
||||
}
|
||||
void print(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit error.
|
||||
@ -100,9 +96,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
|
||||
* @deprecated Use component-based functions (printError)
|
||||
*/
|
||||
@Deprecated
|
||||
default void printError(String msg) {
|
||||
printError(TextComponent.of(msg));
|
||||
}
|
||||
void printError(String msg);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -33,6 +33,7 @@ import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
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.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -141,7 +142,22 @@ public class PlayerProxy extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
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
|
||||
|
@ -280,9 +280,9 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
|
||||
|
||||
BlockVector3 min = getMinimumPoint();
|
||||
BlockVector3 max = getMaximumPoint();
|
||||
boolean processExtra = false;
|
||||
if (tx >= min.getX() && bx <= max.getX() && tz >= min.getZ() && bz <= max.getZ()) {
|
||||
// contains some
|
||||
boolean processExtra = false;
|
||||
for (int layer = 0; layer < 16; layer++) {
|
||||
int by = layer << 4;
|
||||
int ty = by + 15;
|
||||
|
@ -54,7 +54,7 @@ public final class ActorCallbackPaste {
|
||||
AsyncCommandBuilder.wrap(task, sender)
|
||||
.registerWithSupervisor(supervisor, "Submitting content to a pastebin service.")
|
||||
.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)
|
||||
.buildAndExec(Pasters.getExecutor());
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren