3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00

migrate to gradle to kotlin

Dieser Commit ist enthalten in:
MattBDev 2019-08-20 14:52:24 -04:00
Ursprung 2a054b9220
Commit 64a1bfc9b3
24 geänderte Dateien mit 1496 neuen und 1535 gelöschten Zeilen

Datei anzeigen

@ -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
Datei anzeigen

@ -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
Datei anzeigen

@ -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")
}

Datei anzeigen

@ -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")
}
}
}

Datei anzeigen

@ -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

Datei anzeigen

@ -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
}
}
}

Datei anzeigen

@ -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()
}
}

Datei anzeigen

@ -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"
}

Datei anzeigen

@ -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)

Datei anzeigen

@ -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")
}

Datei anzeigen

@ -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)

Datei anzeigen

@ -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")
}
}

Datei anzeigen

@ -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");

Datei anzeigen

@ -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"
// ) // )
@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class) // public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
public class MaskCommands { // scale = 1d / Math.max(1, scale);
private final WorldEdit worldEdit; // minInt = (minInt - 50) / 50;
// maxInt = (maxInt - 50) / 50;
public MaskCommands(WorldEdit worldEdit) { // return new SimplexMask(scale, minInt, maxInt);
this.worldEdit = worldEdit; // }
} //
// @Command(
@Command( // name = "#light",
name = "#simplex", // desc = "Restrict to specific light levels"
desc = "Use simplex noise as the mask" // )
) // public Mask light(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { // return new LightMask(extent, (int) minInt, (int) maxInt);
scale = 1d / Math.max(1, scale); // }
minInt = (minInt - 50) / 50; //
maxInt = (maxInt - 50) / 50; // @Command(
return new SimplexMask(scale, minInt, maxInt); // name = "#false",
} // desc = "Always false"
// )
@Command( // public Mask falseMask(Extent extent) {
name = "#light", // return Masks.alwaysFalse();
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) { // @Command(
return new LightMask(extent, (int) minInt, (int) maxInt); // name = "#true",
} // desc = "Always true"
// )
@Command( // public Mask trueMask(Extent extent) {
name = "#false", // return Masks.alwaysTrue();
desc = "Always false" // }
) //
public Mask falseMask(Extent extent) { // @Command(
return Masks.alwaysFalse(); // name = "#skylight",
} // desc = "Restrict to specific sky light levels"
// )
@Command( // public Mask skylight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
name = "#true", // return new SkyLightMask(extent, (int) minInt, (int) maxInt);
desc = "Always true" // }
) //
public Mask trueMask(Extent extent) { // @Command(
return Masks.alwaysTrue(); // name = "#blocklight",
} // aliases = {"#emittedlight"},
// desc = "Restrict to specific block light levels"
@Command( // )
name = "#skylight", // public Mask blocklight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
desc = "Restrict to specific sky light levels" // return new BlockLightMask(extent, (int) minInt, (int) maxInt);
) // }
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 = "#opacity",
// desc = "Restrict to specific opacity levels"
@Command( // )
name = "#blocklight", // public Mask opacity(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
aliases = {"#emittedlight"}, // return new OpacityMask(extent, (int) minInt, (int) maxInt);
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) { // @Command(
return new BlockLightMask(extent, (int) minInt, (int) maxInt); // name = "#brightness",
} // desc = "Restrict to specific block brightness"
// )
@Command( // public Mask brightness(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
name = "#opacity", // return new BrightnessMask(extent, (int) minInt, (int) maxInt);
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) { // @Command(
return new OpacityMask(extent, (int) minInt, (int) maxInt); // name = "#offset",
} // desc = "Offset a mask"
// )
@Command( // public Mask offset(double x, double y, double z, Mask mask) {
name = "#brightness", // return new OffsetMask(mask, BlockVector3.at(x, y, z));
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) { // @Command(
return new BrightnessMask(extent, (int) minInt, (int) maxInt); // name = "#haslight",
} // desc = "Restricts to blocks with light (sky or emitted)"
// )
@Command( // public Mask haslight(Extent extent) {
name = "#offset", // return new LightMask(extent, 1, Integer.MAX_VALUE);
desc = "Offset a mask" // }
) //
public Mask offset(double x, double y, double z, Mask mask) { // @Command(
return new OffsetMask(mask, BlockVector3.at(x, y, z)); // name = "#nolight",
} // desc = "Restrict to blocks without light (sky or emitted)"
// )
@Command( // public Mask nolight(Extent extent) {
name = "#haslight", // return new LightMask(extent, 0, 0);
desc = "Restricts to blocks with light (sky or emitted)" // }
) //
public Mask haslight(Extent extent) { // @Command(
return new LightMask(extent, 1, Integer.MAX_VALUE); // name = "#existing",
} // desc = "If there is a non air block"
// )
@Command( // public Mask existing(Extent extent) {
name = "#nolight", // return new ExistingBlockMask(extent);
desc = "Restrict to blocks without light (sky or emitted)" // }
) //
public Mask nolight(Extent extent) { // @Command(
return new LightMask(extent, 0, 0); // name = "#solid",
} // desc = "If there is a solid block"
// )
@Command( // public Mask solid(Extent extent) {
name = "#existing", // return new SolidBlockMask(extent);
desc = "If there is a non air block" // }
) //
public Mask existing(Extent extent) { // @Command(
return new ExistingBlockMask(extent); // name = "#liquid",
} // desc = "If there is a solid block"
// )
@Command( // public Mask liquid(Extent extent) {
name = "#solid", // return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent);
desc = "If there is a solid block" // }
) //
public Mask solid(Extent extent) { // @Command(
return new SolidBlockMask(extent); // name = "#dregion",
} // aliases = {"#dselection", "#dsel"},
// desc = "inside the player's selection"
@Command( // )
name = "#liquid", // public Mask dregion() {
desc = "If there is a solid block" // return new RegionMask(new RequestSelection());
) // }
public Mask liquid(Extent extent) { //
return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent); // @Command(
} // name = "#region",
// aliases = {"#selection", "#sel"},
@Command( // desc = "inside the provided selection"
name = "#dregion", // )
aliases = {"#dselection", "#dsel"}, // public Mask selection(Player player, LocalSession session) throws IncompleteRegionException {
desc = "inside the player's selection" // return new RegionMask(session.getSelection(player.getWorld()).clone());
) // }
public Mask dregion() { //
return new RegionMask(new RequestSelection()); // @Command(
} // name = "#xaxis",
// desc = "Restrict to initial x axis"
@Command( // )
name = "#region", // public Mask xaxis() {
aliases = {"#selection", "#sel"}, // return new XAxisMask();
desc = "inside the provided selection" // }
) //
public Mask selection(Player player, LocalSession session) throws IncompleteRegionException { // @Command(
return new RegionMask(session.getSelection(player.getWorld()).clone()); // name = "#yaxis",
} // desc = "Restrict to initial y axis"
// )
@Command( // public Mask yaxis() {
name = "#xaxis", // return new YAxisMask();
desc = "Restrict to initial x axis" // }
) //
public Mask xaxis() { // @Command(
return new XAxisMask(); // name = "#zaxis",
} // desc = "Restrict to initial z axis"
// )
@Command( // public Mask zaxis() {
name = "#yaxis", // return new ZAxisMask();
desc = "Restrict to initial y axis" // }
) //
public Mask yaxis() { // @Command(
return new YAxisMask(); // name = "#id",
} // desc = "Restrict to initial id"
// )
@Command( // public Mask id(Extent extent) {
name = "#zaxis", // return new IdMask(extent);
desc = "Restrict to initial z axis" // }
) //
public Mask zaxis() { // @Command(
return new ZAxisMask(); // name = "#data",
} // desc = "Restrict to initial data"
// )
@Command( // public Mask data(Extent extent) {
name = "#id", // return new DataMask(extent);
desc = "Restrict to initial id" // }
) //
public Mask id(Extent extent) { // @Command(
return new IdMask(extent); // name = "#iddata",
} // desc = "Restrict to initial block id and data"
// )
@Command( // public Mask iddata(Extent extent) {
name = "#data", // return new IdDataMask(extent);
desc = "Restrict to initial data" // }
) //
public Mask data(Extent extent) { // @Command(
return new DataMask(extent); // name = "#air",
} // desc = "Restrict to types of air"
// )
@Command( // public Mask air(Extent extent) {
name = "#iddata", // return new BlockMaskBuilder().addAll(b -> b.getMaterial().isAir()).build(extent);
desc = "Restrict to initial block id and data" // }
) //
public Mask iddata(Extent extent) { // @Command(
return new IdDataMask(extent); // name = "#wall",
} // desc = "Restrict to walls (any block n,e,s,w of air)"
// )
@Command( // public Mask wall(Extent extent) {
name = "#air", // Mask blockMask = air(extent);
desc = "Restrict to types of air" // return new MaskUnion(new ExistingBlockMask(extent), new WallMask(blockMask, 1, 8));
) // }
public Mask air(Extent extent) { //
return new BlockMaskBuilder().addAll(b -> b.getMaterial().isAir()).build(extent); // @Command(
} // name = "#surface",
// desc = "Restrict to surfaces (any solid block touching air)"
@Command( // )
name = "#wall", // public Mask surface(Extent extent) {
desc = "Restrict to walls (any block n,e,s,w of air)" // return new SurfaceMask(extent);
) // }
public Mask wall(Extent extent) { //
Mask blockMask = air(extent); // @Command(
return new MaskUnion(new ExistingBlockMask(extent), new WallMask(blockMask, 1, 8)); // name = "\\",
} // aliases = {"/", "#angle", "#\\", "#/"},
// desc = "Restrict to specific terrain angle",
@Command( // descFooter = "Restrict to specific terrain angle\n" +
name = "#surface", // "The -o flag will only overlay\n" +
desc = "Restrict to surfaces (any solid block touching air)" // "Example: /[0d][45d]\n" +
) // "Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" +
public Mask surface(Extent extent) { // "Example: /[3][20]\n" +
return new SurfaceMask(extent); // "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 {
@Command( // double y1, y2;
name = "\\", // boolean override;
aliases = {"/", "#angle", "#\\", "#/"}, // if (maxStr.endsWith("d")) {
desc = "Restrict to specific terrain angle", // double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
descFooter = "Restrict to specific terrain angle\n" + // double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
"The -o flag will only overlay\n" + // y1 = Math.tan(y1d * (Math.PI / 180));
"Example: /[0d][45d]\n" + // y2 = Math.tan(y2d * (Math.PI / 180));
"Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" + // } else {
"Example: /[3][20]\n" + // y1 = Expression.compile(minStr).evaluate();
"Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below" // y2 = Expression.compile(maxStr).evaluate();
) // }
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 { // return new AngleMask(extent, y1, y2, overlay, distanceOpt);
double y1, y2; // }
boolean override; //
if (maxStr.endsWith("d")) { // @Command(
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); // name = "(",
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); // aliases = {")", "#roc", "#(", "#)"},
y1 = Math.tan(y1d * (Math.PI / 180)); // desc = "Restrict to near specific terrain slope rate of change",
y2 = Math.tan(y2d * (Math.PI / 180)); // descFooter = "Restrict to near specific terrain slope rate of change\n" +
} else { // "The -o flag will only overlay\n" +
y1 = Expression.compile(minStr).evaluate(); // "Example: ([0d][45d][5]\n" +
y2 = Expression.compile(maxStr).evaluate(); // "Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" +
} // "Note: Use negatives for decreasing slope"
return new AngleMask(extent, y1, y2, overlay, distanceOpt); //)
} // 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 = "(", // if (maxStr.endsWith("d")) {
aliases = {")", "#roc", "#(", "#)"}, // double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
desc = "Restrict to near specific terrain slope rate of change", // double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
descFooter = "Restrict to near specific terrain slope rate of change\n" + // y1 = Math.tan(y1d * (Math.PI / 180));
"The -o flag will only overlay\n" + // y2 = Math.tan(y2d * (Math.PI / 180));
"Example: ([0d][45d][5]\n" + // } else {
"Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" + // y1 = Expression.compile(minStr).evaluate();
"Note: Use negatives for decreasing slope" // y2 = Expression.compile(maxStr).evaluate();
) // }
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 { // return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt);
double y1, y2; // }
boolean override; //
if (maxStr.endsWith("d")) { // @Command(
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); // name = "^",
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); // aliases = {"#extrema", "#^"},
y1 = Math.tan(y1d * (Math.PI / 180)); // desc = "Restrict to near specific terrain extrema",
y2 = Math.tan(y2d * (Math.PI / 180)); // descFooter = "Restrict to near specific terrain extrema\n" +
} else { // "The -o flag will only overlay\n" +
y1 = Expression.compile(minStr).evaluate(); // "Example: ([0d][45d][5]\n" +
y2 = Expression.compile(maxStr).evaluate(); // "Explanation: Restrict to near 45 degrees of local maxima\n" +
} // "Note: Use negatives for local minima"
return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt); //)
} // 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;
@Command( // boolean override;
name = "^", // if (maxStr.endsWith("d")) {
aliases = {"#extrema", "#^"}, // double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
desc = "Restrict to near specific terrain extrema", // double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
descFooter = "Restrict to near specific terrain extrema\n" + // y1 = Math.tan(y1d * (Math.PI / 180));
"The -o flag will only overlay\n" + // y2 = Math.tan(y2d * (Math.PI / 180));
"Example: ([0d][45d][5]\n" + // } else {
"Explanation: Restrict to near 45 degrees of local maxima\n" + // y1 = Expression.compile(minStr).evaluate();
"Note: Use negatives for local minima" // y2 = Expression.compile(maxStr).evaluate();
) // }
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 { // return new ExtremaMask(extent, y1, y2, overlay, distanceOpt);
double y1, y2; // }
boolean override; //
if (maxStr.endsWith("d")) { // @Command(
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); // name = "{",
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); // aliases = {"#{"},
y1 = Math.tan(y1d * (Math.PI / 180)); // desc = "Restricts blocks to within a specific radius range of the initial block"
y2 = Math.tan(y2d * (Math.PI / 180)); //)
} else { // public Mask radius(@Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
y1 = Expression.compile(minStr).evaluate(); // return new RadiusMask((int) minInt, (int) maxInt);
y2 = Expression.compile(maxStr).evaluate(); // }
} //
return new ExtremaMask(extent, y1, y2, overlay, distanceOpt); // @Command(
} // name = "|",
// aliases = {"#|", "#side"},
@Command( // desc = "sides with a specific number of other blocks"
name = "{", //)
aliases = {"#{"}, // public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
desc = "Restricts blocks to within a specific radius range of the initial block" // return new WallMask(mask, (int) minInt, (int) maxInt);
) // }
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 = {"#~", "#adjacent"},
@Command( // desc = "Adjacent to a specific number of other blocks"
name = "|", //)
aliases = {"#|", "#side"}, // 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 {
desc = "sides with a specific number of other blocks" // if (min == -1 && max == -1) {
) // min = 1;
public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException { // max = 8;
return new WallMask(mask, (int) minInt, (int) maxInt); // } else if (max == -1) max = min;
} // if (max >= 8 && min == 1) {
// return new AdjacentAnyMask(mask);
@Command( // }
name = "~", // return new AdjacentMask(mask, (int) min, (int) max);
aliases = {"#~", "#adjacent"}, // }
desc = "Adjacent to a specific number of other blocks" //
) // @Command(
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 { // name = "<",
if (min == -1 && max == -1) { // aliases = {"#<", "#below"},
min = 1; // desc = "below a specific block"
max = 8; //)
} else if (max == -1) max = min; // public Mask below(Mask mask) throws ExpressionException {
if (max >= 8 && min == 1) { // OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
return new AdjacentAnyMask(mask); // return new MaskIntersection(offsetMask, Masks.negate(mask));
} // }
return new AdjacentMask(mask, (int) min, (int) max); //
} // @Command(
// name = ">",
@Command( // aliases = {"#>", "#above"},
name = "<", // desc = "above a specific block"
aliases = {"#<", "#below"}, //)
desc = "below a specific block" // public Mask above(Mask mask) throws ExpressionException {
) // OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
public Mask below(Mask mask) throws ExpressionException { // return new MaskIntersection(offsetMask, Masks.negate(mask));
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0)); // }
return new MaskIntersection(offsetMask, Masks.negate(mask)); //
} // @Command(
// name = "$",
@Command( // aliases = {"#biome", "#$"},
name = ">", // desc = "in a specific biome",
aliases = {"#>", "#above"}, // descFooter = "in a specific biome. For a list of biomes use //biomelist"
desc = "above a specific block" //)
) // public Mask biome(Extent extent, BiomeType biome) throws ExpressionException {
public Mask above(Mask mask) throws ExpressionException { // return new BiomeMask(extent, biome);
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0)); // }
return new MaskIntersection(offsetMask, Masks.negate(mask)); //
} // @Command(
// name = "%",
@Command( // aliases = {"#%", "#percent"},
name = "$", // desc = "percentage chance"
aliases = {"#biome", "#$"}, //)
desc = "in a specific biome", // public Mask random(double chance) throws ExpressionException {
descFooter = "in a specific biome. For a list of biomes use //biomelist" // chance = chance / 100;
) // return new RandomMask(chance);
public Mask biome(Extent extent, BiomeType biome) throws ExpressionException { // }
return new BiomeMask(extent, biome); //
} // @Command(
// name = "=",
@Command( // aliases = {"#=", "#expression"},
name = "%", // desc = "expression mask"
aliases = {"#%", "#percent"}, //)
desc = "percentage chance" // public Mask expression(Extent extent, String input) throws ExpressionException {
) // Expression exp = Expression.compile(input, "x", "y", "z");
public Mask random(double chance) throws ExpressionException { // ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
chance = chance / 100; // exp.setEnvironment(env);
return new RandomMask(chance); // return new ExpressionMask(exp);
} // }
//
@Command( // @Command(
name = "=", // name = "!",
aliases = {"#=", "#expression"}, // aliases = {"#not", "#negate", "#!"},
desc = "expression mask" // desc = "Negate another mask"
) //)
public Mask expression(Extent extent, String input) throws ExpressionException { // public Mask expression(Mask mask) throws ExpressionException {
Expression exp = Expression.compile(input, "x", "y", "z"); // return Masks.negate(mask);
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);
}
}

Datei anzeigen

@ -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"
// ) // )
@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class) // public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties
public class PatternCommands { // if (properties == null) return new ExistingPattern(extent);
// return new PropertyPattern(extent).addRegex(".*[" + properties + "]");
@Command( // }
name = "#existing", //
aliases = {"#*", "*", ".*"}, // @Command(
desc = "Use the block that is already there" // name = "#clipboard",
) // aliases = {"#copy"},
public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties // desc = "Use the blocks in your clipboard as the pattern")
if (properties == null) return new ExistingPattern(extent); // public Pattern clipboard(LocalSession session) throws EmptyClipboardException {
return new PropertyPattern(extent).addRegex(".*[" + properties + "]"); // ClipboardHolder holder = session.getClipboard();
} // Clipboard clipboard = holder.getClipboard();
// return new ClipboardPattern(clipboard);
@Command( // }
name = "#clipboard", //
aliases = {"#copy"}, // @Command(
desc = "Use the blocks in your clipboard as the pattern") // name = "#simplex",
public Pattern clipboard(LocalSession session) throws EmptyClipboardException { // desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE"
ClipboardHolder holder = session.getClipboard(); //)
Clipboard clipboard = holder.getClipboard(); // public Pattern simplex(@Arg(desc = "scale factor") double scale, Pattern other) {
return new ClipboardPattern(clipboard); // if (other instanceof RandomPattern) {
} // scale = (1d / Math.max(1, scale));
// RandomCollection<Pattern> collection = ((RandomPattern) other).getCollection();
@Command( // collection.setRandom(new SimplexRandom(scale));
name = "#simplex", // }
desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE" // return other;
) // }
public Pattern simplex(@Arg(desc = "scale factor") double scale, Pattern other) { //
if (other instanceof RandomPattern) { // @Command(
scale = (1d / Math.max(1, scale)); // name = "#color",
RandomCollection<Pattern> collection = ((RandomPattern) other).getCollection(); // desc = "Use the block closest to a specific color"
collection.setRandom(new SimplexRandom(scale)); //)
} // public Pattern color(TextureUtil textureUtil, String color) {
return other; // Color colorObj = ColorUtil.parseColor(color);
} // return textureUtil.getNearestBlock(colorObj.getRGB()).getDefaultState();
// }
@Command( //
name = "#color", // @Command(
desc = "Use the block closest to a specific color" // name = "#anglecolor",
) // desc = "A darker block based on the existing terrain angle"
public Pattern color(TextureUtil textureUtil, String color) { //)
Color colorObj = ColorUtil.parseColor(color); // 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 textureUtil.getNearestBlock(colorObj.getRGB()).getDefaultState(); // return new AngleColorPattern(extent, session, distanceOpt);
} // }
//
@Command( // @Command(
name = "#anglecolor", // name = "#angledata",
desc = "A darker block based on the existing terrain angle" // desc = "Block data 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) { // public Pattern angledata(Extent extent, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) {
return new AngleColorPattern(extent, session, distanceOpt); // return new DataAnglePattern(extent, distanceOpt);
} // }
//
@Command( // @Command(
name = "#angledata", // name = "#saturate",
desc = "Block data based on the existing terrain angle" // desc = "Saturate the existing block with a color"
) //)
public Pattern angledata(Extent extent, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) { // public Pattern saturate(Extent extent, LocalSession session, String colorStr) {
return new DataAnglePattern(extent, distanceOpt); // Color color = ColorUtil.parseColor(colorStr);
} // return new SaturatePattern(extent, color.getRGB(), session);
// }
@Command( //
name = "#saturate", // @Command(
desc = "Saturate the existing block with a color" // name = "#averagecolor",
) // desc = "Average between the existing block and a color"
public Pattern saturate(Extent extent, LocalSession session, String colorStr) { //)
Color color = ColorUtil.parseColor(colorStr); // public Pattern averagecolor(Extent extent, LocalSession session, String colorStr) {
return new SaturatePattern(extent, color.getRGB(), session); // Color color = ColorUtil.parseColor(colorStr);
} // return new AverageColorPattern(extent, color.getRGB(), session);
// }
@Command( //
name = "#averagecolor", // @Command(
desc = "Average between the existing block and a color" // name = "#desaturate",
) // desc = "Desaturated color of the existing block"
public Pattern averagecolor(Extent extent, LocalSession session, String colorStr) { //)
Color color = ColorUtil.parseColor(colorStr); // public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) {
return new AverageColorPattern(extent, color.getRGB(), session); // return new DesaturatePattern(extent, percent / 100d, session);
} // }
//
@Command( // @Command(
name = "#desaturate", // name = "#lighten",
desc = "Desaturated color of the existing block" // desc = "Lighten the existing block"
) //)
public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) { // public Pattern lighten(Extent extent, TextureUtil util) {
return new DesaturatePattern(extent, percent / 100d, session); // return new ShadePattern(extent, false, util);
} // }
//
@Command( // @Command(
name = "#lighten", // name = "#darken",
desc = "Lighten the existing block" // desc = "Darken the existing block"
) //)
public Pattern lighten(Extent extent, TextureUtil util) { // public Pattern darken(Extent extent, TextureUtil util) {
return new ShadePattern(extent, false, util); // return new ShadePattern(extent, true, util);
} // }
//
@Command( // @Command(
name = "#darken", // name = "#fullcopy",
desc = "Darken the existing block" // desc = "Places your full clipboard at each block"
) //)
public Pattern darken(Extent extent, TextureUtil util) { // 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 {
return new ShadePattern(extent, true, util); // List<ClipboardHolder> clipboards;
} // switch (location.toLowerCase()) {
// case "#copy":
@Command( // case "#clipboard":
name = "#fullcopy", // ClipboardHolder clipboard = session.getExistingClipboard();
desc = "Places your full clipboard at each block" // if (clipboard == null) {
) // throw new InputParseException("To use #fullcopy, please first copy something to your clipboard");
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 { // }
List<ClipboardHolder> clipboards; // if (!rotate && !flip) {
switch (location.toLowerCase()) { // return new FullClipboardPattern(extent, clipboard.getClipboard());
case "#copy": // }
case "#clipboard": // clipboards = Collections.singletonList(clipboard);
ClipboardHolder clipboard = session.getExistingClipboard(); // break;
if (clipboard == null) { // default:
throw new InputParseException("To use #fullcopy, please first copy something to your clipboard"); // MultiClipboardHolder multi = ClipboardFormats.loadAllFromInput(player, location, null, true);
} // clipboards = multi != null ? multi.getHolders() : null;
if (!rotate && !flip) { // break;
return new FullClipboardPattern(extent, clipboard.getClipboard()); // }
} // if (clipboards == null) {
clipboards = Collections.singletonList(clipboard); // throw new InputParseException("#fullcopy:<source>");
break; // }
default: // return new RandomFullClipboardPattern(extent, clipboards, rotate, flip);
MultiClipboardHolder multi = ClipboardFormats.loadAllFromInput(player, location, null, true); // }
clipboards = multi != null ? multi.getHolders() : null; //
break; // @Command(
} // name = "#buffer",
if (clipboards == null) { // desc = "Only place a block once while a pattern is in use",
throw new InputParseException("#fullcopy:<source>"); // descFooter = "Only place a block once while a pattern is in use\n" +
} // "Use with a brush when you don't want to apply to the same spot twice"
return new RandomFullClipboardPattern(extent, clipboards, rotate, flip); //)
} // public Pattern buffer(Actor actor, Pattern pattern) {
// return new BufferedPattern(FawePlayer.wrap(actor), pattern);
@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 = "#buffer2d",
"Use with a brush when you don't want to apply to the same spot twice" // desc = "Only place a block once in a column while a pattern is in use"
) //)
public Pattern buffer(Actor actor, Pattern pattern) { // public Pattern buffer2d(Actor actor, Pattern pattern) {
return new BufferedPattern(FawePlayer.wrap(actor), pattern); // return new BufferedPattern2D(FawePlayer.wrap(actor), pattern);
} // }
//
@Command( // @Command(
name = "#buffer2d", // name = "#iddatamask",
desc = "Only place a block once in a column while a pattern is in use" // desc = "Use the pattern's id and the existing blocks data with the provided mask",
) // descFooter = "Use the pattern's id and the existing blocks data with the provided mask\n" +
public Pattern buffer2d(Actor actor, Pattern pattern) { // " - Use to replace slabs or where the data values needs to be shifted instead of set"
return new BufferedPattern2D(FawePlayer.wrap(actor), pattern); //)
} // public Pattern iddatamask(Actor actor, LocalSession session, Extent extent, @Range(min = 0, max = 15) int bitmask, Pattern pattern) {
//
@Command( // return new IdDataMaskPattern(extent, pattern, bitmask);
name = "#iddatamask", // }
desc = "Use the pattern's id and the existing blocks data with the provided mask", //
descFooter = "Use the pattern's id and the existing blocks data with the provided mask\n" + // @Command(
" - Use to replace slabs or where the data values needs to be shifted instead of set" // name = "#id",
) // desc = "Only change the block id"
public Pattern iddatamask(Actor actor, LocalSession session, Extent extent, @Range(min = 0, max = 15) int bitmask, Pattern pattern) { //)
// public Pattern id(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
return new IdDataMaskPattern(extent, pattern, bitmask); //
} // return new IdPattern(extent, pattern);
// }
@Command( //
name = "#id", // @Command(
desc = "Only change the block id" // name = "#data",
) // desc = "Only change the block data"
public Pattern id(Actor actor, LocalSession session, Extent extent, Pattern pattern) { //)
// public Pattern data(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
return new IdPattern(extent, pattern); //
} // return new DataPattern(extent, pattern);
// }
@Command( //
name = "#data", // @Command(
desc = "Only change the block data" // name = "#biome",
) // aliases = {"$"},
public Pattern data(Actor actor, LocalSession session, Extent extent, Pattern pattern) { // desc = "Set the biome"
//)
return new DataPattern(extent, pattern); // public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) {
} //
// return new BiomePattern(extent, biome);
@Command( // }
name = "#biome", //
aliases = {"$"}, // @Command(
desc = "Set the biome" // name = "#relative",
) // aliases = {"#~", "#r", "#rel"},
public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) { // desc = "Offset the pattern to where you click"
//)
return new BiomePattern(extent, biome); // public Pattern relative(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
} //
// return new RelativePattern(pattern);
@Command( // }
name = "#relative", //
aliases = {"#~", "#r", "#rel"}, // @Command(
desc = "Offset the pattern to where you click" // name = "#!x",
) // aliases = {"#nx", "#nox"},
public Pattern relative(Actor actor, LocalSession session, Extent extent, Pattern pattern) { // desc = "The pattern will not be provided the x axis info",
// descFooter = "The pattern will not be provided the z axis info.\n" +
return new RelativePattern(pattern); // "Example: #!x[#!z[#~[#l3d[pattern]]]]"
} //)
// public Pattern nox(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
@Command( //
name = "#!x", // return new NoXPattern(pattern);
aliases = {"#nx", "#nox"}, // }
desc = "The pattern will not be provided the x axis info", //
descFooter = "The pattern will not be provided the z axis info.\n" + // @Command(
"Example: #!x[#!z[#~[#l3d[pattern]]]]" // name = "#!y",
) // aliases = {"#ny", "#noy"},
public Pattern nox(Actor actor, LocalSession session, Extent extent, Pattern pattern) { // desc = "The pattern will not be provided the y axis info"
//)
return new NoXPattern(pattern); // public Pattern noy(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
} //
// return new NoYPattern(pattern);
@Command( // }
name = "#!y", //
aliases = {"#ny", "#noy"}, // @Command(
desc = "The pattern will not be provided the y axis info" // name = "#!z",
) // aliases = {"#nz", "#noz"},
public Pattern noy(Actor actor, LocalSession session, Extent extent, Pattern pattern) { // desc = "The pattern will not be provided the z axis info"
//)
return new NoYPattern(pattern); // public Pattern noz(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
} //
// return new NoZPattern(pattern);
@Command( // }
name = "#!z", //
aliases = {"#nz", "#noz"}, // @Command(
desc = "The pattern will not be provided the z axis info" // name = "#mask",
) // desc = "Apply a pattern depending on a mask"
public Pattern noz(Actor actor, LocalSession session, Extent extent, Pattern pattern) { //)
// public Pattern mask(Actor actor, LocalSession session, Mask mask, Pattern pass, Pattern fail) {
return new NoZPattern(pattern); // return new MaskedPattern(mask, pass, fail);
} // }
//
@Command( // @Command(
name = "#mask", // name = "#offset",
desc = "Apply a pattern depending on a mask" // desc = "Offset a pattern"
) //)
public Pattern mask(Actor actor, LocalSession session, Mask mask, Pattern pass, Pattern fail) { // public Pattern offset(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
return new MaskedPattern(mask, pass, fail); //
} // return new OffsetPattern(pattern, (int) x, (int) y, (int) z);
// }
@Command( //
name = "#offset", // @Command(
desc = "Offset a pattern" // name = "#surfacespread",
) // 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"
public Pattern offset(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { //)
// public Pattern surfacespread(Actor actor, LocalSession session, double distance, Pattern pattern) {
return new OffsetPattern(pattern, (int) x, (int) y, (int) z); //
} // return new SurfaceRandomOffsetPattern(pattern, (int) distance);
// }
@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 = "#solidspread",
) // desc = "Randomly spread solid blocks"
public Pattern surfacespread(Actor actor, LocalSession session, double distance, Pattern pattern) { //)
// public Pattern solidspread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
return new SurfaceRandomOffsetPattern(pattern, (int) distance); //
} // return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
// }
@Command( //
name = "#solidspread", // @Command(
desc = "Randomly spread solid blocks" // name = "#spread",
) // aliases = {"#randomoffset"},
public Pattern solidspread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { // desc = "Randomly spread blocks"
//)
return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z); // public Pattern spread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
} //
// return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
@Command( // }
name = "#spread", //
aliases = {"#randomoffset"}, // @Command(
desc = "Randomly spread blocks" // name = "#linear",
) // aliases = {"#l"},
public Pattern spread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { // desc = "Sequentially set blocks from a list of patterns"
//)
return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z); // public Pattern linear(Actor actor, LocalSession session, Pattern other) {
} //
// if (other instanceof RandomPattern) {
@Command( // Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
name = "#linear", // return new LinearBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
aliases = {"#l"}, // }
desc = "Sequentially set blocks from a list of patterns" // return other;
) // }
public Pattern linear(Actor actor, LocalSession session, Pattern other) { //
// @Command(
if (other instanceof RandomPattern) { // name = "#linear3d",
Set<Pattern> patterns = ((RandomPattern) other).getPatterns(); // aliases = {"#l3d"},
return new LinearBlockPattern(patterns.toArray(new Pattern[patterns.size()])); // desc = "Use the x,y,z coordinate to pick a block from the list"
} //)
return other; // public Pattern linear3d(Actor actor, LocalSession session, Pattern other) {
} //
// if (other instanceof RandomPattern) {
@Command( // Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
name = "#linear3d", // return new Linear3DBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
aliases = {"#l3d"}, // }
desc = "Use the x,y,z coordinate to pick a block from the list" // return other;
) // }
public Pattern linear3d(Actor actor, LocalSession session, Pattern other) { //
// @Command(
if (other instanceof RandomPattern) { // name = "#linear2d",
Set<Pattern> patterns = ((RandomPattern) other).getPatterns(); // aliases = {"#l2d"},
return new Linear3DBlockPattern(patterns.toArray(new Pattern[patterns.size()])); // desc = "Use the x,z coordinate to pick a block from the list"
} //)
return other; // public Pattern linear2d(Actor actor, LocalSession session, Pattern other) {
} //
// if (other instanceof RandomPattern) {
@Command( // Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
name = "#linear2d", // return new Linear2DBlockPattern(patterns.toArray(new Pattern[patterns.size()]));
aliases = {"#l2d"}, // }
desc = "Use the x,z coordinate to pick a block from the list" // return other;
) // }
public Pattern linear2d(Actor actor, LocalSession session, Pattern other) { //
// @Command(
if (other instanceof RandomPattern) { // name = "=",
Set<Pattern> patterns = ((RandomPattern) other).getPatterns(); // aliases = {"#=", "#expression"},
return new Linear2DBlockPattern(patterns.toArray(new Pattern[patterns.size()])); // desc = "Expression pattern: http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax"
} //)
return other; // public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException {
} //
// Expression exp = Expression.compile(input, "x", "y", "z");
@Command( // WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
name = "=", // exp.setEnvironment(env);
aliases = {"#=", "#expression"}, // return new ExpressionPattern(exp);
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);
}
}

Datei anzeigen

@ -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;
} // }
} //}

Datei anzeigen

@ -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;

Datei anzeigen

@ -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;

Datei anzeigen

@ -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(),

Datei anzeigen

@ -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") })
}

Datei anzeigen

@ -0,0 +1,3 @@
tasks.register("build") {
dependsOn(subprojects.map { it.tasks.named("build") })
}

Datei anzeigen

@ -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}")
}

Datei anzeigen

@ -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}")
}

Datei anzeigen

@ -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")
}