Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 01:50:06 +01:00
Merge branch '1.15' of https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13 into 1.15
Dieser Commit ist enthalten in:
Commit
c05cdd8faa
@ -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}")
|
||||
|
@ -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")
|
||||
|
@ -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;
|
||||
|
||||
@ -214,7 +212,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(": ")
|
||||
@ -353,7 +351,6 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
// return ((BlocksHubBukkit) blocksHubPlugin).getApi();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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<BlockPosition, BlockVector3> posNms2We = new Function<BlockPosition, BlockVector3>() {
|
||||
@Override
|
||||
public BlockVector3 apply(BlockPosition v) {
|
||||
return BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
||||
}
|
||||
};
|
||||
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
||||
|
||||
private final static Function<TileEntity, CompoundTag> nmsTile2We = new Function<TileEntity, CompoundTag>() {
|
||||
@Override
|
||||
public CompoundTag apply(TileEntity tileEntity) {
|
||||
return new LazyCompoundTag_1_13(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||
}
|
||||
};
|
||||
private final static Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_13(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||
|
||||
@Override
|
||||
public Map<BlockVector3, CompoundTag> getTiles() {
|
||||
@ -243,9 +232,7 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
||||
{
|
||||
Map<BlockPosition, TileEntity> tiles = nmsChunk.getTileEntities();
|
||||
if (!tiles.isEmpty()) {
|
||||
final Iterator<Map.Entry<BlockPosition, TileEntity>> iterator = tiles.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final Map.Entry<BlockPosition, TileEntity> entry = iterator.next();
|
||||
for (Map.Entry<BlockPosition, TileEntity> 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<Entity>[] entities = nmsChunk.getEntitySlices();
|
||||
|
||||
for (int i = 0; i < entities.length; i++) {
|
||||
final Collection<Entity> ents = entities[i];
|
||||
for (final Collection<Entity> ents : entities) {
|
||||
if (!ents.isEmpty()) {
|
||||
final Iterator<Entity> 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<String, Tag> 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<String, Tag> 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<BlockVector3, CompoundTag> 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<BlockVector3, CompoundTag> 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<Future> chain = new Callable<Future>() {
|
||||
@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<Future> 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);
|
||||
|
@ -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<BlockPosition, BlockVector3> posNms2We = new Function<BlockPosition, BlockVector3>() {
|
||||
@Override
|
||||
public BlockVector3 apply(BlockPosition v) {
|
||||
return BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
||||
}
|
||||
};
|
||||
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
||||
|
||||
private final static Function<TileEntity, CompoundTag> nmsTile2We = new Function<TileEntity, CompoundTag>() {
|
||||
@Override
|
||||
public CompoundTag apply(TileEntity tileEntity) {
|
||||
return new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||
}
|
||||
};
|
||||
private final static Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||
|
||||
@Override
|
||||
public Map<BlockVector3, CompoundTag> getTiles() {
|
||||
@ -249,9 +233,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
{
|
||||
Map<BlockPosition, TileEntity> tiles = nmsChunk.getTileEntities();
|
||||
if (!tiles.isEmpty()) {
|
||||
final Iterator<Map.Entry<BlockPosition, TileEntity>> iterator = tiles.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final Map.Entry<BlockPosition, TileEntity> entry = iterator.next();
|
||||
for (Map.Entry<BlockPosition, TileEntity> 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<Entity>[] entities = nmsChunk.getEntitySlices();
|
||||
syncTasks[2] = () -> {
|
||||
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
||||
|
||||
for (int i = 0; i < entities.length; i++) {
|
||||
final Collection<Entity> ents = entities[i];
|
||||
if (!ents.isEmpty()) {
|
||||
final Iterator<Entity> iter = ents.iterator();
|
||||
while (iter.hasNext()) {
|
||||
final Entity entity = iter.next();
|
||||
if (entityRemoves.contains(entity.getUniqueID())) {
|
||||
iter.remove();
|
||||
removeEntity(entity);
|
||||
}
|
||||
for (final Collection<Entity> ents : entities) {
|
||||
if (!ents.isEmpty()) {
|
||||
final Iterator<Entity> 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<String, Tag> 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<String, Tag> 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<BlockVector3, CompoundTag> 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<BlockVector3, CompoundTag> 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<Future> chain = new Callable<Future>() {
|
||||
@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<Future> 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);
|
||||
|
@ -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<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
||||
private final static Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_15(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||
@ -214,9 +241,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
||||
{
|
||||
Map<BlockPosition, TileEntity> tiles = nmsChunk.getTileEntities();
|
||||
if (!tiles.isEmpty()) {
|
||||
final Iterator<Map.Entry<BlockPosition, TileEntity>> iterator = tiles.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final Map.Entry<BlockPosition, TileEntity> entry = iterator.next();
|
||||
for (Map.Entry<BlockPosition, TileEntity> 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<Entity>[] entities = nmsChunk.getEntitySlices();
|
||||
|
||||
for (int i = 0; i < entities.length; i++) {
|
||||
final Collection<Entity> ents = entities[i];
|
||||
for (final Collection<Entity> ents : entities) {
|
||||
if (!ents.isEmpty()) {
|
||||
final Iterator<Entity> 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<String, Tag> 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<String, Tag> 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<Future> 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();
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import java.io.File;
|
||||
@ -76,7 +75,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @see #wrap(World)
|
||||
* @see #create(WorldCreator)
|
||||
*/
|
||||
public class AsyncWorld extends PassthroughExtent implements World {
|
||||
public class AsyncWorld
|
||||
extends PassthroughExtent implements World {
|
||||
|
||||
private World parent;
|
||||
private BukkitImplAdapter adapter;
|
||||
@ -181,13 +181,13 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, double v, double v1, double v2, int i, T t) {
|
||||
parent.spawnParticle(particle, v, v1, v2, i, t);
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data) {
|
||||
parent.spawnParticle(particle, x, y, z, count, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(Particle particle, Location location, int i, double v, double v1, double v2) {
|
||||
parent.spawnParticle(particle, location, i, v, v1, v2);
|
||||
public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ) {
|
||||
parent.spawnParticle(particle, location, count, offsetX, offsetY, offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -830,22 +830,43 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
return adapter.adapt(getExtent().getBiomeType(x, 0, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Biome getBiome(int x, int y, int z) {
|
||||
return adapter.adapt(getExtent().getBiomeType(x,y,z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiome(int x, int z, Biome bio) {
|
||||
BiomeType biome = adapter.adapt(bio);
|
||||
getExtent().setBiome(x, 0, z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiome(int x, int y, int z, @NotNull Biome bio) {
|
||||
BiomeType biome = adapter.adapt(bio);
|
||||
getExtent().setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTemperature(int x, int z) {
|
||||
return parent.getTemperature(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTemperature(int x, int y, int z) {
|
||||
return parent.getTemperature(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHumidity(int x, int z) {
|
||||
return parent.getHumidity(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHumidity(int x, int y, int z) {
|
||||
return parent.getHumidity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return parent.getMaxHeight();
|
||||
@ -1143,19 +1164,19 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult rayTraceBlocks(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3) {
|
||||
return parent.rayTraceBlocks(arg0, arg1, arg2, arg3);
|
||||
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance, FluidCollisionMode fluidCollisionMode) {
|
||||
return parent.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult rayTraceBlocks(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3,
|
||||
boolean arg4) {
|
||||
return parent.rayTraceBlocks(arg0, arg1, arg2, arg3, arg4);
|
||||
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double arg2, FluidCollisionMode fluidCollisionMode,
|
||||
boolean ignorePassableBlocks) {
|
||||
return parent.rayTraceBlocks(start, direction, arg2, fluidCollisionMode, ignorePassableBlocks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult rayTraceEntities(Location arg0, Vector arg1, double arg2) {
|
||||
return parent.rayTraceEntities(arg0, arg1, arg2);
|
||||
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance) {
|
||||
return parent.rayTraceEntities(start, direction, maxDistance);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1174,16 +1195,11 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
return parent.rayTraceEntities(arg0, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle arg0, Location arg1, int arg2, double arg3, double arg4, double arg5,
|
||||
double arg6, T arg7, boolean arg8) {
|
||||
parent.spawnParticle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle arg0, double arg1, double arg2, double arg3, int arg4, double arg5,
|
||||
double arg6, double arg7, double arg8, T arg9, boolean arg10) {
|
||||
parent.spawnParticle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
|
||||
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z,
|
||||
int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data,
|
||||
boolean force) {
|
||||
|
||||
}
|
||||
|
||||
@ -1340,4 +1356,11 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
||||
public <T> void spawnParticle(Particle particle, List<Player> list, Player player, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6, T t, boolean b) {
|
||||
parent.spawnParticle(particle, list, player, v, v1, v2, i, v3, v4, v5, v6, t, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count,
|
||||
double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data,
|
||||
boolean force) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -108,11 +108,6 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> 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<? extends Entity> getEntities() {
|
||||
return clipboard.getEntities();
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
return clipboard.getOrigin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
return clipboard.getOrigin();
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return clipboard.getEntities(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities() {
|
||||
return clipboard.getEntities();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -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;
|
||||
|
@ -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!<br>
|
||||
*
|
||||
* @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);
|
||||
|
@ -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<T> previous = REGISTERED_POOLS.putIfAbsent(clazz, pool);
|
||||
if (previous != null) {
|
||||
throw new IllegalStateException("Previous key");
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.boydti.fawe.beta;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
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 +66,18 @@ public interface IBatchProcessor {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int layer = (minY - 15) >> 4; layer < (maxY + 15) >> 4; layer++) {
|
||||
if (set.hasSection(layer)) {
|
||||
return true;
|
||||
try {
|
||||
int layer = (minY - 15) >> 4;
|
||||
while (layer < (maxY + 15) >> 4) {
|
||||
if (set.hasSection(layer)) {
|
||||
return true;
|
||||
}
|
||||
layer++;
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException exception) {
|
||||
Fawe.imp().debug("minY = " + minY);
|
||||
Fawe.imp().debug("layer = " + ((minY - 15) >> 4));
|
||||
exception.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -10,7 +10,7 @@ public interface IQueueChunk<T extends Future<T>> extends IChunk, Callable<T> {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
default IQueueChunk reset() {
|
||||
default IQueueChunk<T> reset() {
|
||||
init(null, getX(), getZ());
|
||||
return this;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
@ -104,18 +106,24 @@ public abstract class CharBlocks implements IBlocks {
|
||||
public void set(int x, int y, int z, char value) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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) throws ArrayIndexOutOfBoundsException {
|
||||
sections[layer].set(this, layer, index, value);
|
||||
}
|
||||
|
||||
|
@ -207,8 +207,7 @@ public class ChunkHolder<T extends Future<T>> 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);
|
||||
}
|
||||
|
||||
@ -250,16 +249,14 @@ public class ChunkHolder<T extends Future<T>> 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 +468,9 @@ public class ChunkHolder<T extends Future<T>> 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);
|
||||
|
||||
|
@ -33,8 +33,8 @@ import java.util.concurrent.Future;
|
||||
*/
|
||||
public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent<IQueueChunk> {
|
||||
|
||||
// // Pool discarded chunks for reuse (can safely be cleared by another thread)
|
||||
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
|
||||
// Pool discarded chunks for reuse (can safely be cleared by another thread)
|
||||
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
|
||||
// Chunks currently being queued / worked on
|
||||
private final Long2ObjectLinkedOpenHashMap<IQueueChunk> chunks = new Long2ObjectLinkedOpenHashMap<>();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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`<=?";
|
||||
|
@ -51,7 +51,7 @@ public class MCAChunk implements IChunk {
|
||||
|
||||
public final char[] blocks = new char[65536];
|
||||
|
||||
public final BlockVector3ChunkMap<CompoundTag> tiles = new BlockVector3ChunkMap<CompoundTag>();
|
||||
public final BlockVector3ChunkMap<CompoundTag> tiles = new BlockVector3ChunkMap<>();
|
||||
public final Map<UUID, CompoundTag> entities = new HashMap<>();
|
||||
public long inhabitedTime = System.currentTimeMillis();
|
||||
public long lastUpdate;
|
||||
@ -142,7 +142,7 @@ public class MCAChunk implements IChunk {
|
||||
for (Map.Entry<String, String> entry : properties.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
Property property = type.getProperty(key);
|
||||
Property<Object> 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;
|
||||
}
|
||||
|
||||
|
@ -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<MCAChunk> 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<MCAChunk> list = new ArrayList<>(size);
|
||||
for (int i = 0; i < chunks.length; i++) {
|
||||
MCAChunk chunk = chunks[i];
|
||||
|
@ -13,6 +13,7 @@ import com.boydti.fawe.beta.implementation.filter.block.MultiFilterBlock;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
|
||||
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;
|
||||
@ -51,7 +52,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;
|
||||
@ -66,7 +66,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;
|
||||
@ -1548,9 +1547,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
|
||||
|
@ -18,6 +18,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
|
||||
@ -42,12 +43,12 @@ 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);
|
||||
|
||||
public abstract Collection<CompoundTag> getTileEntities();
|
||||
|
||||
@Override
|
||||
public void close() {}
|
||||
|
||||
public void flush() {}
|
||||
@ -57,6 +58,7 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa
|
||||
close();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<BlockVector3> iterator() {
|
||||
return iterator(Order.YZX);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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<byte[]> {
|
||||
public VariableThreadLocal() {
|
||||
super(() -> null);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 <code>byte</code> 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 <code>length</code> bytes from the specified byte array
|
||||
* starting at <code>offset</code> 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 <code>boolean</code> 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 <code>0</code> in written.
|
||||
* If the argument is false, the byte value {@code 0} in written.
|
||||
*
|
||||
* @param b the <code>boolean</code> 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 <code>byte</code> to the underlying output stream
|
||||
* Writes out a {@code byte} to the underlying output stream
|
||||
*
|
||||
* @param b the <code>byte</code> 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 <code>short</code> 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 <code>short</code> 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 <code>char</code> 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 <code>char</code> 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 <code>int</code> 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 <code>int</code> 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 <code>long</code> 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 <code>long</code> 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 <code>float</code> 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 <code>double</code> 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 <code>writeByte()</code> method.
|
||||
* if by the {@code writeByte()} method.
|
||||
*
|
||||
* @param s the <code>String</code> 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 <code>writeChar</code> method.
|
||||
* if by the {@code writeChar} method.
|
||||
*
|
||||
* @param s a <code>String</code> 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 <code>written</code> field.
|
||||
* @see java.io.DataOutputStream#written
|
||||
* @return the value of the {@code written} field.
|
||||
*/
|
||||
public int size() {
|
||||
return this.written;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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,19 @@ 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();
|
||||
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");
|
||||
|
@ -52,7 +52,7 @@ public class ReflectionUtils {
|
||||
|
||||
// 2. Copy it
|
||||
T[] previousValues = (T[]) valuesField.get(enumType);
|
||||
List values = new ArrayList(Arrays.asList(previousValues));
|
||||
List<T> 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 <T> List<T> getList(List<T> list) {
|
||||
try {
|
||||
Class<? extends List> clazz = (Class<? extends List>) Class.forName("java.util.Collections$UnmodifiableList");
|
||||
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);
|
||||
@ -566,10 +566,10 @@ public class ReflectionUtils {
|
||||
* @throws RuntimeException if constructor not found
|
||||
*/
|
||||
public RefConstructor findConstructor(int number) {
|
||||
final List<Constructor> constructors = new ArrayList<>();
|
||||
final List<Constructor<?>> 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);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class ReflectionUtils9 {
|
||||
|
||||
// 2. Copy it
|
||||
T[] previousValues = (T[]) valuesField.get(enumType);
|
||||
List values = new ArrayList<>(Arrays.asList(previousValues));
|
||||
List<T> values = new ArrayList<>(Arrays.asList(previousValues));
|
||||
|
||||
// 3. build new enum
|
||||
T newValue = (T) makeEnum(enumType, // The target enum class
|
||||
|
@ -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);
|
||||
|
@ -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(getExtent(), mutablebv.setComponents(x, y, z))) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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) {
|
||||
@ -278,7 +278,7 @@ public class HistorySubCommands {
|
||||
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,
|
||||
@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 {
|
||||
@ -318,7 +318,7 @@ public class HistorySubCommands {
|
||||
}
|
||||
|
||||
PaginationBox pages = PaginationBox.fromStrings("Edits:", pageCommand, list, new Function<Supplier<RollbackOptimizedHistory>, Component>() {
|
||||
@Nullable
|
||||
@NotNull
|
||||
@Override
|
||||
public Component apply(@Nullable Supplier<RollbackOptimizedHistory> input) {
|
||||
RollbackOptimizedHistory edit = input.get();
|
||||
|
@ -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)) {
|
||||
|
@ -520,33 +520,6 @@ public class UtilityCommands {
|
||||
return affected;
|
||||
}
|
||||
|
||||
private int killMatchingEntities(Integer radius, Actor actor, Supplier<EntityFunction> func) throws IncompleteRegionException,
|
||||
MaxChangedBlocksException {
|
||||
List<EntityVisitor> visitors = new ArrayList<>();
|
||||
|
||||
LocalSession session = we.getSessionManager().get(actor);
|
||||
BlockVector3 center = session.getPlacementPosition(actor);
|
||||
EditSession editSession = session.createEditSession(actor);
|
||||
List<? extends Entity> 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<EntityFunction> func) throws IncompleteRegionException,
|
||||
MaxChangedBlocksException {
|
||||
List<EntityVisitor> visitors = new ArrayList<>();
|
||||
|
||||
LocalSession session = we.getSessionManager().get(actor);
|
||||
BlockVector3 center = session.getPlacementPosition(actor);
|
||||
EditSession editSession = session.createEditSession(actor);
|
||||
List<? extends Entity> 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);
|
||||
}
|
||||
|
||||
|
@ -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())) {
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
||||
CommandManager commandManager,
|
||||
Consumer<BiConsumer<CommandRegistration, CI>> handlerInstance) {
|
||||
registerSubCommands(name, aliases, desc, commandManager, handlerInstance, m -> {});
|
||||
CommandRegistration<CI> registration, CI instance) {
|
||||
registerSubCommands(name, aliases, desc, registration, instance, m -> {});
|
||||
}
|
||||
|
||||
private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
||||
CommandRegistration<CI> registration, CI instance,
|
||||
Consumer<CommandManager> 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<Command> 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 <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
||||
CommandManager commandManager,
|
||||
Consumer<BiConsumer<CommandRegistration, CI>> handlerInstance,
|
||||
Consumer<CommandManager> additionalConfig) {
|
||||
@NotNull Consumer<CommandManager> 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<Command> subCommands = manager.getAllCommands().collect(Collectors.toList());
|
||||
cmd.addPart(SubCommandPart.builder(TranslatableComponent.of("worldedit.argument.action"),
|
||||
@ -369,26 +395,21 @@ public final class PlatformCommandManager {
|
||||
});
|
||||
}
|
||||
|
||||
public <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
||||
CommandRegistration<CI> 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<String> 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))
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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<BlockVector3> iterator() {
|
||||
OffsetBlockVector3 mutable = new OffsetBlockVector3(offset);
|
||||
|
@ -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<BlockVector3>, 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<BlockVector3>, 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<BlockVector3>, Closeable {
|
||||
|
||||
/**
|
||||
* Remove entity from clipboard
|
||||
* @param entity
|
||||
*/
|
||||
void removeEntity(Entity entity);
|
||||
|
||||
@ -161,6 +157,8 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||
return order.create(getRegion());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
default Iterator<BlockVector3> iterator() {
|
||||
return getRegion().iterator();
|
||||
}
|
||||
@ -173,35 +171,20 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||
return null;
|
||||
}
|
||||
|
||||
// default void paste(Extent other, BlockVector3 to) {
|
||||
// TODO FIXME
|
||||
// }
|
||||
|
||||
@Override
|
||||
default <T extends Filter> T apply(Region region, T filter, boolean full) {
|
||||
if (region.equals(getRegion())) {
|
||||
return apply(this, filter);
|
||||
} else {
|
||||
return apply((Iterable<BlockVector3>) 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<BlockVector3>, 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<BlockVector3>, 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<BlockVector3>, 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<BlockVector3>, 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<BlockVector3>, 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<BlockVector3>, 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<BlockVector3>, 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());
|
||||
}
|
||||
}
|
||||
|
@ -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].*")) {
|
||||
|
@ -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<Operation> {
|
||||
|
||||
private Extent destination;
|
||||
@ -157,12 +157,6 @@ public class Deform implements Contextual<Operation> {
|
||||
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<Operation> {
|
||||
@Override
|
||||
public Iterable<Component> 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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -38,11 +38,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public interface Operation {
|
||||
|
||||
/**
|
||||
* This is an internal field, and should not be touched.
|
||||
*/
|
||||
Set<String> 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<String> messages) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an internal field, and should not be touched.
|
||||
*/
|
||||
Set<String> 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);
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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<BlockVector3> iterator() {
|
||||
if (Settings.IMP.HISTORY.COMPRESSION_LEVEL >= 9 || useOldIterator) {
|
||||
if (Settings.IMP.HISTORY.COMPRESSION_LEVEL >= 9) {
|
||||
return iterator_old();
|
||||
}
|
||||
return new Iterator<BlockVector3>() {
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -196,4 +196,4 @@ public abstract class PaginationBox extends MessageBox {
|
||||
return lines.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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<String, String> filterTranslations(Map<String, String> 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<String, String> parseTranslationFile(InputStream inputStream) {
|
||||
@ -156,4 +160,4 @@ public class TranslationManager {
|
||||
public Locale getDefaultLocale() {
|
||||
return defaultLocale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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<String, Tag> children = rootTag.getValue();
|
||||
CompoundTag tag = null;
|
||||
|
||||
// Find Level tag
|
||||
for (Map.Entry<String, Tag> 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<String, Tag> tags = tag.getValue();
|
||||
if (tags.containsKey("Sections")) {
|
||||
return new AnvilChunk(world, tag);
|
||||
}
|
||||
|
||||
return new OldChunk(world, tag);
|
||||
return ChunkStoreHelper.getChunk(rootTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<String, Tag> children = rootTag.getValue();
|
||||
CompoundTag tag = null;
|
||||
|
||||
// Find Level tag
|
||||
for (Map.Entry<String, Tag> 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<String, Tag> tags = tag.getValue();
|
||||
if (tags.containsKey("Sections")) {
|
||||
return new AnvilChunk(tag);
|
||||
}
|
||||
|
||||
return new OldChunk(tag);
|
||||
}
|
||||
|
||||
private ChunkStoreHelper() {
|
||||
}
|
||||
}
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
@ -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.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",
|
||||
|
||||
|
||||
"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}",
|
||||
@ -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",
|
||||
@ -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.",
|
||||
|
BIN
worldedit-core/src/main/resources/linux/aarch64/liblz4-java.so
Normale Datei
BIN
worldedit-core/src/main/resources/linux/aarch64/liblz4-java.so
Normale Datei
Binäre Datei nicht angezeigt.
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren