mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
fix dependencies
This commit is contained in:
@ -1,129 +0,0 @@
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("eclipse")
|
||||
id("idea")
|
||||
id("net.ltgt.apt") version "0.21" apply false
|
||||
id "net.ltgt.apt-eclipse" version "0.21"
|
||||
id "net.ltgt.apt-idea" version "0.21"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/"}
|
||||
}
|
||||
|
||||
configurations.all { Configuration it ->
|
||||
it.resolutionStrategy { ResolutionStrategy rs ->
|
||||
rs.force("com.google.guava:guava:21.0")
|
||||
}
|
||||
it.resolutionStrategy { ResolutionStrategy rs ->
|
||||
rs.force("it.unimi.dsi:fastutil:8.2.1")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':worldedit-libs:core')
|
||||
compile 'de.schlichtherle:truezip:6.8.3'
|
||||
compile 'rhino:js:1.7R2'
|
||||
compile 'org.yaml:snakeyaml:1.23'
|
||||
compile 'com.google.guava:guava:21.0'
|
||||
compile 'com.google.code.findbugs:jsr305:1.3.9'
|
||||
compile 'com.thoughtworks.paranamer:paranamer:2.6'
|
||||
compile 'com.google.code.gson:gson:2.8.0'
|
||||
compile 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||
compile 'org.slf4j:slf4j-api:1.7.26'
|
||||
compile "it.unimi.dsi:fastutil:8.2.1"
|
||||
|
||||
compileOnly project(':worldedit-libs:core:ap')
|
||||
annotationProcessor project(':worldedit-libs:core:ap')
|
||||
annotationProcessor "com.google.guava:guava:21.0"
|
||||
def avVersion = "1.6.5"
|
||||
compileOnly "com.google.auto.value:auto-value-annotations:$avVersion"
|
||||
annotationProcessor "com.google.auto.value:auto-value:$avVersion"
|
||||
//compile 'net.sf.trove4j:trove4j:3.0.3'
|
||||
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
|
||||
|
||||
// Fawe depends
|
||||
compileOnly 'net.fabiozumbi12:redprotect:1.9.6'
|
||||
compileOnly ("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
|
||||
transitive = false
|
||||
}
|
||||
compile 'com.mojang:datafixerupper:1.0.20'
|
||||
compile 'com.github.luben:zstd-jni:1.1.1'
|
||||
compile 'co.aikar:fastutil-lite:1.0'
|
||||
testImplementation ("org.junit.jupiter:junit-jupiter-api:5.5.0")
|
||||
testImplementation ("org.junit.jupiter:junit-jupiter-params:5.5.0")
|
||||
testImplementation ("org.mockito:mockito-core:3.0.0")
|
||||
testImplementation ("org.mockito:mockito-junit-jupiter:3.0.0")
|
||||
testRuntime ("org.junit.jupiter:junit-jupiter-engine:5.5.0")
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
dependsOn(":worldedit-libs:build")
|
||||
it.options.compilerArgs << "-Xmaxerrs" << "10000"
|
||||
it.options.compilerArgs.add("-Aarg.name.key.prefix=")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/main/java'
|
||||
srcDir 'src/legacy/java'
|
||||
}
|
||||
resources {
|
||||
srcDir 'src/main/resources'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
from('src/main/resources') {
|
||||
include 'fawe.properties'
|
||||
expand(
|
||||
version: "${project.parent.version}",
|
||||
name: project.parent.name,
|
||||
commit: "${git.head().abbreviatedId}",
|
||||
date: "${git.head().getDate().format("yy.MM.dd")}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
jar.archiveName="fawe-api-${project.parent.version}.jar"
|
||||
jar.destinationDir = file '../mvn/com/boydti/fawe-api/' + project.parent.version
|
||||
task createPom {
|
||||
doLast {
|
||||
pom {
|
||||
project {
|
||||
groupId 'com.boydti'
|
||||
artifactId 'fawe-api'
|
||||
version project.parent.version
|
||||
}
|
||||
}
|
||||
.getEffectivePom()
|
||||
.setDependencies(new ArrayList<>())
|
||||
.writeTo("../mvn/com/boydti/fawe-api/${project.parent.version}/fawe-api-${project.parent.version}.pom")
|
||||
pom {
|
||||
project {
|
||||
groupId 'com.boydti'
|
||||
artifactId 'fawe-api'
|
||||
version 'latest'
|
||||
}
|
||||
}
|
||||
.getEffectivePom()
|
||||
.setDependencies(new ArrayList<>())
|
||||
.writeTo("../mvn/com/boydti/fawe-api/latest/fawe-api-latest.pom")
|
||||
}
|
||||
}
|
||||
task copyFiles {
|
||||
doLast {
|
||||
copy {
|
||||
from "../mvn/com/boydti/fawe-api/${project.parent.version}/"
|
||||
into '../mvn/com/boydti/fawe-api/latest/'
|
||||
include('*.jar')
|
||||
rename ("fawe-api-${project.parent.version}.jar", 'fawe-api-latest.jar')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn(shadowJar)
|
||||
build.finalizedBy(copyFiles)
|
||||
copyFiles.dependsOn(createPom)
|
72
worldedit-core/build.gradle.kts
Normal file
72
worldedit-core/build.gradle.kts
Normal file
@ -0,0 +1,72 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("net.ltgt.apt-eclipse")
|
||||
id("net.ltgt.apt-idea")
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force("com.google.guava:guava:21.0")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"compile"(project(":worldedit-libs:core"))
|
||||
"compile"("de.schlichtherle:truezip:6.8.3")
|
||||
"compile"("rhino:js:1.7R2")
|
||||
"compile"("org.yaml:snakeyaml:1.23")
|
||||
"compile"("com.google.guava:guava:21.0")
|
||||
"compile"("com.google.code.findbugs:jsr305:3.0.2")
|
||||
"compile"("com.google.code.gson:gson:2.8.0")
|
||||
"compile"("org.slf4j:slf4j-api:1.7.26")
|
||||
"compile"("it.unimi.dsi:fastutil:8.2.1")
|
||||
"compile"("com.googlecode.json-simple:json-simple:1.1.1") { isTransitive = false }
|
||||
"compileOnly"(project(":worldedit-libs:core:ap"))
|
||||
"annotationProcessor"(project(":worldedit-libs:core:ap"))
|
||||
// ensure this is on the classpath for the AP
|
||||
"annotationProcessor"("com.google.guava:guava:21.0")
|
||||
"compileOnly"("com.google.auto.value:auto-value-annotations:${Versions.AUTO_VALUE}")
|
||||
"annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}")
|
||||
"compile"("co.aikar:fastutil-lite:1.0")
|
||||
"compile"("com.github.luben:zstd-jni:1.4.3-1")
|
||||
//"compile"("com.mojang:datafixerupper:1.0.20")
|
||||
"compileOnly"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
|
||||
isTransitive = false
|
||||
}
|
||||
"compileOnly"("net.fabiozumbi12:redprotect:1.9.6")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
dependsOn(":worldedit-libs:build")
|
||||
options.compilerArgs.add("-Aarg.name.key.prefix=")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir("src/main/java")
|
||||
srcDir("src/legacy/java")
|
||||
}
|
||||
resources {
|
||||
srcDir("src/main/resources")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
filesMatching("fawe.properties") {
|
||||
expand("version" to "$version",
|
||||
"commit" to "${rootProject.ext["revision"]}",
|
||||
"date" to "${rootProject.ext["date"]}")
|
||||
}
|
||||
}
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
dependencies {
|
||||
include(dependency("com.github.luben:zstd-jni:1.4.3-1"))
|
||||
|
||||
}
|
||||
}
|
@ -159,11 +159,6 @@ public interface IDelegateQueueExtent extends IQueueExtent {
|
||||
return getParent().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
default void sendChunk(int chunkX, int chunkZ, int bitMask) {
|
||||
getParent().sendChunk(chunkX, chunkZ, bitMask);
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean trim(boolean aggressive) {
|
||||
return getParent().trim(aggressive);
|
||||
|
@ -182,14 +182,4 @@ public interface IQueueExtent extends Flushable, Trimable, Extent {
|
||||
* @return If queue is empty
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Refresh a specific chunk with a bitMask (0 = default, 65535 = all block sections)
|
||||
* Note: only 0 is guaranteed to send all tiles / entities
|
||||
* Note: Only 65535 is guaranteed to send all blocks
|
||||
* @param chunkX
|
||||
* @param chunkZ
|
||||
* @param bitMask
|
||||
*/
|
||||
void sendChunk(int chunkX, int chunkZ, int bitMask);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.beta.implementation;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
@ -213,7 +214,9 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract IQueueExtent create();
|
||||
public IQueueExtent create() {
|
||||
return new SingleThreadQueueExtent();
|
||||
}
|
||||
|
||||
public abstract void startSet(boolean parallel);
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
package com.boydti.fawe.beta.implementation;
|
||||
|
||||
import com.boydti.fawe.beta.CharFilterBlock;
|
||||
import com.boydti.fawe.beta.ChunkFilterBlock;
|
||||
|
||||
public abstract class SimpleCharQueueExtent extends SingleThreadQueueExtent {
|
||||
|
||||
@Override
|
||||
public ChunkFilterBlock initFilterBlock() {
|
||||
return new CharFilterBlock(this);
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.boydti.fawe.beta.implementation;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.CharFilterBlock;
|
||||
import com.boydti.fawe.beta.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
@ -25,7 +27,7 @@ import java.util.concurrent.Future;
|
||||
* <p>
|
||||
* This queue is reusable {@link #init(IChunkCache)}
|
||||
*/
|
||||
public abstract class SingleThreadQueueExtent implements IQueueExtent {
|
||||
public class SingleThreadQueueExtent implements IQueueExtent {
|
||||
|
||||
// // Pool discarded chunks for reuse (can safely be cleared by another thread)
|
||||
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
|
||||
@ -299,4 +301,9 @@ public abstract class SingleThreadQueueExtent implements IQueueExtent {
|
||||
pollSubmissions(0, true);
|
||||
reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkFilterBlock initFilterBlock() {
|
||||
return new CharFilterBlock(this);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class CFICommand extends CommandProcessor<Object, Object> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object process(InjectedValueAccess context, List<String> args, Object result) {
|
||||
public int process(InjectedValueAccess context, List<String> args, int result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -67,13 +67,13 @@ public abstract class CommandProcessor<I, O> implements CommandManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final O /* Need to recompile with FAWE-piston */ execute(InjectedValueAccess context, List<String> args) {
|
||||
public final int execute(InjectedValueAccess context, List<String> args) {
|
||||
args = preprocess(context, args);
|
||||
if (args != null) {
|
||||
I result = (I) parent.execute(context, args);
|
||||
int result = parent.execute(context, args);
|
||||
return process(context, args, result); // TODO NOT IMPLEMENTED (recompile piston)
|
||||
} else {
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,5 +89,5 @@ public abstract class CommandProcessor<I, O> implements CommandManager {
|
||||
|
||||
public abstract List<String> preprocess(InjectedValueAccess context, List<String> args);
|
||||
|
||||
public abstract O process(InjectedValueAccess context, List<String> args, I result);
|
||||
}
|
||||
public abstract int process(InjectedValueAccess context, List<String> args, int result);
|
||||
}
|
||||
|
@ -2,9 +2,7 @@ package com.boydti.fawe.object.brush.visualization.cfi;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IBlocks;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.implementation.FallbackChunkGet;
|
||||
import com.boydti.fawe.object.FaweInputStream;
|
||||
@ -16,7 +14,6 @@ import com.boydti.fawe.object.change.StreamChange;
|
||||
import com.boydti.fawe.object.changeset.CFIChangeSet;
|
||||
import com.boydti.fawe.object.collection.DifferentialArray;
|
||||
import com.boydti.fawe.object.collection.DifferentialBlockBuffer;
|
||||
import com.boydti.fawe.object.collection.IterableThreadLocal;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVector2DSet;
|
||||
import com.boydti.fawe.object.collection.SummedAreaTable;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
@ -47,14 +44,16 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -64,9 +63,7 @@ import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
// TODO FIXME
|
||||
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable, VirtualWorld {
|
||||
@ -321,6 +318,11 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChunk(int X, int Z, int mask) {
|
||||
throw new UnsupportedOperationException("TODO NOT IMPLEMENTED"); // add method to adapter to send custom chunk
|
||||
}
|
||||
|
||||
public TextureUtil getRawTextureUtil() {
|
||||
if (textureUtil == null) {
|
||||
textureUtil = Fawe.get().getTextureUtil();
|
||||
@ -849,7 +851,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
@Override
|
||||
public void close(boolean update) {
|
||||
if (chunkOffset != null && player != null && update) {
|
||||
IQueueExtent packetQueue = Fawe.get().getQueueHandler().getQueue(player.getWorld());
|
||||
World world = player.getWorld();
|
||||
|
||||
int lenCX = (getWidth() + 15) >> 4;
|
||||
int lenCZ = (getLength() + 15) >> 4;
|
||||
@ -868,7 +870,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
|
||||
for (int cz = scz; cz <= ecz; cz++) {
|
||||
for (int cx = scx; cx <= ecx; cx++) {
|
||||
packetQueue.sendChunk(cx + OX, cz + OZ, 0);
|
||||
world.sendChunk(cx + OX, cz + OZ, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
|
||||
@Override
|
||||
public void refreshChunk(int x, int z) {
|
||||
IMP.sendChunk(x, z, 0);
|
||||
world.sendChunk(x, z, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,9 +59,9 @@ public class PlotSetBiome extends Command {
|
||||
Collection<BiomeType> knownBiomes = BiomeTypes.values();
|
||||
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
|
||||
if (biome == null) {
|
||||
String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s());
|
||||
String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.toString());
|
||||
Captions.NEED_BIOME.send(player);
|
||||
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes);
|
||||
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.toString() + biomes);
|
||||
return;
|
||||
}
|
||||
confirm.run(this, new Runnable() {
|
||||
|
@ -34,9 +34,9 @@ import com.sk89q.worldedit.command.ChunkCommands;
|
||||
import com.sk89q.worldedit.command.ClipboardCommands;
|
||||
import com.sk89q.worldedit.command.GenerationCommands;
|
||||
import com.sk89q.worldedit.command.HistoryCommands;
|
||||
import com.sk89q.worldedit.command.MaskCommands;
|
||||
//import com.sk89q.worldedit.command.MaskCommands;
|
||||
import com.sk89q.worldedit.command.NavigationCommands;
|
||||
import com.sk89q.worldedit.command.PatternCommands;
|
||||
//import com.sk89q.worldedit.command.PatternCommands;
|
||||
import com.sk89q.worldedit.command.RegionCommands;
|
||||
import com.sk89q.worldedit.command.SchematicCommands;
|
||||
import com.sk89q.worldedit.command.ScriptingCommands;
|
||||
@ -45,7 +45,7 @@ import com.sk89q.worldedit.command.SnapshotCommands;
|
||||
import com.sk89q.worldedit.command.SnapshotUtilCommands;
|
||||
import com.sk89q.worldedit.command.SuperPickaxeCommands;
|
||||
import com.sk89q.worldedit.command.ToolCommands;
|
||||
import com.sk89q.worldedit.command.TransformCommands;
|
||||
//import com.sk89q.worldedit.command.TransformCommands;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -127,9 +127,9 @@ public final class DocumentationPrinter {
|
||||
writePermissionsWikiTable(stream, builder, "/", BrushOptionsCommands.class);
|
||||
writePermissionsWikiTable(stream, builder, "/tool ", ToolCommands.class);
|
||||
writePermissionsWikiTable(stream, builder, "/brush ", BrushCommands.class);
|
||||
writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks");
|
||||
writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns");
|
||||
writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms");
|
||||
//writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks");
|
||||
//writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns");
|
||||
//writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms");
|
||||
writePermissionsWikiTable(stream, builder, "/cfi ", CFICommands.class, "Create From Image");
|
||||
stream.println();
|
||||
stream.print("#### Uncategorized\n");
|
||||
|
@ -0,0 +1,27 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class RegionCacheUtil {
|
||||
public RegionCacheUtil() {
|
||||
|
||||
}
|
||||
|
||||
public void cache(Region region) {
|
||||
Iterator<BlockVector3> iter = region.iterator();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
TaskManager.IMP.async(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -228,6 +228,11 @@ public class WorldWrapper extends AbstractWorld {
|
||||
return parent.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChunk(int X, int Z, int mask) {
|
||||
parent.sendChunk(X, Z, mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(final Region region) {
|
||||
return TaskManager.IMP.sync(new RunnableVal<List<? extends Entity>>() {
|
||||
|
@ -26,8 +26,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class CommandContext {
|
||||
|
||||
@ -256,8 +254,11 @@ public class CommandContext {
|
||||
}
|
||||
|
||||
public String getString(int start, int end) {
|
||||
return IntStream.range(start + 1, end + 1).mapToObj(i -> " " + parsedArgs.get(i))
|
||||
.collect(Collectors.joining("", parsedArgs.get(start), ""));
|
||||
StringBuilder buffer = new StringBuilder(parsedArgs.get(start));
|
||||
for (int i = start + 1; i < end + 1; ++i) {
|
||||
buffer.append(" ").append(parsedArgs.get(i));
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public int getInteger(int index) throws NumberFormatException {
|
||||
|
@ -72,6 +72,7 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Countable;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Identifiable;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -395,7 +396,7 @@ public class LocalSession implements TextureHolder {
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized void remember(Player player, World world, ChangeSet changeSet, FaweLimit limit) {
|
||||
public synchronized void remember(Identifiable player, World world, ChangeSet changeSet, FaweLimit limit) {
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
||||
}
|
||||
@ -438,7 +439,7 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void remember(final EditSession editSession, final boolean append, int limitMb) {
|
||||
public synchronized void remember(EditSession editSession, boolean append, int limitMb) {
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import org.mozilla.javascript.NativeJavaObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -109,7 +108,8 @@ public final class WorldEdit {
|
||||
private final PlatformManager platformManager = new PlatformManager(this);
|
||||
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
|
||||
private final SessionManager sessions = new SessionManager(this);
|
||||
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20));;
|
||||
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(
|
||||
EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s"));
|
||||
private final Supervisor supervisor = new SimpleSupervisor();
|
||||
|
||||
private final BlockFactory blockFactory = new BlockFactory(this);
|
||||
@ -635,14 +635,14 @@ public final class WorldEdit {
|
||||
* @param args arguments for the script
|
||||
* @throws WorldEditException
|
||||
*/
|
||||
public Object runScript(Player player, File f, String[] args) throws WorldEditException {
|
||||
public void runScript(Player player, File f, String[] args) throws WorldEditException {
|
||||
String filename = f.getPath();
|
||||
int index = filename.lastIndexOf('.');
|
||||
String ext = filename.substring(index + 1);
|
||||
|
||||
if (!ext.equalsIgnoreCase("js")) {
|
||||
player.printError("Only .js scripts are currently supported");
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
String script;
|
||||
@ -655,7 +655,7 @@ public final class WorldEdit {
|
||||
|
||||
if (file == null) {
|
||||
player.printError("Script does not exist: " + filename);
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
file = new FileInputStream(f);
|
||||
@ -668,7 +668,7 @@ public final class WorldEdit {
|
||||
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
player.printError("Script read error: " + e.getMessage());
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
LocalSession session = getSessionManager().get(player);
|
||||
@ -681,8 +681,8 @@ public final class WorldEdit {
|
||||
engine = new RhinoCraftScriptEngine();
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
player.printError("Failed to find an installed script engine.");
|
||||
player.printError("Please see https://worldedit.readthedocs.io/en/latest/usage/other/craftscripts/");
|
||||
return null;
|
||||
player.printError("Please see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/");
|
||||
return;
|
||||
}
|
||||
|
||||
engine.setTimeLimit(getConfiguration().scriptTimeout);
|
||||
@ -693,11 +693,7 @@ public final class WorldEdit {
|
||||
vars.put("player", player);
|
||||
|
||||
try {
|
||||
Object result = engine.evaluate(script, filename, vars);
|
||||
if (result instanceof NativeJavaObject) {
|
||||
result = ((NativeJavaObject) result).unwrap();
|
||||
}
|
||||
return result;
|
||||
engine.evaluate(script, filename, vars);
|
||||
} catch (ScriptException e) {
|
||||
player.printError("Failed to execute:");
|
||||
player.printRaw(e.getMessage());
|
||||
@ -714,7 +710,6 @@ public final class WorldEdit {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,6 +53,7 @@ import com.boydti.fawe.object.brush.StencilBrush;
|
||||
import com.boydti.fawe.object.brush.SurfaceSphereBrush;
|
||||
import com.boydti.fawe.object.brush.SurfaceSpline;
|
||||
import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap;
|
||||
import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap.Shape;
|
||||
import com.boydti.fawe.object.brush.sweep.SweepBrush;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
@ -152,11 +153,11 @@ public class BrushCommands {
|
||||
"Pic: https://i.imgur.com/cNUQUkj.png -> https://i.imgur.com/hFOFsNf.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.blendball")
|
||||
public BrushSettings blendBallBrush(Player player, LocalSession session,
|
||||
public void blendBallBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new BlendBall()).setSize(radius);
|
||||
set(session, context, new BlendBall()).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -164,11 +165,11 @@ public class BrushCommands {
|
||||
desc = "Erodes terrain"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.erode")
|
||||
public BrushSettings erodeBrush(Player player, LocalSession session,
|
||||
public void erodeBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius for eroding", def = "5")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new ErodeBrush()).setSize(radius);
|
||||
set(session, context, new ErodeBrush()).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -176,11 +177,11 @@ public class BrushCommands {
|
||||
desc = "Pull terrain towards you"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.pull")
|
||||
public BrushSettings pullBrush(Player player, LocalSession session,
|
||||
public void pullBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new RaiseBrush()).setSize(radius);
|
||||
set(session, context, new RaiseBrush()).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -188,11 +189,11 @@ public class BrushCommands {
|
||||
desc = "Creates a circle which revolves around your facing direction"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.sphere")
|
||||
public BrushSettings circleBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
public void circleBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new CircleBrush(player)).setSize(radius).setFill(fill);
|
||||
set(session, context, new CircleBrush(player)).setSize(radius).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -203,18 +204,15 @@ public class BrushCommands {
|
||||
"Note: Set a mask to recurse along specific blocks"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.recursive")
|
||||
public BrushSettings recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
|
||||
public void recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius,
|
||||
@Switch(name = 'd', desc = "Apply in depth first order")
|
||||
boolean depthFirst,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
new RecurseBrush(depthFirst))
|
||||
.setSize(radius)
|
||||
.setFill(fill)
|
||||
.setMask(new IdMask(editSession));
|
||||
set(session, context, new RecurseBrush(depthFirst))
|
||||
.setSize(radius).setFill(fill).setMask(new IdMask(editSession));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -223,7 +221,7 @@ public class BrushCommands {
|
||||
desc = "Create lines"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.line")
|
||||
public BrushSettings lineBrush(Player player, LocalSession session, Pattern fill,
|
||||
public void lineBrush(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius,
|
||||
@Switch(name = 'h', desc = "Create only a shell")
|
||||
@ -233,10 +231,7 @@ public class BrushCommands {
|
||||
@Switch(name = 'f', desc = "Create a flat line")
|
||||
boolean flat, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
new LineBrush(shell, select, flat))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
set(session, context, new LineBrush(shell, select, flat)).setSize(radius).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -250,12 +245,12 @@ public class BrushCommands {
|
||||
"Tutorial: https://www.planetminecraft.com/blog/fawe-tutorial/"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.spline")
|
||||
public BrushSettings splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
public void splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "25")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
player.print(BBC.BRUSH_SPLINE.format(radius));
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new SplineBrush(player, session))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -270,9 +265,9 @@ public class BrushCommands {
|
||||
"Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.sweep")
|
||||
public BrushSettings sweepBrush(Player player, LocalSession session, @Arg(name = "copies", desc = "int", def = "-1") int copies, InjectedValueAccess context) throws WorldEditException {
|
||||
public void sweepBrush(Player player, LocalSession session, @Arg(name = "copies", desc = "int", def = "-1") int copies, InjectedValueAccess context) throws WorldEditException {
|
||||
player.print(BBC.BRUSH_SPLINE.s());
|
||||
return set(session, context, new SweepBrush(copies));
|
||||
set(session, context, new SweepBrush(copies));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -281,7 +276,7 @@ public class BrushCommands {
|
||||
desc = "Create a hanging line between two points"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.spline")
|
||||
public BrushSettings catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min = 1) double lengthFactor,
|
||||
public void catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min = 1) double lengthFactor,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius,
|
||||
@Switch(name = 'h', desc = "Create only a shell")
|
||||
@ -293,7 +288,7 @@ public class BrushCommands {
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new CatenaryBrush(shell, select, facingDirection, lengthFactor))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -307,12 +302,12 @@ public class BrushCommands {
|
||||
"Video: https://www.youtube.com/watch?v=zSN-2jJxXlM"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0,
|
||||
public BrushSettings surfaceSpline(Player player, LocalSession session, Pattern fill,
|
||||
public void surfaceSpline(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius, @Arg(name = "tension", desc = "double", def = "0") double tension, @Arg(name = "bias", desc = "double", def = "0") double bias, @Arg(name = "continuity", desc = "double", def = "0") double continuity, @Arg(name = "quality", desc = "double", def = "10") double quality, InjectedValueAccess context) throws WorldEditException {
|
||||
player.print(BBC.BRUSH_SPLINE.format(radius));
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new SurfaceSpline(tension, bias, continuity, quality))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -324,14 +319,11 @@ public class BrushCommands {
|
||||
desc = "Creates a distorted sphere"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.rock")
|
||||
public BrushSettings blobBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Vector3", def = "10") Vector3 radius, @Arg(name = "sphericity", desc = "double", def = "100") double sphericity, @Arg(name = "frequency", desc = "double", def = "30") double frequency, @Arg(name = "amplitude", desc = "double", def = "50") double amplitude, InjectedValueAccess context) throws WorldEditException {
|
||||
public void blobBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Vector3", def = "10") Vector3 radius, @Arg(name = "sphericity", desc = "double", def = "100") double sphericity, @Arg(name = "frequency", desc = "double", def = "30") double frequency, @Arg(name = "amplitude", desc = "double", def = "50") double amplitude, InjectedValueAccess context) throws WorldEditException {
|
||||
double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
|
||||
worldEdit.checkMaxBrushRadius(max);
|
||||
Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100);
|
||||
return set(session, context,
|
||||
brush)
|
||||
.setSize(max)
|
||||
.setFill(fill);
|
||||
set(session, context, brush).setSize(max).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -340,7 +332,7 @@ public class BrushCommands {
|
||||
desc = "Choose the sphere brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.sphere")
|
||||
public BrushSettings sphereBrush(Player player, LocalSession session,
|
||||
public void sphereBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The radius of the sphere", def = "2")
|
||||
@ -370,7 +362,7 @@ public class BrushCommands {
|
||||
}
|
||||
|
||||
}
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius)
|
||||
.setFill(pattern);
|
||||
@ -384,12 +376,12 @@ public class BrushCommands {
|
||||
"Pic: https://i.imgur.com/2xKsZf2.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.shatter")
|
||||
public BrushSettings shatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
public void shatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "10")
|
||||
Expression radius,
|
||||
@Arg(desc = "Lines", def = "10") int count, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new ShatterBrush(count))
|
||||
.setSize(radius)
|
||||
.setFill(fill)
|
||||
@ -402,7 +394,7 @@ public class BrushCommands {
|
||||
descFooter = "Use a height map to paint any surface.\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public BrushSettings stencilBrush(Player player, LocalSession session, Pattern fill,
|
||||
public void stencilBrush(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(name = "image", desc = "String", def = "") String image,
|
||||
@Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation,
|
||||
@ -421,7 +413,7 @@ public class BrushCommands {
|
||||
if (randomRotate) {
|
||||
brush.setRandomRotate(true);
|
||||
}
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -433,7 +425,7 @@ public class BrushCommands {
|
||||
desc = "Use a height map to paint a surface",
|
||||
descFooter = "Use a height map to paint any surface.\n")
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public BrushSettings imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
public void imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
ProvideBindings.ImageUri imageUri,
|
||||
@Arg(def = "1", desc = "scale height") @Range(min = Double.MIN_NORMAL) double yscale,
|
||||
@Switch(name = 'a', desc = "Use image Alpha") boolean alpha,
|
||||
@ -450,7 +442,7 @@ public class BrushCommands {
|
||||
alpha = true;
|
||||
}
|
||||
ImageBrush brush = new ImageBrush(image, session, alpha);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -464,12 +456,12 @@ public class BrushCommands {
|
||||
"The -r flag will apply random rotation"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.surface")
|
||||
public BrushSettings surfaceBrush(LocalSession session, Pattern fill,
|
||||
public void surfaceBrush(LocalSession session, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
Expression radius,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
|
||||
set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -479,7 +471,7 @@ public class BrushCommands {
|
||||
"Video: https://youtu.be/RPZIaTbqoZw?t=34s"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scatter")
|
||||
public BrushSettings scatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double pointsOpt, @Arg(name = "distance", desc = "double", def = "1") double distanceOpt, @Switch(name = 'o', desc = "Overlay the block") boolean overlay, InjectedValueAccess context) throws WorldEditException {
|
||||
public void scatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double pointsOpt, @Arg(name = "distance", desc = "double", def = "1") double distanceOpt, @Switch(name = 'o', desc = "Overlay the block") boolean overlay, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
Brush brush;
|
||||
if (overlay) {
|
||||
@ -487,7 +479,7 @@ public class BrushCommands {
|
||||
} else {
|
||||
brush = new ScatterBrush((int) pointsOpt, (int) distanceOpt);
|
||||
}
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -499,21 +491,21 @@ public class BrushCommands {
|
||||
desc = "Scatter a schematic on a surface"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.populateschematic")
|
||||
public BrushSettings scatterSchemBrush(Player player, LocalSession session, Mask mask, @Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch(name = 'r', desc = "Apply random rotation") boolean rotate, InjectedValueAccess context) throws WorldEditException {
|
||||
public void scatterSchemBrush(Player player, LocalSession session, Mask mask, @Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch(name = 'r', desc = "Apply random rotation") boolean rotate, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
try {
|
||||
MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true);
|
||||
if (clipboards == null) {
|
||||
BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr);
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
List<ClipboardHolder> holders = clipboards.getHolders();
|
||||
if (holders == null) {
|
||||
BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr);
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -528,9 +520,9 @@ public class BrushCommands {
|
||||
"Pic: https://i.imgur.com/XV0vYoX.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.layer")
|
||||
public BrushSettings surfaceLayer(LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, List<BlockState> blockLayers, InjectedValueAccess context) throws WorldEditException {
|
||||
public void surfaceLayer(LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, List<BlockState> blockLayers, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new LayerBrush(blockLayers.toArray(new BlockState[0]))).setSize(radius);
|
||||
set(session, context, new LayerBrush(blockLayers.toArray(new BlockState[0]))).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -542,9 +534,9 @@ public class BrushCommands {
|
||||
"Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block."
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.splatter")
|
||||
public BrushSettings splatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double pointsOpt, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, InjectedValueAccess context) throws WorldEditException {
|
||||
public void splatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double pointsOpt, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new SplatterBrush((int) pointsOpt, (int) recursion, solid)).setSize(radius).setFill(fill);
|
||||
set(session, context, new SplatterBrush((int) pointsOpt, (int) recursion, solid)).setSize(radius).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -558,9 +550,9 @@ public class BrushCommands {
|
||||
" - Placeholders: {x}, {y}, {z}, {world}, {size}"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scattercommand")
|
||||
public BrushSettings scatterCommandBrush(Player player, EditSession editSession, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, double points, double distance, List<String> commandStr, InjectedValueAccess context) throws WorldEditException {
|
||||
public void scatterCommandBrush(Player player, EditSession editSession, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, double points, double distance, List<String> commandStr, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " ")))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -571,7 +563,7 @@ public class BrushCommands {
|
||||
desc = "Choose the cylinder brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.cylinder")
|
||||
public BrushSettings cylinderBrush(Player player, LocalSession session,
|
||||
public void cylinderBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The radius of the cylinder", def = "2")
|
||||
@ -592,7 +584,6 @@ public class BrushCommands {
|
||||
}
|
||||
settings.setSize(radius)
|
||||
.setFill(pattern);
|
||||
return settings;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -605,7 +596,7 @@ public class BrushCommands {
|
||||
)
|
||||
@Deprecated
|
||||
@CommandPermissions("worldedit.brush.clipboard")
|
||||
public BrushSettings clipboardBrush(Player player,LocalSession session,
|
||||
public void clipboardBrush(Player player,LocalSession session,
|
||||
@Switch(name = 'a', desc = "Don't paste air from the clipboard")
|
||||
boolean ignoreAir,
|
||||
@Switch(name = 'o', desc = "Paste starting at the target location, instead of centering on it")
|
||||
@ -629,7 +620,7 @@ public class BrushCommands {
|
||||
worldEdit.checkMaxBrushRadius(size.getBlockY() / 2D - 1);
|
||||
worldEdit.checkMaxBrushRadius(size.getBlockZ() / 2D - 1);
|
||||
|
||||
return set(session, context, new ClipboardBrush(newHolder, ignoreAir, usingOrigin, !skipEntities, pasteBiomes, sourceMask));
|
||||
set(session, context, new ClipboardBrush(newHolder, ignoreAir, usingOrigin, !skipEntities, pasteBiomes, sourceMask));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -638,7 +629,7 @@ public class BrushCommands {
|
||||
descFooter = "Example: '/brush smooth 2 4 grass_block,dirt,stone'"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.smooth")
|
||||
public BrushSettings smoothBrush(Player player, LocalSession session, EditSession editSession,
|
||||
public void smoothBrush(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius to sample for softening", def = "2")
|
||||
Expression radius,
|
||||
@Arg(desc = "The number of iterations to perform", def = "4")
|
||||
@ -651,7 +642,7 @@ public class BrushCommands {
|
||||
FaweLimit limit = Settings.IMP.getLimit(fp);
|
||||
iterations = Math.min(limit.MAX_ITERATIONS, iterations);
|
||||
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new SmoothBrush(iterations, maskOpt))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -662,14 +653,14 @@ public class BrushCommands {
|
||||
desc = "Shortcut fire extinguisher brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.ex")
|
||||
public BrushSettings extinguishBrush(Player player, LocalSession session, EditSession editSession,
|
||||
public void extinguishBrush(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius to extinguish", def = "5")
|
||||
Expression radius,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
Pattern fill = BlockTypes.AIR.getDefaultState();
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new SphereBrush())
|
||||
.setSize(radius)
|
||||
.setFill(fill)
|
||||
@ -682,7 +673,7 @@ public class BrushCommands {
|
||||
desc = "Gravity brush, simulates the effect of gravity"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.gravity")
|
||||
public BrushSettings gravityBrush(Player player, LocalSession session,
|
||||
public void gravityBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius to apply gravity in", def = "5")
|
||||
Expression radius,
|
||||
@Switch(name = 'h', desc = "Affect blocks starting at max Y, rather than the target location Y + radius")
|
||||
@ -690,7 +681,7 @@ public class BrushCommands {
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new GravityBrush(fromMaxY))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -707,8 +698,8 @@ public class BrushCommands {
|
||||
"Snow Pic: https://i.imgur.com/Hrzn0I4.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
public void heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -718,7 +709,7 @@ public class BrushCommands {
|
||||
descFooter = "This brush flattens terrain and creates cliffs."
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings cliffBrush(Player player, LocalSession session,
|
||||
public void cliffBrush(Player player, LocalSession session,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
Expression radius,
|
||||
@Arg(name = "image", desc = "String", def = "")
|
||||
@ -733,7 +724,7 @@ public class BrushCommands {
|
||||
boolean layers,
|
||||
@Switch(name = 's', desc = "Disables smoothing")
|
||||
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
|
||||
terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -742,17 +733,17 @@ public class BrushCommands {
|
||||
desc = "This brush raises or lowers land towards the clicked point"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
public void flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
@Switch(name = 'r', desc = "Enables random off-axis rotation")
|
||||
boolean randomRotate,
|
||||
@Switch(name = 'l', desc = "Will work on snow layers")
|
||||
boolean layers,
|
||||
@Switch(name = 's', desc = "Disables smoothing")
|
||||
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
|
||||
private BrushSettings terrainBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, ScalableHeightMap.Shape shape, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
private void terrainBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, Shape shape, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
InputStream stream = getHeightmapStream(image);
|
||||
HeightBrush brush;
|
||||
@ -772,9 +763,9 @@ public class BrushCommands {
|
||||
if (randomRotate) {
|
||||
brush.setRandomRotate(true);
|
||||
}
|
||||
return set(session, context,
|
||||
brush)
|
||||
.setSize(radius);
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius);
|
||||
}
|
||||
|
||||
private InputStream getHeightmapStream(String filename) throws FileNotFoundException {
|
||||
@ -789,7 +780,7 @@ public class BrushCommands {
|
||||
|
||||
@Command(
|
||||
name = "copypaste",
|
||||
aliases = {"copy", "paste", "cp", "copypasta"},
|
||||
aliases = {"cp", "copypasta"},
|
||||
desc = "Copy Paste brush",
|
||||
descFooter = "Left click the base of an object to copy.\n" +
|
||||
"Right click to paste\n" +
|
||||
@ -797,11 +788,11 @@ public class BrushCommands {
|
||||
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.copy")
|
||||
public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate, @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate, InjectedValueAccess context) throws WorldEditException {
|
||||
public void copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate, @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
player.print(BBC.BRUSH_COPY.format(radius));
|
||||
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new CopyPastaBrush(player, session, randomRotate, autoRotate))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -815,10 +806,10 @@ public class BrushCommands {
|
||||
" - Placeholders: {x}, {y}, {z}, {world}, {size}"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.command")
|
||||
public BrushSettings command(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, @Arg(desc = "Command to run") List<String> input, InjectedValueAccess context) throws WorldEditException {
|
||||
public void command(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, @Arg(desc = "Command to run") List<String> input, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
String cmd = StringMan.join(input, " ");
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new CommandBrush(cmd))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -829,7 +820,7 @@ public class BrushCommands {
|
||||
desc = "Butcher brush, kills mobs within a radius"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.butcher")
|
||||
public BrushSettings butcherBrush(Player player, LocalSession session, InjectedValueAccess context,
|
||||
public void butcherBrush(Player player, LocalSession session, InjectedValueAccess context,
|
||||
@Arg(desc = "Radius to kill mobs in", def = "5")
|
||||
Expression radius,
|
||||
@Switch(name = 'p', desc = "Also kill pets")
|
||||
@ -860,9 +851,7 @@ public class BrushCommands {
|
||||
flags.or(CreatureButcher.Flags.TAGGED , killWithName, "worldedit.butcher.tagged");
|
||||
flags.or(CreatureButcher.Flags.ARMOR_STAND , killArmorStands, "worldedit.butcher.armorstands");
|
||||
|
||||
return set(session, context,
|
||||
new ButcherBrush(flags))
|
||||
.setSize(radius);
|
||||
set(session, context, new ButcherBrush(flags)).setSize(radius);
|
||||
}
|
||||
|
||||
public BrushSettings process(CommandLocals locals, BrushSettings settings) throws WorldEditException {
|
||||
|
@ -1,448 +1,448 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
||||
import com.boydti.fawe.object.mask.AdjacentMask;
|
||||
import com.boydti.fawe.object.mask.AngleMask;
|
||||
import com.boydti.fawe.object.mask.BiomeMask;
|
||||
import com.boydti.fawe.object.mask.BlockLightMask;
|
||||
import com.boydti.fawe.object.mask.BrightnessMask;
|
||||
import com.boydti.fawe.object.mask.DataMask;
|
||||
import com.boydti.fawe.object.mask.ExtremaMask;
|
||||
import com.boydti.fawe.object.mask.IdDataMask;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.boydti.fawe.object.mask.LightMask;
|
||||
import com.boydti.fawe.object.mask.OpacityMask;
|
||||
import com.boydti.fawe.object.mask.ROCAngleMask;
|
||||
import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.boydti.fawe.object.mask.RandomMask;
|
||||
import com.boydti.fawe.object.mask.SimplexMask;
|
||||
import com.boydti.fawe.object.mask.SkyLightMask;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.boydti.fawe.object.mask.WallMask;
|
||||
import com.boydti.fawe.object.mask.XAxisMask;
|
||||
import com.boydti.fawe.object.mask.YAxisMask;
|
||||
import com.boydti.fawe.object.mask.ZAxisMask;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.ExpressionMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.mask.OffsetMask;
|
||||
import com.sk89q.worldedit.function.mask.RegionMask;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.request.RequestSelection;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
//@Command(aliases = {"masks"},
|
||||
// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
|
||||
// descFooter = "Masks determine if a block can be placed\n" +
|
||||
// " - Use [brackets] for arguments\n" +
|
||||
// " - Use , to OR multiple\n" +
|
||||
// " - Use & to AND multiple\n" +
|
||||
// "e.g. >[stone,dirt],#light[0][5],$jungle\n" +
|
||||
// "More Info: https://git.io/v9r4K"
|
||||
//package com.sk89q.worldedit.command;
|
||||
//
|
||||
//import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
||||
//import com.boydti.fawe.object.mask.AdjacentMask;
|
||||
//import com.boydti.fawe.object.mask.AngleMask;
|
||||
//import com.boydti.fawe.object.mask.BiomeMask;
|
||||
//import com.boydti.fawe.object.mask.BlockLightMask;
|
||||
//import com.boydti.fawe.object.mask.BrightnessMask;
|
||||
//import com.boydti.fawe.object.mask.DataMask;
|
||||
//import com.boydti.fawe.object.mask.ExtremaMask;
|
||||
//import com.boydti.fawe.object.mask.IdDataMask;
|
||||
//import com.boydti.fawe.object.mask.IdMask;
|
||||
//import com.boydti.fawe.object.mask.LightMask;
|
||||
//import com.boydti.fawe.object.mask.OpacityMask;
|
||||
//import com.boydti.fawe.object.mask.ROCAngleMask;
|
||||
//import com.boydti.fawe.object.mask.RadiusMask;
|
||||
//import com.boydti.fawe.object.mask.RandomMask;
|
||||
//import com.boydti.fawe.object.mask.SimplexMask;
|
||||
//import com.boydti.fawe.object.mask.SkyLightMask;
|
||||
//import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
//import com.boydti.fawe.object.mask.WallMask;
|
||||
//import com.boydti.fawe.object.mask.XAxisMask;
|
||||
//import com.boydti.fawe.object.mask.YAxisMask;
|
||||
//import com.boydti.fawe.object.mask.ZAxisMask;
|
||||
//import com.sk89q.worldedit.IncompleteRegionException;
|
||||
//import com.sk89q.worldedit.LocalSession;
|
||||
//import com.sk89q.worldedit.WorldEdit;
|
||||
//import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
//import com.sk89q.worldedit.entity.Player;
|
||||
//import com.sk89q.worldedit.extent.Extent;
|
||||
//import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||
//import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
//import com.sk89q.worldedit.function.mask.ExpressionMask;
|
||||
//import com.sk89q.worldedit.function.mask.Mask;
|
||||
//import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
//import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||
//import com.sk89q.worldedit.function.mask.Masks;
|
||||
//import com.sk89q.worldedit.function.mask.OffsetMask;
|
||||
//import com.sk89q.worldedit.function.mask.RegionMask;
|
||||
//import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
//import com.sk89q.worldedit.internal.expression.Expression;
|
||||
//import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
//import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
|
||||
//import com.sk89q.worldedit.math.BlockVector3;
|
||||
//import com.sk89q.worldedit.math.Vector3;
|
||||
//import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
//import com.sk89q.worldedit.session.request.RequestSelection;
|
||||
//import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
//import org.enginehub.piston.annotation.Command;
|
||||
//import org.enginehub.piston.annotation.CommandContainer;
|
||||
//import org.enginehub.piston.annotation.param.Arg;
|
||||
//import org.enginehub.piston.annotation.param.Switch;
|
||||
//
|
||||
////@Command(aliases = {"masks"},
|
||||
//// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
|
||||
//// descFooter = "Masks determine if a block can be placed\n" +
|
||||
//// " - Use [brackets] for arguments\n" +
|
||||
//// " - Use , to OR multiple\n" +
|
||||
//// " - Use & to AND multiple\n" +
|
||||
//// "e.g. >[stone,dirt],#light[0][5],$jungle\n" +
|
||||
//// "More Info: https://git.io/v9r4K"
|
||||
////)
|
||||
//@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
//public class MaskCommands {
|
||||
// private final WorldEdit worldEdit;
|
||||
//
|
||||
// public MaskCommands(WorldEdit worldEdit) {
|
||||
// this.worldEdit = worldEdit;
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#simplex",
|
||||
// desc = "Use simplex noise as the mask"
|
||||
// )
|
||||
// public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// scale = 1d / Math.max(1, scale);
|
||||
// minInt = (minInt - 50) / 50;
|
||||
// maxInt = (maxInt - 50) / 50;
|
||||
// return new SimplexMask(scale, minInt, maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#light",
|
||||
// desc = "Restrict to specific light levels"
|
||||
// )
|
||||
// public Mask light(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new LightMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#false",
|
||||
// desc = "Always false"
|
||||
// )
|
||||
// public Mask falseMask(Extent extent) {
|
||||
// return Masks.alwaysFalse();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#true",
|
||||
// desc = "Always true"
|
||||
// )
|
||||
// public Mask trueMask(Extent extent) {
|
||||
// return Masks.alwaysTrue();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#skylight",
|
||||
// desc = "Restrict to specific sky light levels"
|
||||
// )
|
||||
// public Mask skylight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new SkyLightMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#blocklight",
|
||||
// aliases = {"#emittedlight"},
|
||||
// desc = "Restrict to specific block light levels"
|
||||
// )
|
||||
// public Mask blocklight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new BlockLightMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#opacity",
|
||||
// desc = "Restrict to specific opacity levels"
|
||||
// )
|
||||
// public Mask opacity(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new OpacityMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#brightness",
|
||||
// desc = "Restrict to specific block brightness"
|
||||
// )
|
||||
// public Mask brightness(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new BrightnessMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#offset",
|
||||
// desc = "Offset a mask"
|
||||
// )
|
||||
// public Mask offset(double x, double y, double z, Mask mask) {
|
||||
// return new OffsetMask(mask, BlockVector3.at(x, y, z));
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#haslight",
|
||||
// desc = "Restricts to blocks with light (sky or emitted)"
|
||||
// )
|
||||
// public Mask haslight(Extent extent) {
|
||||
// return new LightMask(extent, 1, Integer.MAX_VALUE);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#nolight",
|
||||
// desc = "Restrict to blocks without light (sky or emitted)"
|
||||
// )
|
||||
// public Mask nolight(Extent extent) {
|
||||
// return new LightMask(extent, 0, 0);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#existing",
|
||||
// desc = "If there is a non air block"
|
||||
// )
|
||||
// public Mask existing(Extent extent) {
|
||||
// return new ExistingBlockMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#solid",
|
||||
// desc = "If there is a solid block"
|
||||
// )
|
||||
// public Mask solid(Extent extent) {
|
||||
// return new SolidBlockMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#liquid",
|
||||
// desc = "If there is a solid block"
|
||||
// )
|
||||
// public Mask liquid(Extent extent) {
|
||||
// return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#dregion",
|
||||
// aliases = {"#dselection", "#dsel"},
|
||||
// desc = "inside the player's selection"
|
||||
// )
|
||||
// public Mask dregion() {
|
||||
// return new RegionMask(new RequestSelection());
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#region",
|
||||
// aliases = {"#selection", "#sel"},
|
||||
// desc = "inside the provided selection"
|
||||
// )
|
||||
// public Mask selection(Player player, LocalSession session) throws IncompleteRegionException {
|
||||
// return new RegionMask(session.getSelection(player.getWorld()).clone());
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#xaxis",
|
||||
// desc = "Restrict to initial x axis"
|
||||
// )
|
||||
// public Mask xaxis() {
|
||||
// return new XAxisMask();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#yaxis",
|
||||
// desc = "Restrict to initial y axis"
|
||||
// )
|
||||
// public Mask yaxis() {
|
||||
// return new YAxisMask();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#zaxis",
|
||||
// desc = "Restrict to initial z axis"
|
||||
// )
|
||||
// public Mask zaxis() {
|
||||
// return new ZAxisMask();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#id",
|
||||
// desc = "Restrict to initial id"
|
||||
// )
|
||||
// public Mask id(Extent extent) {
|
||||
// return new IdMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#data",
|
||||
// desc = "Restrict to initial data"
|
||||
// )
|
||||
// public Mask data(Extent extent) {
|
||||
// return new DataMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#iddata",
|
||||
// desc = "Restrict to initial block id and data"
|
||||
// )
|
||||
// public Mask iddata(Extent extent) {
|
||||
// return new IdDataMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#air",
|
||||
// desc = "Restrict to types of air"
|
||||
// )
|
||||
// public Mask air(Extent extent) {
|
||||
// return new BlockMaskBuilder().addAll(b -> b.getMaterial().isAir()).build(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#wall",
|
||||
// desc = "Restrict to walls (any block n,e,s,w of air)"
|
||||
// )
|
||||
// public Mask wall(Extent extent) {
|
||||
// Mask blockMask = air(extent);
|
||||
// return new MaskUnion(new ExistingBlockMask(extent), new WallMask(blockMask, 1, 8));
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#surface",
|
||||
// desc = "Restrict to surfaces (any solid block touching air)"
|
||||
// )
|
||||
// public Mask surface(Extent extent) {
|
||||
// return new SurfaceMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "\\",
|
||||
// aliases = {"/", "#angle", "#\\", "#/"},
|
||||
// desc = "Restrict to specific terrain angle",
|
||||
// descFooter = "Restrict to specific terrain angle\n" +
|
||||
// "The -o flag will only overlay\n" +
|
||||
// "Example: /[0d][45d]\n" +
|
||||
// "Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" +
|
||||
// "Example: /[3][20]\n" +
|
||||
// "Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below"
|
||||
//)
|
||||
@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class MaskCommands {
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
public MaskCommands(WorldEdit worldEdit) {
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#simplex",
|
||||
desc = "Use simplex noise as the mask"
|
||||
)
|
||||
public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
scale = 1d / Math.max(1, scale);
|
||||
minInt = (minInt - 50) / 50;
|
||||
maxInt = (maxInt - 50) / 50;
|
||||
return new SimplexMask(scale, minInt, maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#light",
|
||||
desc = "Restrict to specific light levels"
|
||||
)
|
||||
public Mask light(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new LightMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#false",
|
||||
desc = "Always false"
|
||||
)
|
||||
public Mask falseMask(Extent extent) {
|
||||
return Masks.alwaysFalse();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#true",
|
||||
desc = "Always true"
|
||||
)
|
||||
public Mask trueMask(Extent extent) {
|
||||
return Masks.alwaysTrue();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#skylight",
|
||||
desc = "Restrict to specific sky light levels"
|
||||
)
|
||||
public Mask skylight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new SkyLightMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#blocklight",
|
||||
aliases = {"#emittedlight"},
|
||||
desc = "Restrict to specific block light levels"
|
||||
)
|
||||
public Mask blocklight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new BlockLightMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#opacity",
|
||||
desc = "Restrict to specific opacity levels"
|
||||
)
|
||||
public Mask opacity(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new OpacityMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#brightness",
|
||||
desc = "Restrict to specific block brightness"
|
||||
)
|
||||
public Mask brightness(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new BrightnessMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#offset",
|
||||
desc = "Offset a mask"
|
||||
)
|
||||
public Mask offset(double x, double y, double z, Mask mask) {
|
||||
return new OffsetMask(mask, BlockVector3.at(x, y, z));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#haslight",
|
||||
desc = "Restricts to blocks with light (sky or emitted)"
|
||||
)
|
||||
public Mask haslight(Extent extent) {
|
||||
return new LightMask(extent, 1, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#nolight",
|
||||
desc = "Restrict to blocks without light (sky or emitted)"
|
||||
)
|
||||
public Mask nolight(Extent extent) {
|
||||
return new LightMask(extent, 0, 0);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#existing",
|
||||
desc = "If there is a non air block"
|
||||
)
|
||||
public Mask existing(Extent extent) {
|
||||
return new ExistingBlockMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#solid",
|
||||
desc = "If there is a solid block"
|
||||
)
|
||||
public Mask solid(Extent extent) {
|
||||
return new SolidBlockMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#liquid",
|
||||
desc = "If there is a solid block"
|
||||
)
|
||||
public Mask liquid(Extent extent) {
|
||||
return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#dregion",
|
||||
aliases = {"#dselection", "#dsel"},
|
||||
desc = "inside the player's selection"
|
||||
)
|
||||
public Mask dregion() {
|
||||
return new RegionMask(new RequestSelection());
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#region",
|
||||
aliases = {"#selection", "#sel"},
|
||||
desc = "inside the provided selection"
|
||||
)
|
||||
public Mask selection(Player player, LocalSession session) throws IncompleteRegionException {
|
||||
return new RegionMask(session.getSelection(player.getWorld()).clone());
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#xaxis",
|
||||
desc = "Restrict to initial x axis"
|
||||
)
|
||||
public Mask xaxis() {
|
||||
return new XAxisMask();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#yaxis",
|
||||
desc = "Restrict to initial y axis"
|
||||
)
|
||||
public Mask yaxis() {
|
||||
return new YAxisMask();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#zaxis",
|
||||
desc = "Restrict to initial z axis"
|
||||
)
|
||||
public Mask zaxis() {
|
||||
return new ZAxisMask();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#id",
|
||||
desc = "Restrict to initial id"
|
||||
)
|
||||
public Mask id(Extent extent) {
|
||||
return new IdMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#data",
|
||||
desc = "Restrict to initial data"
|
||||
)
|
||||
public Mask data(Extent extent) {
|
||||
return new DataMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#iddata",
|
||||
desc = "Restrict to initial block id and data"
|
||||
)
|
||||
public Mask iddata(Extent extent) {
|
||||
return new IdDataMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#air",
|
||||
desc = "Restrict to types of air"
|
||||
)
|
||||
public Mask air(Extent extent) {
|
||||
return new BlockMaskBuilder().addAll(b -> b.getMaterial().isAir()).build(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#wall",
|
||||
desc = "Restrict to walls (any block n,e,s,w of air)"
|
||||
)
|
||||
public Mask wall(Extent extent) {
|
||||
Mask blockMask = air(extent);
|
||||
return new MaskUnion(new ExistingBlockMask(extent), new WallMask(blockMask, 1, 8));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#surface",
|
||||
desc = "Restrict to surfaces (any solid block touching air)"
|
||||
)
|
||||
public Mask surface(Extent extent) {
|
||||
return new SurfaceMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "\\",
|
||||
aliases = {"/", "#angle", "#\\", "#/"},
|
||||
desc = "Restrict to specific terrain angle",
|
||||
descFooter = "Restrict to specific terrain angle\n" +
|
||||
"The -o flag will only overlay\n" +
|
||||
"Example: /[0d][45d]\n" +
|
||||
"Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" +
|
||||
"Example: /[3][20]\n" +
|
||||
"Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below"
|
||||
)
|
||||
public Mask angle(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (maxStr.endsWith("d")) {
|
||||
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
} else {
|
||||
y1 = Expression.compile(minStr).evaluate();
|
||||
y2 = Expression.compile(maxStr).evaluate();
|
||||
}
|
||||
return new AngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "(",
|
||||
aliases = {")", "#roc", "#(", "#)"},
|
||||
desc = "Restrict to near specific terrain slope rate of change",
|
||||
descFooter = "Restrict to near specific terrain slope rate of change\n" +
|
||||
"The -o flag will only overlay\n" +
|
||||
"Example: ([0d][45d][5]\n" +
|
||||
"Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" +
|
||||
"Note: Use negatives for decreasing slope"
|
||||
)
|
||||
public Mask roc(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (maxStr.endsWith("d")) {
|
||||
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
} else {
|
||||
y1 = Expression.compile(minStr).evaluate();
|
||||
y2 = Expression.compile(maxStr).evaluate();
|
||||
}
|
||||
return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "^",
|
||||
aliases = {"#extrema", "#^"},
|
||||
desc = "Restrict to near specific terrain extrema",
|
||||
descFooter = "Restrict to near specific terrain extrema\n" +
|
||||
"The -o flag will only overlay\n" +
|
||||
"Example: ([0d][45d][5]\n" +
|
||||
"Explanation: Restrict to near 45 degrees of local maxima\n" +
|
||||
"Note: Use negatives for local minima"
|
||||
)
|
||||
public Mask extrema(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (maxStr.endsWith("d")) {
|
||||
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
} else {
|
||||
y1 = Expression.compile(minStr).evaluate();
|
||||
y2 = Expression.compile(maxStr).evaluate();
|
||||
}
|
||||
return new ExtremaMask(extent, y1, y2, overlay, distanceOpt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "{",
|
||||
aliases = {"#{"},
|
||||
desc = "Restricts blocks to within a specific radius range of the initial block"
|
||||
)
|
||||
public Mask radius(@Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||
return new RadiusMask((int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "|",
|
||||
aliases = {"#|", "#side"},
|
||||
desc = "sides with a specific number of other blocks"
|
||||
)
|
||||
public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||
return new WallMask(mask, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "~",
|
||||
aliases = {"#~", "#adjacent"},
|
||||
desc = "Adjacent to a specific number of other blocks"
|
||||
)
|
||||
public Mask adjacent(Mask mask, @Arg(name = "min", desc = "double", def = "-1") double min, @Arg(name = "max", desc = "double", def = "-1") double max) throws ExpressionException {
|
||||
if (min == -1 && max == -1) {
|
||||
min = 1;
|
||||
max = 8;
|
||||
} else if (max == -1) max = min;
|
||||
if (max >= 8 && min == 1) {
|
||||
return new AdjacentAnyMask(mask);
|
||||
}
|
||||
return new AdjacentMask(mask, (int) min, (int) max);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "<",
|
||||
aliases = {"#<", "#below"},
|
||||
desc = "below a specific block"
|
||||
)
|
||||
public Mask below(Mask mask) throws ExpressionException {
|
||||
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = ">",
|
||||
aliases = {"#>", "#above"},
|
||||
desc = "above a specific block"
|
||||
)
|
||||
public Mask above(Mask mask) throws ExpressionException {
|
||||
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "$",
|
||||
aliases = {"#biome", "#$"},
|
||||
desc = "in a specific biome",
|
||||
descFooter = "in a specific biome. For a list of biomes use //biomelist"
|
||||
)
|
||||
public Mask biome(Extent extent, BiomeType biome) throws ExpressionException {
|
||||
return new BiomeMask(extent, biome);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "%",
|
||||
aliases = {"#%", "#percent"},
|
||||
desc = "percentage chance"
|
||||
)
|
||||
public Mask random(double chance) throws ExpressionException {
|
||||
chance = chance / 100;
|
||||
return new RandomMask(chance);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "=",
|
||||
aliases = {"#=", "#expression"},
|
||||
desc = "expression mask"
|
||||
)
|
||||
public Mask expression(Extent extent, String input) throws ExpressionException {
|
||||
Expression exp = Expression.compile(input, "x", "y", "z");
|
||||
ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
||||
exp.setEnvironment(env);
|
||||
return new ExpressionMask(exp);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "!",
|
||||
aliases = {"#not", "#negate", "#!"},
|
||||
desc = "Negate another mask"
|
||||
)
|
||||
public Mask expression(Mask mask) throws ExpressionException {
|
||||
return Masks.negate(mask);
|
||||
}
|
||||
}
|
||||
// public Mask angle(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) throws ExpressionException {
|
||||
// double y1, y2;
|
||||
// boolean override;
|
||||
// if (maxStr.endsWith("d")) {
|
||||
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
// y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
// y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
// } else {
|
||||
// y1 = Expression.compile(minStr).evaluate();
|
||||
// y2 = Expression.compile(maxStr).evaluate();
|
||||
// }
|
||||
// return new AngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "(",
|
||||
// aliases = {")", "#roc", "#(", "#)"},
|
||||
// desc = "Restrict to near specific terrain slope rate of change",
|
||||
// descFooter = "Restrict to near specific terrain slope rate of change\n" +
|
||||
// "The -o flag will only overlay\n" +
|
||||
// "Example: ([0d][45d][5]\n" +
|
||||
// "Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" +
|
||||
// "Note: Use negatives for decreasing slope"
|
||||
//)
|
||||
// public Mask roc(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException {
|
||||
// double y1, y2;
|
||||
// boolean override;
|
||||
// if (maxStr.endsWith("d")) {
|
||||
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
// y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
// y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
// } else {
|
||||
// y1 = Expression.compile(minStr).evaluate();
|
||||
// y2 = Expression.compile(maxStr).evaluate();
|
||||
// }
|
||||
// return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "^",
|
||||
// aliases = {"#extrema", "#^"},
|
||||
// desc = "Restrict to near specific terrain extrema",
|
||||
// descFooter = "Restrict to near specific terrain extrema\n" +
|
||||
// "The -o flag will only overlay\n" +
|
||||
// "Example: ([0d][45d][5]\n" +
|
||||
// "Explanation: Restrict to near 45 degrees of local maxima\n" +
|
||||
// "Note: Use negatives for local minima"
|
||||
//)
|
||||
// public Mask extrema(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException {
|
||||
// double y1, y2;
|
||||
// boolean override;
|
||||
// if (maxStr.endsWith("d")) {
|
||||
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
// y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
// y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
// } else {
|
||||
// y1 = Expression.compile(minStr).evaluate();
|
||||
// y2 = Expression.compile(maxStr).evaluate();
|
||||
// }
|
||||
// return new ExtremaMask(extent, y1, y2, overlay, distanceOpt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "{",
|
||||
// aliases = {"#{"},
|
||||
// desc = "Restricts blocks to within a specific radius range of the initial block"
|
||||
//)
|
||||
// public Mask radius(@Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||
// return new RadiusMask((int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "|",
|
||||
// aliases = {"#|", "#side"},
|
||||
// desc = "sides with a specific number of other blocks"
|
||||
//)
|
||||
// public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||
// return new WallMask(mask, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "~",
|
||||
// aliases = {"#~", "#adjacent"},
|
||||
// desc = "Adjacent to a specific number of other blocks"
|
||||
//)
|
||||
// public Mask adjacent(Mask mask, @Arg(name = "min", desc = "double", def = "-1") double min, @Arg(name = "max", desc = "double", def = "-1") double max) throws ExpressionException {
|
||||
// if (min == -1 && max == -1) {
|
||||
// min = 1;
|
||||
// max = 8;
|
||||
// } else if (max == -1) max = min;
|
||||
// if (max >= 8 && min == 1) {
|
||||
// return new AdjacentAnyMask(mask);
|
||||
// }
|
||||
// return new AdjacentMask(mask, (int) min, (int) max);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "<",
|
||||
// aliases = {"#<", "#below"},
|
||||
// desc = "below a specific block"
|
||||
//)
|
||||
// public Mask below(Mask mask) throws ExpressionException {
|
||||
// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
|
||||
// return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = ">",
|
||||
// aliases = {"#>", "#above"},
|
||||
// desc = "above a specific block"
|
||||
//)
|
||||
// public Mask above(Mask mask) throws ExpressionException {
|
||||
// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
|
||||
// return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "$",
|
||||
// aliases = {"#biome", "#$"},
|
||||
// desc = "in a specific biome",
|
||||
// descFooter = "in a specific biome. For a list of biomes use //biomelist"
|
||||
//)
|
||||
// public Mask biome(Extent extent, BiomeType biome) throws ExpressionException {
|
||||
// return new BiomeMask(extent, biome);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "%",
|
||||
// aliases = {"#%", "#percent"},
|
||||
// desc = "percentage chance"
|
||||
//)
|
||||
// public Mask random(double chance) throws ExpressionException {
|
||||
// chance = chance / 100;
|
||||
// return new RandomMask(chance);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "=",
|
||||
// aliases = {"#=", "#expression"},
|
||||
// desc = "expression mask"
|
||||
//)
|
||||
// public Mask expression(Extent extent, String input) throws ExpressionException {
|
||||
// Expression exp = Expression.compile(input, "x", "y", "z");
|
||||
// ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
||||
// exp.setEnvironment(env);
|
||||
// return new ExpressionMask(exp);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "!",
|
||||
// aliases = {"#not", "#negate", "#!"},
|
||||
// desc = "Negate another mask"
|
||||
//)
|
||||
// public Mask expression(Mask mask) throws ExpressionException {
|
||||
// return Masks.negate(mask);
|
||||
// }
|
||||
//}
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.command.argument;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
import com.sk89q.worldedit.registry.IRegistry;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
@ -28,6 +29,7 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.fluid.FluidCategory;
|
||||
import com.sk89q.worldedit.world.fluid.FluidType;
|
||||
@ -52,7 +54,7 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void register(CommandManager commandManager) {
|
||||
ImmutableList.of(
|
||||
BlockType.class,
|
||||
BlockTypes.class,
|
||||
BlockCategory.class,
|
||||
ItemType.class,
|
||||
ItemCategory.class,
|
||||
@ -73,7 +75,7 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
|
||||
private static <V extends Keyed> RegistryConverter<V> from(Class<Keyed> registryType) {
|
||||
try {
|
||||
Field registryField = registryType.getDeclaredField("REGISTRY");
|
||||
Registry<V> registry = (Registry<V>) registryField.get(null);
|
||||
IRegistry<V> registry = (IRegistry<V>) registryField.get(null);
|
||||
return new RegistryConverter<>(registry);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new IllegalArgumentException("Not a registry-backed type: " + registryType.getName());
|
||||
@ -82,10 +84,10 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
|
||||
}
|
||||
}
|
||||
|
||||
private final Registry<V> registry;
|
||||
private final IRegistry<V> registry;
|
||||
private final TextComponent choices;
|
||||
|
||||
private RegistryConverter(Registry<V> registry) {
|
||||
private RegistryConverter(IRegistry<V> registry) {
|
||||
this.registry = registry;
|
||||
this.choices = TextComponent.of("any " + registry.getName());
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class DelegateCommandManager implements CommandManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(InjectedValueAccess context, List<String> args) {
|
||||
public int execute(InjectedValueAccess context, List<String> args) {
|
||||
return parent.execute(context, args);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.util;
|
||||
|
||||
import com.sk89q.worldedit.registry.IRegistry;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
@ -138,7 +139,7 @@ public final class SuggestionHelper {
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
public static <V extends Keyed> Stream<String> getRegistrySuggestions(Registry<V> registry, String input) {
|
||||
public static <V extends Keyed> Stream<String> getRegistrySuggestions(IRegistry<V> registry, String input) {
|
||||
if (registry instanceof NamespacedRegistry) {
|
||||
return getNamespacedRegistrySuggestions(((NamespacedRegistry<?>) registry), input);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.TransformCommands;
|
||||
//import com.sk89q.worldedit.command.TransformCommands;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
|
@ -28,7 +28,7 @@ import com.google.common.collect.Iterables;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.PatternCommands;
|
||||
//import com.sk89q.worldedit.command.PatternCommands;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
|
@ -88,6 +88,7 @@ import com.sk89q.worldedit.command.ToolUtilCommands;
|
||||
import com.sk89q.worldedit.command.ToolUtilCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.TransformCommands;
|
||||
import com.sk89q.worldedit.command.TransformCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.TransformCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.command.UtilityCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||
|
@ -72,7 +72,9 @@ public class PlatformManager {
|
||||
private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class);
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
private final PlatformCommandManager platformCommandManager;
|
||||
|
||||
private PlatformCommandManager platformCommandManager;
|
||||
|
||||
private final List<Platform> platforms = new ArrayList<>();
|
||||
private final Map<Capability, Platform> preferences = new EnumMap<>(Capability.class);
|
||||
private @Nullable String firstSeenVersion;
|
||||
@ -87,7 +89,6 @@ public class PlatformManager {
|
||||
public PlatformManager(WorldEdit worldEdit) {
|
||||
checkNotNull(worldEdit);
|
||||
this.worldEdit = worldEdit;
|
||||
this.platformCommandManager = new PlatformCommandManager(worldEdit, this);
|
||||
|
||||
// Register this instance for events
|
||||
worldEdit.getEventBus().register(this);
|
||||
@ -117,6 +118,10 @@ public class PlatformManager {
|
||||
} else {
|
||||
firstSeenVersion = platform.getVersion();
|
||||
}
|
||||
|
||||
if (this.platformCommandManager == null) {
|
||||
this.platformCommandManager = new PlatformCommandManager(worldEdit, this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,14 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.internal.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import com.sk89q.worldedit.internal.util.Substring;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.exception.CommandException;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
@ -40,6 +38,9 @@ import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
public class CommandUtil {
|
||||
|
||||
public static Map<String, Command> getSubCommands(Command currentCommand) {
|
||||
@ -64,20 +65,37 @@ public class CommandUtil {
|
||||
* Fix {@code suggestions} to replace the last space-separated word in {@code arguments}.
|
||||
*/
|
||||
public static List<String> fixSuggestions(String arguments, List<Substring> suggestions) {
|
||||
Substring lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments));
|
||||
Substring lastArg = Iterables.getLast(
|
||||
CommandArgParser.spaceSplit(arguments)
|
||||
);
|
||||
return suggestions.stream()
|
||||
.map(suggestion -> CommandUtil.suggestLast(lastArg, suggestion))
|
||||
// Re-map suggestions to only operate on the last non-quoted word
|
||||
.map(suggestion -> onlyOnLastQuotedWord(lastArg, suggestion))
|
||||
.map(suggestion -> suggestLast(lastArg, suggestion))
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
private static Substring onlyOnLastQuotedWord(Substring lastArg, Substring suggestion) {
|
||||
if (suggestion.getSubstring().startsWith(lastArg.getSubstring())) {
|
||||
// This is already fine.
|
||||
return suggestion;
|
||||
}
|
||||
String substr = suggestion.getSubstring();
|
||||
int sp = substr.lastIndexOf(' ');
|
||||
if (sp < 0) {
|
||||
return suggestion;
|
||||
}
|
||||
return Substring.wrap(substr.substring(sp + 1), suggestion.getStart() + sp + 1, suggestion.getEnd());
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the last word of a command, mutate the suggestion to replace the last word, if
|
||||
* possible.
|
||||
*/
|
||||
private static Optional<String> suggestLast(Substring last, Substring suggestion) {
|
||||
if (suggestion.getStart() == last.getEnd()) {
|
||||
if (suggestion.getStart() == last.getEnd() && !last.getSubstring().equals("\"")) {
|
||||
// this suggestion is for the next argument.
|
||||
if (last.getSubstring().isEmpty()) {
|
||||
return Optional.of(suggestion.getSubstring());
|
||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -114,11 +115,12 @@ public class ServerCUIHandler {
|
||||
}
|
||||
|
||||
// Borrowed this math from FAWE
|
||||
double rotX = player.getLocation().getYaw();
|
||||
double rotY = player.getLocation().getPitch();
|
||||
final Location location = player.getLocation();
|
||||
double rotX = location.getYaw();
|
||||
double rotY = location.getPitch();
|
||||
double xz = Math.cos(Math.toRadians(rotY));
|
||||
int x = (int) (player.getLocation().getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12);
|
||||
int z = (int) (player.getLocation().getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12);
|
||||
int x = (int) (location.getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12);
|
||||
int z = (int) (location.getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12);
|
||||
int y = Math.max(0, Math.min(Math.min(255, posY + 32), posY + 3));
|
||||
|
||||
Map<String, Tag> structureTag = new HashMap<>();
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.sk89q.worldedit.registry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
|
||||
|
||||
public interface IRegistry<V> extends Iterable<V> {
|
||||
String getName();
|
||||
|
||||
V get(final String key);
|
||||
|
||||
Set<String> keySet();
|
||||
|
||||
Collection<V> values();
|
||||
|
||||
@Override
|
||||
default Iterator<V> iterator() {
|
||||
return values().iterator();
|
||||
}
|
||||
|
||||
default <V extends Keyed> Stream<String> getSuggestions(String input) {
|
||||
return limitByPrefix(keySet().stream(), input).stream();
|
||||
}
|
||||
}
|
@ -19,30 +19,39 @@
|
||||
|
||||
package com.sk89q.worldedit.registry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class Registry<V extends Keyed> implements Iterable<V> {
|
||||
private final Map<String, V> map = new HashMap<>();
|
||||
public class Registry<V extends Keyed> implements IRegistry<V> {
|
||||
private final Map<String, V> map;
|
||||
private final String name;
|
||||
|
||||
public Registry(final String name) {
|
||||
public Registry(String name, Map<String, V> map) {
|
||||
this.name = name;
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public Registry(final String name) {
|
||||
this(name, Maps.newHashMap());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Map<String, V> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public V get(final String key) {
|
||||
checkState(key.equals(key.toLowerCase(Locale.ROOT)), "key must be lowercase");
|
||||
@ -66,9 +75,4 @@ public class Registry<V extends Keyed> implements Iterable<V> {
|
||||
return Collections.unmodifiableCollection(this.map.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<V> iterator() {
|
||||
return this.map.values().iterator();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class SessionManager {
|
||||
private static final Logger log = LoggerFactory.getLogger(SessionManager.class);
|
||||
private static boolean warnedInvalidTool;
|
||||
|
||||
private final Timer timer = new Timer();
|
||||
private final Timer timer = new Timer("WorldEdit Session Manager");
|
||||
private final WorldEdit worldEdit;
|
||||
private final Map<UUID, SessionHolder> sessions = new HashMap<>();
|
||||
private SessionStore store = new VoidStore();
|
||||
|
@ -19,8 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.util.concurrency;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -39,15 +41,33 @@ public final class EvenMoreExecutors {
|
||||
*
|
||||
* @param minThreads the minimum number of threads to have at a given time
|
||||
* @param maxThreads the maximum number of threads to have at a given time
|
||||
* @param queueSize the size of the queue before new submissions are rejected
|
||||
* @param queueSize the size of the queue before new submissions are rejected
|
||||
* @return the newly created thread pool
|
||||
*/
|
||||
public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize) {
|
||||
return newBoundedCachedThreadPool(minThreads, maxThreads, queueSize, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a thread pool that creates new threads as needed up to
|
||||
* a maximum number of threads, but will reuse previously constructed
|
||||
* threads when they are available.
|
||||
*
|
||||
* @param minThreads the minimum number of threads to have at a given time
|
||||
* @param maxThreads the maximum number of threads to have at a given time
|
||||
* @param queueSize the size of the queue before new submissions are rejected
|
||||
* @param threadFormat thread name formatter
|
||||
* @return the newly created thread pool
|
||||
*/
|
||||
public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize, String threadFormat) {
|
||||
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
|
||||
minThreads, maxThreads,
|
||||
60L, TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(queueSize));
|
||||
new LinkedBlockingDeque<>(queueSize));
|
||||
threadPoolExecutor.allowCoreThreadTimeOut(true);
|
||||
if (threadFormat != null) {
|
||||
threadPoolExecutor.setThreadFactory(new ThreadFactoryBuilder().setNameFormat(threadFormat).build());
|
||||
}
|
||||
return threadPoolExecutor;
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.util.paste;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.util.net.HttpRequest;
|
||||
import org.json.simple.JSONValue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -33,6 +34,8 @@ public class EngineHubPaste implements Paster {
|
||||
|
||||
private static final Pattern URL_PATTERN = Pattern.compile("https?://.+$");
|
||||
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
@Override
|
||||
public Callable<URL> paste(String content) {
|
||||
return new PasteTask(content);
|
||||
@ -59,10 +62,10 @@ public class EngineHubPaste implements Paster {
|
||||
.returnContent()
|
||||
.asString("UTF-8").trim();
|
||||
|
||||
Object object = JSONValue.parse(result);
|
||||
if (object instanceof Map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
String urlString = String.valueOf(((Map<Object, Object>) object).get("url"));
|
||||
Map<Object, Object> object = GSON.fromJson(result, new TypeToken<Map<Object, Object>>() {
|
||||
}.getType());
|
||||
if (object != null) {
|
||||
String urlString = String.valueOf(object.get("url"));
|
||||
Matcher m = URL_PATTERN.matcher(urlString);
|
||||
|
||||
if (m.matches()) {
|
||||
|
@ -134,6 +134,11 @@ public class NullWorld extends AbstractWorld {
|
||||
return BlockVector3.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChunk(int X, int Z, int mask) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkGet get(int x, int z) {
|
||||
return NullChunkGet.INSTANCE;
|
||||
|
@ -72,7 +72,6 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
|
||||
*
|
||||
* @return the maximum Y
|
||||
*/
|
||||
@Override
|
||||
int getMaxY();
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.function.mask.SingleBlockTypeMask;
|
||||
import com.sk89q.worldedit.function.pattern.FawePattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
@ -36,6 +37,7 @@ import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -45,6 +47,9 @@ import java.util.stream.IntStream;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockType implements FawePattern, Keyed {
|
||||
|
||||
public static final NamespacedRegistry<BlockType> REGISTRY = new NamespacedRegistry<>("block type");
|
||||
|
||||
private final String id;
|
||||
private final BlockTypes.Settings settings;
|
||||
|
||||
|
@ -26,11 +26,17 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.registry.IRegistry;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.registry.Registries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Field;
|
||||
@ -871,18 +877,22 @@ public final class BlockTypes {
|
||||
public static final int BIT_OFFSET; // Used internally
|
||||
protected static final int BIT_MASK; // Used internally
|
||||
|
||||
private static final Map<String, BlockType> $REGISTRY = new HashMap<>();
|
||||
// private static final Map<String, BlockType> $REGISTRY = new HashMap<>();
|
||||
// public static final NamespacedRegistry<BlockType> REGISTRY = new NamespacedRegistry<>("block type", $REGISTRY);
|
||||
|
||||
public static final BlockType[] values;
|
||||
public static final BlockState[] states;
|
||||
|
||||
private static final Set<String> $NAMESPACES = new LinkedHashSet<String>();
|
||||
private static final Set<String> $NAMESPACES = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
try {
|
||||
ArrayList<BlockState> stateList = new ArrayList<>();
|
||||
|
||||
Collection<String> blocks = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().registerBlocks();
|
||||
Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS);
|
||||
Registries registries = platform.getRegistries();
|
||||
BlockRegistry blockReg = registries.getBlockRegistry();
|
||||
Collection<String> blocks = blockReg.registerBlocks();
|
||||
Map<String, String> blockMap = blocks.stream().collect(Collectors.toMap(item -> item.charAt(item.length() - 1) == ']' ? item.substring(0, item.indexOf('[')) : item, item -> item));
|
||||
|
||||
int size = blockMap.size();
|
||||
@ -928,7 +938,7 @@ public final class BlockTypes {
|
||||
|
||||
// Add to $Registry
|
||||
for (BlockType type : values) {
|
||||
$REGISTRY.put(type.getId().toLowerCase(Locale.ROOT), type);
|
||||
BlockType.REGISTRY.register(type.getId().toLowerCase(Locale.ROOT), type);
|
||||
}
|
||||
states = stateList.toArray(new BlockState[stateList.size()]);
|
||||
|
||||
@ -954,15 +964,13 @@ public final class BlockTypes {
|
||||
try {
|
||||
Field field = BlockTypes.class.getDeclaredField(enumName);
|
||||
ReflectionUtils.setFailsafeFieldValue(field, null, existing);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// register states
|
||||
if (typeName.startsWith("minecraft:")) $REGISTRY.put(typeName.substring(10), existing);
|
||||
$REGISTRY.put(typeName, existing);
|
||||
if (typeName.startsWith("minecraft:")) BlockType.REGISTRY.register(typeName.substring(10), existing);
|
||||
BlockType.REGISTRY.register(typeName, existing);
|
||||
String nameSpace = typeName.substring(0, typeName.indexOf(':'));
|
||||
$NAMESPACES.add(nameSpace);
|
||||
return existing;
|
||||
@ -980,7 +988,7 @@ public final class BlockTypes {
|
||||
String input = inputLower;
|
||||
|
||||
if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input;
|
||||
BlockType result = $REGISTRY.get(input);
|
||||
BlockType result = BlockType.REGISTRY.get(input);
|
||||
if (result != null) return result;
|
||||
|
||||
try {
|
||||
@ -1002,11 +1010,11 @@ public final class BlockTypes {
|
||||
}
|
||||
|
||||
public static @Nullable BlockType get(final String id) {
|
||||
return $REGISTRY.get(id);
|
||||
return BlockType.REGISTRY.getMap().get(id);
|
||||
}
|
||||
|
||||
public static @Nullable BlockType get(final CharSequence id) {
|
||||
return $REGISTRY.get(id);
|
||||
return BlockType.REGISTRY.getMap().get(id);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -22,6 +22,8 @@ package com.sk89q.worldedit.world.registry;
|
||||
import com.google.common.io.Resources;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
@ -76,6 +78,15 @@ public final class BundledBlockData {
|
||||
private void loadFromResource() throws IOException {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter());
|
||||
gsonBuilder.registerTypeAdapter(int.class, (JsonDeserializer<Integer>) (json, typeOfT, context) -> {
|
||||
JsonPrimitive primitive = (JsonPrimitive) json;
|
||||
if (primitive.isString()) {
|
||||
String value = primitive.getAsString();
|
||||
if (value.charAt(0) == '#') return Integer.parseInt(value.substring(1), 16);
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
return primitive.getAsInt();
|
||||
});
|
||||
Gson gson = gsonBuilder.create();
|
||||
URL url = null;
|
||||
final int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataVersion();
|
||||
|
@ -66,13 +66,13 @@ public class SnapshotRepository {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of snapshots in a directory. The newest snapshot is near the top of the array.
|
||||
* Get a list of snapshots in a directory. The newest snapshot is
|
||||
* near the top of the array.
|
||||
*
|
||||
* @param newestFirst true to get the newest first
|
||||
* @return a list of snapshots
|
||||
*/
|
||||
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName)
|
||||
throws MissingWorldException {
|
||||
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException {
|
||||
FilenameFilter filter = (dir, name) -> {
|
||||
File f = new File(dir, name);
|
||||
return isValidSnapshot(f);
|
||||
@ -116,8 +116,7 @@ public class SnapshotRepository {
|
||||
* @return a snapshot or null
|
||||
*/
|
||||
@Nullable
|
||||
public Snapshot getSnapshotAfter(ZonedDateTime date, String world)
|
||||
throws MissingWorldException {
|
||||
public Snapshot getSnapshotAfter(ZonedDateTime date, String world) throws MissingWorldException {
|
||||
List<Snapshot> snapshots = getSnapshots(true, world);
|
||||
Snapshot last = null;
|
||||
|
||||
@ -139,8 +138,7 @@ public class SnapshotRepository {
|
||||
* @return a snapshot or null
|
||||
*/
|
||||
@Nullable
|
||||
public Snapshot getSnapshotBefore(ZonedDateTime date, String world)
|
||||
throws MissingWorldException {
|
||||
public Snapshot getSnapshotBefore(ZonedDateTime date, String world) throws MissingWorldException {
|
||||
List<Snapshot> snapshots = getSnapshots(false, world);
|
||||
Snapshot last = null;
|
||||
|
||||
@ -206,8 +204,7 @@ public class SnapshotRepository {
|
||||
* @return whether it is a valid snapshot
|
||||
*/
|
||||
protected boolean isValidSnapshot(File file) {
|
||||
if (!file.getName()
|
||||
.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
|
||||
if (!file.getName().matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@
|
||||
"hardness": 2.0,
|
||||
"resistance": 3.0,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -758,7 +758,7 @@
|
||||
"hardness": 3.0,
|
||||
"resistance": 3.0,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -771,7 +771,7 @@
|
||||
"unpushable": false,
|
||||
"mapColor": "#000000",
|
||||
"isTranslucent": false,
|
||||
"hasContainer": false
|
||||
"hasContainer": true
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -1133,7 +1133,7 @@
|
||||
"hardness": 2.0,
|
||||
"resistance": 3.0,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -1246,7 +1246,7 @@
|
||||
"unpushable": false,
|
||||
"mapColor": "#8f7748",
|
||||
"isTranslucent": false,
|
||||
"hasContainer": false
|
||||
"hasContainer": true
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -1383,7 +1383,7 @@
|
||||
"hardness": 2.0,
|
||||
"resistance": 2.0,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -1391,10 +1391,10 @@
|
||||
"burnable": false,
|
||||
"opaque": true,
|
||||
"replacedDuringPlacement": false,
|
||||
"toolRequired": false,
|
||||
"toolRequired": true,
|
||||
"fragileWhenPushed": false,
|
||||
"unpushable": false,
|
||||
"mapColor": "#7f3fb2",
|
||||
"mapColor": "#707070",
|
||||
"isTranslucent": true,
|
||||
"hasContainer": true
|
||||
}
|
||||
@ -1408,7 +1408,7 @@
|
||||
"hardness": 0.3,
|
||||
"resistance": 0.3,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -16899,4 +16899,4 @@
|
||||
"hasContainer": false
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -316,16 +316,11 @@
|
||||
"47:0": "minecraft:bookshelf",
|
||||
"48:0": "minecraft:mossy_cobblestone",
|
||||
"49:0": "minecraft:obsidian",
|
||||
"50:0": "minecraft:torch",
|
||||
"50:1": "minecraft:wall_torch[facing=east]",
|
||||
"50:2": "minecraft:wall_torch[facing=west]",
|
||||
"50:3": "minecraft:wall_torch[facing=south]",
|
||||
"50:4": "minecraft:wall_torch[facing=north]",
|
||||
"50:9": "minecraft:wall_torch[facing=east]",
|
||||
"50:10": "minecraft:wall_torch[facing=west]",
|
||||
"50:11": "minecraft:wall_torch[facing=south]",
|
||||
"50:12": "minecraft:wall_torch[facing=north]",
|
||||
"50:13": "minecraft:torch",
|
||||
"50:5": "minecraft:torch",
|
||||
"51:0": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=0]",
|
||||
"51:1": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=1]",
|
||||
"51:2": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=2]",
|
||||
@ -351,15 +346,10 @@
|
||||
"53:5": "minecraft:oak_stairs[half=top,shape=outer_right,facing=west]",
|
||||
"53:6": "minecraft:oak_stairs[half=top,shape=outer_right,facing=south]",
|
||||
"53:7": "minecraft:oak_stairs[half=top,shape=outer_right,facing=north]",
|
||||
"54:0": "minecraft:chest",
|
||||
"54:2": "minecraft:chest[facing=north,type=single]",
|
||||
"54:3": "minecraft:chest[facing=south,type=single]",
|
||||
"54:4": "minecraft:chest[facing=west,type=single]",
|
||||
"54:5": "minecraft:chest[facing=east,type=single]",
|
||||
"54:10": "minecraft:chest[facing=north]",
|
||||
"54:11": "minecraft:chest[facing=south]",
|
||||
"54:12": "minecraft:chest[facing=west]",
|
||||
"54:13": "minecraft:chest[facing=east]",
|
||||
"55:0": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=0]",
|
||||
"55:1": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=1]",
|
||||
"55:2": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=2]",
|
||||
@ -395,40 +385,30 @@
|
||||
"60:5": "minecraft:farmland[moisture=5]",
|
||||
"60:6": "minecraft:farmland[moisture=6]",
|
||||
"60:7": "minecraft:farmland[moisture=7]",
|
||||
"61:0": "minecraft:furnace",
|
||||
"61:2": "minecraft:furnace[facing=north,lit=false]",
|
||||
"61:3": "minecraft:furnace[facing=south,lit=false]",
|
||||
"61:4": "minecraft:furnace[facing=west,lit=false]",
|
||||
"61:5": "minecraft:furnace[facing=east,lit=false]",
|
||||
"61:10": "minecraft:furnace[facing=north,lit=false]",
|
||||
"61:11": "minecraft:furnace[facing=south,lit=false]",
|
||||
"61:12": "minecraft:furnace[facing=west,lit=false]",
|
||||
"61:13": "minecraft:furnace[facing=east,lit=false]",
|
||||
"62:0": "minecraft:furnace[lit=true]",
|
||||
"62:2": "minecraft:furnace[facing=north,lit=true]",
|
||||
"62:3": "minecraft:furnace[facing=south,lit=true]",
|
||||
"62:4": "minecraft:furnace[facing=west,lit=true]",
|
||||
"62:5": "minecraft:furnace[facing=east,lit=true]",
|
||||
"62:10": "minecraft:furnace[facing=north,lit=true]",
|
||||
"62:11": "minecraft:furnace[facing=south,lit=true]",
|
||||
"62:12": "minecraft:furnace[facing=west,lit=true]",
|
||||
"62:13": "minecraft:furnace[facing=east,lit=true]",
|
||||
"63:0": "minecraft:oak_sign[rotation=0]",
|
||||
"63:1": "minecraft:oak_sign[rotation=1]",
|
||||
"63:2": "minecraft:oak_sign[rotation=2]",
|
||||
"63:3": "minecraft:oak_sign[rotation=3]",
|
||||
"63:4": "minecraft:oak_sign[rotation=4]",
|
||||
"63:5": "minecraft:oak_sign[rotation=5]",
|
||||
"63:6": "minecraft:oak_sign[rotation=6]",
|
||||
"63:7": "minecraft:oak_sign[rotation=7]",
|
||||
"63:8": "minecraft:oak_sign[rotation=8]",
|
||||
"63:9": "minecraft:oak_sign[rotation=9]",
|
||||
"63:10": "minecraft:oak_sign[rotation=10]",
|
||||
"63:11": "minecraft:oak_sign[rotation=11]",
|
||||
"63:12": "minecraft:oak_sign[rotation=12]",
|
||||
"63:13": "minecraft:oak_sign[rotation=13]",
|
||||
"63:14": "minecraft:oak_sign[rotation=14]",
|
||||
"63:15": "minecraft:oak_sign[rotation=15]",
|
||||
"63:0": "minecraft:sign[rotation=0]",
|
||||
"63:1": "minecraft:sign[rotation=1]",
|
||||
"63:2": "minecraft:sign[rotation=2]",
|
||||
"63:3": "minecraft:sign[rotation=3]",
|
||||
"63:4": "minecraft:sign[rotation=4]",
|
||||
"63:5": "minecraft:sign[rotation=5]",
|
||||
"63:6": "minecraft:sign[rotation=6]",
|
||||
"63:7": "minecraft:sign[rotation=7]",
|
||||
"63:8": "minecraft:sign[rotation=8]",
|
||||
"63:9": "minecraft:sign[rotation=9]",
|
||||
"63:10": "minecraft:sign[rotation=10]",
|
||||
"63:11": "minecraft:sign[rotation=11]",
|
||||
"63:12": "minecraft:sign[rotation=12]",
|
||||
"63:13": "minecraft:sign[rotation=13]",
|
||||
"63:14": "minecraft:sign[rotation=14]",
|
||||
"63:15": "minecraft:sign[rotation=15]",
|
||||
"64:0": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]",
|
||||
"64:1": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=south,open=false]",
|
||||
"64:2": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=west,open=false]",
|
||||
@ -441,15 +421,10 @@
|
||||
"64:9": "minecraft:oak_door[hinge=right,half=upper,powered=false,facing=east,open=false]",
|
||||
"64:10": "minecraft:oak_door[hinge=left,half=upper,powered=true,facing=east,open=false]",
|
||||
"64:11": "minecraft:oak_door[hinge=right,half=upper,powered=true,facing=east,open=false]",
|
||||
"65:0": "minecraft:ladder",
|
||||
"65:2": "minecraft:ladder[facing=north]",
|
||||
"65:3": "minecraft:ladder[facing=south]",
|
||||
"65:4": "minecraft:ladder[facing=west]",
|
||||
"65:5": "minecraft:ladder[facing=east]",
|
||||
"65:10": "minecraft:ladder[facing=north]",
|
||||
"65:11": "minecraft:ladder[facing=south]",
|
||||
"65:12": "minecraft:ladder[facing=west]",
|
||||
"65:13": "minecraft:ladder[facing=east]",
|
||||
"66:0": "minecraft:rail[shape=north_south]",
|
||||
"66:1": "minecraft:rail[shape=east_west]",
|
||||
"66:2": "minecraft:rail[shape=ascending_east]",
|
||||
@ -468,15 +443,10 @@
|
||||
"67:5": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=west]",
|
||||
"67:6": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=south]",
|
||||
"67:7": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=north]",
|
||||
"68:0": "minecraft:oak_wall_sign",
|
||||
"68:2": "minecraft:oak_wall_sign[facing=north]",
|
||||
"68:3": "minecraft:oak_wall_sign[facing=south]",
|
||||
"68:4": "minecraft:oak_wall_sign[facing=west]",
|
||||
"68:5": "minecraft:oak_wall_sign[facing=east]",
|
||||
"68:10": "minecraft:oak_wall_sign[facing=north]",
|
||||
"68:11": "minecraft:oak_wall_sign[facing=south]",
|
||||
"68:12": "minecraft:oak_wall_sign[facing=west]",
|
||||
"68:13": "minecraft:oak_wall_sign[facing=east]",
|
||||
"68:2": "minecraft:wall_sign[facing=north]",
|
||||
"68:3": "minecraft:wall_sign[facing=south]",
|
||||
"68:4": "minecraft:wall_sign[facing=west]",
|
||||
"68:5": "minecraft:wall_sign[facing=east]",
|
||||
"69:0": "minecraft:lever[powered=false,facing=north,face=ceiling]",
|
||||
"69:1": "minecraft:lever[powered=false,facing=east,face=wall]",
|
||||
"69:2": "minecraft:lever[powered=false,facing=west,face=wall]",
|
||||
@ -511,28 +481,16 @@
|
||||
"72:1": "minecraft:oak_pressure_plate[powered=true]",
|
||||
"73:0": "minecraft:redstone_ore[lit=false]",
|
||||
"74:0": "minecraft:redstone_ore[lit=true]",
|
||||
"75:0": "minecraft:redstone_torch[lit=false]",
|
||||
"75:1": "minecraft:redstone_wall_torch[facing=east,lit=false]",
|
||||
"75:2": "minecraft:redstone_wall_torch[facing=west,lit=false]",
|
||||
"75:3": "minecraft:redstone_wall_torch[facing=south,lit=false]",
|
||||
"75:4": "minecraft:redstone_wall_torch[facing=north,lit=false]",
|
||||
"75:5": "minecraft:redstone_torch[lit=false]",
|
||||
"75:9": "minecraft:redstone_wall_torch[facing=east,lit=false]",
|
||||
"75:10": "minecraft:redstone_wall_torch[facing=west,lit=false]",
|
||||
"75:11": "minecraft:redstone_wall_torch[facing=south,lit=false]",
|
||||
"75:12": "minecraft:redstone_wall_torch[facing=north,lit=false]",
|
||||
"75:13": "minecraft:redstone_wall_torch[lit=false]",
|
||||
"76:0": "minecraft:redstone_torch[lit=true]",
|
||||
"76:1": "minecraft:redstone_wall_torch[facing=east,lit=true]",
|
||||
"76:2": "minecraft:redstone_wall_torch[facing=west,lit=true]",
|
||||
"76:3": "minecraft:redstone_wall_torch[facing=south,lit=true]",
|
||||
"76:4": "minecraft:redstone_wall_torch[facing=north,lit=true]",
|
||||
"76:5": "minecraft:redstone_wall_torch[lit=true]",
|
||||
"76:9": "minecraft:redstone_wall_torch[facing=east,lit=true]",
|
||||
"76:10": "minecraft:redstone_wall_torch[facing=west,lit=true]",
|
||||
"76:11": "minecraft:redstone_wall_torch[facing=south,lit=true]",
|
||||
"76:12": "minecraft:redstone_wall_torch[facing=north,lit=true]",
|
||||
"76:13": "minecraft:redstone_wall_torch[lit=true]",
|
||||
"76:5": "minecraft:redstone_torch[lit=true]",
|
||||
"77:0": "minecraft:stone_button[powered=false,facing=east,face=ceiling]",
|
||||
"77:1": "minecraft:stone_button[powered=false,facing=east,face=wall]",
|
||||
"77:2": "minecraft:stone_button[powered=false,facing=west,face=wall]",
|
||||
@ -598,15 +556,8 @@
|
||||
"87:0": "minecraft:netherrack",
|
||||
"88:0": "minecraft:soul_sand",
|
||||
"89:0": "minecraft:glowstone",
|
||||
"90:0": "minecraft:nether_portal",
|
||||
"90:1": "minecraft:nether_portal[axis=x]",
|
||||
"90:2": "minecraft:nether_portal[axis=z]",
|
||||
"90:5": "minecraft:nether_portal[axis=x]",
|
||||
"90:6": "minecraft:nether_portal[axis=z]",
|
||||
"90:9": "minecraft:nether_portal[axis=x]",
|
||||
"90:10": "minecraft:nether_portal[axis=z]",
|
||||
"90:13": "minecraft:nether_portal[axis=x]",
|
||||
"90:14": "minecraft:nether_portal[axis=z]",
|
||||
"91:0": "minecraft:jack_o_lantern[facing=south]",
|
||||
"91:1": "minecraft:jack_o_lantern[facing=west]",
|
||||
"91:2": "minecraft:jack_o_lantern[facing=north]",
|
||||
@ -866,15 +817,10 @@
|
||||
"128:6": "minecraft:sandstone_stairs[half=top,shape=straight,facing=south]",
|
||||
"128:7": "minecraft:sandstone_stairs[half=top,shape=straight,facing=north]",
|
||||
"129:0": "minecraft:emerald_ore",
|
||||
"130:0": "minecraft:ender_chest",
|
||||
"130:2": "minecraft:ender_chest[facing=north]",
|
||||
"130:3": "minecraft:ender_chest[facing=south]",
|
||||
"130:4": "minecraft:ender_chest[facing=west]",
|
||||
"130:5": "minecraft:ender_chest[facing=east]",
|
||||
"130:10": "minecraft:ender_chest[facing=north]",
|
||||
"130:11": "minecraft:ender_chest[facing=south]",
|
||||
"130:12": "minecraft:ender_chest[facing=west]",
|
||||
"130:13": "minecraft:ender_chest[facing=east]",
|
||||
"131:0": "minecraft:tripwire_hook[powered=false,attached=false,facing=south]",
|
||||
"131:1": "minecraft:tripwire_hook[powered=false,attached=false,facing=west]",
|
||||
"131:2": "minecraft:tripwire_hook[powered=false,attached=false,facing=north]",
|
||||
@ -1007,15 +953,10 @@
|
||||
"145:9": "minecraft:damaged_anvil[facing=west]",
|
||||
"145:10": "minecraft:damaged_anvil[facing=north]",
|
||||
"145:11": "minecraft:damaged_anvil[facing=east]",
|
||||
"146:0": "minecraft:trapped_chest",
|
||||
"146:2": "minecraft:trapped_chest[facing=north,type=single]",
|
||||
"146:3": "minecraft:trapped_chest[facing=south,type=single]",
|
||||
"146:4": "minecraft:trapped_chest[facing=west,type=single]",
|
||||
"146:5": "minecraft:trapped_chest[facing=east,type=single]",
|
||||
"146:10": "minecraft:trapped_chest[facing=north,type=single]",
|
||||
"146:11": "minecraft:trapped_chest[facing=south,type=single]",
|
||||
"146:12": "minecraft:trapped_chest[facing=west,type=single]",
|
||||
"146:13": "minecraft:trapped_chest[facing=east,type=single]",
|
||||
"147:0": "minecraft:light_weighted_pressure_plate[power=0]",
|
||||
"147:1": "minecraft:light_weighted_pressure_plate[power=1]",
|
||||
"147:2": "minecraft:light_weighted_pressure_plate[power=2]",
|
||||
@ -1283,15 +1224,10 @@
|
||||
"176:13": "minecraft:white_banner[rotation=13]",
|
||||
"176:14": "minecraft:white_banner[rotation=14]",
|
||||
"176:15": "minecraft:white_banner[rotation=15]",
|
||||
"177:0": "minecraft:white_wall_banner",
|
||||
"177:2": "minecraft:white_wall_banner[facing=north]",
|
||||
"177:3": "minecraft:white_wall_banner[facing=south]",
|
||||
"177:4": "minecraft:white_wall_banner[facing=west]",
|
||||
"177:5": "minecraft:white_wall_banner[facing=east]",
|
||||
"177:10": "minecraft:white_wall_banner[facing=north]",
|
||||
"177:11": "minecraft:white_wall_banner[facing=south]",
|
||||
"177:12": "minecraft:white_wall_banner[facing=west]",
|
||||
"177:13": "minecraft:white_wall_banner[facing=east]",
|
||||
"178:0": "minecraft:daylight_detector[inverted=true,power=0]",
|
||||
"178:1": "minecraft:daylight_detector[inverted=true,power=1]",
|
||||
"178:2": "minecraft:daylight_detector[inverted=true,power=2]",
|
||||
@ -2196,7 +2132,7 @@
|
||||
"321:0": "minecraft:painting",
|
||||
"322:0": "minecraft:golden_apple",
|
||||
"322:1": "minecraft:enchanted_golden_apple",
|
||||
"323:0": "minecraft:oak_sign",
|
||||
"323:0": "minecraft:sign",
|
||||
"324:0": "minecraft:oak_door",
|
||||
"325:0": "minecraft:bucket",
|
||||
"326:0": "minecraft:water_bucket",
|
||||
|
@ -19,19 +19,20 @@
|
||||
|
||||
package com.sk89q.minecraft.util.commands;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class CommandContextTest {
|
||||
|
||||
@ -39,7 +40,7 @@ public class CommandContextTest {
|
||||
private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something";
|
||||
CommandContext firstCommand;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUpTest() {
|
||||
try {
|
||||
firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w')));
|
||||
@ -49,10 +50,12 @@ public class CommandContextTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = CommandException.class)
|
||||
public void testInvalidFlags() throws CommandException {
|
||||
@Test
|
||||
public void testInvalidFlags() {
|
||||
final String failingCommand = "herpderp -opw testers";
|
||||
assertThrows(CommandException.class, () -> {
|
||||
new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w')));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -19,34 +19,29 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.transform;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
|
||||
@Ignore("A platform is currently required to get properties, preventing this test.")
|
||||
@Disabled("A platform is currently required to get properties, preventing this test.")
|
||||
public class BlockTransformExtentTest {
|
||||
|
||||
private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90);
|
||||
private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90);
|
||||
private final Set<BlockType> ignored = new HashSet<>();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
// BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransform() throws Exception {
|
||||
public void testTransform() {
|
||||
// for (BlockType type : BlockType.REGISTRY.values()) {
|
||||
// if (ignored.contains(type)) {
|
||||
// continue;
|
||||
@ -66,4 +61,4 @@ public class BlockTransformExtentTest {
|
||||
// assertEquals(base, rotated);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
junit.jupiter.execution.parallel.enabled=true
|
||||
junit.jupiter.execution.parallel.mode.default=concurrent
|
||||
junit.jupiter.execution.parallel.mode.classes.default=same_thread
|
||||
junit.jupiter.execution.parallel.config.strategy=dynamic
|
||||
junit.jupiter.execution.parallel.config.dynamic.factor=4
|
Reference in New Issue
Block a user