Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 08:02:50 +02:00
A lot of small changes
Dieser Commit ist enthalten in:
Ursprung
6cb2d7cd5c
Commit
f3e0109be2
@ -43,7 +43,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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-api:${Versions.JUNIT}")
|
||||||
"testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
|
"testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
|
||||||
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")
|
"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_14_r1:spigotmcv1_14_r1:1_14_r1")
|
||||||
"compile"("org.spigotmcv1_15_r1:spigotmcv1_15_r1:1_15_r1")
|
"compile"("org.spigotmcv1_15_r1:spigotmcv1_15_r1:1_15_r1")
|
||||||
"compile"("it.unimi.dsi:fastutil:8.2.1")
|
"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")
|
exclude("junit", "junit")
|
||||||
isTransitive = false
|
isTransitive = false
|
||||||
}
|
}
|
||||||
"compileOnly"("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT")
|
"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")
|
"implementation"("io.papermc:paperlib:1.0.2")
|
||||||
"compileOnly"("com.sk89q:dummypermscompat:1.10")
|
"compileOnly"("com.sk89q:dummypermscompat:1.10")
|
||||||
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
|
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
|
||||||
"testCompile"("org.mockito:mockito-core:1.9.0-rc1")
|
"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-bukkit")
|
||||||
exclude("com.sk89q.worldedit", "worldedit-core")
|
exclude("com.sk89q.worldedit", "worldedit-core")
|
||||||
exclude("com.sk89q.worldedit.worldedit-libs", "bukkit")
|
exclude("com.sk89q.worldedit.worldedit-libs", "bukkit")
|
||||||
|
@ -41,7 +41,6 @@ import java.util.function.Supplier;
|
|||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -50,7 +49,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.bukkit.event.world.WorldLoadEvent;
|
import org.bukkit.event.world.WorldLoadEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -353,7 +351,6 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
// return ((BlocksHubBukkit) blocksHubPlugin).getApi();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.boydti.fawe.bukkit.adapter.mc1_13;
|
package com.boydti.fawe.bukkit.adapter.mc1_13;
|
||||||
|
|
||||||
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
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.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
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.BiomeBase;
|
||||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||||
import net.minecraft.server.v1_13_R2.Chunk;
|
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.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
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 class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
||||||
public ChunkSection[] sections;
|
public ChunkSection[] sections;
|
||||||
public Chunk nmsChunk;
|
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())));
|
return new LazyCompoundTag_1_13(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Function<BlockPosition, BlockVector3> posNms2We = new Function<BlockPosition, BlockVector3>() {
|
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
||||||
@Override
|
|
||||||
public BlockVector3 apply(BlockPosition v) {
|
|
||||||
return BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private final static Function<TileEntity, CompoundTag> nmsTile2We = new Function<TileEntity, CompoundTag>() {
|
private final static Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_13(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||||
@Override
|
|
||||||
public CompoundTag apply(TileEntity tileEntity) {
|
|
||||||
return new LazyCompoundTag_1_13(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<BlockVector3, CompoundTag> getTiles() {
|
public Map<BlockVector3, CompoundTag> getTiles() {
|
||||||
@ -243,9 +232,7 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
|||||||
{
|
{
|
||||||
Map<BlockPosition, TileEntity> tiles = nmsChunk.getTileEntities();
|
Map<BlockPosition, TileEntity> tiles = nmsChunk.getTileEntities();
|
||||||
if (!tiles.isEmpty()) {
|
if (!tiles.isEmpty()) {
|
||||||
final Iterator<Map.Entry<BlockPosition, TileEntity>> iterator = tiles.entrySet().iterator();
|
for (Map.Entry<BlockPosition, TileEntity> entry : tiles.entrySet()) {
|
||||||
while (iterator.hasNext()) {
|
|
||||||
final Map.Entry<BlockPosition, TileEntity> entry = iterator.next();
|
|
||||||
final BlockPosition pos = entry.getKey();
|
final BlockPosition pos = entry.getKey();
|
||||||
final int lx = pos.getX() & 15;
|
final int lx = pos.getX() & 15;
|
||||||
final int ly = pos.getY();
|
final int ly = pos.getY();
|
||||||
@ -345,8 +332,7 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
|||||||
public void run() {
|
public void run() {
|
||||||
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
||||||
|
|
||||||
for (int i = 0; i < entities.length; i++) {
|
for (final Collection<Entity> ents : entities) {
|
||||||
final Collection<Entity> ents = entities[i];
|
|
||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
final Iterator<Entity> iter = ents.iterator();
|
final Iterator<Entity> iter = ents.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
@ -366,9 +352,7 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
|||||||
if (entities != null && !entities.isEmpty()) {
|
if (entities != null && !entities.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[2];
|
if (syncTasks == null) syncTasks = new Runnable[2];
|
||||||
|
|
||||||
syncTasks[1] = new Runnable() {
|
syncTasks[1] = () -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (final CompoundTag nativeTag : entities) {
|
for (final CompoundTag nativeTag : entities) {
|
||||||
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
||||||
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
||||||
@ -405,7 +389,6 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -415,9 +398,7 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
|||||||
if (tiles != null && !tiles.isEmpty()) {
|
if (tiles != null && !tiles.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[1];
|
if (syncTasks == null) syncTasks = new Runnable[1];
|
||||||
|
|
||||||
syncTasks[0] = new Runnable() {
|
syncTasks[0] = () -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||||
final CompoundTag nativeTag = entry.getValue();
|
final CompoundTag nativeTag = entry.getValue();
|
||||||
final BlockVector3 blockHash = entry.getKey();
|
final BlockVector3 blockHash = entry.getKey();
|
||||||
@ -442,7 +423,6 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,13 +453,10 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
|||||||
Runnable[] finalSyncTasks = syncTasks;
|
Runnable[] finalSyncTasks = syncTasks;
|
||||||
|
|
||||||
// Chain the sync tasks and the callback
|
// Chain the sync tasks and the callback
|
||||||
Callable<Future> chain = new Callable<Future>() {
|
Callable<Future> chain = () -> {
|
||||||
@Override
|
|
||||||
public Future call() {
|
|
||||||
try {
|
try {
|
||||||
// Run the sync tasks
|
// Run the sync tasks
|
||||||
for (int i = 0; i < finalSyncTasks.length; i++) {
|
for (Runnable task : finalSyncTasks) {
|
||||||
Runnable task = finalSyncTasks[i];
|
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
task.run();
|
task.run();
|
||||||
}
|
}
|
||||||
@ -494,7 +471,6 @@ public class BukkitGetBlocks_1_13 extends CharGetBlocks {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return (T) (Future) queueHandler.sync(chain);
|
return (T) (Future) queueHandler.sync(chain);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import com.bekvon.bukkit.residence.commands.set;
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
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.AdaptedMap;
|
||||||
import com.boydti.fawe.object.collection.BitArray4096;
|
import com.boydti.fawe.object.collection.BitArray4096;
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
import com.boydti.fawe.util.ReflectionUtils;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
@ -42,13 +39,11 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.server.v1_14_R1.BiomeBase;
|
import net.minecraft.server.v1_14_R1.BiomeBase;
|
||||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_14_R1.Chunk;
|
import net.minecraft.server.v1_14_R1.Chunk;
|
||||||
import net.minecraft.server.v1_14_R1.ChunkSection;
|
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.DataBits;
|
||||||
import net.minecraft.server.v1_14_R1.DataPalette;
|
import net.minecraft.server.v1_14_R1.DataPalette;
|
||||||
import net.minecraft.server.v1_14_R1.DataPaletteBlock;
|
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.Entity;
|
||||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
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.LightEngineThreaded;
|
||||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_14_R1.NBTTagInt;
|
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())));
|
return new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Function<BlockPosition, BlockVector3> posNms2We = new Function<BlockPosition, BlockVector3>() {
|
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
||||||
@Override
|
|
||||||
public BlockVector3 apply(BlockPosition v) {
|
|
||||||
return BlockVector3.at(v.getX(), v.getY(), v.getZ());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private final static Function<TileEntity, CompoundTag> nmsTile2We = new Function<TileEntity, CompoundTag>() {
|
private final static Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||||
@Override
|
|
||||||
public CompoundTag apply(TileEntity tileEntity) {
|
|
||||||
return new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<BlockVector3, CompoundTag> getTiles() {
|
public Map<BlockVector3, CompoundTag> getTiles() {
|
||||||
@ -249,9 +233,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
{
|
{
|
||||||
Map<BlockPosition, TileEntity> tiles = nmsChunk.getTileEntities();
|
Map<BlockPosition, TileEntity> tiles = nmsChunk.getTileEntities();
|
||||||
if (!tiles.isEmpty()) {
|
if (!tiles.isEmpty()) {
|
||||||
final Iterator<Map.Entry<BlockPosition, TileEntity>> iterator = tiles.entrySet().iterator();
|
for (Map.Entry<BlockPosition, TileEntity> entry : tiles.entrySet()) {
|
||||||
while (iterator.hasNext()) {
|
|
||||||
final Map.Entry<BlockPosition, TileEntity> entry = iterator.next();
|
|
||||||
final BlockPosition pos = entry.getKey();
|
final BlockPosition pos = entry.getKey();
|
||||||
final int lx = pos.getX() & 15;
|
final int lx = pos.getX() & 15;
|
||||||
final int ly = pos.getY();
|
final int ly = pos.getY();
|
||||||
@ -346,13 +328,10 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
if (entityRemoves != null && !entityRemoves.isEmpty()) {
|
if (entityRemoves != null && !entityRemoves.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[3];
|
if (syncTasks == null) syncTasks = new Runnable[3];
|
||||||
|
|
||||||
syncTasks[2] = new Runnable() {
|
syncTasks[2] = () -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
||||||
|
|
||||||
for (int i = 0; i < entities.length; i++) {
|
for (final Collection<Entity> ents : entities) {
|
||||||
final Collection<Entity> ents = entities[i];
|
|
||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
final Iterator<Entity> iter = ents.iterator();
|
final Iterator<Entity> iter = ents.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
@ -364,7 +343,6 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,9 +350,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
if (entities != null && !entities.isEmpty()) {
|
if (entities != null && !entities.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[2];
|
if (syncTasks == null) syncTasks = new Runnable[2];
|
||||||
|
|
||||||
syncTasks[1] = new Runnable() {
|
syncTasks[1] = () -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (final CompoundTag nativeTag : entities) {
|
for (final CompoundTag nativeTag : entities) {
|
||||||
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
||||||
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
||||||
@ -411,7 +387,6 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -421,9 +396,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
if (tiles != null && !tiles.isEmpty()) {
|
if (tiles != null && !tiles.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[1];
|
if (syncTasks == null) syncTasks = new Runnable[1];
|
||||||
|
|
||||||
syncTasks[0] = new Runnable() {
|
syncTasks[0] = () -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||||
final CompoundTag nativeTag = entry.getValue();
|
final CompoundTag nativeTag = entry.getValue();
|
||||||
final BlockVector3 blockHash = entry.getKey();
|
final BlockVector3 blockHash = entry.getKey();
|
||||||
@ -448,7 +421,6 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,13 +450,10 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
Runnable[] finalSyncTasks = syncTasks;
|
Runnable[] finalSyncTasks = syncTasks;
|
||||||
|
|
||||||
// Chain the sync tasks and the callback
|
// Chain the sync tasks and the callback
|
||||||
Callable<Future> chain = new Callable<Future>() {
|
Callable<Future> chain = () -> {
|
||||||
@Override
|
|
||||||
public Future call() {
|
|
||||||
try {
|
try {
|
||||||
// Run the sync tasks
|
// Run the sync tasks
|
||||||
for (int i = 0; i < finalSyncTasks.length; i++) {
|
for (Runnable task : finalSyncTasks) {
|
||||||
Runnable task = finalSyncTasks[i];
|
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
task.run();
|
task.run();
|
||||||
}
|
}
|
||||||
@ -499,7 +468,6 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return (T) (Future) queueHandler.sync(chain);
|
return (T) (Future) queueHandler.sync(chain);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.boydti.fawe.bukkit.adapter.mc1_15;
|
package com.boydti.fawe.bukkit.adapter.mc1_15;
|
||||||
|
|
||||||
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
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.boydti.fawe.util.ReflectionUtils;
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Iterables;
|
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.Tag;
|
||||||
import com.sk89q.jnbt.*;
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
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.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
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.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
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.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
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 {
|
public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
||||||
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> 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 = tileEntity -> new LazyCompoundTag_1_15(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
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();
|
Map<BlockPosition, TileEntity> tiles = nmsChunk.getTileEntities();
|
||||||
if (!tiles.isEmpty()) {
|
if (!tiles.isEmpty()) {
|
||||||
final Iterator<Map.Entry<BlockPosition, TileEntity>> iterator = tiles.entrySet().iterator();
|
for (Map.Entry<BlockPosition, TileEntity> entry : tiles.entrySet()) {
|
||||||
while (iterator.hasNext()) {
|
|
||||||
final Map.Entry<BlockPosition, TileEntity> entry = iterator.next();
|
|
||||||
final BlockPosition pos = entry.getKey();
|
final BlockPosition pos = entry.getKey();
|
||||||
final int lx = pos.getX() & 15;
|
final int lx = pos.getX() & 15;
|
||||||
final int ly = pos.getY();
|
final int ly = pos.getY();
|
||||||
@ -319,8 +344,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
|||||||
syncTasks[2] = () -> {
|
syncTasks[2] = () -> {
|
||||||
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
||||||
|
|
||||||
for (int i = 0; i < entities.length; i++) {
|
for (final Collection<Entity> ents : entities) {
|
||||||
final Collection<Entity> ents = entities[i];
|
|
||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
final Iterator<Entity> iter = ents.iterator();
|
final Iterator<Entity> iter = ents.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
@ -339,9 +363,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
|||||||
if (entities != null && !entities.isEmpty()) {
|
if (entities != null && !entities.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[2];
|
if (syncTasks == null) syncTasks = new Runnable[2];
|
||||||
|
|
||||||
syncTasks[1] = new Runnable() {
|
syncTasks[1] = () -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (final CompoundTag nativeTag : entities) {
|
for (final CompoundTag nativeTag : entities) {
|
||||||
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
final Map<String, Tag> entityTagMap = ReflectionUtils.getMap(nativeTag.getValue());
|
||||||
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
final StringTag idTag = (StringTag) entityTagMap.get("Id");
|
||||||
@ -378,7 +400,6 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -416,11 +437,10 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
{//Lighting
|
//Lighting
|
||||||
// TODO optimize, cause this is really slow
|
// TODO optimize, cause this is really slow
|
||||||
LightEngineThreaded engine = (LightEngineThreaded) nmsChunk.e();
|
LightEngineThreaded engine = (LightEngineThreaded) nmsChunk.e();
|
||||||
engine.a(nmsChunk, false);
|
engine.a(nmsChunk, false);
|
||||||
}
|
|
||||||
|
|
||||||
Runnable callback;
|
Runnable callback;
|
||||||
if (bitMask == 0 && biomes == null) {
|
if (bitMask == 0 && biomes == null) {
|
||||||
@ -445,8 +465,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
|
|||||||
Callable<Future> chain = () -> {
|
Callable<Future> chain = () -> {
|
||||||
try {
|
try {
|
||||||
// Run the sync tasks
|
// Run the sync tasks
|
||||||
for (int i = 0; i < finalSyncTasks.length; i++) {
|
for (Runnable task : finalSyncTasks) {
|
||||||
Runnable task = finalSyncTasks[i];
|
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
task.run();
|
task.run();
|
||||||
}
|
}
|
||||||
|
@ -207,8 +207,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(ChunkHolder chunk, int x, int y, int z,
|
public boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder block) {
|
||||||
BlockStateHolder block) {
|
|
||||||
return chunk.chunkSet.setBlock(x, y, z, block);
|
return chunk.chunkSet.setBlock(x, y, z, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 = "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_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 = "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 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`<=?";
|
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`<=?";
|
||||||
|
@ -15,10 +15,12 @@ import com.sk89q.jnbt.ShortTag;
|
|||||||
import com.sk89q.jnbt.StringTag;
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.List;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class JSON2NBT {
|
public class JSON2NBT {
|
||||||
private static final Pattern INT_ARRAY_MATCHER = Pattern.compile("\\[[-+\\d|,\\s]+\\]");
|
private static final Pattern INT_ARRAY_MATCHER = Pattern.compile("\\[[-+\\d|,\\s]+\\]");
|
||||||
@ -40,7 +42,7 @@ public class JSON2NBT {
|
|||||||
public static int topTagsCount(String str) throws NBTException {
|
public static int topTagsCount(String str) throws NBTException {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
Stack stack = new Stack();
|
Stack<Character> stack = new Stack<>();
|
||||||
|
|
||||||
for (int j = 0; j < str.length(); ++j) {
|
for (int j = 0; j < str.length(); ++j) {
|
||||||
char c0 = str.charAt(j);
|
char c0 = str.charAt(j);
|
||||||
@ -54,11 +56,11 @@ public class JSON2NBT {
|
|||||||
}
|
}
|
||||||
} else if (!flag) {
|
} else if (!flag) {
|
||||||
if (c0 != 123 && c0 != 91) {
|
if (c0 != 123 && c0 != 91) {
|
||||||
if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) {
|
if (c0 == 125 && (stack.isEmpty() || stack.pop() != 123)) {
|
||||||
throw new NBTException("Unbalanced curly brackets {}: " + str);
|
throw new NBTException("Unbalanced curly brackets {}: " + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) {
|
if (c0 == 93 && (stack.isEmpty() || stack.pop() != 91)) {
|
||||||
throw new NBTException("Unbalanced square brackets []: " + str);
|
throw new NBTException("Unbalanced square brackets []: " + str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -66,7 +68,7 @@ public class JSON2NBT {
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.push(Character.valueOf(c0));
|
stack.push(c0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,7 +93,6 @@ public class JSON2NBT {
|
|||||||
private static JSON2NBT.Any nameValueToNBT(String key, String value) throws NBTException {
|
private static JSON2NBT.Any nameValueToNBT(String key, String value) throws NBTException {
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
String s;
|
String s;
|
||||||
boolean c0;
|
|
||||||
char c01;
|
char c01;
|
||||||
if (value.startsWith("{")) {
|
if (value.startsWith("{")) {
|
||||||
value = value.substring(1, value.length() - 1);
|
value = value.substring(1, value.length() - 1);
|
||||||
@ -100,7 +101,6 @@ public class JSON2NBT {
|
|||||||
for (JSON2NBT$list1 = new JSON2NBT.Compound(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
for (JSON2NBT$list1 = new JSON2NBT.Compound(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
||||||
s = nextNameValuePair(value, true);
|
s = nextNameValuePair(value, true);
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
c0 = false;
|
|
||||||
JSON2NBT$list1.tagList.add(getTagFromNameValue(s, false));
|
JSON2NBT$list1.tagList.add(getTagFromNameValue(s, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,6 @@ public class JSON2NBT {
|
|||||||
for (JSON2NBT$list = new JSON2NBT.List(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
for (JSON2NBT$list = new JSON2NBT.List(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
||||||
s = nextNameValuePair(value, false);
|
s = nextNameValuePair(value, false);
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
c0 = true;
|
|
||||||
JSON2NBT$list.tagList.add(getTagFromNameValue(s, true));
|
JSON2NBT$list.tagList.add(getTagFromNameValue(s, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +144,7 @@ public class JSON2NBT {
|
|||||||
private static JSON2NBT.Any getTagFromNameValue(String str, boolean isArray) throws NBTException {
|
private static JSON2NBT.Any getTagFromNameValue(String str, boolean isArray) throws NBTException {
|
||||||
String s = locateName(str, isArray);
|
String s = locateName(str, isArray);
|
||||||
String s1 = locateValue(str, isArray);
|
String s1 = locateValue(str, isArray);
|
||||||
return joinStrToNBT(new String[]{s, s1});
|
return joinStrToNBT(s, s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String nextNameValuePair(String str, boolean isCompound) throws NBTException {
|
private static String nextNameValuePair(String str, boolean isCompound) throws NBTException {
|
||||||
@ -167,7 +166,7 @@ public class JSON2NBT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String locateValueAt(String str, int index) throws NBTException {
|
private static String locateValueAt(String str, int index) throws NBTException {
|
||||||
Stack stack = new Stack();
|
Stack<Character> stack = new Stack<>();
|
||||||
int i = index + 1;
|
int i = index + 1;
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
@ -192,11 +191,11 @@ public class JSON2NBT {
|
|||||||
}
|
}
|
||||||
} else if (!flag) {
|
} else if (!flag) {
|
||||||
if (c0 != 123 && c0 != 91) {
|
if (c0 != 123 && c0 != 91) {
|
||||||
if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) {
|
if (c0 == 125 && (stack.isEmpty() || stack.pop() != 123)) {
|
||||||
throw new NBTException("Unbalanced curly brackets {}: " + str);
|
throw new NBTException("Unbalanced curly brackets {}: " + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) {
|
if (c0 == 93 && (stack.isEmpty() || stack.pop() != 91)) {
|
||||||
throw new NBTException("Unbalanced square brackets []: " + str);
|
throw new NBTException("Unbalanced square brackets []: " + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +203,7 @@ public class JSON2NBT {
|
|||||||
return str.substring(0, i);
|
return str.substring(0, i);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stack.push(Character.valueOf(c0));
|
stack.push(c0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,14 +342,11 @@ public class JSON2NBT {
|
|||||||
|
|
||||||
if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) {
|
if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) {
|
||||||
String var7 = this.jsonValue.substring(1, this.jsonValue.length() - 1);
|
String var7 = this.jsonValue.substring(1, this.jsonValue.length() - 1);
|
||||||
String[] var8 = (String[]) ((String[]) Iterables.toArray(SPLITTER.split(var7), String.class));
|
String[] var8 = Iterables.toArray(SPLITTER.split(var7), String.class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int[] var5 = new int[var8.length];
|
int[] var5 = Arrays.stream(var8).mapToInt(s -> Integer.parseInt(s.trim()))
|
||||||
|
.toArray();
|
||||||
for (int j = 0; j < var8.length; ++j) {
|
|
||||||
var5[j] = Integer.parseInt(var8[j].trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new IntArrayTag(var5);
|
return new IntArrayTag(var5);
|
||||||
} catch (NumberFormatException var51) {
|
} catch (NumberFormatException var51) {
|
||||||
@ -379,27 +375,23 @@ public class JSON2NBT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class List extends JSON2NBT.Any {
|
private static class List extends JSON2NBT.Any {
|
||||||
protected java.util.List<JSON2NBT.Any> tagList = Lists.newArrayList();
|
protected List<JSON2NBT.Any> tagList = Lists.newArrayList();
|
||||||
|
|
||||||
public List(String json) {
|
public List(String json) {
|
||||||
this.json = json;
|
this.json = json;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tag parse() throws NBTException {
|
public Tag parse() throws NBTException {
|
||||||
ArrayList<Tag> list = new ArrayList<>();
|
ArrayList<Tag> list = this.tagList.stream().map(Any::parse)
|
||||||
Iterator var2 = this.tagList.iterator();
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
|
|
||||||
while (var2.hasNext()) {
|
|
||||||
JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any) var2.next();
|
|
||||||
list.add(JSON2NBT$any.parse());
|
|
||||||
}
|
|
||||||
Class<? extends Tag> tagType = list.isEmpty() ? CompoundTag.class : list.get(0).getClass();
|
Class<? extends Tag> tagType = list.isEmpty() ? CompoundTag.class : list.get(0).getClass();
|
||||||
return new ListTag(tagType, list);
|
return new ListTag(tagType, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Compound extends JSON2NBT.Any {
|
private static class Compound extends JSON2NBT.Any {
|
||||||
protected java.util.List<JSON2NBT.Any> tagList = Lists.newArrayList();
|
protected List<JSON2NBT.Any> tagList = Lists.newArrayList();
|
||||||
|
|
||||||
public Compound(String jsonIn) {
|
public Compound(String jsonIn) {
|
||||||
this.json = jsonIn;
|
this.json = jsonIn;
|
||||||
@ -407,10 +399,8 @@ public class JSON2NBT {
|
|||||||
|
|
||||||
public Tag parse() throws NBTException {
|
public Tag parse() throws NBTException {
|
||||||
HashMap<String, Tag> map = new HashMap<>();
|
HashMap<String, Tag> map = new HashMap<>();
|
||||||
Iterator var2 = this.tagList.iterator();
|
|
||||||
|
|
||||||
while (var2.hasNext()) {
|
for (Any JSON2NBT$any : this.tagList) {
|
||||||
JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any) var2.next();
|
|
||||||
map.put(JSON2NBT$any.json, JSON2NBT$any.parse());
|
map.put(JSON2NBT$any.json, JSON2NBT$any.parse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class MCAChunk implements IChunk {
|
|||||||
|
|
||||||
public final char[] blocks = new char[65536];
|
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 final Map<UUID, CompoundTag> entities = new HashMap<>();
|
||||||
public long inhabitedTime = System.currentTimeMillis();
|
public long inhabitedTime = System.currentTimeMillis();
|
||||||
public long lastUpdate;
|
public long lastUpdate;
|
||||||
|
@ -7,8 +7,8 @@ import com.boydti.fawe.FaweCache;
|
|||||||
import com.boydti.fawe.beta.IBlocks;
|
import com.boydti.fawe.beta.IBlocks;
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
import com.boydti.fawe.beta.IChunkSet;
|
||||||
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
|
||||||
import com.boydti.fawe.beta.implementation.blocks.FallbackChunkGet;
|
import com.boydti.fawe.beta.implementation.blocks.FallbackChunkGet;
|
||||||
|
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||||
import com.boydti.fawe.jnbt.anvil.MCAChunk;
|
import com.boydti.fawe.jnbt.anvil.MCAChunk;
|
||||||
import com.boydti.fawe.object.FaweInputStream;
|
import com.boydti.fawe.object.FaweInputStream;
|
||||||
import com.boydti.fawe.object.FaweOutputStream;
|
import com.boydti.fawe.object.FaweOutputStream;
|
||||||
@ -46,7 +46,6 @@ import com.sk89q.worldedit.math.transform.AffineTransform;
|
|||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.util.Identifiable;
|
import com.sk89q.worldedit.util.Identifiable;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
@ -60,7 +59,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -1556,9 +1554,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setHeights(int value) {
|
public void setHeights(int value) {
|
||||||
heights.record(() -> {
|
heights.record(() -> Arrays.fill(heights.get(), (byte) value));
|
||||||
Arrays.fill(heights.get(), (byte) value);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,6 +17,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Best used when clipboard selections are small, or using legacy formats
|
* Best used when clipboard selections are small, or using legacy formats
|
||||||
@ -46,6 +47,7 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa
|
|||||||
|
|
||||||
public abstract Collection<CompoundTag> getTileEntities();
|
public abstract Collection<CompoundTag> getTileEntities();
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close() {}
|
public void close() {}
|
||||||
|
|
||||||
public void flush() {}
|
public void flush() {}
|
||||||
@ -55,6 +57,7 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Iterator<BlockVector3> iterator() {
|
public Iterator<BlockVector3> iterator() {
|
||||||
return iterator(Order.YZX);
|
return iterator(Order.YZX);
|
||||||
|
@ -9,8 +9,6 @@ import java.util.Spliterator;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,6 @@ import java.io.RandomAccessFile;
|
|||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -156,10 +155,8 @@ public class FastByteArrayOutputStream extends OutputStream {
|
|||||||
public void writeTo(OutputStream out) throws IOException {
|
public void writeTo(OutputStream out) throws IOException {
|
||||||
// Check if we have a list of buffers
|
// Check if we have a list of buffers
|
||||||
if (buffers != null) {
|
if (buffers != null) {
|
||||||
Iterator iter = buffers.iterator();
|
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
for (byte[] bytes : buffers) {
|
||||||
byte[] bytes = (byte[]) iter.next();
|
|
||||||
out.write(bytes, 0, blockSize);
|
out.write(bytes, 0, blockSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,10 +168,8 @@ public class FastByteArrayOutputStream extends OutputStream {
|
|||||||
public void writeTo(RandomAccessFile out) throws IOException {
|
public void writeTo(RandomAccessFile out) throws IOException {
|
||||||
// Check if we have a list of buffers
|
// Check if we have a list of buffers
|
||||||
if (buffers != null) {
|
if (buffers != null) {
|
||||||
Iterator iter = buffers.iterator();
|
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
for (byte[] bytes : buffers) {
|
||||||
byte[] bytes = (byte[]) iter.next();
|
|
||||||
out.write(bytes, 0, blockSize);
|
out.write(bytes, 0, blockSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
package com.boydti.fawe.object.task;
|
package com.boydti.fawe.object.task;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
@ -52,7 +52,7 @@ public class ReflectionUtils {
|
|||||||
|
|
||||||
// 2. Copy it
|
// 2. Copy it
|
||||||
T[] previousValues = (T[]) valuesField.get(enumType);
|
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
|
// 3. build new enum
|
||||||
T newValue = (T) makeEnum(enumType, // The target enum class
|
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) {
|
public static <T> List<T> getList(List<T> list) {
|
||||||
try {
|
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;
|
if (!clazz.isInstance(list)) return list;
|
||||||
Field m = clazz.getDeclaredField("list");
|
Field m = clazz.getDeclaredField("list");
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
@ -566,10 +566,10 @@ public class ReflectionUtils {
|
|||||||
* @throws RuntimeException if constructor not found
|
* @throws RuntimeException if constructor not found
|
||||||
*/
|
*/
|
||||||
public RefConstructor findConstructor(int number) {
|
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.getConstructors());
|
||||||
Collections.addAll(constructors, this.clazz.getDeclaredConstructors());
|
Collections.addAll(constructors, this.clazz.getDeclaredConstructors());
|
||||||
for (Constructor m : constructors) {
|
for (Constructor<?> m : constructors) {
|
||||||
if (m.getParameterTypes().length == number) {
|
if (m.getParameterTypes().length == number) {
|
||||||
return new RefConstructor(m);
|
return new RefConstructor(m);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class ReflectionUtils9 {
|
|||||||
|
|
||||||
// 2. Copy it
|
// 2. Copy it
|
||||||
T[] previousValues = (T[]) valuesField.get(enumType);
|
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
|
// 3. build new enum
|
||||||
T newValue = (T) makeEnum(enumType, // The target enum class
|
T newValue = (T) makeEnum(enumType, // The target enum class
|
||||||
|
@ -19,9 +19,14 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit;
|
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.FaweCache;
|
||||||
import com.boydti.fawe.config.Caption;
|
import com.boydti.fawe.config.Caption;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweLimit;
|
import com.boydti.fawe.object.FaweLimit;
|
||||||
import com.boydti.fawe.object.RegionWrapper;
|
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.EvaluationException;
|
||||||
import com.sk89q.worldedit.internal.expression.Expression;
|
import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
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.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MathUtils;
|
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.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector2;
|
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.Direction;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
import com.sk89q.worldedit.util.TreeGenerator;
|
||||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
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.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
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.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
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.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -138,12 +139,10 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import org.slf4j.Logger;
|
||||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
import org.slf4j.LoggerFactory;
|
||||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
|
||||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An {@link Extent} that handles history, {@link BlockBag}s, change limits,
|
* 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 final String worldName;
|
||||||
private boolean wrapped;
|
private boolean wrapped;
|
||||||
private Extent bypassHistory;
|
|
||||||
private Extent bypassAll;
|
|
||||||
private final FaweLimit originalLimit;
|
private final FaweLimit originalLimit;
|
||||||
private final FaweLimit limit;
|
private final FaweLimit limit;
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private FaweChangeSet changeTask;
|
private FaweChangeSet changeSet;
|
||||||
private boolean history;
|
private boolean history;
|
||||||
|
|
||||||
private final MutableBlockVector3 mutablebv = new MutableBlockVector3();
|
private final MutableBlockVector3 mutablebv = new MutableBlockVector3();
|
||||||
@ -208,6 +206,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
private int changes = -1;
|
private int changes = -1;
|
||||||
private final BlockBag blockBag;
|
private final BlockBag blockBag;
|
||||||
|
|
||||||
|
private Extent bypassHistory;
|
||||||
|
private Extent bypassAll;
|
||||||
|
|
||||||
private final int maxY;
|
private final int maxY;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -229,10 +230,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
this.originalLimit = builder.getLimit();
|
this.originalLimit = builder.getLimit();
|
||||||
this.limit = builder.getLimit().copy();
|
this.limit = builder.getLimit().copy();
|
||||||
this.player = builder.getPlayer();
|
this.player = builder.getPlayer();
|
||||||
this.changeTask = builder.getChangeTask();
|
this.changeSet = builder.getChangeTask();
|
||||||
this.maxY = builder.getMaxY();
|
this.maxY = builder.getMaxY();
|
||||||
this.blockBag = builder.getBlockBag();
|
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 blockBag an optional {@link BlockBag} to use, otherwise null
|
||||||
* @param event the event to call with the extent
|
* @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);
|
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
|
* @return the change set
|
||||||
*/
|
*/
|
||||||
public ChangeSet getChangeSet() {
|
public ChangeSet getChangeSet() {
|
||||||
return changeTask;
|
return changeSet;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Will be removed very soon. Use getChangeSet()
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public FaweChangeSet getChangeTask() {
|
|
||||||
return changeTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -401,7 +394,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
* @param set
|
* @param set
|
||||||
*/
|
*/
|
||||||
public void setRawChangeSet(@Nullable FaweChangeSet set) {
|
public void setRawChangeSet(@Nullable FaweChangeSet set) {
|
||||||
changeTask = set;
|
changeSet = set;
|
||||||
changes++;
|
changes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +425,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
* @return whether the queue is enabled
|
* @return whether the queue is enabled
|
||||||
* @deprecated Use {@link EditSession#getReorderMode()} with MULTI_STAGE instead.
|
* @deprecated Use {@link EditSession#getReorderMode()} with MULTI_STAGE instead.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isQueueEnabled() {
|
public boolean isQueueEnabled() {
|
||||||
return true;
|
return true;
|
||||||
@ -444,7 +436,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
* Uses {@link ReorderMode#MULTI_STAGE}
|
* Uses {@link ReorderMode#MULTI_STAGE}
|
||||||
* @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with MULTI_STAGE instead.
|
* @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with MULTI_STAGE instead.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void enableQueue() {
|
public void enableQueue() {
|
||||||
super.enableQueue();
|
super.enableQueue();
|
||||||
@ -453,7 +444,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
/**
|
/**
|
||||||
* Disable the queue. This will close the queue.
|
* Disable the queue. This will close the queue.
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void disableQueue() {
|
public void disableQueue() {
|
||||||
super.disableQueue();
|
super.disableQueue();
|
||||||
@ -599,10 +589,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.history) {
|
if (this.history) {
|
||||||
if (this.changeTask == null) {
|
if (this.changeSet == null) {
|
||||||
throw new IllegalArgumentException("History was never provided, cannot enable");
|
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
|
* @param blockBag the block bag to set, or null to use none
|
||||||
*/
|
*/
|
||||||
public void setBlockBag(BlockBag blockBag) {
|
public void setBlockBag(BlockBag blockBag) {
|
||||||
|
//Not Supported in FAWE
|
||||||
throw new UnsupportedOperationException("TODO - this is never called anyway");
|
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
|
* @return {@code true} if any watchdog extent is enabled
|
||||||
*/
|
*/
|
||||||
public boolean isTickingWatchdog() {
|
public boolean isTickingWatchdog() {
|
||||||
/*
|
|
||||||
return watchdogExtents.stream().anyMatch(WatchdogTickingExtent::isEnabled);
|
return watchdogExtents.stream().anyMatch(WatchdogTickingExtent::isEnabled);
|
||||||
*/
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all watchdog extents to the given mode.
|
* Set all watchdog extents to the given mode.
|
||||||
*/
|
*/
|
||||||
public void setTickingWatchdog(boolean active) {
|
public void setTickingWatchdog(boolean active) {
|
||||||
/*
|
|
||||||
for (WatchdogTickingExtent extent : watchdogExtents) {
|
for (WatchdogTickingExtent extent : watchdogExtents) {
|
||||||
extent.setEnabled(active);
|
extent.setEnabled(active);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -777,7 +763,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
* @param maxY maximal height
|
* @param maxY maximal height
|
||||||
* @return height of highest block found or 'minY'
|
* @return height of highest block found or 'minY'
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
|
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
|
||||||
for (int y = maxY; y >= minY; --y) {
|
for (int y = maxY; y >= minY; --y) {
|
||||||
if (getBlock(x, y, z).getBlockType().getMaterial().isMovementBlocker()) {
|
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
|
* @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'
|
* @return height of highest block found or 'minY'
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) {
|
public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) {
|
||||||
for (int y = maxY; y >= minY; --y) {
|
for (int y = maxY; y >= minY; --y) {
|
||||||
if (filter.test(mutablebv.setComponents(x, y, z))) {
|
if (filter.test(mutablebv.setComponents(x, y, z))) {
|
||||||
|
@ -483,6 +483,7 @@ public class ClipboardCommands {
|
|||||||
} else {
|
} else {
|
||||||
actor.printInfo(TranslatableComponent.of("worldedit.paste.pasted", TextComponent.of(to.toString())));
|
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) {
|
private void checkPaste(Actor player, EditSession editSession, BlockVector3 to, ClipboardHolder holder, Clipboard clipboard) {
|
||||||
|
@ -12,7 +12,6 @@ import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
|||||||
import com.boydti.fawe.object.RegionWrapper;
|
import com.boydti.fawe.object.RegionWrapper;
|
||||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
@ -32,7 +31,6 @@ import com.sk89q.worldedit.util.Direction;
|
|||||||
import com.sk89q.worldedit.util.Identifiable;
|
import com.sk89q.worldedit.util.Identifiable;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||||
@ -48,13 +46,11 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.atomic.LongAdder;
|
import java.util.concurrent.atomic.LongAdder;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||||
import org.enginehub.piston.annotation.param.Switch;
|
import org.enginehub.piston.annotation.param.Switch;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Range;
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
@ -317,10 +313,7 @@ public class HistorySubCommands {
|
|||||||
player.setMeta(pageCommand, new SoftReference<>(list));
|
player.setMeta(pageCommand, new SoftReference<>(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
PaginationBox pages = PaginationBox.fromStrings("Edits:", pageCommand, list, new Function<Supplier<RollbackOptimizedHistory>, Component>() {
|
PaginationBox pages = PaginationBox.fromStrings("Edits:", pageCommand, list, input -> {
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Component apply(@Nullable Supplier<RollbackOptimizedHistory> input) {
|
|
||||||
RollbackOptimizedHistory edit = input.get();
|
RollbackOptimizedHistory edit = input.get();
|
||||||
UUID uuid = edit.getUUID();
|
UUID uuid = edit.getUUID();
|
||||||
int index = edit.getIndex();
|
int index = edit.getIndex();
|
||||||
@ -354,7 +347,6 @@ public class HistorySubCommands {
|
|||||||
elem = elem.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, infoCmd));
|
elem = elem.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, infoCmd));
|
||||||
|
|
||||||
return elem;
|
return elem;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
player.print(pages.create(page));
|
player.print(pages.create(page));
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ public class SchematicCommands {
|
|||||||
URI uri;
|
URI uri;
|
||||||
if (filename.startsWith("url:")) {
|
if (filename.startsWith("url:")) {
|
||||||
if (!actor.hasPermission("worldedit.schematic.load.web")) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
UUID uuid = UUID.fromString(filename.substring(4));
|
UUID uuid = UUID.fromString(filename.substring(4));
|
||||||
@ -250,7 +250,7 @@ public class SchematicCommands {
|
|||||||
}
|
}
|
||||||
} else {
|
} 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()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (format == null && filename.matches(".*\\.[\\w].*")) {
|
if (format == null && filename.matches(".*\\.[\\w].*")) {
|
||||||
@ -329,7 +329,7 @@ public class SchematicCommands {
|
|||||||
if (filename.contains("../")) {
|
if (filename.contains("../")) {
|
||||||
other = true;
|
other = true;
|
||||||
if (!actor.hasPermission("worldedit.schematic.save.other")) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (filename.startsWith("../")) {
|
if (filename.startsWith("../")) {
|
||||||
@ -347,7 +347,7 @@ public class SchematicCommands {
|
|||||||
}
|
}
|
||||||
if (other) {
|
if (other) {
|
||||||
if (!actor.hasPermission("worldedit.schematic.delete.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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -393,7 +393,7 @@ public class SchematicCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
ClipboardHolder clipboard = session.getClipboard();
|
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")) {
|
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,
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -829,7 +829,7 @@ public class SchematicCommands {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission("worldedit.schematic.delete.other")) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
if (!deleteFile(f)) {
|
if (!deleteFile(f)) {
|
||||||
|
@ -23,14 +23,11 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
|||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.Caption;
|
import com.boydti.fawe.config.Caption;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.DelegateConsumer;
|
import com.boydti.fawe.object.DelegateConsumer;
|
||||||
import com.boydti.fawe.object.function.QuadFunction;
|
import com.boydti.fawe.object.function.QuadFunction;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.image.ImageUtil;
|
import com.boydti.fawe.util.image.ImageUtil;
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
@ -45,6 +42,7 @@ import com.sk89q.worldedit.command.util.CreatureButcher;
|
|||||||
import com.sk89q.worldedit.command.util.EntityRemover;
|
import com.sk89q.worldedit.command.util.EntityRemover;
|
||||||
import com.sk89q.worldedit.command.util.Logging;
|
import com.sk89q.worldedit.command.util.Logging;
|
||||||
import com.sk89q.worldedit.command.util.PrintCommandHelp;
|
import com.sk89q.worldedit.command.util.PrintCommandHelp;
|
||||||
|
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||||
import com.sk89q.worldedit.command.util.annotation.SkipQueue;
|
import com.sk89q.worldedit.command.util.annotation.SkipQueue;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
@ -52,19 +50,16 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
import com.sk89q.worldedit.function.EntityFunction;
|
import com.sk89q.worldedit.function.EntityFunction;
|
||||||
|
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
|
||||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||||
import com.sk89q.worldedit.internal.expression.EvaluationException;
|
import com.sk89q.worldedit.internal.expression.EvaluationException;
|
||||||
import com.sk89q.worldedit.internal.expression.Expression;
|
import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||||
@ -72,6 +67,7 @@ import com.sk89q.worldedit.regions.Region;
|
|||||||
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
@ -81,8 +77,9 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap.SimpleEntry;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -91,7 +88,9 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
@ -713,11 +712,12 @@ public class UtilityCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Map.Entry<URI, String>> filesToEntry(final File root, final List<File> files, final UUID uuid) {
|
public static List<Map.Entry<URI, String>> filesToEntry(final File root, final List<File> files, final UUID uuid) {
|
||||||
return Lists.transform(files, input -> { // Keep this functional, as transform is evaluated lazily
|
return files.stream()
|
||||||
|
.map(input -> { // Keep this functional, as transform is evaluated lazily
|
||||||
URI uri = input.toURI();
|
URI uri = input.toURI();
|
||||||
String path = getPath(root, input, uuid);
|
String path = getPath(root, input, uuid);
|
||||||
return new AbstractMap.SimpleEntry<>(uri, path);
|
return new SimpleEntry<>(uri, path);
|
||||||
});
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum URIType {
|
public static enum URIType {
|
||||||
@ -728,7 +728,7 @@ public class UtilityCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Component> entryToComponent(File root, List<Map.Entry<URI, String>> entries, Function<URI, Boolean> isLoaded, QuadFunction<String, String, URIType, Boolean, Component> adapter) {
|
public static List<Component> entryToComponent(File root, List<Map.Entry<URI, String>> entries, Function<URI, Boolean> isLoaded, QuadFunction<String, String, URIType, Boolean, Component> adapter) {
|
||||||
return Lists.transform(entries, input -> {
|
return entries.stream().map(input -> {
|
||||||
URI uri = input.getKey();
|
URI uri = input.getKey();
|
||||||
String path = input.getValue();
|
String path = input.getValue();
|
||||||
|
|
||||||
@ -745,11 +745,13 @@ public class UtilityCommands {
|
|||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
type = URIType.DIRECTORY;
|
type = URIType.DIRECTORY;
|
||||||
} else {
|
} else {
|
||||||
if (name.indexOf('.') != -1) name = name.substring(0, name.lastIndexOf('.'));
|
if (name.indexOf('.') != -1)
|
||||||
|
name = name.substring(0, name.lastIndexOf('.'));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (!MainUtil.isInSubDirectory(root, file)) {
|
if (!MainUtil.isInSubDirectory(root, file)) {
|
||||||
throw new RuntimeException(new StopExecutionException(TextComponent.of("Invalid path")));
|
throw new RuntimeException(
|
||||||
|
new StopExecutionException(TextComponent.of("Invalid path")));
|
||||||
}
|
}
|
||||||
} catch (IOException ignore) {
|
} catch (IOException ignore) {
|
||||||
}
|
}
|
||||||
@ -760,7 +762,7 @@ public class UtilityCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return adapter.apply(name, path, type, loaded);
|
return adapter.apply(name, path, type, loaded);
|
||||||
});
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<File> getFiles(File dir, Actor actor, List<String> args, String formatName, boolean playerFolder, boolean oldFirst, boolean newFirst) {
|
public static List<File> getFiles(File dir, Actor actor, List<String> args, String formatName, boolean playerFolder, boolean oldFirst, boolean newFirst) {
|
||||||
@ -810,8 +812,7 @@ public class UtilityCommands {
|
|||||||
boolean listMine = false;
|
boolean listMine = false;
|
||||||
boolean listGlobal = !Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS;
|
boolean listGlobal = !Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS;
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
for (int i = 0; i < len; i++) {
|
for (String arg : args) {
|
||||||
String arg = args.get(i);
|
|
||||||
switch (arg.toLowerCase()) {
|
switch (arg.toLowerCase()) {
|
||||||
case "me":
|
case "me":
|
||||||
case "mine":
|
case "mine":
|
||||||
@ -831,7 +832,10 @@ public class UtilityCommands {
|
|||||||
if (arg.endsWith("/") || arg.endsWith(File.separator)) {
|
if (arg.endsWith("/") || arg.endsWith(File.separator)) {
|
||||||
arg = arg.replace("/", File.separator);
|
arg = arg.replace("/", File.separator);
|
||||||
String newDirFilter = dirFilter + arg;
|
String newDirFilter = dirFilter + arg;
|
||||||
boolean exists = new File(dir, newDirFilter).exists() || playerFolder && MainUtil.resolveRelative(new File(dir, actor.getUniqueId() + newDirFilter)).exists();
|
boolean exists =
|
||||||
|
new File(dir, newDirFilter).exists() || playerFolder && MainUtil
|
||||||
|
.resolveRelative(
|
||||||
|
new File(dir, actor.getUniqueId() + newDirFilter)).exists();
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
arg = arg.substring(0, arg.length() - File.separator.length());
|
arg = arg.substring(0, arg.length() - File.separator.length());
|
||||||
if (arg.length() > 3 && arg.length() <= 16) {
|
if (arg.length() > 3 && arg.length() <= 16) {
|
||||||
@ -843,8 +847,7 @@ public class UtilityCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dirFilter = newDirFilter;
|
dirFilter = newDirFilter;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
filters.add(arg);
|
filters.add(arg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -491,7 +491,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
if (brush == null) return false;
|
if (brush == null) return false;
|
||||||
|
|
||||||
if (current.setWorld(player.getWorld().getName()) && !current.canUse(player)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
try (EditSession editSession = session.createEditSession(player, current.toString())) {
|
try (EditSession editSession = session.createEditSession(player, current.toString())) {
|
||||||
|
@ -619,7 +619,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
@Override
|
@Override
|
||||||
public void checkPermission(String permission) throws AuthorizationException {
|
public void checkPermission(String permission) throws AuthorizationException {
|
||||||
if (!hasPermission(permission)) {
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ import java.io.Closeable;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
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);
|
return getParent().getBiomeType(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Iterator<BlockVector3> iterator() {
|
public Iterator<BlockVector3> iterator() {
|
||||||
OffsetBlockVector3 mutable = new OffsetBlockVector3(offset);
|
OffsetBlockVector3 mutable = new OffsetBlockVector3(offset);
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent.clipboard;
|
package com.sk89q.worldedit.extent.clipboard;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.boydti.fawe.beta.Filter;
|
import com.boydti.fawe.beta.Filter;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.clipboard.CPUOptimizedClipboard;
|
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.boydti.fawe.util.MaskTraverser;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
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.ExistingBlockMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
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.operation.Operations;
|
||||||
import com.sk89q.worldedit.function.visitor.Order;
|
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.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2;
|
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.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -63,13 +58,14 @@ import java.io.OutputStream;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies an object that implements something suitable as a "clipboard."
|
* Specifies an object that implements something suitable as a "clipboard."
|
||||||
*/
|
*/
|
||||||
public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||||
|
|
||||||
static Clipboard create(Region region) {
|
static Clipboard create(Region region) {
|
||||||
checkNotNull(region);
|
checkNotNull(region);
|
||||||
checkNotNull(region.getWorld(),
|
checkNotNull(region.getWorld(),
|
||||||
@ -120,10 +116,11 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
|||||||
void setOrigin(BlockVector3 origin);
|
void setOrigin(BlockVector3 origin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the clipboard has biome data. This can be checked since {@link Extent#getBiome(BlockVector2)}
|
* Returns true if the clipboard has biome data. This can be checked since {@link
|
||||||
* strongly suggests returning {@link com.sk89q.worldedit.world.biome.BiomeTypes#OCEAN} instead of {@code null}
|
* Extent#getBiome(BlockVector2)} strongly suggests returning {@link
|
||||||
* if biomes aren't present. However, it might not be desired to set areas to ocean if the clipboard is defaulting
|
* com.sk89q.worldedit.world.biome.BiomeTypes#OCEAN} instead of {@code null} if biomes aren't
|
||||||
* to ocean, instead of having biomes explicitly set.
|
* 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
|
* @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
|
* Remove entity from clipboard
|
||||||
* @param entity
|
|
||||||
*/
|
*/
|
||||||
void removeEntity(Entity entity);
|
void removeEntity(Entity entity);
|
||||||
|
|
||||||
@ -161,6 +157,8 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
|||||||
return order.create(getRegion());
|
return order.create(getRegion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NotNull
|
||||||
default Iterator<BlockVector3> iterator() {
|
default Iterator<BlockVector3> iterator() {
|
||||||
return getRegion().iterator();
|
return getRegion().iterator();
|
||||||
}
|
}
|
||||||
@ -173,35 +171,20 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default void paste(Extent other, BlockVector3 to) {
|
|
||||||
// TODO FIXME
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default <T extends Filter> T apply(Region region, T filter, boolean full) {
|
default <T extends Filter> T apply(Region region, T filter, boolean full) {
|
||||||
if (region.equals(getRegion())) {
|
if (region.equals(getRegion())) {
|
||||||
return apply(this, filter);
|
return apply(this, filter);
|
||||||
} else {
|
|
||||||
return apply((Iterable<BlockVector3>) region, filter);
|
|
||||||
}
|
}
|
||||||
|
return apply(region, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void close() {
|
default void close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Utility methods
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forwards to paste(world, to, true, true, null)
|
* Forwards to paste(world, to, true, true, null)
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param to
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
default EditSession paste(World world, BlockVector3 to) {
|
default EditSession paste(World world, BlockVector3 to) {
|
||||||
return paste(world, to, true, true, null);
|
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
|
* Save this schematic to a stream
|
||||||
*
|
|
||||||
* @param stream
|
|
||||||
* @param format
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
default void save(OutputStream stream, ClipboardFormat format) throws IOException {
|
default void save(OutputStream stream, ClipboardFormat format) throws IOException {
|
||||||
checkNotNull(stream);
|
checkNotNull(stream);
|
||||||
@ -242,13 +221,6 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste this schematic in a world
|
* 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,
|
default EditSession paste(World world, BlockVector3 to, boolean allowUndo, boolean pasteAir,
|
||||||
boolean copyEntities, @Nullable Transform transform) {
|
boolean copyEntities, @Nullable Transform transform) {
|
||||||
@ -298,12 +270,14 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
|||||||
return editSession;
|
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;
|
Extent source = this;
|
||||||
if (transform != null && !transform.isIdentity()) {
|
if (transform != null && !transform.isIdentity()) {
|
||||||
source = new BlockTransformExtent(this, transform);
|
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) {
|
if (transform != null) {
|
||||||
copy.setTransform(transform);
|
copy.setTransform(transform);
|
||||||
}
|
}
|
||||||
@ -345,6 +319,9 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
|||||||
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
|
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (pos.getY() < 0) {
|
||||||
|
throw new RuntimeException("Y-Position cannot be less than 0!");
|
||||||
|
}
|
||||||
extent.setBlock(xx, pos.getY() + rely, zz, block);
|
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)
|
// Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin)
|
||||||
|
@ -170,7 +170,7 @@ public class ClipboardFormats {
|
|||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
if (input.startsWith("url:")) {
|
if (input.startsWith("url:")) {
|
||||||
if (!player.hasPermission("worldedit.schematic.load.web")) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
URL base = new URL(Settings.IMP.WEB.URL);
|
URL base = new URL(Settings.IMP.WEB.URL);
|
||||||
@ -178,7 +178,7 @@ public class ClipboardFormats {
|
|||||||
}
|
}
|
||||||
if (input.startsWith("http")) {
|
if (input.startsWith("http")) {
|
||||||
if (!player.hasPermission("worldedit.schematic.load.asset")) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
URL url = new URL(input);
|
URL url = new URL(input);
|
||||||
@ -190,7 +190,7 @@ public class ClipboardFormats {
|
|||||||
return loadAllFromUrl(url);
|
return loadAllFromUrl(url);
|
||||||
} else {
|
} 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 (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;
|
return null;
|
||||||
}
|
}
|
||||||
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
||||||
@ -210,7 +210,7 @@ public class ClipboardFormats {
|
|||||||
}
|
}
|
||||||
} else {
|
} 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 (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;
|
return null;
|
||||||
}
|
}
|
||||||
if (format == null && input.matches(".*\\.[\\w].*")) {
|
if (format == null && input.matches(".*\\.[\\w].*")) {
|
||||||
|
@ -262,9 +262,7 @@ public class BlockMaskBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockMaskBuilder addAll() {
|
public BlockMaskBuilder addAll() {
|
||||||
for (int i = 0; i < bitSets.length; i++) {
|
Arrays.fill(bitSets, ALL);
|
||||||
bitSets[i] = ALL;
|
|
||||||
}
|
|
||||||
reset(true);
|
reset(true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -275,9 +273,7 @@ public class BlockMaskBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockMaskBuilder clear() {
|
public BlockMaskBuilder clear() {
|
||||||
for (int i = 0; i < bitSets.length; i++) {
|
Arrays.fill(bitSets, null);
|
||||||
bitSets[i] = null;
|
|
||||||
}
|
|
||||||
reset(true);
|
reset(true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -19,23 +19,18 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util.formatting.component;
|
package com.sk89q.worldedit.util.formatting.component;
|
||||||
|
|
||||||
import com.boydti.fawe.object.collection.AdaptedSetCollection;
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class PaginationBox extends MessageBox {
|
public abstract class PaginationBox extends MessageBox {
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"fawe.worldedit.history.find.element": "&8 - &2{0}: {1} &7ago &3{2}m &6{3} &c/{4}",
|
"fawe.worldedit.history.find.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.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.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.set.region": "Selection set to your current allowed region",
|
||||||
|
|
||||||
@ -216,7 +216,7 @@
|
|||||||
|
|
||||||
"fawe.worldedit.cycler.block.cycler.cannot.cycle": "That block's data cannot be cycled!",
|
"fawe.worldedit.cycler.block.cycler.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.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).",
|
"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.progress.progress.finished": "[ Done! ]",
|
||||||
|
|
||||||
"fawe.error.command.syntax": "Usage: {0}",
|
"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.block.not.allowed": "You are not allowed to use",
|
||||||
"fawe.error.setting.disable": "Lacking setting: {0}",
|
"fawe.error.setting.disable": "Lacking setting: {0}",
|
||||||
"fawe.error.brush.not.found": "Available brushes: {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.list": "For a list of selection types use: //sel list",
|
||||||
"fawe.selection.sel.modes": "Select one of the modes below:",
|
"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.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.sel.list": "Tip: See the different selection modes with //sel list",
|
||||||
"fawe.tips.tip.select.connected": "Tip: Select all connected blocks with //sel fuzzy",
|
"fawe.tips.tip.select.connected": "Tip: Select all connected blocks with //sel fuzzy",
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren