Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
migrate to gradle to kotlin
Dieser Commit ist enthalten in:
Ursprung
2a054b9220
Commit
64a1bfc9b3
188
build.gradle
188
build.gradle
@ -1,188 +0,0 @@
|
|||||||
import org.ajoberstar.grgit.Grgit
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations.all {
|
|
||||||
resolutionStrategy {
|
|
||||||
force "commons-io:commons-io:2.4"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.4"
|
|
||||||
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id "org.ajoberstar.grgit" version "3.1.1"
|
|
||||||
id "com.github.johnrengelman.shadow" version "5.1.0"
|
|
||||||
id 'com.gradle.build-scan' version '2.1'
|
|
||||||
}
|
|
||||||
|
|
||||||
buildScan {
|
|
||||||
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
|
|
||||||
termsOfServiceAgree = 'yes'
|
|
||||||
}
|
|
||||||
|
|
||||||
println """
|
|
||||||
*******************************************
|
|
||||||
You are building FastAsyncWorldEdit!
|
|
||||||
|
|
||||||
If you encounter trouble:
|
|
||||||
1) Read COMPILING.md if you haven"t yet
|
|
||||||
2) Try running "build" in a separate Gradle run
|
|
||||||
3) Use gradlew and not gradle
|
|
||||||
4) If you still need help, ask on Discord! https://discord.gg/ngZCzbU
|
|
||||||
|
|
||||||
Output files will be in /target
|
|
||||||
*******************************************
|
|
||||||
"""
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
group = "com.boydti.fawe"
|
|
||||||
|
|
||||||
def rootVersion = "1.13"
|
|
||||||
def revision = ""
|
|
||||||
def buildNumber = ""
|
|
||||||
def date = ""
|
|
||||||
ext {
|
|
||||||
git = Grgit.open(dir: new File(rootDir.toString()+"/.git"))
|
|
||||||
date = git.head().getDate().format("yy.MM.dd")
|
|
||||||
revision = "-${git.head().abbreviatedId}"
|
|
||||||
parents = git.head().parentIds;
|
|
||||||
if (project.hasProperty("buildnumber")) {
|
|
||||||
buildNumber = "$buildnumber"
|
|
||||||
} else {
|
|
||||||
index = -2109; // Offset to match CI
|
|
||||||
for (; parents != null && !parents.isEmpty(); index++) {
|
|
||||||
parents = git.getResolve().toCommit(parents.get(0)).getParentIds()
|
|
||||||
}
|
|
||||||
buildNumber = "${index}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
version = String.format("%s.%s", rootVersion, buildNumber)
|
|
||||||
}
|
|
||||||
|
|
||||||
description = rootProject.name
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven { url "http://maven.sk89q.com/repo/" }
|
|
||||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
|
||||||
maven { url "http://repo.maven.apache.org/maven2" }
|
|
||||||
// Fawe
|
|
||||||
maven { url "https://mvnrepository.com/artifact/" }
|
|
||||||
maven { url "http://repo.dmulloy2.net/content/groups/public/" }
|
|
||||||
maven { url "https://repo.destroystokyo.com/repository/maven-public//" }
|
|
||||||
maven { url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/" }
|
|
||||||
maven { url "https://libraries.minecraft.net" }
|
|
||||||
mavenLocal()
|
|
||||||
maven { url "http://empcraft.com/maven2" }
|
|
||||||
maven { url "https://hub.spigotmc.org/nexus/content/groups/public/" }
|
|
||||||
maven { url "http://ci.frostcast.net/plugin/repository/everything" }
|
|
||||||
maven { url "http://maven.sk89q.com/artifactory/repo" }
|
|
||||||
maven { url "http://repo.spongepowered.org/maven" }
|
|
||||||
maven { url "http://dl.bintray.com/tastybento/maven-repo" }
|
|
||||||
maven { url "http://ci.emc.gs/nexus/content/groups/aikar/" }
|
|
||||||
ivy {
|
|
||||||
url "https://ci.athion.net/job"
|
|
||||||
layout "pattern", {
|
|
||||||
artifact "/[organisation]/[module]/artifact/[revision].[ext]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
configurations.all {
|
|
||||||
resolutionStrategy {
|
|
||||||
cacheChangingModulesFor 5, "minutes"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(["worldedit-core", "worldedit-bukkit"].collect { project("$it") }) {
|
|
||||||
apply plugin: "java"
|
|
||||||
apply plugin: "maven"
|
|
||||||
// apply plugin: "checkstyle"
|
|
||||||
apply plugin: "com.github.johnrengelman.shadow"
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
|
|
||||||
// checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml")
|
|
||||||
// checkstyle.toolVersion = "7.6.1"
|
|
||||||
|
|
||||||
clean.doFirst {
|
|
||||||
delete "../target"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JavaVersion.current().isJava8Compatible()) {
|
|
||||||
// Java 8 turns on doclint which we fail
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
options.addStringOption("Xdoclint:none", "-quiet")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name == "worldedit-core" || name == "worldedit-bukkit") {
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = "sources"
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives sourcesJar
|
|
||||||
}
|
|
||||||
build.dependsOn(sourcesJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
// build.dependsOn(checkstyleMain)
|
|
||||||
// build.dependsOn(checkstyleTest)
|
|
||||||
// build.dependsOn(javadocJar)
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly "org.jetbrains:annotations:17.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(["bukkit"].collect { project(":worldedit-$it") }) {
|
|
||||||
shadowJar {
|
|
||||||
getArchiveClassifier().set("dist")
|
|
||||||
dependencies {
|
|
||||||
include(project(":worldedit-libs:core"))
|
|
||||||
include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}"))
|
|
||||||
include(project(":worldedit-core"))
|
|
||||||
include(dependency("com.github.luben:zstd-jni:1.1.1"))
|
|
||||||
include(dependency("co.aikar:fastutil-lite:1.0"))
|
|
||||||
}
|
|
||||||
exclude "GradleStart**"
|
|
||||||
exclude ".cache"
|
|
||||||
exclude "LICENSE*"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
task aggregatedJavadocs(type: Javadoc, description: "Generate javadocs from all child projects as if it was a single project", group: "Documentation") {
|
|
||||||
destinationDir = file("./docs/javadoc")
|
|
||||||
title = "$project.name $version API"
|
|
||||||
options.author true
|
|
||||||
options.links "http://docs.spring.io/spring/docs/4.3.x/javadoc-api/", "http://docs.oracle.com/javase/8/docs/api/", "http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/", "http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/"
|
|
||||||
options.addStringOption("Xdoclint:none", "-quiet")
|
|
||||||
|
|
||||||
delete "./docs"
|
|
||||||
|
|
||||||
subprojects.each { proj ->
|
|
||||||
proj.tasks.withType(Javadoc).each { javadocTask ->
|
|
||||||
source += javadocTask.source
|
|
||||||
classpath += javadocTask.classpath
|
|
||||||
excludes += javadocTask.excludes
|
|
||||||
includes += javadocTask.includes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
48
build.gradle.kts
Normale Datei
48
build.gradle.kts
Normale Datei
@ -0,0 +1,48 @@
|
|||||||
|
import org.ajoberstar.grgit.Grgit
|
||||||
|
|
||||||
|
logger.lifecycle("""
|
||||||
|
*******************************************
|
||||||
|
You are building WorldEdit!
|
||||||
|
|
||||||
|
If you encounter trouble:
|
||||||
|
1) Read COMPILING.md if you haven't yet
|
||||||
|
2) Try running 'build' in a separate Gradle run
|
||||||
|
3) Use gradlew and not gradle
|
||||||
|
4) If you still need help, ask on Discord! https://discord.gg/enginehub
|
||||||
|
|
||||||
|
Output files will be in [subproject]/build/libs
|
||||||
|
*******************************************
|
||||||
|
""")
|
||||||
|
|
||||||
|
//def rootVersion = "1.13"
|
||||||
|
//def revision = ""
|
||||||
|
//def buildNumber = ""
|
||||||
|
//def date = ""
|
||||||
|
//ext {
|
||||||
|
// git = Grgit.open(dir: new File(rootDir.toString()+"/.git"))
|
||||||
|
// date = git.head().getDate().format("yy.MM.dd")
|
||||||
|
// revision = "-${git.head().abbreviatedId}"
|
||||||
|
// parents = git.head().parentIds;
|
||||||
|
// if (project.hasProperty("buildnumber")) {
|
||||||
|
// buildNumber = "$buildnumber"
|
||||||
|
// } else {
|
||||||
|
// index = -2109; // Offset to match CI
|
||||||
|
// for (; parents != null && !parents.isEmpty(); index++) {
|
||||||
|
// parents = git.getResolve().toCommit(parents.get(0)).getParentIds()
|
||||||
|
// }
|
||||||
|
// buildNumber = "${index}"
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//version = String.format("%s.%s", rootVersion, buildNumber)
|
||||||
|
|
||||||
|
if (!project.hasProperty("gitCommitHash")) {
|
||||||
|
apply(plugin = "org.ajoberstar.grgit")
|
||||||
|
ext["gitCommitHash"] = try {
|
||||||
|
(ext["grgit"] as Grgit?)?.head()?.abbreviatedId
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.warn("Error getting commit hash", e)
|
||||||
|
|
||||||
|
"no_git_id"
|
||||||
|
}
|
||||||
|
}
|
29
buildSrc/build.gradle.kts
Normale Datei
29
buildSrc/build.gradle.kts
Normale Datei
@ -0,0 +1,29 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
kotlin("jvm") version embeddedKotlinVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy {
|
||||||
|
// Fabric needs this.
|
||||||
|
force(
|
||||||
|
"commons-io:commons-io:2.5",
|
||||||
|
"org.ow2.asm:asm:7.1",
|
||||||
|
"org.ow2.asm:asm-commons:7.1"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(gradleApi())
|
||||||
|
implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1")
|
||||||
|
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
|
||||||
|
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
|
||||||
|
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
|
||||||
|
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
|
||||||
|
}
|
27
buildSrc/src/main/kotlin/CommonConfig.kt
Normale Datei
27
buildSrc/src/main/kotlin/CommonConfig.kt
Normale Datei
@ -0,0 +1,27 @@
|
|||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.repositories
|
||||||
|
|
||||||
|
fun Project.applyCommonConfiguration() {
|
||||||
|
group = rootProject.group
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
maven { url = uri("http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/") }
|
||||||
|
maven { url = uri("https://maven.sk89q.com/repo/") }
|
||||||
|
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
|
||||||
|
maven { url = uri("http://empcraft.com/maven2") }
|
||||||
|
maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") }
|
||||||
|
maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") }
|
||||||
|
ivy { url = uri("https://ci.athion.net/job")
|
||||||
|
patternLayout {
|
||||||
|
artifact("/[organisation]/[module]/artifact/[revision].[ext]")
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy {
|
||||||
|
cacheChangingModulesFor(5, "minutes")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
buildSrc/src/main/kotlin/GradleExtras.kt
Normale Datei
12
buildSrc/src/main/kotlin/GradleExtras.kt
Normale Datei
@ -0,0 +1,12 @@
|
|||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||||
|
import org.gradle.api.plugins.JavaPluginConvention
|
||||||
|
import org.gradle.api.tasks.SourceSetContainer
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
import org.gradle.kotlin.dsl.the
|
||||||
|
|
||||||
|
val Project.ext: ExtraPropertiesExtension
|
||||||
|
get() = extensions.getByType()
|
||||||
|
|
||||||
|
val Project.sourceSets: SourceSetContainer
|
||||||
|
get() = the<JavaPluginConvention>().sourceSets
|
97
buildSrc/src/main/kotlin/LibsConfig.kt
Normale Datei
97
buildSrc/src/main/kotlin/LibsConfig.kt
Normale Datei
@ -0,0 +1,97 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.ModuleDependency
|
||||||
|
import org.gradle.api.internal.HasConvention
|
||||||
|
import org.gradle.api.plugins.MavenRepositoryHandlerConvention
|
||||||
|
import org.gradle.api.tasks.Upload
|
||||||
|
import org.gradle.api.tasks.bundling.Jar
|
||||||
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.get
|
||||||
|
import org.gradle.kotlin.dsl.getPlugin
|
||||||
|
import org.gradle.kotlin.dsl.invoke
|
||||||
|
import org.gradle.kotlin.dsl.register
|
||||||
|
|
||||||
|
fun Project.applyLibrariesConfiguration() {
|
||||||
|
applyCommonConfiguration()
|
||||||
|
apply(plugin = "java-base")
|
||||||
|
apply(plugin = "maven")
|
||||||
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
|
apply(plugin = "com.jfrog.artifactory")
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
create("shade")
|
||||||
|
getByName("archives").extendsFrom(getByName("default"))
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "${rootProject.group}.worldedit-libs"
|
||||||
|
|
||||||
|
tasks.register<ShadowJar>("jar") {
|
||||||
|
configurations = listOf(project.configurations["shade"])
|
||||||
|
archiveClassifier.set("")
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
exclude(dependency("com.google.guava:guava"))
|
||||||
|
exclude(dependency("com.google.code.gson:gson"))
|
||||||
|
exclude(dependency("org.checkerframework:checker-qual"))
|
||||||
|
}
|
||||||
|
|
||||||
|
relocate("net.kyori.text", "com.sk89q.worldedit.util.formatting.text")
|
||||||
|
}
|
||||||
|
val altConfigFiles = { artifactType: String ->
|
||||||
|
val deps = configurations["shade"].incoming.dependencies
|
||||||
|
.filterIsInstance<ModuleDependency>()
|
||||||
|
.map { it.copy() }
|
||||||
|
.map { dependency ->
|
||||||
|
dependency.artifact {
|
||||||
|
name = dependency.name
|
||||||
|
type = artifactType
|
||||||
|
extension = "jar"
|
||||||
|
classifier = artifactType
|
||||||
|
}
|
||||||
|
dependency
|
||||||
|
}
|
||||||
|
|
||||||
|
files(configurations.detachedConfiguration(*deps.toTypedArray())
|
||||||
|
.resolvedConfiguration.lenientConfiguration.artifacts
|
||||||
|
.filter { it.classifier == artifactType }
|
||||||
|
.map { zipTree(it.file) })
|
||||||
|
}
|
||||||
|
tasks.register<Jar>("sourcesJar") {
|
||||||
|
from({
|
||||||
|
altConfigFiles("sources")
|
||||||
|
})
|
||||||
|
val filePattern = Regex("(.*)net/kyori/text((?:/|$).*)")
|
||||||
|
val textPattern = Regex("net\\.kyori\\.text")
|
||||||
|
eachFile {
|
||||||
|
filter {
|
||||||
|
it.replaceFirst(textPattern, "com.sk89q.worldedit.util.formatting.text")
|
||||||
|
}
|
||||||
|
path = path.replaceFirst(filePattern, "$1com/sk89q/worldedit/util/formatting/text$2")
|
||||||
|
}
|
||||||
|
archiveClassifier.set("sources")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("assemble").configure {
|
||||||
|
dependsOn("jar", "sourcesJar")
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
val jar = tasks.named("jar")
|
||||||
|
add("default", jar) {
|
||||||
|
builtBy(jar)
|
||||||
|
}
|
||||||
|
val sourcesJar = tasks.named("sourcesJar")
|
||||||
|
add("archives", sourcesJar) {
|
||||||
|
builtBy(sourcesJar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Upload>("install") {
|
||||||
|
configuration = configurations["archives"]
|
||||||
|
(repositories as HasConvention).convention.getPlugin<MavenRepositoryHandlerConvention>().mavenInstaller {
|
||||||
|
pom.version = project.version.toString()
|
||||||
|
pom.artifactId = project.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
108
buildSrc/src/main/kotlin/PlatformConfig.kt
Normale Datei
108
buildSrc/src/main/kotlin/PlatformConfig.kt
Normale Datei
@ -0,0 +1,108 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.JavaPluginConvention
|
||||||
|
import org.gradle.api.plugins.quality.CheckstyleExtension
|
||||||
|
import org.gradle.api.tasks.bundling.Jar
|
||||||
|
import org.gradle.api.tasks.javadoc.Javadoc
|
||||||
|
import org.gradle.api.tasks.testing.Test
|
||||||
|
import org.gradle.external.javadoc.CoreJavadocOptions
|
||||||
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
|
import org.gradle.kotlin.dsl.get
|
||||||
|
import org.gradle.kotlin.dsl.getByName
|
||||||
|
import org.gradle.kotlin.dsl.named
|
||||||
|
import org.gradle.kotlin.dsl.register
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
|
||||||
|
fun Project.applyPlatformAndCoreConfiguration() {
|
||||||
|
applyCommonConfiguration()
|
||||||
|
apply(plugin = "java")
|
||||||
|
apply(plugin = "eclipse")
|
||||||
|
apply(plugin = "idea")
|
||||||
|
apply(plugin = "maven")
|
||||||
|
apply(plugin = "checkstyle")
|
||||||
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
|
apply(plugin = "com.jfrog.artifactory")
|
||||||
|
|
||||||
|
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
|
||||||
|
|
||||||
|
configure<JavaPluginConvention> {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<CheckstyleExtension> {
|
||||||
|
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
||||||
|
toolVersion = "7.6.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Test>().configureEach {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"compileOnly"("org.jetbrains:annotations:17.0.0")
|
||||||
|
"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
|
||||||
|
"testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
|
||||||
|
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")
|
||||||
|
"testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}")
|
||||||
|
"testRuntime"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Java 8 turns on doclint which we fail
|
||||||
|
tasks.withType<Javadoc>().configureEach {
|
||||||
|
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Jar>("javadocJar") {
|
||||||
|
dependsOn("javadoc")
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
|
from(tasks.getByName<Javadoc>("javadoc").destinationDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("assemble").configure {
|
||||||
|
dependsOn("javadocJar")
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
add("archives", tasks.named("jar"))
|
||||||
|
add("archives", tasks.named("javadocJar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == "worldedit-core" || name == "worldedit-bukkit") {
|
||||||
|
tasks.register<Jar>("sourcesJar") {
|
||||||
|
dependsOn("classes")
|
||||||
|
archiveClassifier.set("sources")
|
||||||
|
from(sourceSets["main"].allSource)
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
add("archives", tasks.named("sourcesJar"))
|
||||||
|
}
|
||||||
|
tasks.named("assemble").configure {
|
||||||
|
dependsOn("sourcesJar")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("check").configure {
|
||||||
|
dependsOn("checkstyleMain", "checkstyleTest")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.applyShadowConfiguration() {
|
||||||
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
archiveClassifier.set("dist")
|
||||||
|
dependencies {
|
||||||
|
include(project(":worldedit-libs:core"))
|
||||||
|
include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}"))
|
||||||
|
include(project(":worldedit-core"))
|
||||||
|
}
|
||||||
|
exclude("GradleStart**")
|
||||||
|
exclude(".cache")
|
||||||
|
exclude("LICENSE*")
|
||||||
|
minimize()
|
||||||
|
}
|
||||||
|
}
|
8
buildSrc/src/main/kotlin/Versions.kt
Normale Datei
8
buildSrc/src/main/kotlin/Versions.kt
Normale Datei
@ -0,0 +1,8 @@
|
|||||||
|
object Versions {
|
||||||
|
const val TEXT = "3.0.1"
|
||||||
|
const val TEXT_EXTRAS = "3.0.2"
|
||||||
|
const val PISTON = "0.4.4-SNAPSHOT"
|
||||||
|
const val AUTO_VALUE = "1.6.5"
|
||||||
|
const val JUNIT = "5.5.0"
|
||||||
|
const val MOCKITO = "3.0.0"
|
||||||
|
}
|
@ -1,114 +0,0 @@
|
|||||||
apply plugin: "eclipse"
|
|
||||||
apply plugin: "idea"
|
|
||||||
apply plugin: "maven"
|
|
||||||
apply plugin: "java-library"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url "https://hub.spigotmc.org/nexus/content/groups/public" }
|
|
||||||
maven { url "https://repo.codemc.org/repository/maven-public" }
|
|
||||||
maven { url "https://papermc.io/repo/repository/maven-public/" }
|
|
||||||
}
|
|
||||||
|
|
||||||
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 ("net.milkbowl.vault:VaultAPI:1.7")
|
|
||||||
api project(":worldedit-core")
|
|
||||||
api project(":worldedit-libs:core") // TODO remove once core can compile
|
|
||||||
api project(":worldedit-libs:bukkit")
|
|
||||||
compileOnly "com.sk89q:dummypermscompat:1.10"
|
|
||||||
compile "it.unimi.dsi:fastutil:8.2.1"
|
|
||||||
testCompile "org.mockito:mockito-core:1.9.0-rc1"
|
|
||||||
implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1"){transitive = false}
|
|
||||||
compile "com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT"
|
|
||||||
implementation("io.papermc:paperlib:1.0.2"){transitive = false}
|
|
||||||
compileOnly "BuildTools:spigot-1.14.4:lastSuccessfulBuild@jar"
|
|
||||||
implementation("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39"){transitive = false}
|
|
||||||
implementation("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39"){transitive = false}
|
|
||||||
implementation("com.massivecraft:factions:2.8.0"){transitive = false}
|
|
||||||
implementation("com.drtshock:factions:1.6.9.5"){transitive = false}
|
|
||||||
implementation("com.factionsone:FactionsOne:1.2.2"){transitive = false}
|
|
||||||
implementation("me.ryanhamshire:GriefPrevention:11.5.2"){transitive = false}
|
|
||||||
implementation("com.massivecraft:mcore:7.0.1"){transitive = false}
|
|
||||||
implementation("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT"){transitive = false}
|
|
||||||
implementation("net.jzx7:regios:5.9.9"){transitive = false}
|
|
||||||
implementation("com.bekvon.bukkit.residence:Residence:4.5._13.1"){transitive = false}
|
|
||||||
implementation("com.palmergames.bukkit:towny:0.84.0.9"){transitive = false}
|
|
||||||
implementation("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0"){transitive = false}
|
|
||||||
implementation("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT"){transitive = false}
|
|
||||||
implementation("com.wasteofplastic:askyblock:3.0.8.2"){transitive = false}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
dependencies {
|
|
||||||
relocate "org.slf4j", "com.sk89q.worldedit.slf4j"
|
|
||||||
relocate "org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge"
|
|
||||||
include(dependency(":worldedit-core"))
|
|
||||||
include(dependency(":worldedit-libs:core"))
|
|
||||||
include(dependency(":worldedit-libs:bukkit"))
|
|
||||||
include(dependency("org.slf4j:slf4j-api"))
|
|
||||||
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
|
|
||||||
relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") {
|
|
||||||
include("it.unimi.dsi:fastutil")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
archiveName = "${parent.name}-${project.name.replaceAll("worldedit-", "")}-${parent.version}.jar"
|
|
||||||
destinationDir = file "../target"
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
from("src/main/resources") {
|
|
||||||
expand(
|
|
||||||
name: project.parent.name,
|
|
||||||
version: project.parent.version
|
|
||||||
)
|
|
||||||
include "plugin.yml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jar.archiveName="fawe-bukkit-${project.parent.version}.jar"
|
|
||||||
jar.destinationDir = file "../mvn/com/boydti/fawe-bukkit/" + project.parent.version
|
|
||||||
task createPom {
|
|
||||||
doLast {
|
|
||||||
pom {
|
|
||||||
project {
|
|
||||||
groupId "com.boydti"
|
|
||||||
artifactId "fawe-bukkit"
|
|
||||||
version project.parent.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.getEffectivePom()
|
|
||||||
.setDependencies(new ArrayList<>())
|
|
||||||
.writeTo("../mvn/com/boydti/fawe-bukkit/${project.parent.version}/fawe-bukkit-${project.parent.version}.pom")
|
|
||||||
pom {
|
|
||||||
project {
|
|
||||||
groupId "com.boydti"
|
|
||||||
artifactId "fawe-bukkit"
|
|
||||||
version "latest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.getEffectivePom()
|
|
||||||
.setDependencies(new ArrayList<>())
|
|
||||||
.writeTo("../mvn/com/boydti/fawe-bukkit/latest/fawe-bukkit-latest.pom")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
task copyFiles {
|
|
||||||
doLast {
|
|
||||||
copy {
|
|
||||||
from "../mvn/com/boydti/fawe-bukkit/${project.parent.version}/"
|
|
||||||
into "../mvn/com/boydti/fawe-bukkit/latest/"
|
|
||||||
include("*.jar")
|
|
||||||
rename ("fawe-bukkit-${project.parent.version}.jar", "fawe-bukkit-latest.jar")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
build.dependsOn(shadowJar)
|
|
||||||
build.finalizedBy(copyFiles)
|
|
||||||
copyFiles.dependsOn(createPom)
|
|
98
worldedit-bukkit/build.gradle.kts
Normale Datei
98
worldedit-bukkit/build.gradle.kts
Normale Datei
@ -0,0 +1,98 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
}
|
||||||
|
|
||||||
|
applyPlatformAndCoreConfiguration()
|
||||||
|
applyShadowConfiguration()
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url = uri("https://hub.spigotmc.org/nexus/content/groups/public") }
|
||||||
|
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
|
||||||
|
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
||||||
|
maven { url = uri("http://empcraft.com/maven2") }
|
||||||
|
maven { url = uri("http://ci.frostcast.net/plugin/repository/everything") }
|
||||||
|
maven { url = uri("http://dl.bintray.com/tastybento/maven-repo") }
|
||||||
|
maven { url = uri("http://ci.emc.gs/nexus/content/groups/aikar/") }
|
||||||
|
maven { url = uri("https://libraries.minecraft.net") }
|
||||||
|
maven { url = uri("https://repo.destroystokyo.com/repository/maven-public//") }
|
||||||
|
maven { url = uri("http://repo.dmulloy2.net/content/groups/public/") }
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy {
|
||||||
|
force("com.google.guava:guava:21.0")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"compile"("net.milkbowl.vault:VaultAPI:1.7")
|
||||||
|
"api"(project(":worldedit-core"))
|
||||||
|
"api"(project(":worldedit-libs:bukkit"))
|
||||||
|
"api"("org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT") {
|
||||||
|
exclude("junit", "junit")
|
||||||
|
}
|
||||||
|
"compile"("it.unimi.dsi:fastutil:8.2.1")
|
||||||
|
"compileOnly"("com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT")
|
||||||
|
"compile"("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT")
|
||||||
|
"compileOnly"("BuildTools:spigot-1.14.4:lastSuccessfulBuild@jar")
|
||||||
|
"implementation"("io.papermc:paperlib:1.0.2")
|
||||||
|
"compileOnly"("com.sk89q:dummypermscompat:1.10")
|
||||||
|
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
|
||||||
|
"implementation"("org.bstats:bstats-bukkit:1.5")
|
||||||
|
"testCompile"("org.mockito:mockito-core:1.9.0-rc1")
|
||||||
|
"implementation"("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39")
|
||||||
|
"implementation"("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39")
|
||||||
|
"implementation"("com.massivecraft:factions:2.8.0")
|
||||||
|
"implementation"("com.drtshock:factions:1.6.9.5")
|
||||||
|
"implementation"("com.factionsone:FactionsOne:1.2.2")
|
||||||
|
"implementation"("me.ryanhamshire:GriefPrevention:11.5.2")
|
||||||
|
"implementation"("com.massivecraft:mcore:7.0.1")
|
||||||
|
"implementation"("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT")
|
||||||
|
"implementation"("net.jzx7:regios:5.9.9")
|
||||||
|
"implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1")
|
||||||
|
"implementation"("com.palmergames.bukkit:towny:0.84.0.9")
|
||||||
|
"implementation"("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0")
|
||||||
|
"implementation"("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT")
|
||||||
|
"implementation"("com.wasteofplastic:askyblock:3.0.8.2")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<Copy>("processResources") {
|
||||||
|
filesMatching("plugin.yml") {
|
||||||
|
expand("name" to (project.parent?.name ?: "FAWE"))
|
||||||
|
expand("version" to (project.parent?.version ?: "UNKNOWN"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<Jar>("jar") {
|
||||||
|
manifest {
|
||||||
|
attributes("Class-Path" to "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar",
|
||||||
|
"WorldEdit-Version" to project.version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
dependencies {
|
||||||
|
relocate("org.slf4j", "com.sk89q.worldedit.slf4j")
|
||||||
|
relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge")
|
||||||
|
include(dependency(":worldedit-core"))
|
||||||
|
include(dependency(":worldedit-libs:core"))
|
||||||
|
include(dependency(":worldedit-libs:bukkit"))
|
||||||
|
include(dependency("org.slf4j:slf4j-api"))
|
||||||
|
include(dependency("org.apache.logging.log4j:log4j-slf4j-impl"))
|
||||||
|
relocate("org.bstats", "com.sk89q.worldedit.bukkit.bstats") {
|
||||||
|
include(dependency("org.bstats:bstats-bukkit:1.5"))
|
||||||
|
}
|
||||||
|
relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") {
|
||||||
|
include(dependency("io.papermc:paperlib:1.0.2"))
|
||||||
|
}
|
||||||
|
relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") {
|
||||||
|
include(dependency("it.unimi.dsi:fastutil"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("assemble").configure {
|
||||||
|
dependsOn("shadowJar")
|
||||||
|
}
|
@ -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)
|
|
67
worldedit-core/build.gradle.kts
Normale Datei
67
worldedit-core/build.gradle.kts
Normale Datei
@ -0,0 +1,67 @@
|
|||||||
|
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:1.3.9")
|
||||||
|
"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")
|
||||||
|
|
||||||
|
|
||||||
|
"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.1.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 (project.parent?.version ?: "UNKNOWN"))
|
||||||
|
expand("name" to (project.parent?.name ?: "FAWE"))
|
||||||
|
expand("commit" to "TODO GIT")
|
||||||
|
expand("date" to "TODO Date")
|
||||||
|
}
|
||||||
|
}
|
@ -34,9 +34,9 @@ import com.sk89q.worldedit.command.ChunkCommands;
|
|||||||
import com.sk89q.worldedit.command.ClipboardCommands;
|
import com.sk89q.worldedit.command.ClipboardCommands;
|
||||||
import com.sk89q.worldedit.command.GenerationCommands;
|
import com.sk89q.worldedit.command.GenerationCommands;
|
||||||
import com.sk89q.worldedit.command.HistoryCommands;
|
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.NavigationCommands;
|
||||||
import com.sk89q.worldedit.command.PatternCommands;
|
//import com.sk89q.worldedit.command.PatternCommands;
|
||||||
import com.sk89q.worldedit.command.RegionCommands;
|
import com.sk89q.worldedit.command.RegionCommands;
|
||||||
import com.sk89q.worldedit.command.SchematicCommands;
|
import com.sk89q.worldedit.command.SchematicCommands;
|
||||||
import com.sk89q.worldedit.command.ScriptingCommands;
|
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.SnapshotUtilCommands;
|
||||||
import com.sk89q.worldedit.command.SuperPickaxeCommands;
|
import com.sk89q.worldedit.command.SuperPickaxeCommands;
|
||||||
import com.sk89q.worldedit.command.ToolCommands;
|
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.UtilityCommands;
|
||||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
@ -127,9 +127,9 @@ public final class DocumentationPrinter {
|
|||||||
writePermissionsWikiTable(stream, builder, "/", BrushOptionsCommands.class);
|
writePermissionsWikiTable(stream, builder, "/", BrushOptionsCommands.class);
|
||||||
writePermissionsWikiTable(stream, builder, "/tool ", ToolCommands.class);
|
writePermissionsWikiTable(stream, builder, "/tool ", ToolCommands.class);
|
||||||
writePermissionsWikiTable(stream, builder, "/brush ", BrushCommands.class);
|
writePermissionsWikiTable(stream, builder, "/brush ", BrushCommands.class);
|
||||||
writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks");
|
//writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks");
|
||||||
writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns");
|
//writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns");
|
||||||
writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms");
|
//writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms");
|
||||||
writePermissionsWikiTable(stream, builder, "/cfi ", CFICommands.class, "Create From Image");
|
writePermissionsWikiTable(stream, builder, "/cfi ", CFICommands.class, "Create From Image");
|
||||||
stream.println();
|
stream.println();
|
||||||
stream.print("#### Uncategorized\n");
|
stream.print("#### Uncategorized\n");
|
||||||
|
@ -1,448 +1,448 @@
|
|||||||
package com.sk89q.worldedit.command;
|
//package com.sk89q.worldedit.command;
|
||||||
|
//
|
||||||
import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
//import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
||||||
import com.boydti.fawe.object.mask.AdjacentMask;
|
//import com.boydti.fawe.object.mask.AdjacentMask;
|
||||||
import com.boydti.fawe.object.mask.AngleMask;
|
//import com.boydti.fawe.object.mask.AngleMask;
|
||||||
import com.boydti.fawe.object.mask.BiomeMask;
|
//import com.boydti.fawe.object.mask.BiomeMask;
|
||||||
import com.boydti.fawe.object.mask.BlockLightMask;
|
//import com.boydti.fawe.object.mask.BlockLightMask;
|
||||||
import com.boydti.fawe.object.mask.BrightnessMask;
|
//import com.boydti.fawe.object.mask.BrightnessMask;
|
||||||
import com.boydti.fawe.object.mask.DataMask;
|
//import com.boydti.fawe.object.mask.DataMask;
|
||||||
import com.boydti.fawe.object.mask.ExtremaMask;
|
//import com.boydti.fawe.object.mask.ExtremaMask;
|
||||||
import com.boydti.fawe.object.mask.IdDataMask;
|
//import com.boydti.fawe.object.mask.IdDataMask;
|
||||||
import com.boydti.fawe.object.mask.IdMask;
|
//import com.boydti.fawe.object.mask.IdMask;
|
||||||
import com.boydti.fawe.object.mask.LightMask;
|
//import com.boydti.fawe.object.mask.LightMask;
|
||||||
import com.boydti.fawe.object.mask.OpacityMask;
|
//import com.boydti.fawe.object.mask.OpacityMask;
|
||||||
import com.boydti.fawe.object.mask.ROCAngleMask;
|
//import com.boydti.fawe.object.mask.ROCAngleMask;
|
||||||
import com.boydti.fawe.object.mask.RadiusMask;
|
//import com.boydti.fawe.object.mask.RadiusMask;
|
||||||
import com.boydti.fawe.object.mask.RandomMask;
|
//import com.boydti.fawe.object.mask.RandomMask;
|
||||||
import com.boydti.fawe.object.mask.SimplexMask;
|
//import com.boydti.fawe.object.mask.SimplexMask;
|
||||||
import com.boydti.fawe.object.mask.SkyLightMask;
|
//import com.boydti.fawe.object.mask.SkyLightMask;
|
||||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
//import com.boydti.fawe.object.mask.SurfaceMask;
|
||||||
import com.boydti.fawe.object.mask.WallMask;
|
//import com.boydti.fawe.object.mask.WallMask;
|
||||||
import com.boydti.fawe.object.mask.XAxisMask;
|
//import com.boydti.fawe.object.mask.XAxisMask;
|
||||||
import com.boydti.fawe.object.mask.YAxisMask;
|
//import com.boydti.fawe.object.mask.YAxisMask;
|
||||||
import com.boydti.fawe.object.mask.ZAxisMask;
|
//import com.boydti.fawe.object.mask.ZAxisMask;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
//import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
//import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
//import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
//import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
//import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
//import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
//import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
//import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||||
import com.sk89q.worldedit.function.mask.ExpressionMask;
|
//import com.sk89q.worldedit.function.mask.ExpressionMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
//import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
//import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||||
import com.sk89q.worldedit.function.mask.MaskUnion;
|
//import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||||
import com.sk89q.worldedit.function.mask.Masks;
|
//import com.sk89q.worldedit.function.mask.Masks;
|
||||||
import com.sk89q.worldedit.function.mask.OffsetMask;
|
//import com.sk89q.worldedit.function.mask.OffsetMask;
|
||||||
import com.sk89q.worldedit.function.mask.RegionMask;
|
//import com.sk89q.worldedit.function.mask.RegionMask;
|
||||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
//import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||||
import com.sk89q.worldedit.internal.expression.Expression;
|
//import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
//import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||||
import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
|
//import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
//import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
//import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
//import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||||
import com.sk89q.worldedit.session.request.RequestSelection;
|
//import com.sk89q.worldedit.session.request.RequestSelection;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
//import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import org.enginehub.piston.annotation.Command;
|
//import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
//import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
//import org.enginehub.piston.annotation.param.Arg;
|
||||||
import org.enginehub.piston.annotation.param.Switch;
|
//import org.enginehub.piston.annotation.param.Switch;
|
||||||
|
//
|
||||||
//@Command(aliases = {"masks"},
|
////@Command(aliases = {"masks"},
|
||||||
// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
|
//// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
|
||||||
// descFooter = "Masks determine if a block can be placed\n" +
|
//// descFooter = "Masks determine if a block can be placed\n" +
|
||||||
// " - Use [brackets] for arguments\n" +
|
//// " - Use [brackets] for arguments\n" +
|
||||||
// " - Use , to OR multiple\n" +
|
//// " - Use , to OR multiple\n" +
|
||||||
// " - Use & to AND multiple\n" +
|
//// " - Use & to AND multiple\n" +
|
||||||
// "e.g. >[stone,dirt],#light[0][5],$jungle\n" +
|
//// "e.g. >[stone,dirt],#light[0][5],$jungle\n" +
|
||||||
// "More Info: https://git.io/v9r4K"
|
//// "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 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 {
|
||||||
public class MaskCommands {
|
// double y1, y2;
|
||||||
private final WorldEdit worldEdit;
|
// boolean override;
|
||||||
|
// if (maxStr.endsWith("d")) {
|
||||||
public MaskCommands(WorldEdit worldEdit) {
|
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||||
this.worldEdit = worldEdit;
|
// 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));
|
||||||
@Command(
|
// } else {
|
||||||
name = "#simplex",
|
// y1 = Expression.compile(minStr).evaluate();
|
||||||
desc = "Use simplex noise as the mask"
|
// y2 = Expression.compile(maxStr).evaluate();
|
||||||
)
|
// }
|
||||||
public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
// return new AngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||||
scale = 1d / Math.max(1, scale);
|
// }
|
||||||
minInt = (minInt - 50) / 50;
|
//
|
||||||
maxInt = (maxInt - 50) / 50;
|
// @Command(
|
||||||
return new SimplexMask(scale, minInt, maxInt);
|
// name = "(",
|
||||||
}
|
// aliases = {")", "#roc", "#(", "#)"},
|
||||||
|
// desc = "Restrict to near specific terrain slope rate of change",
|
||||||
@Command(
|
// descFooter = "Restrict to near specific terrain slope rate of change\n" +
|
||||||
name = "#light",
|
// "The -o flag will only overlay\n" +
|
||||||
desc = "Restrict to specific light levels"
|
// "Example: ([0d][45d][5]\n" +
|
||||||
)
|
// "Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" +
|
||||||
public Mask light(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
// "Note: Use negatives for decreasing slope"
|
||||||
return new LightMask(extent, (int) minInt, (int) maxInt);
|
//)
|
||||||
}
|
// 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;
|
||||||
@Command(
|
// boolean override;
|
||||||
name = "#false",
|
// if (maxStr.endsWith("d")) {
|
||||||
desc = "Always false"
|
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||||
)
|
// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||||
public Mask falseMask(Extent extent) {
|
// y1 = Math.tan(y1d * (Math.PI / 180));
|
||||||
return Masks.alwaysFalse();
|
// y2 = Math.tan(y2d * (Math.PI / 180));
|
||||||
}
|
// } else {
|
||||||
|
// y1 = Expression.compile(minStr).evaluate();
|
||||||
@Command(
|
// y2 = Expression.compile(maxStr).evaluate();
|
||||||
name = "#true",
|
// }
|
||||||
desc = "Always true"
|
// return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||||
)
|
// }
|
||||||
public Mask trueMask(Extent extent) {
|
//
|
||||||
return Masks.alwaysTrue();
|
// @Command(
|
||||||
}
|
// name = "^",
|
||||||
|
// aliases = {"#extrema", "#^"},
|
||||||
@Command(
|
// desc = "Restrict to near specific terrain extrema",
|
||||||
name = "#skylight",
|
// descFooter = "Restrict to near specific terrain extrema\n" +
|
||||||
desc = "Restrict to specific sky light levels"
|
// "The -o flag will only overlay\n" +
|
||||||
)
|
// "Example: ([0d][45d][5]\n" +
|
||||||
public Mask skylight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
// "Explanation: Restrict to near 45 degrees of local maxima\n" +
|
||||||
return new SkyLightMask(extent, (int) minInt, (int) maxInt);
|
// "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 {
|
||||||
@Command(
|
// double y1, y2;
|
||||||
name = "#blocklight",
|
// boolean override;
|
||||||
aliases = {"#emittedlight"},
|
// if (maxStr.endsWith("d")) {
|
||||||
desc = "Restrict to specific block light levels"
|
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||||
)
|
// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||||
public Mask blocklight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
// y1 = Math.tan(y1d * (Math.PI / 180));
|
||||||
return new BlockLightMask(extent, (int) minInt, (int) maxInt);
|
// y2 = Math.tan(y2d * (Math.PI / 180));
|
||||||
}
|
// } else {
|
||||||
|
// y1 = Expression.compile(minStr).evaluate();
|
||||||
@Command(
|
// y2 = Expression.compile(maxStr).evaluate();
|
||||||
name = "#opacity",
|
// }
|
||||||
desc = "Restrict to specific opacity levels"
|
// return new ExtremaMask(extent, y1, y2, overlay, distanceOpt);
|
||||||
)
|
// }
|
||||||
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 = "{",
|
||||||
|
// aliases = {"#{"},
|
||||||
@Command(
|
// desc = "Restricts blocks to within a specific radius range of the initial block"
|
||||||
name = "#brightness",
|
//)
|
||||||
desc = "Restrict to specific block brightness"
|
// 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);
|
||||||
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 = "|",
|
||||||
@Command(
|
// aliases = {"#|", "#side"},
|
||||||
name = "#offset",
|
// desc = "sides with a specific number of other blocks"
|
||||||
desc = "Offset a mask"
|
//)
|
||||||
)
|
// public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||||
public Mask offset(double x, double y, double z, Mask mask) {
|
// return new WallMask(mask, (int) minInt, (int) maxInt);
|
||||||
return new OffsetMask(mask, BlockVector3.at(x, y, z));
|
// }
|
||||||
}
|
//
|
||||||
|
// @Command(
|
||||||
@Command(
|
// name = "~",
|
||||||
name = "#haslight",
|
// aliases = {"#~", "#adjacent"},
|
||||||
desc = "Restricts to blocks with light (sky or emitted)"
|
// desc = "Adjacent to a specific number of other blocks"
|
||||||
)
|
//)
|
||||||
public Mask haslight(Extent extent) {
|
// 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 {
|
||||||
return new LightMask(extent, 1, Integer.MAX_VALUE);
|
// if (min == -1 && max == -1) {
|
||||||
}
|
// min = 1;
|
||||||
|
// max = 8;
|
||||||
@Command(
|
// } else if (max == -1) max = min;
|
||||||
name = "#nolight",
|
// if (max >= 8 && min == 1) {
|
||||||
desc = "Restrict to blocks without light (sky or emitted)"
|
// return new AdjacentAnyMask(mask);
|
||||||
)
|
// }
|
||||||
public Mask nolight(Extent extent) {
|
// return new AdjacentMask(mask, (int) min, (int) max);
|
||||||
return new LightMask(extent, 0, 0);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Command(
|
||||||
@Command(
|
// name = "<",
|
||||||
name = "#existing",
|
// aliases = {"#<", "#below"},
|
||||||
desc = "If there is a non air block"
|
// desc = "below a specific block"
|
||||||
)
|
//)
|
||||||
public Mask existing(Extent extent) {
|
// public Mask below(Mask mask) throws ExpressionException {
|
||||||
return new ExistingBlockMask(extent);
|
// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
|
||||||
}
|
// return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||||
|
// }
|
||||||
@Command(
|
//
|
||||||
name = "#solid",
|
// @Command(
|
||||||
desc = "If there is a solid block"
|
// name = ">",
|
||||||
)
|
// aliases = {"#>", "#above"},
|
||||||
public Mask solid(Extent extent) {
|
// desc = "above a specific block"
|
||||||
return new SolidBlockMask(extent);
|
//)
|
||||||
}
|
// public Mask above(Mask mask) throws ExpressionException {
|
||||||
|
// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
|
||||||
@Command(
|
// return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||||
name = "#liquid",
|
// }
|
||||||
desc = "If there is a solid block"
|
//
|
||||||
)
|
// @Command(
|
||||||
public Mask liquid(Extent extent) {
|
// name = "$",
|
||||||
return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent);
|
// aliases = {"#biome", "#$"},
|
||||||
}
|
// desc = "in a specific biome",
|
||||||
|
// descFooter = "in a specific biome. For a list of biomes use //biomelist"
|
||||||
@Command(
|
//)
|
||||||
name = "#dregion",
|
// public Mask biome(Extent extent, BiomeType biome) throws ExpressionException {
|
||||||
aliases = {"#dselection", "#dsel"},
|
// return new BiomeMask(extent, biome);
|
||||||
desc = "inside the player's selection"
|
// }
|
||||||
)
|
//
|
||||||
public Mask dregion() {
|
// @Command(
|
||||||
return new RegionMask(new RequestSelection());
|
// name = "%",
|
||||||
}
|
// aliases = {"#%", "#percent"},
|
||||||
|
// desc = "percentage chance"
|
||||||
@Command(
|
//)
|
||||||
name = "#region",
|
// public Mask random(double chance) throws ExpressionException {
|
||||||
aliases = {"#selection", "#sel"},
|
// chance = chance / 100;
|
||||||
desc = "inside the provided selection"
|
// return new RandomMask(chance);
|
||||||
)
|
// }
|
||||||
public Mask selection(Player player, LocalSession session) throws IncompleteRegionException {
|
//
|
||||||
return new RegionMask(session.getSelection(player.getWorld()).clone());
|
// @Command(
|
||||||
}
|
// name = "=",
|
||||||
|
// aliases = {"#=", "#expression"},
|
||||||
@Command(
|
// desc = "expression mask"
|
||||||
name = "#xaxis",
|
//)
|
||||||
desc = "Restrict to initial x axis"
|
// public Mask expression(Extent extent, String input) throws ExpressionException {
|
||||||
)
|
// Expression exp = Expression.compile(input, "x", "y", "z");
|
||||||
public Mask xaxis() {
|
// ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
||||||
return new XAxisMask();
|
// exp.setEnvironment(env);
|
||||||
}
|
// return new ExpressionMask(exp);
|
||||||
|
// }
|
||||||
@Command(
|
//
|
||||||
name = "#yaxis",
|
// @Command(
|
||||||
desc = "Restrict to initial y axis"
|
// name = "!",
|
||||||
)
|
// aliases = {"#not", "#negate", "#!"},
|
||||||
public Mask yaxis() {
|
// desc = "Negate another mask"
|
||||||
return new YAxisMask();
|
//)
|
||||||
}
|
// public Mask expression(Mask mask) throws ExpressionException {
|
||||||
|
// return Masks.negate(mask);
|
||||||
@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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,378 +1,378 @@
|
|||||||
package com.sk89q.worldedit.command;
|
//package com.sk89q.worldedit.command;
|
||||||
|
//
|
||||||
import com.boydti.fawe.object.DataAnglePattern;
|
//import com.boydti.fawe.object.DataAnglePattern;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
//import com.boydti.fawe.object.FawePlayer;
|
||||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
//import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||||
import com.boydti.fawe.object.collection.RandomCollection;
|
//import com.boydti.fawe.object.collection.RandomCollection;
|
||||||
import com.boydti.fawe.object.pattern.*;
|
//import com.boydti.fawe.object.pattern.*;
|
||||||
import com.boydti.fawe.object.random.SimplexRandom;
|
//import com.boydti.fawe.object.random.SimplexRandom;
|
||||||
import com.boydti.fawe.util.ColorUtil;
|
//import com.boydti.fawe.util.ColorUtil;
|
||||||
import com.boydti.fawe.util.TextureUtil;
|
//import com.boydti.fawe.util.TextureUtil;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
//import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import org.enginehub.piston.annotation.Command;
|
//import org.enginehub.piston.annotation.Command;
|
||||||
import com.sk89q.worldedit.*;
|
//import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
//import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
//import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
//import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
//import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
//import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
//import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
//import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.pattern.ClipboardPattern;
|
//import com.sk89q.worldedit.function.pattern.ClipboardPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
//import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
//import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||||
import com.sk89q.worldedit.internal.expression.Expression;
|
//import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
//import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
//import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
//import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
//import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.internal.annotation.Range;
|
//import com.sk89q.worldedit.internal.annotation.Range;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
//import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
//import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
//import org.enginehub.piston.annotation.param.Arg;
|
||||||
|
//
|
||||||
import java.awt.Color;
|
//import java.awt.Color;
|
||||||
import java.io.IOException;
|
//import java.io.IOException;
|
||||||
import java.util.Collections;
|
//import java.util.Collections;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
|
//
|
||||||
//@Command(aliases = {"patterns"},
|
////@Command(aliases = {"patterns"},
|
||||||
// desc = "Help for the various patterns. [More Info](https://git.io/vSPmA)",
|
//// desc = "Help for the various patterns. [More Info](https://git.io/vSPmA)",
|
||||||
// descFooter = "Patterns determine what blocks are placed\n" +
|
//// descFooter = "Patterns determine what blocks are placed\n" +
|
||||||
// " - Use [brackets] for arguments\n" +
|
//// " - Use [brackets] for arguments\n" +
|
||||||
// " - Use , to OR multiple\n" +
|
//// " - Use , to OR multiple\n" +
|
||||||
// "e.g. #surfacespread[10][#existing],andesite\n" +
|
//// "e.g. #surfacespread[10][#existing],andesite\n" +
|
||||||
// "More Info: https://git.io/vSPmA"
|
//// "More Info: https://git.io/vSPmA"
|
||||||
|
////)
|
||||||
|
//@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
|
//public class PatternCommands {
|
||||||
|
//
|
||||||
|
// @Command(
|
||||||
|
// name = "#existing",
|
||||||
|
// aliases = {"#*", "*", ".*"},
|
||||||
|
// desc = "Use the block that is already there"
|
||||||
|
// )
|
||||||
|
// public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties
|
||||||
|
// if (properties == null) return new ExistingPattern(extent);
|
||||||
|
// return new PropertyPattern(extent).addRegex(".*[" + properties + "]");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Command(
|
||||||
|
// name = "#clipboard",
|
||||||
|
// aliases = {"#copy"},
|
||||||
|
// desc = "Use the blocks in your clipboard as the pattern")
|
||||||
|
// public Pattern clipboard(LocalSession session) throws EmptyClipboardException {
|
||||||
|
// ClipboardHolder holder = session.getClipboard();
|
||||||
|
// Clipboard clipboard = holder.getClipboard();
|
||||||
|
// return new ClipboardPattern(clipboard);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Command(
|
||||||
|
// name = "#simplex",
|
||||||
|
// desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE"
|
||||||
//)
|
//)
|
||||||
@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
// public Pattern simplex(@Arg(desc = "scale factor") double scale, Pattern other) {
|
||||||
public class PatternCommands {
|
// if (other instanceof RandomPattern) {
|
||||||
|
// scale = (1d / Math.max(1, scale));
|
||||||
@Command(
|
// RandomCollection<Pattern> collection = ((RandomPattern) other).getCollection();
|
||||||
name = "#existing",
|
// collection.setRandom(new SimplexRandom(scale));
|
||||||
aliases = {"#*", "*", ".*"},
|
// }
|
||||||
desc = "Use the block that is already there"
|
// return other;
|
||||||
)
|
// }
|
||||||
public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties
|
//
|
||||||
if (properties == null) return new ExistingPattern(extent);
|
// @Command(
|
||||||
return new PropertyPattern(extent).addRegex(".*[" + properties + "]");
|
// name = "#color",
|
||||||
}
|
// desc = "Use the block closest to a specific color"
|
||||||
|
//)
|
||||||
@Command(
|
// public Pattern color(TextureUtil textureUtil, String color) {
|
||||||
name = "#clipboard",
|
// Color colorObj = ColorUtil.parseColor(color);
|
||||||
aliases = {"#copy"},
|
// return textureUtil.getNearestBlock(colorObj.getRGB()).getDefaultState();
|
||||||
desc = "Use the blocks in your clipboard as the pattern")
|
// }
|
||||||
public Pattern clipboard(LocalSession session) throws EmptyClipboardException {
|
//
|
||||||
ClipboardHolder holder = session.getClipboard();
|
// @Command(
|
||||||
Clipboard clipboard = holder.getClipboard();
|
// name = "#anglecolor",
|
||||||
return new ClipboardPattern(clipboard);
|
// desc = "A darker block based on the existing terrain angle"
|
||||||
}
|
//)
|
||||||
|
// public Pattern anglecolor(Extent extent, LocalSession session, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize, @Arg(name = "maxcomplexity", desc = "double", def = "100") double maxComplexity, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) {
|
||||||
@Command(
|
// return new AngleColorPattern(extent, session, distanceOpt);
|
||||||
name = "#simplex",
|
// }
|
||||||
desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE"
|
//
|
||||||
)
|
// @Command(
|
||||||
public Pattern simplex(@Arg(desc = "scale factor") double scale, Pattern other) {
|
// name = "#angledata",
|
||||||
if (other instanceof RandomPattern) {
|
// desc = "Block data based on the existing terrain angle"
|
||||||
scale = (1d / Math.max(1, scale));
|
// )
|
||||||
RandomCollection<Pattern> collection = ((RandomPattern) other).getCollection();
|
// public Pattern angledata(Extent extent, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) {
|
||||||
collection.setRandom(new SimplexRandom(scale));
|
// return new DataAnglePattern(extent, distanceOpt);
|
||||||
}
|
// }
|
||||||
return other;
|
//
|
||||||
}
|
// @Command(
|
||||||
|
// name = "#saturate",
|
||||||
@Command(
|
// desc = "Saturate the existing block with a color"
|
||||||
name = "#color",
|
//)
|
||||||
desc = "Use the block closest to a specific color"
|
// public Pattern saturate(Extent extent, LocalSession session, String colorStr) {
|
||||||
)
|
// Color color = ColorUtil.parseColor(colorStr);
|
||||||
public Pattern color(TextureUtil textureUtil, String color) {
|
// return new SaturatePattern(extent, color.getRGB(), session);
|
||||||
Color colorObj = ColorUtil.parseColor(color);
|
// }
|
||||||
return textureUtil.getNearestBlock(colorObj.getRGB()).getDefaultState();
|
//
|
||||||
}
|
// @Command(
|
||||||
|
// name = "#averagecolor",
|
||||||
@Command(
|
// desc = "Average between the existing block and a color"
|
||||||
name = "#anglecolor",
|
//)
|
||||||
desc = "A darker block based on the existing terrain angle"
|
// public Pattern averagecolor(Extent extent, LocalSession session, String colorStr) {
|
||||||
)
|
// Color color = ColorUtil.parseColor(colorStr);
|
||||||
public Pattern anglecolor(Extent extent, LocalSession session, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize, @Arg(name = "maxcomplexity", desc = "double", def = "100") double maxComplexity, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) {
|
// return new AverageColorPattern(extent, color.getRGB(), session);
|
||||||
return new AngleColorPattern(extent, session, distanceOpt);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Command(
|
||||||
@Command(
|
// name = "#desaturate",
|
||||||
name = "#angledata",
|
// desc = "Desaturated color of the existing block"
|
||||||
desc = "Block data based on the existing terrain angle"
|
//)
|
||||||
)
|
// public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) {
|
||||||
public Pattern angledata(Extent extent, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) {
|
// return new DesaturatePattern(extent, percent / 100d, session);
|
||||||
return new DataAnglePattern(extent, distanceOpt);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Command(
|
||||||
@Command(
|
// name = "#lighten",
|
||||||
name = "#saturate",
|
// desc = "Lighten the existing block"
|
||||||
desc = "Saturate the existing block with a color"
|
//)
|
||||||
)
|
// public Pattern lighten(Extent extent, TextureUtil util) {
|
||||||
public Pattern saturate(Extent extent, LocalSession session, String colorStr) {
|
// return new ShadePattern(extent, false, util);
|
||||||
Color color = ColorUtil.parseColor(colorStr);
|
// }
|
||||||
return new SaturatePattern(extent, color.getRGB(), session);
|
//
|
||||||
}
|
// @Command(
|
||||||
|
// name = "#darken",
|
||||||
@Command(
|
// desc = "Darken the existing block"
|
||||||
name = "#averagecolor",
|
//)
|
||||||
desc = "Average between the existing block and a color"
|
// public Pattern darken(Extent extent, TextureUtil util) {
|
||||||
)
|
// return new ShadePattern(extent, true, util);
|
||||||
public Pattern averagecolor(Extent extent, LocalSession session, String colorStr) {
|
// }
|
||||||
Color color = ColorUtil.parseColor(colorStr);
|
//
|
||||||
return new AverageColorPattern(extent, color.getRGB(), session);
|
// @Command(
|
||||||
}
|
// name = "#fullcopy",
|
||||||
|
// desc = "Places your full clipboard at each block"
|
||||||
@Command(
|
//)
|
||||||
name = "#desaturate",
|
// public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Arg(name = "location", desc = "String", def = "#copy") String location, @Arg(name = "rotate", desc = "boolean", def = "false") boolean rotate, @Arg(name = "flip", desc = "boolean", def = "false") boolean flip) throws EmptyClipboardException, InputParseException, IOException {
|
||||||
desc = "Desaturated color of the existing block"
|
// List<ClipboardHolder> clipboards;
|
||||||
)
|
// switch (location.toLowerCase()) {
|
||||||
public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) {
|
// case "#copy":
|
||||||
return new DesaturatePattern(extent, percent / 100d, session);
|
// case "#clipboard":
|
||||||
}
|
// ClipboardHolder clipboard = session.getExistingClipboard();
|
||||||
|
// if (clipboard == null) {
|
||||||
@Command(
|
// throw new InputParseException("To use #fullcopy, please first copy something to your clipboard");
|
||||||
name = "#lighten",
|
// }
|
||||||
desc = "Lighten the existing block"
|
// if (!rotate && !flip) {
|
||||||
)
|
// return new FullClipboardPattern(extent, clipboard.getClipboard());
|
||||||
public Pattern lighten(Extent extent, TextureUtil util) {
|
// }
|
||||||
return new ShadePattern(extent, false, util);
|
// clipboards = Collections.singletonList(clipboard);
|
||||||
}
|
// break;
|
||||||
|
// default:
|
||||||
@Command(
|
// MultiClipboardHolder multi = ClipboardFormats.loadAllFromInput(player, location, null, true);
|
||||||
name = "#darken",
|
// clipboards = multi != null ? multi.getHolders() : null;
|
||||||
desc = "Darken the existing block"
|
// break;
|
||||||
)
|
// }
|
||||||
public Pattern darken(Extent extent, TextureUtil util) {
|
// if (clipboards == null) {
|
||||||
return new ShadePattern(extent, true, util);
|
// throw new InputParseException("#fullcopy:<source>");
|
||||||
}
|
// }
|
||||||
|
// return new RandomFullClipboardPattern(extent, clipboards, rotate, flip);
|
||||||
@Command(
|
// }
|
||||||
name = "#fullcopy",
|
//
|
||||||
desc = "Places your full clipboard at each block"
|
// @Command(
|
||||||
)
|
// name = "#buffer",
|
||||||
public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Arg(name = "location", desc = "String", def = "#copy") String location, @Arg(name = "rotate", desc = "boolean", def = "false") boolean rotate, @Arg(name = "flip", desc = "boolean", def = "false") boolean flip) throws EmptyClipboardException, InputParseException, IOException {
|
// desc = "Only place a block once while a pattern is in use",
|
||||||
List<ClipboardHolder> clipboards;
|
// descFooter = "Only place a block once while a pattern is in use\n" +
|
||||||
switch (location.toLowerCase()) {
|
// "Use with a brush when you don't want to apply to the same spot twice"
|
||||||
case "#copy":
|
//)
|
||||||
case "#clipboard":
|
// public Pattern buffer(Actor actor, Pattern pattern) {
|
||||||
ClipboardHolder clipboard = session.getExistingClipboard();
|
// return new BufferedPattern(FawePlayer.wrap(actor), pattern);
|
||||||
if (clipboard == null) {
|
// }
|
||||||
throw new InputParseException("To use #fullcopy, please first copy something to your clipboard");
|
//
|
||||||
}
|
// @Command(
|
||||||
if (!rotate && !flip) {
|
// name = "#buffer2d",
|
||||||
return new FullClipboardPattern(extent, clipboard.getClipboard());
|
// desc = "Only place a block once in a column while a pattern is in use"
|
||||||
}
|
//)
|
||||||
clipboards = Collections.singletonList(clipboard);
|
// public Pattern buffer2d(Actor actor, Pattern pattern) {
|
||||||
break;
|
// return new BufferedPattern2D(FawePlayer.wrap(actor), pattern);
|
||||||
default:
|
// }
|
||||||
MultiClipboardHolder multi = ClipboardFormats.loadAllFromInput(player, location, null, true);
|
//
|
||||||
clipboards = multi != null ? multi.getHolders() : null;
|
// @Command(
|
||||||
break;
|
// name = "#iddatamask",
|
||||||
}
|
// desc = "Use the pattern's id and the existing blocks data with the provided mask",
|
||||||
if (clipboards == null) {
|
// descFooter = "Use the pattern's id and the existing blocks data with the provided mask\n" +
|
||||||
throw new InputParseException("#fullcopy:<source>");
|
// " - Use to replace slabs or where the data values needs to be shifted instead of set"
|
||||||
}
|
//)
|
||||||
return new RandomFullClipboardPattern(extent, clipboards, rotate, flip);
|
// public Pattern iddatamask(Actor actor, LocalSession session, Extent extent, @Range(min = 0, max = 15) int bitmask, Pattern pattern) {
|
||||||
}
|
//
|
||||||
|
// return new IdDataMaskPattern(extent, pattern, bitmask);
|
||||||
@Command(
|
// }
|
||||||
name = "#buffer",
|
//
|
||||||
desc = "Only place a block once while a pattern is in use",
|
// @Command(
|
||||||
descFooter = "Only place a block once while a pattern is in use\n" +
|
// name = "#id",
|
||||||
"Use with a brush when you don't want to apply to the same spot twice"
|
// desc = "Only change the block id"
|
||||||
)
|
//)
|
||||||
public Pattern buffer(Actor actor, Pattern pattern) {
|
// public Pattern id(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
||||||
return new BufferedPattern(FawePlayer.wrap(actor), pattern);
|
//
|
||||||
}
|
// return new IdPattern(extent, pattern);
|
||||||
|
// }
|
||||||
@Command(
|
//
|
||||||
name = "#buffer2d",
|
// @Command(
|
||||||
desc = "Only place a block once in a column while a pattern is in use"
|
// name = "#data",
|
||||||
)
|
// desc = "Only change the block data"
|
||||||
public Pattern buffer2d(Actor actor, Pattern pattern) {
|
//)
|
||||||
return new BufferedPattern2D(FawePlayer.wrap(actor), pattern);
|
// public Pattern data(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
||||||
}
|
//
|
||||||
|
// return new DataPattern(extent, pattern);
|
||||||
@Command(
|
// }
|
||||||
name = "#iddatamask",
|
//
|
||||||
desc = "Use the pattern's id and the existing blocks data with the provided mask",
|
// @Command(
|
||||||
descFooter = "Use the pattern's id and the existing blocks data with the provided mask\n" +
|
// name = "#biome",
|
||||||
" - Use to replace slabs or where the data values needs to be shifted instead of set"
|
// aliases = {"$"},
|
||||||
)
|
// desc = "Set the biome"
|
||||||
public Pattern iddatamask(Actor actor, LocalSession session, Extent extent, @Range(min = 0, max = 15) int bitmask, Pattern pattern) {
|
//)
|
||||||
|
// public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) {
|
||||||
return new IdDataMaskPattern(extent, pattern, bitmask);
|
//
|
||||||
}
|
// return new BiomePattern(extent, biome);
|
||||||
|
// }
|
||||||
@Command(
|
//
|
||||||
name = "#id",
|
// @Command(
|
||||||
desc = "Only change the block id"
|
// name = "#relative",
|
||||||
)
|
// aliases = {"#~", "#r", "#rel"},
|
||||||
public Pattern id(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
// desc = "Offset the pattern to where you click"
|
||||||
|
//)
|
||||||
return new IdPattern(extent, pattern);
|
// public Pattern relative(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
||||||
}
|
//
|
||||||
|
// return new RelativePattern(pattern);
|
||||||
@Command(
|
// }
|
||||||
name = "#data",
|
//
|
||||||
desc = "Only change the block data"
|
// @Command(
|
||||||
)
|
// name = "#!x",
|
||||||
public Pattern data(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
// aliases = {"#nx", "#nox"},
|
||||||
|
// desc = "The pattern will not be provided the x axis info",
|
||||||
return new DataPattern(extent, pattern);
|
// descFooter = "The pattern will not be provided the z axis info.\n" +
|
||||||
}
|
// "Example: #!x[#!z[#~[#l3d[pattern]]]]"
|
||||||
|
//)
|
||||||
@Command(
|
// public Pattern nox(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
||||||
name = "#biome",
|
//
|
||||||
aliases = {"$"},
|
// return new NoXPattern(pattern);
|
||||||
desc = "Set the biome"
|
// }
|
||||||
)
|
//
|
||||||
public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) {
|
// @Command(
|
||||||
|
// name = "#!y",
|
||||||
return new BiomePattern(extent, biome);
|
// aliases = {"#ny", "#noy"},
|
||||||
}
|
// desc = "The pattern will not be provided the y axis info"
|
||||||
|
//)
|
||||||
@Command(
|
// public Pattern noy(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
||||||
name = "#relative",
|
//
|
||||||
aliases = {"#~", "#r", "#rel"},
|
// return new NoYPattern(pattern);
|
||||||
desc = "Offset the pattern to where you click"
|
// }
|
||||||
)
|
//
|
||||||
public Pattern relative(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
// @Command(
|
||||||
|
// name = "#!z",
|
||||||
return new RelativePattern(pattern);
|
// aliases = {"#nz", "#noz"},
|
||||||
}
|
// desc = "The pattern will not be provided the z axis info"
|
||||||
|
//)
|
||||||
@Command(
|
// public Pattern noz(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
||||||
name = "#!x",
|
//
|
||||||
aliases = {"#nx", "#nox"},
|
// return new NoZPattern(pattern);
|
||||||
desc = "The pattern will not be provided the x axis info",
|
// }
|
||||||
descFooter = "The pattern will not be provided the z axis info.\n" +
|
//
|
||||||
"Example: #!x[#!z[#~[#l3d[pattern]]]]"
|
// @Command(
|
||||||
)
|
// name = "#mask",
|
||||||
public Pattern nox(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
// desc = "Apply a pattern depending on a mask"
|
||||||
|
//)
|
||||||
return new NoXPattern(pattern);
|
// public Pattern mask(Actor actor, LocalSession session, Mask mask, Pattern pass, Pattern fail) {
|
||||||
}
|
// return new MaskedPattern(mask, pass, fail);
|
||||||
|
// }
|
||||||
@Command(
|
//
|
||||||
name = "#!y",
|
// @Command(
|
||||||
aliases = {"#ny", "#noy"},
|
// name = "#offset",
|
||||||
desc = "The pattern will not be provided the y axis info"
|
// desc = "Offset a pattern"
|
||||||
)
|
//)
|
||||||
public Pattern noy(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
// public Pattern offset(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
|
||||||
|
//
|
||||||
return new NoYPattern(pattern);
|
// return new OffsetPattern(pattern, (int) x, (int) y, (int) z);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#!z",
|
// name = "#surfacespread",
|
||||||
aliases = {"#nz", "#noz"},
|
// desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset `[0, <distance>)`. e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard"
|
||||||
desc = "The pattern will not be provided the z axis info"
|
//)
|
||||||
)
|
// public Pattern surfacespread(Actor actor, LocalSession session, double distance, Pattern pattern) {
|
||||||
public Pattern noz(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
|
//
|
||||||
|
// return new SurfaceRandomOffsetPattern(pattern, (int) distance);
|
||||||
return new NoZPattern(pattern);
|
// }
|
||||||
}
|
//
|
||||||
|
// @Command(
|
||||||
@Command(
|
// name = "#solidspread",
|
||||||
name = "#mask",
|
// desc = "Randomly spread solid blocks"
|
||||||
desc = "Apply a pattern depending on a mask"
|
//)
|
||||||
)
|
// public Pattern solidspread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
|
||||||
public Pattern mask(Actor actor, LocalSession session, Mask mask, Pattern pass, Pattern fail) {
|
//
|
||||||
return new MaskedPattern(mask, pass, fail);
|
// return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#offset",
|
// name = "#spread",
|
||||||
desc = "Offset a pattern"
|
// aliases = {"#randomoffset"},
|
||||||
)
|
// desc = "Randomly spread blocks"
|
||||||
public Pattern offset(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
|
//)
|
||||||
|
// public Pattern spread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
|
||||||
return new OffsetPattern(pattern, (int) x, (int) y, (int) z);
|
//
|
||||||
}
|
// return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
|
||||||
|
// }
|
||||||
@Command(
|
//
|
||||||
name = "#surfacespread",
|
// @Command(
|
||||||
desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset `[0, <distance>)`. e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard"
|
// name = "#linear",
|
||||||
)
|
// aliases = {"#l"},
|
||||||
public Pattern surfacespread(Actor actor, LocalSession session, double distance, Pattern pattern) {
|
// desc = "Sequentially set blocks from a list of patterns"
|
||||||
|
//)
|
||||||
return new SurfaceRandomOffsetPattern(pattern, (int) distance);
|
// public Pattern linear(Actor actor, LocalSession session, Pattern other) {
|
||||||
}
|
//
|
||||||
|
// if (other instanceof RandomPattern) {
|
||||||
@Command(
|
// Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
|
||||||
name = "#solidspread",
|
// return new LinearBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
|
||||||
desc = "Randomly spread solid blocks"
|
// }
|
||||||
)
|
// return other;
|
||||||
public Pattern solidspread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
|
// }
|
||||||
|
//
|
||||||
return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
|
// @Command(
|
||||||
}
|
// name = "#linear3d",
|
||||||
|
// aliases = {"#l3d"},
|
||||||
@Command(
|
// desc = "Use the x,y,z coordinate to pick a block from the list"
|
||||||
name = "#spread",
|
//)
|
||||||
aliases = {"#randomoffset"},
|
// public Pattern linear3d(Actor actor, LocalSession session, Pattern other) {
|
||||||
desc = "Randomly spread blocks"
|
//
|
||||||
)
|
// if (other instanceof RandomPattern) {
|
||||||
public Pattern spread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
|
// Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
|
||||||
|
// return new Linear3DBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
|
||||||
return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
|
// }
|
||||||
}
|
// return other;
|
||||||
|
// }
|
||||||
@Command(
|
//
|
||||||
name = "#linear",
|
// @Command(
|
||||||
aliases = {"#l"},
|
// name = "#linear2d",
|
||||||
desc = "Sequentially set blocks from a list of patterns"
|
// aliases = {"#l2d"},
|
||||||
)
|
// desc = "Use the x,z coordinate to pick a block from the list"
|
||||||
public Pattern linear(Actor actor, LocalSession session, Pattern other) {
|
//)
|
||||||
|
// public Pattern linear2d(Actor actor, LocalSession session, Pattern other) {
|
||||||
if (other instanceof RandomPattern) {
|
//
|
||||||
Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
|
// if (other instanceof RandomPattern) {
|
||||||
return new LinearBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
|
// Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
|
||||||
}
|
// return new Linear2DBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
|
||||||
return other;
|
// }
|
||||||
}
|
// return other;
|
||||||
|
// }
|
||||||
@Command(
|
//
|
||||||
name = "#linear3d",
|
// @Command(
|
||||||
aliases = {"#l3d"},
|
// name = "=",
|
||||||
desc = "Use the x,y,z coordinate to pick a block from the list"
|
// aliases = {"#=", "#expression"},
|
||||||
)
|
// desc = "Expression pattern: http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax"
|
||||||
public Pattern linear3d(Actor actor, LocalSession session, Pattern other) {
|
//)
|
||||||
|
// public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException {
|
||||||
if (other instanceof RandomPattern) {
|
//
|
||||||
Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
|
// Expression exp = Expression.compile(input, "x", "y", "z");
|
||||||
return new Linear3DBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
|
// WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
||||||
}
|
// exp.setEnvironment(env);
|
||||||
return other;
|
// return new ExpressionPattern(exp);
|
||||||
}
|
// }
|
||||||
|
//}
|
||||||
@Command(
|
|
||||||
name = "#linear2d",
|
|
||||||
aliases = {"#l2d"},
|
|
||||||
desc = "Use the x,z coordinate to pick a block from the list"
|
|
||||||
)
|
|
||||||
public Pattern linear2d(Actor actor, LocalSession session, Pattern other) {
|
|
||||||
|
|
||||||
if (other instanceof RandomPattern) {
|
|
||||||
Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
|
|
||||||
return new Linear2DBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
|
|
||||||
}
|
|
||||||
return other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command(
|
|
||||||
name = "=",
|
|
||||||
aliases = {"#=", "#expression"},
|
|
||||||
desc = "Expression pattern: http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax"
|
|
||||||
)
|
|
||||||
public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException {
|
|
||||||
|
|
||||||
Expression exp = Expression.compile(input, "x", "y", "z");
|
|
||||||
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
|
||||||
exp.setEnvironment(env);
|
|
||||||
return new ExpressionPattern(exp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,104 +1,104 @@
|
|||||||
package com.sk89q.worldedit.command;
|
//package com.sk89q.worldedit.command;
|
||||||
|
//
|
||||||
import com.boydti.fawe.object.extent.Linear3DTransform;
|
//import com.boydti.fawe.object.extent.Linear3DTransform;
|
||||||
import com.boydti.fawe.object.extent.LinearTransform;
|
//import com.boydti.fawe.object.extent.LinearTransform;
|
||||||
import com.boydti.fawe.object.extent.OffsetExtent;
|
//import com.boydti.fawe.object.extent.OffsetExtent;
|
||||||
import com.boydti.fawe.object.extent.PatternTransform;
|
//import com.boydti.fawe.object.extent.PatternTransform;
|
||||||
import com.boydti.fawe.object.extent.RandomOffsetTransform;
|
//import com.boydti.fawe.object.extent.RandomOffsetTransform;
|
||||||
import com.boydti.fawe.object.extent.RandomTransform;
|
//import com.boydti.fawe.object.extent.RandomTransform;
|
||||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
//import com.boydti.fawe.object.extent.ResettableExtent;
|
||||||
import com.boydti.fawe.object.extent.ScaleTransform;
|
//import com.boydti.fawe.object.extent.ScaleTransform;
|
||||||
import com.boydti.fawe.object.extent.TransformExtent;
|
//import com.boydti.fawe.object.extent.TransformExtent;
|
||||||
import com.boydti.fawe.util.ExtentTraverser;
|
//import com.boydti.fawe.util.ExtentTraverser;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
//import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
//import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
//import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
//import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
//import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
//import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
//import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
import org.enginehub.piston.annotation.Command;
|
//import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
//import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
//import org.enginehub.piston.annotation.param.Arg;
|
||||||
|
//
|
||||||
@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
//@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
public class TransformCommands {
|
//public class TransformCommands {
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#linear",
|
// name = "#linear",
|
||||||
aliases = {"#l"},
|
// aliases = {"#l"},
|
||||||
desc = "Sequentially pick from a list of transform"
|
// desc = "Sequentially pick from a list of transform"
|
||||||
)
|
// )
|
||||||
public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
// public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
if (other instanceof RandomTransform) {
|
// if (other instanceof RandomTransform) {
|
||||||
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
|
// Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
|
||||||
return new LinearTransform(extents.toArray(new ResettableExtent[0]));
|
// return new LinearTransform(extents.toArray(new ResettableExtent[0]));
|
||||||
}
|
// }
|
||||||
return other;
|
// return other;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#linear3d",
|
// name = "#linear3d",
|
||||||
aliases = {"#l3d"},
|
// aliases = {"#l3d"},
|
||||||
desc = "Use the x,y,z coordinate to pick a transform from the list"
|
// desc = "Use the x,y,z coordinate to pick a transform from the list"
|
||||||
)
|
// )
|
||||||
public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
// public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
if (other instanceof RandomTransform) {
|
// if (other instanceof RandomTransform) {
|
||||||
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
|
// Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
|
||||||
return new Linear3DTransform(extents.toArray(new ResettableExtent[0]));
|
// return new Linear3DTransform(extents.toArray(new ResettableExtent[0]));
|
||||||
}
|
// }
|
||||||
return other;
|
// return other;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#pattern",
|
// name = "#pattern",
|
||||||
desc = "Always use a specific pattern"
|
// desc = "Always use a specific pattern"
|
||||||
)
|
// )
|
||||||
public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
// public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
return new PatternTransform(other, pattern);
|
// return new PatternTransform(other, pattern);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#offset",
|
// name = "#offset",
|
||||||
desc = "Offset transform"
|
// desc = "Offset transform"
|
||||||
)
|
// )
|
||||||
public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
// public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
return new OffsetExtent(other, (int) x, (int) y, (int) z);
|
// return new OffsetExtent(other, (int) x, (int) y, (int) z);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#spread",
|
// name = "#spread",
|
||||||
aliases = {"#randomoffset"},
|
// aliases = {"#randomoffset"},
|
||||||
desc = "Random offset transform"
|
// desc = "Random offset transform"
|
||||||
)
|
//)
|
||||||
public ResettableExtent randomOffset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
// public ResettableExtent randomOffset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
return new RandomOffsetTransform(other, (int) x, (int) y, (int) z);
|
// return new RandomOffsetTransform(other, (int) x, (int) y, (int) z);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#scale",
|
// name = "#scale",
|
||||||
desc = "All changes will be scaled"
|
// desc = "All changes will be scaled"
|
||||||
)
|
// )
|
||||||
public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
// public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
return new ScaleTransform(other, x, y, z);
|
// return new ScaleTransform(other, x, y, z);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Command(
|
// @Command(
|
||||||
name = "#rotate",
|
// name = "#rotate",
|
||||||
desc = "All changes will be rotate around the initial position"
|
// desc = "All changes will be rotate around the initial position"
|
||||||
)
|
// )
|
||||||
public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
// public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
ExtentTraverser<TransformExtent> traverser = new ExtentTraverser<>(other).find(TransformExtent.class);
|
// ExtentTraverser<TransformExtent> traverser = new ExtentTraverser<>(other).find(TransformExtent.class);
|
||||||
BlockTransformExtent affine = traverser != null ? traverser.get() : null;
|
// BlockTransformExtent affine = traverser != null ? traverser.get() : null;
|
||||||
if (affine == null) {
|
// if (affine == null) {
|
||||||
other = affine = new TransformExtent(other);
|
// other = affine = new TransformExtent(other);
|
||||||
}
|
// }
|
||||||
AffineTransform transform = (AffineTransform) affine.getTransform();
|
// AffineTransform transform = (AffineTransform) affine.getTransform();
|
||||||
transform = transform.rotateX(x);
|
// transform = transform.rotateX(x);
|
||||||
transform = transform.rotateY(y);
|
// transform = transform.rotateY(y);
|
||||||
transform = transform.rotateZ(z);
|
// transform = transform.rotateZ(z);
|
||||||
affine.setTransform(transform);
|
// affine.setTransform(transform);
|
||||||
return other;
|
// return other;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -10,7 +10,7 @@ import com.boydti.fawe.util.StringMan;
|
|||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
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.InputParseException;
|
||||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
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.CommandException;
|
||||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
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.InputParseException;
|
||||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
|
@ -61,8 +61,6 @@ import com.sk89q.worldedit.command.HistoryCommandsRegistration;
|
|||||||
import com.sk89q.worldedit.command.NavigationCommands;
|
import com.sk89q.worldedit.command.NavigationCommands;
|
||||||
import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.PaintBrushCommands;
|
import com.sk89q.worldedit.command.PaintBrushCommands;
|
||||||
import com.sk89q.worldedit.command.PatternCommands;
|
|
||||||
import com.sk89q.worldedit.command.PatternCommandsRegistration;
|
|
||||||
import com.sk89q.worldedit.command.RegionCommands;
|
import com.sk89q.worldedit.command.RegionCommands;
|
||||||
import com.sk89q.worldedit.command.RegionCommandsRegistration;
|
import com.sk89q.worldedit.command.RegionCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.SchematicCommands;
|
import com.sk89q.worldedit.command.SchematicCommands;
|
||||||
@ -81,8 +79,8 @@ import com.sk89q.worldedit.command.ToolCommands;
|
|||||||
import com.sk89q.worldedit.command.ToolCommandsRegistration;
|
import com.sk89q.worldedit.command.ToolCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.ToolUtilCommands;
|
import com.sk89q.worldedit.command.ToolUtilCommands;
|
||||||
import com.sk89q.worldedit.command.ToolUtilCommandsRegistration;
|
import com.sk89q.worldedit.command.ToolUtilCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.TransformCommands;
|
//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.UtilityCommands;
|
||||||
import com.sk89q.worldedit.command.UtilityCommandsRegistration;
|
import com.sk89q.worldedit.command.UtilityCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||||
@ -306,20 +304,20 @@ public final class PlatformCommandManager {
|
|||||||
public void registerAllCommands() {
|
public void registerAllCommands() {
|
||||||
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
|
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
|
||||||
// TODO NOT IMPLEMENTED dunno why these have issues generating
|
// TODO NOT IMPLEMENTED dunno why these have issues generating
|
||||||
registerSubCommands(
|
// registerSubCommands(
|
||||||
"patterns",
|
// "patterns",
|
||||||
ImmutableList.of(),
|
// ImmutableList.of(),
|
||||||
"Patterns determine what blocks are placed",
|
// "Patterns determine what blocks are placed",
|
||||||
PatternCommandsRegistration.builder(),
|
// PatternCommandsRegistration.builder(),
|
||||||
new PatternCommands()
|
// new PatternCommands()
|
||||||
);
|
// );
|
||||||
registerSubCommands(
|
// registerSubCommands(
|
||||||
"transforms",
|
// "transforms",
|
||||||
ImmutableList.of(),
|
// ImmutableList.of(),
|
||||||
"Transforms modify how a block is placed",
|
// "Transforms modify how a block is placed",
|
||||||
TransformCommandsRegistration.builder(),
|
// TransformCommandsRegistration.builder(),
|
||||||
new TransformCommands()
|
// new TransformCommands()
|
||||||
);
|
// );
|
||||||
registerSubCommands(
|
registerSubCommands(
|
||||||
"schematic",
|
"schematic",
|
||||||
ImmutableList.of("schem", "/schematic", "/schem"),
|
ImmutableList.of("schem", "/schematic", "/schem"),
|
||||||
@ -380,17 +378,17 @@ public final class PlatformCommandManager {
|
|||||||
AnvilCommandsRegistration.builder(),
|
AnvilCommandsRegistration.builder(),
|
||||||
new AnvilCommands(worldEdit)
|
new AnvilCommands(worldEdit)
|
||||||
);
|
);
|
||||||
registerSubCommands(
|
// registerSubCommands(
|
||||||
"transforms",
|
// "transforms",
|
||||||
ImmutableList.of(),
|
// ImmutableList.of(),
|
||||||
"Transforms modify how a block is placed\n" +
|
// "Transforms modify how a block is placed\n" +
|
||||||
" - Use [brackets] for arguments\n" +
|
// " - Use [brackets] for arguments\n" +
|
||||||
" - Use , to OR multiple\n" +
|
// " - Use , to OR multiple\n" +
|
||||||
" - Use & to AND multiple\n" +
|
// " - Use & to AND multiple\n" +
|
||||||
"More Info: https://git.io/v9KHO",
|
// "More Info: https://git.io/v9KHO",
|
||||||
TransformCommandsRegistration.builder(),
|
// TransformCommandsRegistration.builder(),
|
||||||
new TransformCommands()
|
// new TransformCommands()
|
||||||
);
|
// );
|
||||||
this.registration.register(
|
this.registration.register(
|
||||||
commandManager,
|
commandManager,
|
||||||
BiomeCommandsRegistration.builder(),
|
BiomeCommandsRegistration.builder(),
|
||||||
|
@ -1,139 +0,0 @@
|
|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
||||||
/*
|
|
||||||
|
|
||||||
This project shades <em>API</em> libraries, i.e. those libraries
|
|
||||||
whose classes are publicly referenced from `-core` classes.
|
|
||||||
|
|
||||||
This project <em>does not</em> shade implementation libraries, i.e.
|
|
||||||
those libraries whose classes are internally depended on.
|
|
||||||
|
|
||||||
This is because the main reason for shading those libraries is for
|
|
||||||
their internal usage in each platform, not because we need them available to
|
|
||||||
dependents of `-core` to compile and work with WorldEdit"s API.
|
|
||||||
|
|
||||||
*/
|
|
||||||
configure(subprojects + project("core:ap")) {
|
|
||||||
apply plugin: "maven"
|
|
||||||
apply plugin: "com.github.johnrengelman.shadow"
|
|
||||||
apply plugin: "com.jfrog.artifactory"
|
|
||||||
configurations {
|
|
||||||
create("shade")
|
|
||||||
getByName("archives").extendsFrom(getByName("default"))
|
|
||||||
}
|
|
||||||
|
|
||||||
group = rootProject.group + ".worldedit-libs"
|
|
||||||
|
|
||||||
tasks.register("jar", ShadowJar) {
|
|
||||||
configurations = [project.configurations.shade]
|
|
||||||
classifier = ""
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
exclude(dependency("com.google.guava:guava"))
|
|
||||||
exclude(dependency("com.google.code.gson:gson"))
|
|
||||||
exclude(dependency("org.checkerframework:checker-qual"))
|
|
||||||
}
|
|
||||||
|
|
||||||
relocate("net.kyori.text", "com.sk89q.worldedit.util.formatting.text")
|
|
||||||
}
|
|
||||||
def altConfigFiles = { String artifactType ->
|
|
||||||
def deps = configurations.shade.incoming.dependencies
|
|
||||||
.collect { it.copy() }
|
|
||||||
.collect { dependency ->
|
|
||||||
dependency.artifact { artifact ->
|
|
||||||
artifact.name = dependency.name
|
|
||||||
artifact.type = artifactType
|
|
||||||
artifact.extension = "jar"
|
|
||||||
artifact.classifier = artifactType
|
|
||||||
}
|
|
||||||
dependency
|
|
||||||
}
|
|
||||||
|
|
||||||
return files(configurations.detachedConfiguration(deps as Dependency[])
|
|
||||||
.resolvedConfiguration.lenientConfiguration.getArtifacts()
|
|
||||||
.findAll { it.classifier == artifactType }
|
|
||||||
.collect { zipTree(it.file) })
|
|
||||||
}
|
|
||||||
tasks.register("sourcesJar", Jar) {
|
|
||||||
from {
|
|
||||||
altConfigFiles("sources")
|
|
||||||
}
|
|
||||||
def filePattern = ~/(.*)net\/kyori\/text((?:\/|\u0024).*)/
|
|
||||||
def textPattern = ~/net\.kyori\.text/
|
|
||||||
eachFile {
|
|
||||||
it.filter { String line ->
|
|
||||||
line.replaceFirst(textPattern, "com.sk89q.worldedit.util.formatting.text")
|
|
||||||
}
|
|
||||||
it.path = it.path.replaceFirst(filePattern, "\$1com/sk89q/worldedit/util/formatting/text\$2")
|
|
||||||
}
|
|
||||||
classifier = "sources"
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
add("default", jar)
|
|
||||||
add("archives", sourcesJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("install", Upload) {
|
|
||||||
configuration = configurations.archives
|
|
||||||
repositories.mavenInstaller {
|
|
||||||
pom.version = project.version
|
|
||||||
pom.artifactId = project.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
artifactoryPublish {
|
|
||||||
publishConfigs("default")
|
|
||||||
}
|
|
||||||
|
|
||||||
build.dependsOn(jar, sourcesJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
def textExtrasVersion = "3.0.2"
|
|
||||||
project("core") {
|
|
||||||
def textVersion = "3.0.2"
|
|
||||||
def pistonVersion = "0.4.4-SNAPSHOT"
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
shade "net.kyori:text-api:$textVersion"
|
|
||||||
shade "net.kyori:text-serializer-gson:$textVersion"
|
|
||||||
shade "net.kyori:text-serializer-legacy:$textVersion"
|
|
||||||
shade "net.kyori:text-serializer-plain:$textVersion"
|
|
||||||
shade "net.kyori:text-feature-pagination:$textVersion"
|
|
||||||
shade("com.sk89q:jchronic:0.2.4a") {
|
|
||||||
exclude(group: "junit", module: "junit")
|
|
||||||
}
|
|
||||||
shade "com.thoughtworks.paranamer:paranamer:2.6"
|
|
||||||
shade "com.sk89q.lib:jlibnoise:1.0.0"
|
|
||||||
shade "FAWE-Piston:lastSuccessfulBuild:core/build/libs/core-$pistonVersion@jar"
|
|
||||||
shade "FAWE-Piston:lastSuccessfulBuild:core-ap/runtime/build/libs/runtime-$pistonVersion@jar"
|
|
||||||
shade "FAWE-Piston:lastSuccessfulBuild:default-impl/build/libs/default-impl-$pistonVersion@jar"
|
|
||||||
}
|
|
||||||
|
|
||||||
project("ap") {
|
|
||||||
dependencies {
|
|
||||||
// def avVersion = "1.6.5"
|
|
||||||
// shade "com.google.auto.value:auto-value-annotations:$avVersion"
|
|
||||||
shade "FAWE-Piston:lastSuccessfulBuild:core/build/libs/core-$pistonVersion@jar"
|
|
||||||
shade "FAWE-Piston:lastSuccessfulBuild:core-ap/annotations/build/libs/annotations-$pistonVersion@jar"
|
|
||||||
shade "FAWE-Piston:lastSuccessfulBuild:core-ap/processor/build/libs/processor-$pistonVersion@jar"
|
|
||||||
|
|
||||||
shade "org.enginehub.piston.core-ap:annotations:$pistonVersion"
|
|
||||||
shade "org.enginehub.piston.core-ap:processor:$pistonVersion"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
project("bukkit") {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = "SpigotMC"
|
|
||||||
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
shade "net.kyori:text-adapter-bukkit:$textExtrasVersion"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("build") {
|
|
||||||
dependsOn(subprojects.collect { it.tasks.named("build") })
|
|
||||||
}
|
|
3
worldedit-libs/build.gradle.kts
Normale Datei
3
worldedit-libs/build.gradle.kts
Normale Datei
@ -0,0 +1,3 @@
|
|||||||
|
tasks.register("build") {
|
||||||
|
dependsOn(subprojects.map { it.tasks.named("build") })
|
||||||
|
}
|
11
worldedit-libs/bukkit/build.gradle.kts
Normale Datei
11
worldedit-libs/bukkit/build.gradle.kts
Normale Datei
@ -0,0 +1,11 @@
|
|||||||
|
applyLibrariesConfiguration()
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "SpigotMC"
|
||||||
|
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
"shade"("net.kyori:text-adapter-bukkit:${Versions.TEXT_EXTRAS}")
|
||||||
|
}
|
9
worldedit-libs/core/ap/build.gradle.kts
Normale Datei
9
worldedit-libs/core/ap/build.gradle.kts
Normale Datei
@ -0,0 +1,9 @@
|
|||||||
|
applyLibrariesConfiguration()
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||||
|
"shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||||
|
"shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||||
|
"shade"("org.enginehub.piston.core-ap:annotations:${Versions.PISTON}")
|
||||||
|
"shade"("org.enginehub.piston.core-ap:processor:${Versions.PISTON}")
|
||||||
|
}
|
16
worldedit-libs/core/build.gradle.kts
Normale Datei
16
worldedit-libs/core/build.gradle.kts
Normale Datei
@ -0,0 +1,16 @@
|
|||||||
|
applyLibrariesConfiguration()
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"shade"("net.kyori:text-api:${Versions.TEXT}")
|
||||||
|
"shade"("net.kyori:text-serializer-gson:${Versions.TEXT}")
|
||||||
|
"shade"("net.kyori:text-serializer-legacy:${Versions.TEXT}")
|
||||||
|
"shade"("net.kyori:text-serializer-plain:${Versions.TEXT}")
|
||||||
|
"shade"("com.sk89q:jchronic:0.2.4a") {
|
||||||
|
exclude(group = "junit", module = "junit")
|
||||||
|
}
|
||||||
|
"shade"("com.thoughtworks.paranamer:paranamer:2.6")
|
||||||
|
"shade"("com.sk89q.lib:jlibnoise:1.0.0")
|
||||||
|
"shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||||
|
"shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||||
|
"shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren