mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 09:17:39 +00:00
fix dependencies
This commit is contained in:
parent
ae89c16390
commit
4e49d16505
195
build.gradle
195
build.gradle
@ -1,195 +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"
|
||||
}
|
||||
|
||||
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]/[revision]/artifact/[module].[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'
|
||||
// apply plugin: 'com.jfrog.artifactory'
|
||||
// Enable this requires putting license header files in many, many FAWE files
|
||||
// apply plugin: 'net.minecrell.licenser'
|
||||
|
||||
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)
|
||||
//
|
||||
// artifactoryPublish {
|
||||
// publishConfigs('archives')
|
||||
// }
|
||||
|
||||
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*'
|
||||
}
|
||||
|
||||
// Enable this requires putting license header files in many, many FAWE files
|
||||
//license {
|
||||
// header = rootProject.file("HEADER.txt")
|
||||
// include '**/*.java'
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
84
build.gradle.kts
Normal file
84
build.gradle.kts
Normal file
@ -0,0 +1,84 @@
|
||||
import org.ajoberstar.grgit.Grgit
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
plugins {
|
||||
id("com.gradle.build-scan") version "2.4.1"
|
||||
}
|
||||
|
||||
logger.lifecycle("""
|
||||
*******************************************
|
||||
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/cSMxtGn
|
||||
|
||||
Output files will be in [subproject]/build/libs
|
||||
*******************************************
|
||||
""")
|
||||
//TODO FIX THIS WHEN I FEEL LIKE IT
|
||||
var rootVersion = "1.14"
|
||||
var revision: String = ""
|
||||
var buildNumber = ""
|
||||
var date: String = ""
|
||||
ext {
|
||||
val git: Grgit = Grgit.open {
|
||||
dir = File(rootDir.toString() + "/.git");
|
||||
}
|
||||
ext["date"] = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"));
|
||||
ext["revision"] = "-${git.head().abbreviatedId}";
|
||||
var parents: MutableList<String>? = git.head().parentIds;
|
||||
if (project.hasProperty("buildnumber")) {
|
||||
buildNumber = project.properties["buildnumber"] as String;
|
||||
} else {
|
||||
var index = -2109; // Offset to match CI
|
||||
while (parents != null && parents.isNotEmpty()) {
|
||||
parents = git.getResolve().toCommit(parents.get(0)).getParentIds()
|
||||
index++;
|
||||
}
|
||||
buildNumber = index.toString();
|
||||
}
|
||||
}
|
||||
//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)
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
buildScan {
|
||||
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
|
||||
setTermsOfServiceAgree("yes")
|
||||
|
||||
publishAlways()
|
||||
}
|
29
buildSrc/build.gradle.kts
Normal file
29
buildSrc/build.gradle.kts
Normal file
@ -0,0 +1,29 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
kotlin("jvm") version embeddedKotlinVersion
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
// Fabric needs this.
|
||||
force(
|
||||
"commons-io:commons-io:2.5",
|
||||
"org.ow2.asm:asm:7.1",
|
||||
"org.ow2.asm:asm-commons:7.1"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(gradleApi())
|
||||
implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1")
|
||||
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
|
||||
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
|
||||
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
|
||||
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
|
||||
}
|
27
buildSrc/src/main/kotlin/CommonConfig.kt
Normal file
27
buildSrc/src/main/kotlin/CommonConfig.kt
Normal file
@ -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]/[revision]/artifact/[module].[ext]")
|
||||
}}
|
||||
}
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
cacheChangingModulesFor(5, "minutes")
|
||||
}
|
||||
}
|
||||
}
|
12
buildSrc/src/main/kotlin/GradleExtras.kt
Normal file
12
buildSrc/src/main/kotlin/GradleExtras.kt
Normal file
@ -0,0 +1,12 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
val Project.ext: ExtraPropertiesExtension
|
||||
get() = extensions.getByType()
|
||||
|
||||
val Project.sourceSets: SourceSetContainer
|
||||
get() = the<JavaPluginConvention>().sourceSets
|
97
buildSrc/src/main/kotlin/LibsConfig.kt
Normal file
97
buildSrc/src/main/kotlin/LibsConfig.kt
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
109
buildSrc/src/main/kotlin/PlatformConfig.kt
Normal file
109
buildSrc/src/main/kotlin/PlatformConfig.kt
Normal file
@ -0,0 +1,109 @@
|
||||
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"))
|
||||
}
|
||||
archiveName = "FastAsyncWorldEdit-${project.version}.jar"
|
||||
exclude("GradleStart**")
|
||||
exclude(".cache")
|
||||
exclude("LICENSE*")
|
||||
minimize()
|
||||
}
|
||||
}
|
8
buildSrc/src/main/kotlin/Versions.kt
Normal file
8
buildSrc/src/main/kotlin/Versions.kt
Normal file
@ -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"
|
||||
}
|
@ -65,10 +65,6 @@
|
||||
<property name="format" value="(?!Character)\.to(Lower|Upper)Case\(\)"/>
|
||||
<property name="illegalPattern" value="true"/>
|
||||
</module>
|
||||
<module name="EmptyCatchBlock">
|
||||
<property name="exceptionVariableName" value="ignored|ignore"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
<!-- Validate that command annotations are formatted correctly -->
|
||||
<module name="RegexpMultiline">
|
||||
|
@ -6,10 +6,9 @@ Example usage:
|
||||
|
||||
You may or may not install these scripts -- it is optional. If you are, however,
|
||||
place the entire craftscripts/ folder into the respective directory for the platform
|
||||
that you have installed WorldEdit for
|
||||
(see http://wiki.sk89q.com/wiki/WorldEdit/Installation).
|
||||
that you have installed WorldEdit.
|
||||
|
||||
In order to be able to use CraftScripts, you must install the Rhino JavaScript library.
|
||||
The installation page linked above has information about that. More information
|
||||
about scripts in general can be found at
|
||||
http://wiki.sk89q.com/wiki/WorldEdit/Scripting
|
||||
https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
group=com.sk89q.worldedit
|
||||
#version=7.1.0-SNAPSHOT
|
||||
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
|
@ -1,9 +0,0 @@
|
||||
rootProject.name = 'FastAsyncWorldEdit'
|
||||
|
||||
include 'worldedit-libs'
|
||||
|
||||
['core', 'bukkit'].forEach {
|
||||
include "worldedit-libs:$it"
|
||||
include "worldedit-$it"
|
||||
}
|
||||
include "worldedit-libs:core:ap"
|
9
settings.gradle.kts
Normal file
9
settings.gradle.kts
Normal file
@ -0,0 +1,9 @@
|
||||
rootProject.name = "FastAsyncWorldEdit"
|
||||
|
||||
include("worldedit-libs")
|
||||
|
||||
listOf("bukkit", "core").forEach {
|
||||
include("worldedit-libs:$it")
|
||||
include("worldedit-$it")
|
||||
}
|
||||
include("worldedit-libs:core:ap")
|
@ -1,118 +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'
|
||||
}
|
||||
// from (zipTree('src/main/resources/worldedit-adapters.jar').matching {
|
||||
// exclude 'META-INF/'
|
||||
// })
|
||||
// exclude '**/worldedit-adapters.jar'
|
||||
}
|
||||
|
||||
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)
|
95
worldedit-bukkit/build.gradle.kts
Normal file
95
worldedit-bukkit/build.gradle.kts
Normal file
@ -0,0 +1,95 @@
|
||||
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") { isTransitive = false }
|
||||
"api"(project(":worldedit-core"))
|
||||
"api"(project(":worldedit-libs:bukkit"))
|
||||
"compile"("it.unimi.dsi:fastutil:8.2.1")
|
||||
"api"("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") {
|
||||
exclude("junit", "junit")
|
||||
}
|
||||
"compileOnly"("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT")
|
||||
"implementation"("io.papermc:paperlib:1.0.2")
|
||||
"compileOnly"("com.sk89q:dummypermscompat:1.10")
|
||||
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
|
||||
"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") { isTransitive = false }
|
||||
"implementation"("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39") { isTransitive = false }
|
||||
"implementation"("com.massivecraft:factions:2.8.0") { isTransitive = false }
|
||||
"implementation"("com.drtshock:factions:1.6.9.5") { isTransitive = false }
|
||||
"implementation"("com.factionsone:FactionsOne:1.2.2") { isTransitive = false }
|
||||
"implementation"("me.ryanhamshire:GriefPrevention:11.5.2") { isTransitive = false }
|
||||
"implementation"("com.massivecraft:mcore:7.0.1") { isTransitive = false }
|
||||
"implementation"("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT") { isTransitive = false }
|
||||
"implementation"("net.jzx7:regios:5.9.9") { isTransitive = false }
|
||||
"implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") { isTransitive = false }
|
||||
"implementation"("com.palmergames.bukkit:towny:0.84.0.9") { isTransitive = false }
|
||||
"implementation"("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0") { isTransitive = false }
|
||||
"implementation"("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT") { isTransitive = false }
|
||||
"implementation"("com.wasteofplastic:askyblock:3.0.8.2") { isTransitive = false }
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
filesMatching("plugin.yml") {
|
||||
expand("internalVersion" to project.ext["internalVersion"])
|
||||
}
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
@ -3,24 +3,22 @@ package com.boydti.fawe.bukkit;
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.IFawe;
|
||||
import com.boydti.fawe.beta.implementation.QueueHandler;
|
||||
import com.boydti.fawe.bukkit.beta.BukkitQueueHandler;
|
||||
import com.boydti.fawe.bukkit.adapter.BukkitQueueHandler;
|
||||
import com.boydti.fawe.bukkit.listener.BrushListener;
|
||||
import com.boydti.fawe.bukkit.listener.BukkitImageListener;
|
||||
import com.boydti.fawe.bukkit.listener.RenderListener;
|
||||
import com.boydti.fawe.bukkit.regions.*;
|
||||
import com.boydti.fawe.bukkit.util.BukkitReflectionUtils;
|
||||
import com.boydti.fawe.bukkit.util.BukkitTaskMan;
|
||||
import com.boydti.fawe.bukkit.util.ItemUtil;
|
||||
import com.boydti.fawe.bukkit.util.VaultUtil;
|
||||
import com.boydti.fawe.bukkit.util.image.BukkitImageViewer;
|
||||
import com.boydti.fawe.bukkit.v0.ChunkListener_8;
|
||||
import com.boydti.fawe.bukkit.v0.ChunkListener_9;
|
||||
import com.boydti.fawe.bukkit.listener.ChunkListener_8;
|
||||
import com.boydti.fawe.bukkit.listener.ChunkListener_9;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweCommand;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
import com.boydti.fawe.util.Jars;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.util.image.ImageViewer;
|
||||
|
||||
@ -39,18 +37,13 @@ import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FaweBukkit implements IFawe, Listener {
|
||||
|
@ -1,19 +1,13 @@
|
||||
package com.boydti.fawe.bukkit.beta;
|
||||
package com.boydti.fawe.bukkit.adapter;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.implementation.QueueHandler;
|
||||
import com.boydti.fawe.bukkit.v0.ChunkListener;
|
||||
import com.boydti.fawe.bukkit.listener.ChunkListener;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class BukkitQueueHandler extends QueueHandler {
|
||||
@Override
|
||||
public IQueueExtent create() {
|
||||
return new BukkitQueue();
|
||||
}
|
||||
|
||||
private volatile boolean timingsEnabled;
|
||||
private static boolean alertTimingsChange = true;
|
||||
|
@ -1,11 +1,7 @@
|
||||
package com.boydti.fawe.bukkit.beta;
|
||||
package com.boydti.fawe.bukkit.adapter;
|
||||
|
||||
import org.apache.commons.lang.mutable.MutableInt;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
@ -1,4 +1,4 @@
|
||||
package com.boydti.fawe.bukkit.v1_14.adapter;
|
||||
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
||||
|
||||
import com.sk89q.util.ReflectionUtil;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
@ -1,20 +1,12 @@
|
||||
package com.boydti.fawe.bukkit.beta;
|
||||
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.beta.implementation.SimpleCharQueueExtent;
|
||||
import com.boydti.fawe.beta.implementation.IChunkCache;
|
||||
import com.boydti.fawe.bukkit.v1_14.adapter.BlockMaterial_1_14;
|
||||
import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.collection.BitArray4096;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -31,8 +23,6 @@ import net.minecraft.server.v1_14_R1.GameProfileSerializer;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.PlayerChunk;
|
||||
import net.minecraft.server.v1_14_R1.PlayerChunkMap;
|
||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
||||
import sun.misc.Unsafe;
|
||||
@ -45,17 +35,10 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class BukkitAdapter_1_14 {
|
||||
|
||||
public class BukkitQueue extends SimpleCharQueueExtent {
|
||||
private org.bukkit.World bukkitWorld;
|
||||
private WorldServer nmsWorld;
|
||||
/*
|
||||
|
||||
public BukkitQueue() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void init(Extent extent, IChunkCache<IChunkGet> get, IChunkCache<IChunkSet> set) {
|
||||
World world = WorldWrapper.unwrap(extent);
|
||||
if (world == null) throw new IllegalArgumentException("Get must be a world.");
|
||||
if (world instanceof BukkitWorld) {
|
||||
@ -66,13 +49,8 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
||||
checkNotNull(this.bukkitWorld);
|
||||
CraftWorld craftWorld = ((CraftWorld) bukkitWorld);
|
||||
this.nmsWorld = craftWorld.getHandle();
|
||||
super.init(extent, get, set);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void reset() {
|
||||
super.reset();
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
NMS fields
|
||||
@ -172,10 +150,6 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
||||
|
||||
private static boolean PAPER = true;
|
||||
|
||||
public Chunk ensureLoaded(int X, int Z) {
|
||||
return ensureLoaded(nmsWorld, X, Z);
|
||||
}
|
||||
|
||||
public static Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int X, int Z) {
|
||||
Chunk nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
|
||||
if (nmsChunk != null) {
|
||||
@ -251,11 +225,6 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChunk(final int X, final int Z, final int mask) {
|
||||
sendChunk(nmsWorld, X, Z, mask);
|
||||
}
|
||||
|
||||
/*
|
||||
NMS conversion
|
||||
*/
|
@ -1,11 +1,11 @@
|
||||
package com.boydti.fawe.bukkit.beta;
|
||||
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.beta.implementation.QueueHandler;
|
||||
import com.boydti.fawe.beta.implementation.blocks.CharGetBlocks;
|
||||
import com.boydti.fawe.bukkit.v1_14.adapter.Spigot_v1_14_R1;
|
||||
import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
||||
import com.boydti.fawe.object.collection.BitArray4096;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
@ -51,14 +51,14 @@ import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class BukkitGetBlocks extends CharGetBlocks {
|
||||
public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
public ChunkSection[] sections;
|
||||
public Chunk nmsChunk;
|
||||
public CraftWorld world;
|
||||
public int X, Z;
|
||||
private boolean forceLoad;
|
||||
|
||||
public BukkitGetBlocks(World world, int X, int Z, boolean forceLoad) {
|
||||
public BukkitGetBlocks_1_14(World world, int X, int Z, boolean forceLoad) {
|
||||
this.world = (CraftWorld) world;
|
||||
this.X = X;
|
||||
this.Z = Z;
|
||||
@ -91,7 +91,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
return load(layer, null);
|
||||
}
|
||||
|
||||
private void updateGet(BukkitGetBlocks get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
|
||||
private void updateGet(BukkitGetBlocks_1_14 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
|
||||
synchronized (get) {
|
||||
if (this.nmsChunk != nmsChunk) {
|
||||
this.nmsChunk = nmsChunk;
|
||||
@ -117,7 +117,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
public <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
|
||||
try {
|
||||
WorldServer nmsWorld = world.getHandle();
|
||||
Chunk nmsChunk = BukkitQueue.ensureLoaded(nmsWorld, X, Z);
|
||||
Chunk nmsChunk = BukkitAdapter_1_14.ensureLoaded(nmsWorld, X, Z);
|
||||
|
||||
// Remove existing tiles
|
||||
|
||||
@ -157,8 +157,8 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
ChunkSection newSection;
|
||||
ChunkSection existingSection = sections[layer];
|
||||
if (existingSection == null) {
|
||||
newSection = BukkitQueue.newChunkSection(layer, setArr);
|
||||
if (BukkitQueue.setSectionAtomic(sections, null, newSection, layer)) {
|
||||
newSection = BukkitAdapter_1_14.newChunkSection(layer, setArr);
|
||||
if (BukkitAdapter_1_14.setSectionAtomic(sections, null, newSection, layer)) {
|
||||
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
|
||||
continue;
|
||||
} else {
|
||||
@ -169,7 +169,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
}
|
||||
}
|
||||
}
|
||||
DelegateLock lock = BukkitQueue.applyLock(existingSection);
|
||||
DelegateLock lock = BukkitAdapter_1_14.applyLock(existingSection);
|
||||
synchronized (this) {
|
||||
synchronized (lock) {
|
||||
lock.untilFree();
|
||||
@ -194,8 +194,8 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
getArr[i] = value;
|
||||
}
|
||||
}
|
||||
newSection = BukkitQueue.newChunkSection(layer, getArr);
|
||||
if (!BukkitQueue.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||
newSection = BukkitAdapter_1_14.newChunkSection(layer, getArr);
|
||||
if (!BukkitAdapter_1_14.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||
System.out.println("Failed to set chunk section:" + X + "," + Z + " layer: " + layer);
|
||||
continue;
|
||||
} else {
|
||||
@ -344,7 +344,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
nmsChunk.mustNotSave = false;
|
||||
nmsChunk.markDirty();
|
||||
// send to player
|
||||
BukkitQueue.sendChunk(nmsWorld, X, Z, finalMask);
|
||||
BukkitAdapter_1_14.sendChunk(nmsWorld, X, Z, finalMask);
|
||||
if (finalizer != null) finalizer.run();
|
||||
};
|
||||
}
|
||||
@ -397,7 +397,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
if (data == null || data == FaweCache.IMP.EMPTY_CHAR_4096) {
|
||||
data = new char[4096];
|
||||
}
|
||||
DelegateLock lock = BukkitQueue.applyLock(section);
|
||||
DelegateLock lock = BukkitAdapter_1_14.applyLock(section);
|
||||
synchronized (lock) {
|
||||
lock.untilFree();
|
||||
lock.setModified(false);
|
||||
@ -406,8 +406,8 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
Spigot_v1_14_R1 adapter = ((Spigot_v1_14_R1) WorldEditPlugin.getInstance().getBukkitImplAdapter());
|
||||
|
||||
final DataPaletteBlock<IBlockData> blocks = section.getBlocks();
|
||||
final DataBits bits = (DataBits) BukkitQueue.fieldBits.get(blocks);
|
||||
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitQueue.fieldPalette.get(blocks);
|
||||
final DataBits bits = (DataBits) BukkitAdapter_1_14.fieldBits.get(blocks);
|
||||
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_14.fieldPalette.get(blocks);
|
||||
|
||||
final int bitsPerEntry = bits.c();
|
||||
final long[] blockStates = bits.a();
|
||||
@ -506,7 +506,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
|
||||
synchronized (this) {
|
||||
tmp = nmsChunk;
|
||||
if (tmp == null) {
|
||||
nmsChunk = tmp = BukkitQueue.ensureLoaded(this.world.getHandle(), X, Z);
|
||||
nmsChunk = tmp = BukkitAdapter_1_14.ensureLoaded(this.world.getHandle(), X, Z);
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.boydti.fawe.bukkit.v1_14.adapter;
|
||||
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.google.common.collect.ImmutableList;
|
@ -0,0 +1,4 @@
|
||||
package com.boydti.fawe.bukkit.listener;
|
||||
|
||||
public class ChunkCache {
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.boydti.fawe.bukkit.v0;
|
||||
package com.boydti.fawe.bukkit.listener;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
@ -1,4 +1,4 @@
|
||||
package com.boydti.fawe.bukkit.v0;
|
||||
package com.boydti.fawe.bukkit.listener;
|
||||
|
||||
import sun.misc.SharedSecrets;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.boydti.fawe.bukkit.v0;
|
||||
package com.boydti.fawe.bukkit.listener;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
@ -1,4 +1,4 @@
|
||||
package com.boydti.fawe.bukkit.v0;
|
||||
package com.boydti.fawe.bukkit.listener;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.Settings;
|
@ -1,12 +1,9 @@
|
||||
package com.boydti.fawe.bukkit.util;
|
||||
|
||||
import com.boydti.fawe.bukkit.beta.BukkitQueue;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
@ -57,10 +57,6 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
||||
"# into WEPIF, paste it into http://yaml-online-parser.appspot.com/\r\n" +
|
||||
"# and see if it gives \"ERROR:\".\r\n" +
|
||||
"# - Lines starting with # are comments and so they are ignored.\r\n" +
|
||||
"#\r\n" +
|
||||
"# About Configuration Permissions\r\n" +
|
||||
"# - See http://wiki.sk89q.com/wiki/WorldEdit/Permissions/Bukkit\r\n" +
|
||||
"# - Now with multiworld support (see example)\r\n" +
|
||||
"\r\n";
|
||||
|
||||
private static PermissionsResolverManager instance;
|
||||
|
@ -28,6 +28,7 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
@ -36,6 +37,7 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
@ -252,9 +254,6 @@ public class BukkitWorld extends AbstractWorld {
|
||||
@Override
|
||||
public boolean clearContainerBlockContents(BlockVector3 pt) {
|
||||
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (block == null) {
|
||||
return false;
|
||||
}
|
||||
BlockState state = block.getState();
|
||||
if (!(state instanceof InventoryHolder)) {
|
||||
return false;
|
||||
@ -321,14 +320,12 @@ public class BukkitWorld extends AbstractWorld {
|
||||
public void checkLoadedChunk(BlockVector3 pt) {
|
||||
World world = getWorld();
|
||||
|
||||
if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) {
|
||||
world.loadChunk(pt.getBlockX() >> 4, pt.getBlockZ() >> 4);
|
||||
}
|
||||
world.getChunkAt(pt.getBlockX() >> 4, pt.getBlockZ() >> 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
World ref = worldRef.get();
|
||||
final World ref = worldRef.get();
|
||||
if (ref == null) {
|
||||
return false;
|
||||
} else if (other == null) {
|
||||
@ -337,7 +334,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
World otherWorld = ((BukkitWorld) other).worldRef.get();
|
||||
return ref.equals(otherWorld);
|
||||
} else if (other instanceof com.sk89q.worldedit.world.World) {
|
||||
return ((com.sk89q.worldedit.world.World) other).getName().equals(getName());
|
||||
return ((com.sk89q.worldedit.world.World) other).getName().equals(ref.getName());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -37,16 +37,24 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.internal.command.CommandUtil;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.FuzzyBlockState;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import com.sk89q.worldedit.world.item.ItemCategory;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -214,7 +222,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
PaperLib.suggestPaper(this);
|
||||
}
|
||||
|
||||
public void setupRegistries() {
|
||||
private void setupRegistries() {
|
||||
// Biome
|
||||
for (Biome biome : Biome.values()) {
|
||||
String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT);
|
||||
@ -259,6 +267,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
EntityType.REGISTRY.register("minecraft:" + lowerCaseMcId, new EntityType("minecraft:" + lowerCaseMcId));
|
||||
}
|
||||
}
|
||||
// ... :|
|
||||
GameModes.get("");
|
||||
WeatherTypes.get("");
|
||||
}
|
||||
|
||||
private void setupTags() {
|
||||
@ -428,7 +439,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
// code of WorldEdit expects it
|
||||
String[] split = new String[args.length + 1];
|
||||
System.arraycopy(args, 0, split, 1, args.length);
|
||||
split[0] = "/" + cmd.getName();
|
||||
split[0] = "/" + commandLabel;
|
||||
|
||||
CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
|
||||
getWorldEdit().getEventBus().post(event);
|
||||
@ -443,7 +454,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
// code of WorldEdit expects it
|
||||
String[] split = new String[args.length + 1];
|
||||
System.arraycopy(args, 0, split, 1, args.length);
|
||||
split[0] = "/" + cmd.getName();
|
||||
split[0] = "/" + commandLabel;
|
||||
|
||||
String arguments = Joiner.on(" ").join(split);
|
||||
CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), arguments);
|
||||
@ -577,9 +588,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
if (!event.isCommand()) return;
|
||||
|
||||
String buffer = event.getBuffer();
|
||||
final String[] parts = buffer.split(" ");
|
||||
if (parts.length < 1) return;
|
||||
final String label = parts[0];
|
||||
int firstSpace = buffer.indexOf(' ');
|
||||
if (firstSpace < 0) return;
|
||||
final String label = buffer.substring(0, firstSpace);
|
||||
final Optional<org.enginehub.piston.Command> command
|
||||
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
|
||||
if (!command.isPresent()) return;
|
||||
|
@ -54,7 +54,7 @@ public class BukkitImplLoader {
|
||||
"** will be blank, and so on. There will be no support for entity\n" +
|
||||
"** and block property-related functions.\n" +
|
||||
"**\n" +
|
||||
"** Please see https://worldedit.rtfd.io/en/latest/faq/#bukkit-adapters\n" +
|
||||
"** Please see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters\n" +
|
||||
"**********************************************\n";
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,10 @@
|
||||
name: WorldEdit
|
||||
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
|
||||
version: ${version}
|
||||
version: "${internalVersion}"
|
||||
load: STARTUP
|
||||
api-version: 1.13
|
||||
description: Fast Async WorldEdit plugin
|
||||
authors: [Empire92]
|
||||
load: STARTUP
|
||||
authors: [Empire92, MattBDev]
|
||||
loadbefore: [BannerBoard, WorldGuard, PlotSquared, AsyncWorldEdit, AsyncWorldEditInjector]
|
||||
database: false
|
||||
permissions:
|
||||
|
@ -19,20 +19,20 @@
|
||||
|
||||
package com.sk89q.wepif;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class DinnerPermsResolverTest {
|
||||
private DinnerPermsResolver resolver;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
Server server = mock(Server.class);
|
||||
when(server.getPluginManager()).thenReturn(mock(PluginManager.class));
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@ -52,7 +53,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(String s) {
|
||||
return assignedPermissions.containsKey(s.toLowerCase());
|
||||
return assignedPermissions.containsKey(s.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -63,7 +64,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
||||
@Override
|
||||
public boolean hasPermission(String s) {
|
||||
if (isPermissionSet(s)) {
|
||||
return assignedPermissions.get(s.toLowerCase());
|
||||
return assignedPermissions.get(s.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -113,11 +114,11 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
||||
}
|
||||
|
||||
public void setPermission(String permission, boolean value) {
|
||||
assignedPermissions.put(permission.toLowerCase(), value);
|
||||
assignedPermissions.put(permission.toLowerCase(Locale.ROOT), value);
|
||||
}
|
||||
|
||||
public void unsetPermission(String permission) {
|
||||
assignedPermissions.remove(permission.toLowerCase());
|
||||
assignedPermissions.remove(permission.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
public void clearPermissions() {
|
||||
|
@ -20,15 +20,16 @@
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class BukkitWorldTest {
|
||||
|
||||
@Test
|
||||
public void testTreeTypeMapping() {
|
||||
for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) {
|
||||
Assert.assertNotNull("No mapping for: " + type, BukkitWorld.toBukkitTreeType(type));
|
||||
assertNotNull(BukkitWorld.toBukkitTreeType(type), "No mapping for: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,129 +0,0 @@
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("eclipse")
|
||||
id("idea")
|
||||
id("net.ltgt.apt") version "0.21" apply false
|
||||
id "net.ltgt.apt-eclipse" version "0.21"
|
||||
id "net.ltgt.apt-idea" version "0.21"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/"}
|
||||
}
|
||||
|
||||
configurations.all { Configuration it ->
|
||||
it.resolutionStrategy { ResolutionStrategy rs ->
|
||||
rs.force("com.google.guava:guava:21.0")
|
||||
}
|
||||
it.resolutionStrategy { ResolutionStrategy rs ->
|
||||
rs.force("it.unimi.dsi:fastutil:8.2.1")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':worldedit-libs:core')
|
||||
compile 'de.schlichtherle:truezip:6.8.3'
|
||||
compile 'rhino:js:1.7R2'
|
||||
compile 'org.yaml:snakeyaml:1.23'
|
||||
compile 'com.google.guava:guava:21.0'
|
||||
compile 'com.google.code.findbugs:jsr305:1.3.9'
|
||||
compile 'com.thoughtworks.paranamer:paranamer:2.6'
|
||||
compile 'com.google.code.gson:gson:2.8.0'
|
||||
compile 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||
compile 'org.slf4j:slf4j-api:1.7.26'
|
||||
compile "it.unimi.dsi:fastutil:8.2.1"
|
||||
|
||||
compileOnly project(':worldedit-libs:core:ap')
|
||||
annotationProcessor project(':worldedit-libs:core:ap')
|
||||
annotationProcessor "com.google.guava:guava:21.0"
|
||||
def avVersion = "1.6.5"
|
||||
compileOnly "com.google.auto.value:auto-value-annotations:$avVersion"
|
||||
annotationProcessor "com.google.auto.value:auto-value:$avVersion"
|
||||
//compile 'net.sf.trove4j:trove4j:3.0.3'
|
||||
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
|
||||
|
||||
// Fawe depends
|
||||
compileOnly 'net.fabiozumbi12:redprotect:1.9.6'
|
||||
compileOnly ("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
|
||||
transitive = false
|
||||
}
|
||||
compile 'com.mojang:datafixerupper:1.0.20'
|
||||
compile 'com.github.luben:zstd-jni:1.1.1'
|
||||
compile 'co.aikar:fastutil-lite:1.0'
|
||||
testImplementation ("org.junit.jupiter:junit-jupiter-api:5.5.0")
|
||||
testImplementation ("org.junit.jupiter:junit-jupiter-params:5.5.0")
|
||||
testImplementation ("org.mockito:mockito-core:3.0.0")
|
||||
testImplementation ("org.mockito:mockito-junit-jupiter:3.0.0")
|
||||
testRuntime ("org.junit.jupiter:junit-jupiter-engine:5.5.0")
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
dependsOn(":worldedit-libs:build")
|
||||
it.options.compilerArgs << "-Xmaxerrs" << "10000"
|
||||
it.options.compilerArgs.add("-Aarg.name.key.prefix=")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/main/java'
|
||||
srcDir 'src/legacy/java'
|
||||
}
|
||||
resources {
|
||||
srcDir 'src/main/resources'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
from('src/main/resources') {
|
||||
include 'fawe.properties'
|
||||
expand(
|
||||
version: "${project.parent.version}",
|
||||
name: project.parent.name,
|
||||
commit: "${git.head().abbreviatedId}",
|
||||
date: "${git.head().getDate().format("yy.MM.dd")}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
jar.archiveName="fawe-api-${project.parent.version}.jar"
|
||||
jar.destinationDir = file '../mvn/com/boydti/fawe-api/' + project.parent.version
|
||||
task createPom {
|
||||
doLast {
|
||||
pom {
|
||||
project {
|
||||
groupId 'com.boydti'
|
||||
artifactId 'fawe-api'
|
||||
version project.parent.version
|
||||
}
|
||||
}
|
||||
.getEffectivePom()
|
||||
.setDependencies(new ArrayList<>())
|
||||
.writeTo("../mvn/com/boydti/fawe-api/${project.parent.version}/fawe-api-${project.parent.version}.pom")
|
||||
pom {
|
||||
project {
|
||||
groupId 'com.boydti'
|
||||
artifactId 'fawe-api'
|
||||
version 'latest'
|
||||
}
|
||||
}
|
||||
.getEffectivePom()
|
||||
.setDependencies(new ArrayList<>())
|
||||
.writeTo("../mvn/com/boydti/fawe-api/latest/fawe-api-latest.pom")
|
||||
}
|
||||
}
|
||||
task copyFiles {
|
||||
doLast {
|
||||
copy {
|
||||
from "../mvn/com/boydti/fawe-api/${project.parent.version}/"
|
||||
into '../mvn/com/boydti/fawe-api/latest/'
|
||||
include('*.jar')
|
||||
rename ("fawe-api-${project.parent.version}.jar", 'fawe-api-latest.jar')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn(shadowJar)
|
||||
build.finalizedBy(copyFiles)
|
||||
copyFiles.dependsOn(createPom)
|
72
worldedit-core/build.gradle.kts
Normal file
72
worldedit-core/build.gradle.kts
Normal file
@ -0,0 +1,72 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("net.ltgt.apt-eclipse")
|
||||
id("net.ltgt.apt-idea")
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force("com.google.guava:guava:21.0")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"compile"(project(":worldedit-libs:core"))
|
||||
"compile"("de.schlichtherle:truezip:6.8.3")
|
||||
"compile"("rhino:js:1.7R2")
|
||||
"compile"("org.yaml:snakeyaml:1.23")
|
||||
"compile"("com.google.guava:guava:21.0")
|
||||
"compile"("com.google.code.findbugs:jsr305:3.0.2")
|
||||
"compile"("com.google.code.gson:gson:2.8.0")
|
||||
"compile"("org.slf4j:slf4j-api:1.7.26")
|
||||
"compile"("it.unimi.dsi:fastutil:8.2.1")
|
||||
"compile"("com.googlecode.json-simple:json-simple:1.1.1") { isTransitive = false }
|
||||
"compileOnly"(project(":worldedit-libs:core:ap"))
|
||||
"annotationProcessor"(project(":worldedit-libs:core:ap"))
|
||||
// ensure this is on the classpath for the AP
|
||||
"annotationProcessor"("com.google.guava:guava:21.0")
|
||||
"compileOnly"("com.google.auto.value:auto-value-annotations:${Versions.AUTO_VALUE}")
|
||||
"annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}")
|
||||
"compile"("co.aikar:fastutil-lite:1.0")
|
||||
"compile"("com.github.luben:zstd-jni:1.4.3-1")
|
||||
//"compile"("com.mojang:datafixerupper:1.0.20")
|
||||
"compileOnly"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
|
||||
isTransitive = false
|
||||
}
|
||||
"compileOnly"("net.fabiozumbi12:redprotect:1.9.6")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
dependsOn(":worldedit-libs:build")
|
||||
options.compilerArgs.add("-Aarg.name.key.prefix=")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir("src/main/java")
|
||||
srcDir("src/legacy/java")
|
||||
}
|
||||
resources {
|
||||
srcDir("src/main/resources")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
filesMatching("fawe.properties") {
|
||||
expand("version" to "$version",
|
||||
"commit" to "${rootProject.ext["revision"]}",
|
||||
"date" to "${rootProject.ext["date"]}")
|
||||
}
|
||||
}
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
dependencies {
|
||||
include(dependency("com.github.luben:zstd-jni:1.4.3-1"))
|
||||
|
||||
}
|
||||
}
|
@ -159,11 +159,6 @@ public interface IDelegateQueueExtent extends IQueueExtent {
|
||||
return getParent().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
default void sendChunk(int chunkX, int chunkZ, int bitMask) {
|
||||
getParent().sendChunk(chunkX, chunkZ, bitMask);
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean trim(boolean aggressive) {
|
||||
return getParent().trim(aggressive);
|
||||
|
@ -182,14 +182,4 @@ public interface IQueueExtent extends Flushable, Trimable, Extent {
|
||||
* @return If queue is empty
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Refresh a specific chunk with a bitMask (0 = default, 65535 = all block sections)
|
||||
* Note: only 0 is guaranteed to send all tiles / entities
|
||||
* Note: Only 65535 is guaranteed to send all blocks
|
||||
* @param chunkX
|
||||
* @param chunkZ
|
||||
* @param bitMask
|
||||
*/
|
||||
void sendChunk(int chunkX, int chunkZ, int bitMask);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.beta.implementation;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
@ -213,7 +214,9 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract IQueueExtent create();
|
||||
public IQueueExtent create() {
|
||||
return new SingleThreadQueueExtent();
|
||||
}
|
||||
|
||||
public abstract void startSet(boolean parallel);
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
package com.boydti.fawe.beta.implementation;
|
||||
|
||||
import com.boydti.fawe.beta.CharFilterBlock;
|
||||
import com.boydti.fawe.beta.ChunkFilterBlock;
|
||||
|
||||
public abstract class SimpleCharQueueExtent extends SingleThreadQueueExtent {
|
||||
|
||||
@Override
|
||||
public ChunkFilterBlock initFilterBlock() {
|
||||
return new CharFilterBlock(this);
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.boydti.fawe.beta.implementation;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.CharFilterBlock;
|
||||
import com.boydti.fawe.beta.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
@ -25,7 +27,7 @@ import java.util.concurrent.Future;
|
||||
* <p>
|
||||
* This queue is reusable {@link #init(IChunkCache)}
|
||||
*/
|
||||
public abstract class SingleThreadQueueExtent implements IQueueExtent {
|
||||
public class SingleThreadQueueExtent implements IQueueExtent {
|
||||
|
||||
// // Pool discarded chunks for reuse (can safely be cleared by another thread)
|
||||
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
|
||||
@ -299,4 +301,9 @@ public abstract class SingleThreadQueueExtent implements IQueueExtent {
|
||||
pollSubmissions(0, true);
|
||||
reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkFilterBlock initFilterBlock() {
|
||||
return new CharFilterBlock(this);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class CFICommand extends CommandProcessor<Object, Object> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object process(InjectedValueAccess context, List<String> args, Object result) {
|
||||
public int process(InjectedValueAccess context, List<String> args, int result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -67,13 +67,13 @@ public abstract class CommandProcessor<I, O> implements CommandManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final O /* Need to recompile with FAWE-piston */ execute(InjectedValueAccess context, List<String> args) {
|
||||
public final int execute(InjectedValueAccess context, List<String> args) {
|
||||
args = preprocess(context, args);
|
||||
if (args != null) {
|
||||
I result = (I) parent.execute(context, args);
|
||||
int result = parent.execute(context, args);
|
||||
return process(context, args, result); // TODO NOT IMPLEMENTED (recompile piston)
|
||||
} else {
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,5 +89,5 @@ public abstract class CommandProcessor<I, O> implements CommandManager {
|
||||
|
||||
public abstract List<String> preprocess(InjectedValueAccess context, List<String> args);
|
||||
|
||||
public abstract O process(InjectedValueAccess context, List<String> args, I result);
|
||||
public abstract int process(InjectedValueAccess context, List<String> args, int result);
|
||||
}
|
@ -2,9 +2,7 @@ package com.boydti.fawe.object.brush.visualization.cfi;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IBlocks;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.implementation.FallbackChunkGet;
|
||||
import com.boydti.fawe.object.FaweInputStream;
|
||||
@ -16,7 +14,6 @@ import com.boydti.fawe.object.change.StreamChange;
|
||||
import com.boydti.fawe.object.changeset.CFIChangeSet;
|
||||
import com.boydti.fawe.object.collection.DifferentialArray;
|
||||
import com.boydti.fawe.object.collection.DifferentialBlockBuffer;
|
||||
import com.boydti.fawe.object.collection.IterableThreadLocal;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVector2DSet;
|
||||
import com.boydti.fawe.object.collection.SummedAreaTable;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
@ -47,14 +44,16 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -64,9 +63,7 @@ import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
// TODO FIXME
|
||||
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable, VirtualWorld {
|
||||
@ -321,6 +318,11 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChunk(int X, int Z, int mask) {
|
||||
throw new UnsupportedOperationException("TODO NOT IMPLEMENTED"); // add method to adapter to send custom chunk
|
||||
}
|
||||
|
||||
public TextureUtil getRawTextureUtil() {
|
||||
if (textureUtil == null) {
|
||||
textureUtil = Fawe.get().getTextureUtil();
|
||||
@ -849,7 +851,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
@Override
|
||||
public void close(boolean update) {
|
||||
if (chunkOffset != null && player != null && update) {
|
||||
IQueueExtent packetQueue = Fawe.get().getQueueHandler().getQueue(player.getWorld());
|
||||
World world = player.getWorld();
|
||||
|
||||
int lenCX = (getWidth() + 15) >> 4;
|
||||
int lenCZ = (getLength() + 15) >> 4;
|
||||
@ -868,7 +870,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
|
||||
for (int cz = scz; cz <= ecz; cz++) {
|
||||
for (int cx = scx; cx <= ecx; cx++) {
|
||||
packetQueue.sendChunk(cx + OX, cz + OZ, 0);
|
||||
world.sendChunk(cx + OX, cz + OZ, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
||||
|
||||
@Override
|
||||
public void refreshChunk(int x, int z) {
|
||||
IMP.sendChunk(x, z, 0);
|
||||
world.sendChunk(x, z, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,9 +59,9 @@ public class PlotSetBiome extends Command {
|
||||
Collection<BiomeType> knownBiomes = BiomeTypes.values();
|
||||
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
|
||||
if (biome == null) {
|
||||
String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s());
|
||||
String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.toString());
|
||||
Captions.NEED_BIOME.send(player);
|
||||
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes);
|
||||
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.toString() + biomes);
|
||||
return;
|
||||
}
|
||||
confirm.run(this, new Runnable() {
|
||||
|
@ -34,9 +34,9 @@ import com.sk89q.worldedit.command.ChunkCommands;
|
||||
import com.sk89q.worldedit.command.ClipboardCommands;
|
||||
import com.sk89q.worldedit.command.GenerationCommands;
|
||||
import com.sk89q.worldedit.command.HistoryCommands;
|
||||
import com.sk89q.worldedit.command.MaskCommands;
|
||||
//import com.sk89q.worldedit.command.MaskCommands;
|
||||
import com.sk89q.worldedit.command.NavigationCommands;
|
||||
import com.sk89q.worldedit.command.PatternCommands;
|
||||
//import com.sk89q.worldedit.command.PatternCommands;
|
||||
import com.sk89q.worldedit.command.RegionCommands;
|
||||
import com.sk89q.worldedit.command.SchematicCommands;
|
||||
import com.sk89q.worldedit.command.ScriptingCommands;
|
||||
@ -45,7 +45,7 @@ import com.sk89q.worldedit.command.SnapshotCommands;
|
||||
import com.sk89q.worldedit.command.SnapshotUtilCommands;
|
||||
import com.sk89q.worldedit.command.SuperPickaxeCommands;
|
||||
import com.sk89q.worldedit.command.ToolCommands;
|
||||
import com.sk89q.worldedit.command.TransformCommands;
|
||||
//import com.sk89q.worldedit.command.TransformCommands;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -127,9 +127,9 @@ public final class DocumentationPrinter {
|
||||
writePermissionsWikiTable(stream, builder, "/", BrushOptionsCommands.class);
|
||||
writePermissionsWikiTable(stream, builder, "/tool ", ToolCommands.class);
|
||||
writePermissionsWikiTable(stream, builder, "/brush ", BrushCommands.class);
|
||||
writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks");
|
||||
writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns");
|
||||
writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms");
|
||||
//writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks");
|
||||
//writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns");
|
||||
//writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms");
|
||||
writePermissionsWikiTable(stream, builder, "/cfi ", CFICommands.class, "Create From Image");
|
||||
stream.println();
|
||||
stream.print("#### Uncategorized\n");
|
||||
|
@ -0,0 +1,27 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class RegionCacheUtil {
|
||||
public RegionCacheUtil() {
|
||||
|
||||
}
|
||||
|
||||
public void cache(Region region) {
|
||||
Iterator<BlockVector3> iter = region.iterator();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
TaskManager.IMP.async(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -228,6 +228,11 @@ public class WorldWrapper extends AbstractWorld {
|
||||
return parent.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChunk(int X, int Z, int mask) {
|
||||
parent.sendChunk(X, Z, mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(final Region region) {
|
||||
return TaskManager.IMP.sync(new RunnableVal<List<? extends Entity>>() {
|
||||
|
@ -26,8 +26,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class CommandContext {
|
||||
|
||||
@ -256,8 +254,11 @@ public class CommandContext {
|
||||
}
|
||||
|
||||
public String getString(int start, int end) {
|
||||
return IntStream.range(start + 1, end + 1).mapToObj(i -> " " + parsedArgs.get(i))
|
||||
.collect(Collectors.joining("", parsedArgs.get(start), ""));
|
||||
StringBuilder buffer = new StringBuilder(parsedArgs.get(start));
|
||||
for (int i = start + 1; i < end + 1; ++i) {
|
||||
buffer.append(" ").append(parsedArgs.get(i));
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public int getInteger(int index) throws NumberFormatException {
|
||||
|
@ -72,6 +72,7 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Countable;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.Identifiable;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -395,7 +396,7 @@ public class LocalSession implements TextureHolder {
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized void remember(Player player, World world, ChangeSet changeSet, FaweLimit limit) {
|
||||
public synchronized void remember(Identifiable player, World world, ChangeSet changeSet, FaweLimit limit) {
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
||||
}
|
||||
@ -438,7 +439,7 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void remember(final EditSession editSession, final boolean append, int limitMb) {
|
||||
public synchronized void remember(EditSession editSession, boolean append, int limitMb) {
|
||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import org.mozilla.javascript.NativeJavaObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -109,7 +108,8 @@ public final class WorldEdit {
|
||||
private final PlatformManager platformManager = new PlatformManager(this);
|
||||
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
|
||||
private final SessionManager sessions = new SessionManager(this);
|
||||
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20));;
|
||||
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(
|
||||
EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s"));
|
||||
private final Supervisor supervisor = new SimpleSupervisor();
|
||||
|
||||
private final BlockFactory blockFactory = new BlockFactory(this);
|
||||
@ -635,14 +635,14 @@ public final class WorldEdit {
|
||||
* @param args arguments for the script
|
||||
* @throws WorldEditException
|
||||
*/
|
||||
public Object runScript(Player player, File f, String[] args) throws WorldEditException {
|
||||
public void runScript(Player player, File f, String[] args) throws WorldEditException {
|
||||
String filename = f.getPath();
|
||||
int index = filename.lastIndexOf('.');
|
||||
String ext = filename.substring(index + 1);
|
||||
|
||||
if (!ext.equalsIgnoreCase("js")) {
|
||||
player.printError("Only .js scripts are currently supported");
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
String script;
|
||||
@ -655,7 +655,7 @@ public final class WorldEdit {
|
||||
|
||||
if (file == null) {
|
||||
player.printError("Script does not exist: " + filename);
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
file = new FileInputStream(f);
|
||||
@ -668,7 +668,7 @@ public final class WorldEdit {
|
||||
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
player.printError("Script read error: " + e.getMessage());
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
LocalSession session = getSessionManager().get(player);
|
||||
@ -681,8 +681,8 @@ public final class WorldEdit {
|
||||
engine = new RhinoCraftScriptEngine();
|
||||
} catch (NoClassDefFoundError ignored) {
|
||||
player.printError("Failed to find an installed script engine.");
|
||||
player.printError("Please see https://worldedit.readthedocs.io/en/latest/usage/other/craftscripts/");
|
||||
return null;
|
||||
player.printError("Please see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/");
|
||||
return;
|
||||
}
|
||||
|
||||
engine.setTimeLimit(getConfiguration().scriptTimeout);
|
||||
@ -693,11 +693,7 @@ public final class WorldEdit {
|
||||
vars.put("player", player);
|
||||
|
||||
try {
|
||||
Object result = engine.evaluate(script, filename, vars);
|
||||
if (result instanceof NativeJavaObject) {
|
||||
result = ((NativeJavaObject) result).unwrap();
|
||||
}
|
||||
return result;
|
||||
engine.evaluate(script, filename, vars);
|
||||
} catch (ScriptException e) {
|
||||
player.printError("Failed to execute:");
|
||||
player.printRaw(e.getMessage());
|
||||
@ -714,7 +710,6 @@ public final class WorldEdit {
|
||||
session.remember(editSession);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,6 +53,7 @@ import com.boydti.fawe.object.brush.StencilBrush;
|
||||
import com.boydti.fawe.object.brush.SurfaceSphereBrush;
|
||||
import com.boydti.fawe.object.brush.SurfaceSpline;
|
||||
import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap;
|
||||
import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap.Shape;
|
||||
import com.boydti.fawe.object.brush.sweep.SweepBrush;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
@ -152,11 +153,11 @@ public class BrushCommands {
|
||||
"Pic: https://i.imgur.com/cNUQUkj.png -> https://i.imgur.com/hFOFsNf.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.blendball")
|
||||
public BrushSettings blendBallBrush(Player player, LocalSession session,
|
||||
public void blendBallBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new BlendBall()).setSize(radius);
|
||||
set(session, context, new BlendBall()).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -164,11 +165,11 @@ public class BrushCommands {
|
||||
desc = "Erodes terrain"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.erode")
|
||||
public BrushSettings erodeBrush(Player player, LocalSession session,
|
||||
public void erodeBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius for eroding", def = "5")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new ErodeBrush()).setSize(radius);
|
||||
set(session, context, new ErodeBrush()).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -176,11 +177,11 @@ public class BrushCommands {
|
||||
desc = "Pull terrain towards you"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.pull")
|
||||
public BrushSettings pullBrush(Player player, LocalSession session,
|
||||
public void pullBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new RaiseBrush()).setSize(radius);
|
||||
set(session, context, new RaiseBrush()).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -188,11 +189,11 @@ public class BrushCommands {
|
||||
desc = "Creates a circle which revolves around your facing direction"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.sphere")
|
||||
public BrushSettings circleBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
public void circleBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new CircleBrush(player)).setSize(radius).setFill(fill);
|
||||
set(session, context, new CircleBrush(player)).setSize(radius).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -203,18 +204,15 @@ public class BrushCommands {
|
||||
"Note: Set a mask to recurse along specific blocks"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.recursive")
|
||||
public BrushSettings recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
|
||||
public void recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius,
|
||||
@Switch(name = 'd', desc = "Apply in depth first order")
|
||||
boolean depthFirst,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
new RecurseBrush(depthFirst))
|
||||
.setSize(radius)
|
||||
.setFill(fill)
|
||||
.setMask(new IdMask(editSession));
|
||||
set(session, context, new RecurseBrush(depthFirst))
|
||||
.setSize(radius).setFill(fill).setMask(new IdMask(editSession));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -223,7 +221,7 @@ public class BrushCommands {
|
||||
desc = "Create lines"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.line")
|
||||
public BrushSettings lineBrush(Player player, LocalSession session, Pattern fill,
|
||||
public void lineBrush(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius,
|
||||
@Switch(name = 'h', desc = "Create only a shell")
|
||||
@ -233,10 +231,7 @@ public class BrushCommands {
|
||||
@Switch(name = 'f', desc = "Create a flat line")
|
||||
boolean flat, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
new LineBrush(shell, select, flat))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
set(session, context, new LineBrush(shell, select, flat)).setSize(radius).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -250,12 +245,12 @@ public class BrushCommands {
|
||||
"Tutorial: https://www.planetminecraft.com/blog/fawe-tutorial/"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.spline")
|
||||
public BrushSettings splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
public void splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "25")
|
||||
Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
player.print(BBC.BRUSH_SPLINE.format(radius));
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new SplineBrush(player, session))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -270,9 +265,9 @@ public class BrushCommands {
|
||||
"Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.sweep")
|
||||
public BrushSettings sweepBrush(Player player, LocalSession session, @Arg(name = "copies", desc = "int", def = "-1") int copies, InjectedValueAccess context) throws WorldEditException {
|
||||
public void sweepBrush(Player player, LocalSession session, @Arg(name = "copies", desc = "int", def = "-1") int copies, InjectedValueAccess context) throws WorldEditException {
|
||||
player.print(BBC.BRUSH_SPLINE.s());
|
||||
return set(session, context, new SweepBrush(copies));
|
||||
set(session, context, new SweepBrush(copies));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -281,7 +276,7 @@ public class BrushCommands {
|
||||
desc = "Create a hanging line between two points"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.spline")
|
||||
public BrushSettings catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min = 1) double lengthFactor,
|
||||
public void catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min = 1) double lengthFactor,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius,
|
||||
@Switch(name = 'h', desc = "Create only a shell")
|
||||
@ -293,7 +288,7 @@ public class BrushCommands {
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new CatenaryBrush(shell, select, facingDirection, lengthFactor))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -307,12 +302,12 @@ public class BrushCommands {
|
||||
"Video: https://www.youtube.com/watch?v=zSN-2jJxXlM"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0,
|
||||
public BrushSettings surfaceSpline(Player player, LocalSession session, Pattern fill,
|
||||
public void surfaceSpline(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius, @Arg(name = "tension", desc = "double", def = "0") double tension, @Arg(name = "bias", desc = "double", def = "0") double bias, @Arg(name = "continuity", desc = "double", def = "0") double continuity, @Arg(name = "quality", desc = "double", def = "10") double quality, InjectedValueAccess context) throws WorldEditException {
|
||||
player.print(BBC.BRUSH_SPLINE.format(radius));
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new SurfaceSpline(tension, bias, continuity, quality))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -324,14 +319,11 @@ public class BrushCommands {
|
||||
desc = "Creates a distorted sphere"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.rock")
|
||||
public BrushSettings blobBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Vector3", def = "10") Vector3 radius, @Arg(name = "sphericity", desc = "double", def = "100") double sphericity, @Arg(name = "frequency", desc = "double", def = "30") double frequency, @Arg(name = "amplitude", desc = "double", def = "50") double amplitude, InjectedValueAccess context) throws WorldEditException {
|
||||
public void blobBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Vector3", def = "10") Vector3 radius, @Arg(name = "sphericity", desc = "double", def = "100") double sphericity, @Arg(name = "frequency", desc = "double", def = "30") double frequency, @Arg(name = "amplitude", desc = "double", def = "50") double amplitude, InjectedValueAccess context) throws WorldEditException {
|
||||
double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
|
||||
worldEdit.checkMaxBrushRadius(max);
|
||||
Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100);
|
||||
return set(session, context,
|
||||
brush)
|
||||
.setSize(max)
|
||||
.setFill(fill);
|
||||
set(session, context, brush).setSize(max).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -340,7 +332,7 @@ public class BrushCommands {
|
||||
desc = "Choose the sphere brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.sphere")
|
||||
public BrushSettings sphereBrush(Player player, LocalSession session,
|
||||
public void sphereBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The radius of the sphere", def = "2")
|
||||
@ -370,7 +362,7 @@ public class BrushCommands {
|
||||
}
|
||||
|
||||
}
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius)
|
||||
.setFill(pattern);
|
||||
@ -384,12 +376,12 @@ public class BrushCommands {
|
||||
"Pic: https://i.imgur.com/2xKsZf2.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.shatter")
|
||||
public BrushSettings shatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
public void shatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "10")
|
||||
Expression radius,
|
||||
@Arg(desc = "Lines", def = "10") int count, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new ShatterBrush(count))
|
||||
.setSize(radius)
|
||||
.setFill(fill)
|
||||
@ -402,7 +394,7 @@ public class BrushCommands {
|
||||
descFooter = "Use a height map to paint any surface.\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public BrushSettings stencilBrush(Player player, LocalSession session, Pattern fill,
|
||||
public void stencilBrush(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(name = "image", desc = "String", def = "") String image,
|
||||
@Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation,
|
||||
@ -421,7 +413,7 @@ public class BrushCommands {
|
||||
if (randomRotate) {
|
||||
brush.setRandomRotate(true);
|
||||
}
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -433,7 +425,7 @@ public class BrushCommands {
|
||||
desc = "Use a height map to paint a surface",
|
||||
descFooter = "Use a height map to paint any surface.\n")
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public BrushSettings imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
public void imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
ProvideBindings.ImageUri imageUri,
|
||||
@Arg(def = "1", desc = "scale height") @Range(min = Double.MIN_NORMAL) double yscale,
|
||||
@Switch(name = 'a', desc = "Use image Alpha") boolean alpha,
|
||||
@ -450,7 +442,7 @@ public class BrushCommands {
|
||||
alpha = true;
|
||||
}
|
||||
ImageBrush brush = new ImageBrush(image, session, alpha);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -464,12 +456,12 @@ public class BrushCommands {
|
||||
"The -r flag will apply random rotation"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.surface")
|
||||
public BrushSettings surfaceBrush(LocalSession session, Pattern fill,
|
||||
public void surfaceBrush(LocalSession session, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
Expression radius,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
|
||||
set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -479,7 +471,7 @@ public class BrushCommands {
|
||||
"Video: https://youtu.be/RPZIaTbqoZw?t=34s"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scatter")
|
||||
public BrushSettings scatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double pointsOpt, @Arg(name = "distance", desc = "double", def = "1") double distanceOpt, @Switch(name = 'o', desc = "Overlay the block") boolean overlay, InjectedValueAccess context) throws WorldEditException {
|
||||
public void scatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double pointsOpt, @Arg(name = "distance", desc = "double", def = "1") double distanceOpt, @Switch(name = 'o', desc = "Overlay the block") boolean overlay, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
Brush brush;
|
||||
if (overlay) {
|
||||
@ -487,7 +479,7 @@ public class BrushCommands {
|
||||
} else {
|
||||
brush = new ScatterBrush((int) pointsOpt, (int) distanceOpt);
|
||||
}
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
@ -499,21 +491,21 @@ public class BrushCommands {
|
||||
desc = "Scatter a schematic on a surface"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.populateschematic")
|
||||
public BrushSettings scatterSchemBrush(Player player, LocalSession session, Mask mask, @Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch(name = 'r', desc = "Apply random rotation") boolean rotate, InjectedValueAccess context) throws WorldEditException {
|
||||
public void scatterSchemBrush(Player player, LocalSession session, Mask mask, @Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch(name = 'r', desc = "Apply random rotation") boolean rotate, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
try {
|
||||
MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true);
|
||||
if (clipboards == null) {
|
||||
BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr);
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
List<ClipboardHolder> holders = clipboards.getHolders();
|
||||
if (holders == null) {
|
||||
BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr);
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -528,9 +520,9 @@ public class BrushCommands {
|
||||
"Pic: https://i.imgur.com/XV0vYoX.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.layer")
|
||||
public BrushSettings surfaceLayer(LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, List<BlockState> blockLayers, InjectedValueAccess context) throws WorldEditException {
|
||||
public void surfaceLayer(LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, List<BlockState> blockLayers, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new LayerBrush(blockLayers.toArray(new BlockState[0]))).setSize(radius);
|
||||
set(session, context, new LayerBrush(blockLayers.toArray(new BlockState[0]))).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -542,9 +534,9 @@ public class BrushCommands {
|
||||
"Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block."
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.splatter")
|
||||
public BrushSettings splatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double pointsOpt, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, InjectedValueAccess context) throws WorldEditException {
|
||||
public void splatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double pointsOpt, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new SplatterBrush((int) pointsOpt, (int) recursion, solid)).setSize(radius).setFill(fill);
|
||||
set(session, context, new SplatterBrush((int) pointsOpt, (int) recursion, solid)).setSize(radius).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -558,9 +550,9 @@ public class BrushCommands {
|
||||
" - Placeholders: {x}, {y}, {z}, {world}, {size}"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scattercommand")
|
||||
public BrushSettings scatterCommandBrush(Player player, EditSession editSession, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, double points, double distance, List<String> commandStr, InjectedValueAccess context) throws WorldEditException {
|
||||
public void scatterCommandBrush(Player player, EditSession editSession, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, double points, double distance, List<String> commandStr, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " ")))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -571,7 +563,7 @@ public class BrushCommands {
|
||||
desc = "Choose the cylinder brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.cylinder")
|
||||
public BrushSettings cylinderBrush(Player player, LocalSession session,
|
||||
public void cylinderBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The radius of the cylinder", def = "2")
|
||||
@ -592,7 +584,6 @@ public class BrushCommands {
|
||||
}
|
||||
settings.setSize(radius)
|
||||
.setFill(pattern);
|
||||
return settings;
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -605,7 +596,7 @@ public class BrushCommands {
|
||||
)
|
||||
@Deprecated
|
||||
@CommandPermissions("worldedit.brush.clipboard")
|
||||
public BrushSettings clipboardBrush(Player player,LocalSession session,
|
||||
public void clipboardBrush(Player player,LocalSession session,
|
||||
@Switch(name = 'a', desc = "Don't paste air from the clipboard")
|
||||
boolean ignoreAir,
|
||||
@Switch(name = 'o', desc = "Paste starting at the target location, instead of centering on it")
|
||||
@ -629,7 +620,7 @@ public class BrushCommands {
|
||||
worldEdit.checkMaxBrushRadius(size.getBlockY() / 2D - 1);
|
||||
worldEdit.checkMaxBrushRadius(size.getBlockZ() / 2D - 1);
|
||||
|
||||
return set(session, context, new ClipboardBrush(newHolder, ignoreAir, usingOrigin, !skipEntities, pasteBiomes, sourceMask));
|
||||
set(session, context, new ClipboardBrush(newHolder, ignoreAir, usingOrigin, !skipEntities, pasteBiomes, sourceMask));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -638,7 +629,7 @@ public class BrushCommands {
|
||||
descFooter = "Example: '/brush smooth 2 4 grass_block,dirt,stone'"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.smooth")
|
||||
public BrushSettings smoothBrush(Player player, LocalSession session, EditSession editSession,
|
||||
public void smoothBrush(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius to sample for softening", def = "2")
|
||||
Expression radius,
|
||||
@Arg(desc = "The number of iterations to perform", def = "4")
|
||||
@ -651,7 +642,7 @@ public class BrushCommands {
|
||||
FaweLimit limit = Settings.IMP.getLimit(fp);
|
||||
iterations = Math.min(limit.MAX_ITERATIONS, iterations);
|
||||
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new SmoothBrush(iterations, maskOpt))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -662,14 +653,14 @@ public class BrushCommands {
|
||||
desc = "Shortcut fire extinguisher brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.ex")
|
||||
public BrushSettings extinguishBrush(Player player, LocalSession session, EditSession editSession,
|
||||
public void extinguishBrush(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius to extinguish", def = "5")
|
||||
Expression radius,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
Pattern fill = BlockTypes.AIR.getDefaultState();
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new SphereBrush())
|
||||
.setSize(radius)
|
||||
.setFill(fill)
|
||||
@ -682,7 +673,7 @@ public class BrushCommands {
|
||||
desc = "Gravity brush, simulates the effect of gravity"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.gravity")
|
||||
public BrushSettings gravityBrush(Player player, LocalSession session,
|
||||
public void gravityBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius to apply gravity in", def = "5")
|
||||
Expression radius,
|
||||
@Switch(name = 'h', desc = "Affect blocks starting at max Y, rather than the target location Y + radius")
|
||||
@ -690,7 +681,7 @@ public class BrushCommands {
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new GravityBrush(fromMaxY))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -707,8 +698,8 @@ public class BrushCommands {
|
||||
"Snow Pic: https://i.imgur.com/Hrzn0I4.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
public void heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -718,7 +709,7 @@ public class BrushCommands {
|
||||
descFooter = "This brush flattens terrain and creates cliffs."
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings cliffBrush(Player player, LocalSession session,
|
||||
public void cliffBrush(Player player, LocalSession session,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
Expression radius,
|
||||
@Arg(name = "image", desc = "String", def = "")
|
||||
@ -733,7 +724,7 @@ public class BrushCommands {
|
||||
boolean layers,
|
||||
@Switch(name = 's', desc = "Disables smoothing")
|
||||
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
|
||||
terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -742,17 +733,17 @@ public class BrushCommands {
|
||||
desc = "This brush raises or lowers land towards the clicked point"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
public void flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
@Switch(name = 'r', desc = "Enables random off-axis rotation")
|
||||
boolean randomRotate,
|
||||
@Switch(name = 'l', desc = "Will work on snow layers")
|
||||
boolean layers,
|
||||
@Switch(name = 's', desc = "Disables smoothing")
|
||||
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
|
||||
private BrushSettings terrainBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, ScalableHeightMap.Shape shape, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
private void terrainBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, Shape shape, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
InputStream stream = getHeightmapStream(image);
|
||||
HeightBrush brush;
|
||||
@ -772,7 +763,7 @@ public class BrushCommands {
|
||||
if (randomRotate) {
|
||||
brush.setRandomRotate(true);
|
||||
}
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
brush)
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -789,7 +780,7 @@ public class BrushCommands {
|
||||
|
||||
@Command(
|
||||
name = "copypaste",
|
||||
aliases = {"copy", "paste", "cp", "copypasta"},
|
||||
aliases = {"cp", "copypasta"},
|
||||
desc = "Copy Paste brush",
|
||||
descFooter = "Left click the base of an object to copy.\n" +
|
||||
"Right click to paste\n" +
|
||||
@ -797,11 +788,11 @@ public class BrushCommands {
|
||||
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.copy")
|
||||
public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate, @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate, InjectedValueAccess context) throws WorldEditException {
|
||||
public void copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate, @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
player.print(BBC.BRUSH_COPY.format(radius));
|
||||
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new CopyPastaBrush(player, session, randomRotate, autoRotate))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -815,10 +806,10 @@ public class BrushCommands {
|
||||
" - Placeholders: {x}, {y}, {z}, {world}, {size}"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.command")
|
||||
public BrushSettings command(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, @Arg(desc = "Command to run") List<String> input, InjectedValueAccess context) throws WorldEditException {
|
||||
public void command(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, @Arg(desc = "Command to run") List<String> input, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
String cmd = StringMan.join(input, " ");
|
||||
return set(session, context,
|
||||
set(session, context,
|
||||
new CommandBrush(cmd))
|
||||
.setSize(radius);
|
||||
}
|
||||
@ -829,7 +820,7 @@ public class BrushCommands {
|
||||
desc = "Butcher brush, kills mobs within a radius"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.butcher")
|
||||
public BrushSettings butcherBrush(Player player, LocalSession session, InjectedValueAccess context,
|
||||
public void butcherBrush(Player player, LocalSession session, InjectedValueAccess context,
|
||||
@Arg(desc = "Radius to kill mobs in", def = "5")
|
||||
Expression radius,
|
||||
@Switch(name = 'p', desc = "Also kill pets")
|
||||
@ -860,9 +851,7 @@ public class BrushCommands {
|
||||
flags.or(CreatureButcher.Flags.TAGGED , killWithName, "worldedit.butcher.tagged");
|
||||
flags.or(CreatureButcher.Flags.ARMOR_STAND , killArmorStands, "worldedit.butcher.armorstands");
|
||||
|
||||
return set(session, context,
|
||||
new ButcherBrush(flags))
|
||||
.setSize(radius);
|
||||
set(session, context, new ButcherBrush(flags)).setSize(radius);
|
||||
}
|
||||
|
||||
public BrushSettings process(CommandLocals locals, BrushSettings settings) throws WorldEditException {
|
||||
|
@ -1,448 +1,448 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
||||
import com.boydti.fawe.object.mask.AdjacentMask;
|
||||
import com.boydti.fawe.object.mask.AngleMask;
|
||||
import com.boydti.fawe.object.mask.BiomeMask;
|
||||
import com.boydti.fawe.object.mask.BlockLightMask;
|
||||
import com.boydti.fawe.object.mask.BrightnessMask;
|
||||
import com.boydti.fawe.object.mask.DataMask;
|
||||
import com.boydti.fawe.object.mask.ExtremaMask;
|
||||
import com.boydti.fawe.object.mask.IdDataMask;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.boydti.fawe.object.mask.LightMask;
|
||||
import com.boydti.fawe.object.mask.OpacityMask;
|
||||
import com.boydti.fawe.object.mask.ROCAngleMask;
|
||||
import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.boydti.fawe.object.mask.RandomMask;
|
||||
import com.boydti.fawe.object.mask.SimplexMask;
|
||||
import com.boydti.fawe.object.mask.SkyLightMask;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.boydti.fawe.object.mask.WallMask;
|
||||
import com.boydti.fawe.object.mask.XAxisMask;
|
||||
import com.boydti.fawe.object.mask.YAxisMask;
|
||||
import com.boydti.fawe.object.mask.ZAxisMask;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.ExpressionMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.mask.OffsetMask;
|
||||
import com.sk89q.worldedit.function.mask.RegionMask;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.request.RequestSelection;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
//@Command(aliases = {"masks"},
|
||||
// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
|
||||
// descFooter = "Masks determine if a block can be placed\n" +
|
||||
// " - Use [brackets] for arguments\n" +
|
||||
// " - Use , to OR multiple\n" +
|
||||
// " - Use & to AND multiple\n" +
|
||||
// "e.g. >[stone,dirt],#light[0][5],$jungle\n" +
|
||||
// "More Info: https://git.io/v9r4K"
|
||||
//package com.sk89q.worldedit.command;
|
||||
//
|
||||
//import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
||||
//import com.boydti.fawe.object.mask.AdjacentMask;
|
||||
//import com.boydti.fawe.object.mask.AngleMask;
|
||||
//import com.boydti.fawe.object.mask.BiomeMask;
|
||||
//import com.boydti.fawe.object.mask.BlockLightMask;
|
||||
//import com.boydti.fawe.object.mask.BrightnessMask;
|
||||
//import com.boydti.fawe.object.mask.DataMask;
|
||||
//import com.boydti.fawe.object.mask.ExtremaMask;
|
||||
//import com.boydti.fawe.object.mask.IdDataMask;
|
||||
//import com.boydti.fawe.object.mask.IdMask;
|
||||
//import com.boydti.fawe.object.mask.LightMask;
|
||||
//import com.boydti.fawe.object.mask.OpacityMask;
|
||||
//import com.boydti.fawe.object.mask.ROCAngleMask;
|
||||
//import com.boydti.fawe.object.mask.RadiusMask;
|
||||
//import com.boydti.fawe.object.mask.RandomMask;
|
||||
//import com.boydti.fawe.object.mask.SimplexMask;
|
||||
//import com.boydti.fawe.object.mask.SkyLightMask;
|
||||
//import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
//import com.boydti.fawe.object.mask.WallMask;
|
||||
//import com.boydti.fawe.object.mask.XAxisMask;
|
||||
//import com.boydti.fawe.object.mask.YAxisMask;
|
||||
//import com.boydti.fawe.object.mask.ZAxisMask;
|
||||
//import com.sk89q.worldedit.IncompleteRegionException;
|
||||
//import com.sk89q.worldedit.LocalSession;
|
||||
//import com.sk89q.worldedit.WorldEdit;
|
||||
//import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
//import com.sk89q.worldedit.entity.Player;
|
||||
//import com.sk89q.worldedit.extent.Extent;
|
||||
//import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||
//import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
//import com.sk89q.worldedit.function.mask.ExpressionMask;
|
||||
//import com.sk89q.worldedit.function.mask.Mask;
|
||||
//import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
//import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||
//import com.sk89q.worldedit.function.mask.Masks;
|
||||
//import com.sk89q.worldedit.function.mask.OffsetMask;
|
||||
//import com.sk89q.worldedit.function.mask.RegionMask;
|
||||
//import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
//import com.sk89q.worldedit.internal.expression.Expression;
|
||||
//import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
//import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
|
||||
//import com.sk89q.worldedit.math.BlockVector3;
|
||||
//import com.sk89q.worldedit.math.Vector3;
|
||||
//import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
//import com.sk89q.worldedit.session.request.RequestSelection;
|
||||
//import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
//import org.enginehub.piston.annotation.Command;
|
||||
//import org.enginehub.piston.annotation.CommandContainer;
|
||||
//import org.enginehub.piston.annotation.param.Arg;
|
||||
//import org.enginehub.piston.annotation.param.Switch;
|
||||
//
|
||||
////@Command(aliases = {"masks"},
|
||||
//// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
|
||||
//// descFooter = "Masks determine if a block can be placed\n" +
|
||||
//// " - Use [brackets] for arguments\n" +
|
||||
//// " - Use , to OR multiple\n" +
|
||||
//// " - Use & to AND multiple\n" +
|
||||
//// "e.g. >[stone,dirt],#light[0][5],$jungle\n" +
|
||||
//// "More Info: https://git.io/v9r4K"
|
||||
////)
|
||||
//@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
//public class MaskCommands {
|
||||
// private final WorldEdit worldEdit;
|
||||
//
|
||||
// public MaskCommands(WorldEdit worldEdit) {
|
||||
// this.worldEdit = worldEdit;
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#simplex",
|
||||
// desc = "Use simplex noise as the mask"
|
||||
// )
|
||||
@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class MaskCommands {
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
public MaskCommands(WorldEdit worldEdit) {
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#simplex",
|
||||
desc = "Use simplex noise as the mask"
|
||||
)
|
||||
public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
scale = 1d / Math.max(1, scale);
|
||||
minInt = (minInt - 50) / 50;
|
||||
maxInt = (maxInt - 50) / 50;
|
||||
return new SimplexMask(scale, minInt, maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#light",
|
||||
desc = "Restrict to specific light levels"
|
||||
)
|
||||
public Mask light(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new LightMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#false",
|
||||
desc = "Always false"
|
||||
)
|
||||
public Mask falseMask(Extent extent) {
|
||||
return Masks.alwaysFalse();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#true",
|
||||
desc = "Always true"
|
||||
)
|
||||
public Mask trueMask(Extent extent) {
|
||||
return Masks.alwaysTrue();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#skylight",
|
||||
desc = "Restrict to specific sky light levels"
|
||||
)
|
||||
public Mask skylight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new SkyLightMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#blocklight",
|
||||
aliases = {"#emittedlight"},
|
||||
desc = "Restrict to specific block light levels"
|
||||
)
|
||||
public Mask blocklight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new BlockLightMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#opacity",
|
||||
desc = "Restrict to specific opacity levels"
|
||||
)
|
||||
public Mask opacity(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new OpacityMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#brightness",
|
||||
desc = "Restrict to specific block brightness"
|
||||
)
|
||||
public Mask brightness(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
return new BrightnessMask(extent, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#offset",
|
||||
desc = "Offset a mask"
|
||||
)
|
||||
public Mask offset(double x, double y, double z, Mask mask) {
|
||||
return new OffsetMask(mask, BlockVector3.at(x, y, z));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#haslight",
|
||||
desc = "Restricts to blocks with light (sky or emitted)"
|
||||
)
|
||||
public Mask haslight(Extent extent) {
|
||||
return new LightMask(extent, 1, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#nolight",
|
||||
desc = "Restrict to blocks without light (sky or emitted)"
|
||||
)
|
||||
public Mask nolight(Extent extent) {
|
||||
return new LightMask(extent, 0, 0);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#existing",
|
||||
desc = "If there is a non air block"
|
||||
)
|
||||
public Mask existing(Extent extent) {
|
||||
return new ExistingBlockMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#solid",
|
||||
desc = "If there is a solid block"
|
||||
)
|
||||
public Mask solid(Extent extent) {
|
||||
return new SolidBlockMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#liquid",
|
||||
desc = "If there is a solid block"
|
||||
)
|
||||
public Mask liquid(Extent extent) {
|
||||
return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#dregion",
|
||||
aliases = {"#dselection", "#dsel"},
|
||||
desc = "inside the player's selection"
|
||||
)
|
||||
public Mask dregion() {
|
||||
return new RegionMask(new RequestSelection());
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#region",
|
||||
aliases = {"#selection", "#sel"},
|
||||
desc = "inside the provided selection"
|
||||
)
|
||||
public Mask selection(Player player, LocalSession session) throws IncompleteRegionException {
|
||||
return new RegionMask(session.getSelection(player.getWorld()).clone());
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#xaxis",
|
||||
desc = "Restrict to initial x axis"
|
||||
)
|
||||
public Mask xaxis() {
|
||||
return new XAxisMask();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#yaxis",
|
||||
desc = "Restrict to initial y axis"
|
||||
)
|
||||
public Mask yaxis() {
|
||||
return new YAxisMask();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#zaxis",
|
||||
desc = "Restrict to initial z axis"
|
||||
)
|
||||
public Mask zaxis() {
|
||||
return new ZAxisMask();
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#id",
|
||||
desc = "Restrict to initial id"
|
||||
)
|
||||
public Mask id(Extent extent) {
|
||||
return new IdMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#data",
|
||||
desc = "Restrict to initial data"
|
||||
)
|
||||
public Mask data(Extent extent) {
|
||||
return new DataMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#iddata",
|
||||
desc = "Restrict to initial block id and data"
|
||||
)
|
||||
public Mask iddata(Extent extent) {
|
||||
return new IdDataMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#air",
|
||||
desc = "Restrict to types of air"
|
||||
)
|
||||
public Mask air(Extent extent) {
|
||||
return new BlockMaskBuilder().addAll(b -> b.getMaterial().isAir()).build(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#wall",
|
||||
desc = "Restrict to walls (any block n,e,s,w of air)"
|
||||
)
|
||||
public Mask wall(Extent extent) {
|
||||
Mask blockMask = air(extent);
|
||||
return new MaskUnion(new ExistingBlockMask(extent), new WallMask(blockMask, 1, 8));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#surface",
|
||||
desc = "Restrict to surfaces (any solid block touching air)"
|
||||
)
|
||||
public Mask surface(Extent extent) {
|
||||
return new SurfaceMask(extent);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "\\",
|
||||
aliases = {"/", "#angle", "#\\", "#/"},
|
||||
desc = "Restrict to specific terrain angle",
|
||||
descFooter = "Restrict to specific terrain angle\n" +
|
||||
"The -o flag will only overlay\n" +
|
||||
"Example: /[0d][45d]\n" +
|
||||
"Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" +
|
||||
"Example: /[3][20]\n" +
|
||||
"Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below"
|
||||
)
|
||||
public Mask angle(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (maxStr.endsWith("d")) {
|
||||
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
} else {
|
||||
y1 = Expression.compile(minStr).evaluate();
|
||||
y2 = Expression.compile(maxStr).evaluate();
|
||||
}
|
||||
return new AngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "(",
|
||||
aliases = {")", "#roc", "#(", "#)"},
|
||||
desc = "Restrict to near specific terrain slope rate of change",
|
||||
descFooter = "Restrict to near specific terrain slope rate of change\n" +
|
||||
"The -o flag will only overlay\n" +
|
||||
"Example: ([0d][45d][5]\n" +
|
||||
"Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" +
|
||||
"Note: Use negatives for decreasing slope"
|
||||
)
|
||||
public Mask roc(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (maxStr.endsWith("d")) {
|
||||
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
} else {
|
||||
y1 = Expression.compile(minStr).evaluate();
|
||||
y2 = Expression.compile(maxStr).evaluate();
|
||||
}
|
||||
return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "^",
|
||||
aliases = {"#extrema", "#^"},
|
||||
desc = "Restrict to near specific terrain extrema",
|
||||
descFooter = "Restrict to near specific terrain extrema\n" +
|
||||
"The -o flag will only overlay\n" +
|
||||
"Example: ([0d][45d][5]\n" +
|
||||
"Explanation: Restrict to near 45 degrees of local maxima\n" +
|
||||
"Note: Use negatives for local minima"
|
||||
)
|
||||
public Mask extrema(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (maxStr.endsWith("d")) {
|
||||
double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
} else {
|
||||
y1 = Expression.compile(minStr).evaluate();
|
||||
y2 = Expression.compile(maxStr).evaluate();
|
||||
}
|
||||
return new ExtremaMask(extent, y1, y2, overlay, distanceOpt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "{",
|
||||
aliases = {"#{"},
|
||||
desc = "Restricts blocks to within a specific radius range of the initial block"
|
||||
)
|
||||
public Mask radius(@Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||
return new RadiusMask((int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "|",
|
||||
aliases = {"#|", "#side"},
|
||||
desc = "sides with a specific number of other blocks"
|
||||
)
|
||||
public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||
return new WallMask(mask, (int) minInt, (int) maxInt);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "~",
|
||||
aliases = {"#~", "#adjacent"},
|
||||
desc = "Adjacent to a specific number of other blocks"
|
||||
)
|
||||
public Mask adjacent(Mask mask, @Arg(name = "min", desc = "double", def = "-1") double min, @Arg(name = "max", desc = "double", def = "-1") double max) throws ExpressionException {
|
||||
if (min == -1 && max == -1) {
|
||||
min = 1;
|
||||
max = 8;
|
||||
} else if (max == -1) max = min;
|
||||
if (max >= 8 && min == 1) {
|
||||
return new AdjacentAnyMask(mask);
|
||||
}
|
||||
return new AdjacentMask(mask, (int) min, (int) max);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "<",
|
||||
aliases = {"#<", "#below"},
|
||||
desc = "below a specific block"
|
||||
)
|
||||
public Mask below(Mask mask) throws ExpressionException {
|
||||
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = ">",
|
||||
aliases = {"#>", "#above"},
|
||||
desc = "above a specific block"
|
||||
)
|
||||
public Mask above(Mask mask) throws ExpressionException {
|
||||
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
|
||||
return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "$",
|
||||
aliases = {"#biome", "#$"},
|
||||
desc = "in a specific biome",
|
||||
descFooter = "in a specific biome. For a list of biomes use //biomelist"
|
||||
)
|
||||
public Mask biome(Extent extent, BiomeType biome) throws ExpressionException {
|
||||
return new BiomeMask(extent, biome);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "%",
|
||||
aliases = {"#%", "#percent"},
|
||||
desc = "percentage chance"
|
||||
)
|
||||
public Mask random(double chance) throws ExpressionException {
|
||||
chance = chance / 100;
|
||||
return new RandomMask(chance);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "=",
|
||||
aliases = {"#=", "#expression"},
|
||||
desc = "expression mask"
|
||||
)
|
||||
public Mask expression(Extent extent, String input) throws ExpressionException {
|
||||
Expression exp = Expression.compile(input, "x", "y", "z");
|
||||
ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
||||
exp.setEnvironment(env);
|
||||
return new ExpressionMask(exp);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "!",
|
||||
aliases = {"#not", "#negate", "#!"},
|
||||
desc = "Negate another mask"
|
||||
)
|
||||
public Mask expression(Mask mask) throws ExpressionException {
|
||||
return Masks.negate(mask);
|
||||
}
|
||||
}
|
||||
// public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// scale = 1d / Math.max(1, scale);
|
||||
// minInt = (minInt - 50) / 50;
|
||||
// maxInt = (maxInt - 50) / 50;
|
||||
// return new SimplexMask(scale, minInt, maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#light",
|
||||
// desc = "Restrict to specific light levels"
|
||||
// )
|
||||
// public Mask light(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new LightMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#false",
|
||||
// desc = "Always false"
|
||||
// )
|
||||
// public Mask falseMask(Extent extent) {
|
||||
// return Masks.alwaysFalse();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#true",
|
||||
// desc = "Always true"
|
||||
// )
|
||||
// public Mask trueMask(Extent extent) {
|
||||
// return Masks.alwaysTrue();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#skylight",
|
||||
// desc = "Restrict to specific sky light levels"
|
||||
// )
|
||||
// public Mask skylight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new SkyLightMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#blocklight",
|
||||
// aliases = {"#emittedlight"},
|
||||
// desc = "Restrict to specific block light levels"
|
||||
// )
|
||||
// public Mask blocklight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new BlockLightMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#opacity",
|
||||
// desc = "Restrict to specific opacity levels"
|
||||
// )
|
||||
// public Mask opacity(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new OpacityMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#brightness",
|
||||
// desc = "Restrict to specific block brightness"
|
||||
// )
|
||||
// public Mask brightness(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) {
|
||||
// return new BrightnessMask(extent, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#offset",
|
||||
// desc = "Offset a mask"
|
||||
// )
|
||||
// public Mask offset(double x, double y, double z, Mask mask) {
|
||||
// return new OffsetMask(mask, BlockVector3.at(x, y, z));
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#haslight",
|
||||
// desc = "Restricts to blocks with light (sky or emitted)"
|
||||
// )
|
||||
// public Mask haslight(Extent extent) {
|
||||
// return new LightMask(extent, 1, Integer.MAX_VALUE);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#nolight",
|
||||
// desc = "Restrict to blocks without light (sky or emitted)"
|
||||
// )
|
||||
// public Mask nolight(Extent extent) {
|
||||
// return new LightMask(extent, 0, 0);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#existing",
|
||||
// desc = "If there is a non air block"
|
||||
// )
|
||||
// public Mask existing(Extent extent) {
|
||||
// return new ExistingBlockMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#solid",
|
||||
// desc = "If there is a solid block"
|
||||
// )
|
||||
// public Mask solid(Extent extent) {
|
||||
// return new SolidBlockMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#liquid",
|
||||
// desc = "If there is a solid block"
|
||||
// )
|
||||
// public Mask liquid(Extent extent) {
|
||||
// return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#dregion",
|
||||
// aliases = {"#dselection", "#dsel"},
|
||||
// desc = "inside the player's selection"
|
||||
// )
|
||||
// public Mask dregion() {
|
||||
// return new RegionMask(new RequestSelection());
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#region",
|
||||
// aliases = {"#selection", "#sel"},
|
||||
// desc = "inside the provided selection"
|
||||
// )
|
||||
// public Mask selection(Player player, LocalSession session) throws IncompleteRegionException {
|
||||
// return new RegionMask(session.getSelection(player.getWorld()).clone());
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#xaxis",
|
||||
// desc = "Restrict to initial x axis"
|
||||
// )
|
||||
// public Mask xaxis() {
|
||||
// return new XAxisMask();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#yaxis",
|
||||
// desc = "Restrict to initial y axis"
|
||||
// )
|
||||
// public Mask yaxis() {
|
||||
// return new YAxisMask();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#zaxis",
|
||||
// desc = "Restrict to initial z axis"
|
||||
// )
|
||||
// public Mask zaxis() {
|
||||
// return new ZAxisMask();
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#id",
|
||||
// desc = "Restrict to initial id"
|
||||
// )
|
||||
// public Mask id(Extent extent) {
|
||||
// return new IdMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#data",
|
||||
// desc = "Restrict to initial data"
|
||||
// )
|
||||
// public Mask data(Extent extent) {
|
||||
// return new DataMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#iddata",
|
||||
// desc = "Restrict to initial block id and data"
|
||||
// )
|
||||
// public Mask iddata(Extent extent) {
|
||||
// return new IdDataMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#air",
|
||||
// desc = "Restrict to types of air"
|
||||
// )
|
||||
// public Mask air(Extent extent) {
|
||||
// return new BlockMaskBuilder().addAll(b -> b.getMaterial().isAir()).build(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#wall",
|
||||
// desc = "Restrict to walls (any block n,e,s,w of air)"
|
||||
// )
|
||||
// public Mask wall(Extent extent) {
|
||||
// Mask blockMask = air(extent);
|
||||
// return new MaskUnion(new ExistingBlockMask(extent), new WallMask(blockMask, 1, 8));
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "#surface",
|
||||
// desc = "Restrict to surfaces (any solid block touching air)"
|
||||
// )
|
||||
// public Mask surface(Extent extent) {
|
||||
// return new SurfaceMask(extent);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "\\",
|
||||
// aliases = {"/", "#angle", "#\\", "#/"},
|
||||
// desc = "Restrict to specific terrain angle",
|
||||
// descFooter = "Restrict to specific terrain angle\n" +
|
||||
// "The -o flag will only overlay\n" +
|
||||
// "Example: /[0d][45d]\n" +
|
||||
// "Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" +
|
||||
// "Example: /[3][20]\n" +
|
||||
// "Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below"
|
||||
//)
|
||||
// public Mask angle(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) throws ExpressionException {
|
||||
// double y1, y2;
|
||||
// boolean override;
|
||||
// if (maxStr.endsWith("d")) {
|
||||
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
// y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
// y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
// } else {
|
||||
// y1 = Expression.compile(minStr).evaluate();
|
||||
// y2 = Expression.compile(maxStr).evaluate();
|
||||
// }
|
||||
// return new AngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "(",
|
||||
// aliases = {")", "#roc", "#(", "#)"},
|
||||
// desc = "Restrict to near specific terrain slope rate of change",
|
||||
// descFooter = "Restrict to near specific terrain slope rate of change\n" +
|
||||
// "The -o flag will only overlay\n" +
|
||||
// "Example: ([0d][45d][5]\n" +
|
||||
// "Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" +
|
||||
// "Note: Use negatives for decreasing slope"
|
||||
//)
|
||||
// public Mask roc(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException {
|
||||
// double y1, y2;
|
||||
// boolean override;
|
||||
// if (maxStr.endsWith("d")) {
|
||||
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
// y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
// y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
// } else {
|
||||
// y1 = Expression.compile(minStr).evaluate();
|
||||
// y2 = Expression.compile(maxStr).evaluate();
|
||||
// }
|
||||
// return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "^",
|
||||
// aliases = {"#extrema", "#^"},
|
||||
// desc = "Restrict to near specific terrain extrema",
|
||||
// descFooter = "Restrict to near specific terrain extrema\n" +
|
||||
// "The -o flag will only overlay\n" +
|
||||
// "Example: ([0d][45d][5]\n" +
|
||||
// "Explanation: Restrict to near 45 degrees of local maxima\n" +
|
||||
// "Note: Use negatives for local minima"
|
||||
//)
|
||||
// public Mask extrema(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException {
|
||||
// double y1, y2;
|
||||
// boolean override;
|
||||
// if (maxStr.endsWith("d")) {
|
||||
// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate();
|
||||
// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate();
|
||||
// y1 = Math.tan(y1d * (Math.PI / 180));
|
||||
// y2 = Math.tan(y2d * (Math.PI / 180));
|
||||
// } else {
|
||||
// y1 = Expression.compile(minStr).evaluate();
|
||||
// y2 = Expression.compile(maxStr).evaluate();
|
||||
// }
|
||||
// return new ExtremaMask(extent, y1, y2, overlay, distanceOpt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "{",
|
||||
// aliases = {"#{"},
|
||||
// desc = "Restricts blocks to within a specific radius range of the initial block"
|
||||
//)
|
||||
// public Mask radius(@Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||
// return new RadiusMask((int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "|",
|
||||
// aliases = {"#|", "#side"},
|
||||
// desc = "sides with a specific number of other blocks"
|
||||
//)
|
||||
// public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException {
|
||||
// return new WallMask(mask, (int) minInt, (int) maxInt);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "~",
|
||||
// aliases = {"#~", "#adjacent"},
|
||||
// desc = "Adjacent to a specific number of other blocks"
|
||||
//)
|
||||
// public Mask adjacent(Mask mask, @Arg(name = "min", desc = "double", def = "-1") double min, @Arg(name = "max", desc = "double", def = "-1") double max) throws ExpressionException {
|
||||
// if (min == -1 && max == -1) {
|
||||
// min = 1;
|
||||
// max = 8;
|
||||
// } else if (max == -1) max = min;
|
||||
// if (max >= 8 && min == 1) {
|
||||
// return new AdjacentAnyMask(mask);
|
||||
// }
|
||||
// return new AdjacentMask(mask, (int) min, (int) max);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "<",
|
||||
// aliases = {"#<", "#below"},
|
||||
// desc = "below a specific block"
|
||||
//)
|
||||
// public Mask below(Mask mask) throws ExpressionException {
|
||||
// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
|
||||
// return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = ">",
|
||||
// aliases = {"#>", "#above"},
|
||||
// desc = "above a specific block"
|
||||
//)
|
||||
// public Mask above(Mask mask) throws ExpressionException {
|
||||
// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
|
||||
// return new MaskIntersection(offsetMask, Masks.negate(mask));
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "$",
|
||||
// aliases = {"#biome", "#$"},
|
||||
// desc = "in a specific biome",
|
||||
// descFooter = "in a specific biome. For a list of biomes use //biomelist"
|
||||
//)
|
||||
// public Mask biome(Extent extent, BiomeType biome) throws ExpressionException {
|
||||
// return new BiomeMask(extent, biome);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "%",
|
||||
// aliases = {"#%", "#percent"},
|
||||
// desc = "percentage chance"
|
||||
//)
|
||||
// public Mask random(double chance) throws ExpressionException {
|
||||
// chance = chance / 100;
|
||||
// return new RandomMask(chance);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "=",
|
||||
// aliases = {"#=", "#expression"},
|
||||
// desc = "expression mask"
|
||||
//)
|
||||
// public Mask expression(Extent extent, String input) throws ExpressionException {
|
||||
// Expression exp = Expression.compile(input, "x", "y", "z");
|
||||
// ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
|
||||
// exp.setEnvironment(env);
|
||||
// return new ExpressionMask(exp);
|
||||
// }
|
||||
//
|
||||
// @Command(
|
||||
// name = "!",
|
||||
// aliases = {"#not", "#negate", "#!"},
|
||||
// desc = "Negate another mask"
|
||||
//)
|
||||
// public Mask expression(Mask mask) throws ExpressionException {
|
||||
// return Masks.negate(mask);
|
||||
// }
|
||||
//}
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.command.argument;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
import com.sk89q.worldedit.registry.IRegistry;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
@ -28,6 +29,7 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.fluid.FluidCategory;
|
||||
import com.sk89q.worldedit.world.fluid.FluidType;
|
||||
@ -52,7 +54,7 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void register(CommandManager commandManager) {
|
||||
ImmutableList.of(
|
||||
BlockType.class,
|
||||
BlockTypes.class,
|
||||
BlockCategory.class,
|
||||
ItemType.class,
|
||||
ItemCategory.class,
|
||||
@ -73,7 +75,7 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
|
||||
private static <V extends Keyed> RegistryConverter<V> from(Class<Keyed> registryType) {
|
||||
try {
|
||||
Field registryField = registryType.getDeclaredField("REGISTRY");
|
||||
Registry<V> registry = (Registry<V>) registryField.get(null);
|
||||
IRegistry<V> registry = (IRegistry<V>) registryField.get(null);
|
||||
return new RegistryConverter<>(registry);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new IllegalArgumentException("Not a registry-backed type: " + registryType.getName());
|
||||
@ -82,10 +84,10 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
|
||||
}
|
||||
}
|
||||
|
||||
private final Registry<V> registry;
|
||||
private final IRegistry<V> registry;
|
||||
private final TextComponent choices;
|
||||
|
||||
private RegistryConverter(Registry<V> registry) {
|
||||
private RegistryConverter(IRegistry<V> registry) {
|
||||
this.registry = registry;
|
||||
this.choices = TextComponent.of("any " + registry.getName());
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class DelegateCommandManager implements CommandManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(InjectedValueAccess context, List<String> args) {
|
||||
public int execute(InjectedValueAccess context, List<String> args) {
|
||||
return parent.execute(context, args);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.util;
|
||||
|
||||
import com.sk89q.worldedit.registry.IRegistry;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
@ -138,7 +139,7 @@ public final class SuggestionHelper {
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
public static <V extends Keyed> Stream<String> getRegistrySuggestions(Registry<V> registry, String input) {
|
||||
public static <V extends Keyed> Stream<String> getRegistrySuggestions(IRegistry<V> registry, String input) {
|
||||
if (registry instanceof NamespacedRegistry) {
|
||||
return getNamespacedRegistrySuggestions(((NamespacedRegistry<?>) registry), input);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.TransformCommands;
|
||||
//import com.sk89q.worldedit.command.TransformCommands;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
|
@ -28,7 +28,7 @@ import com.google.common.collect.Iterables;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.PatternCommands;
|
||||
//import com.sk89q.worldedit.command.PatternCommands;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
|
@ -88,6 +88,7 @@ import com.sk89q.worldedit.command.ToolUtilCommands;
|
||||
import com.sk89q.worldedit.command.ToolUtilCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.TransformCommands;
|
||||
import com.sk89q.worldedit.command.TransformCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.TransformCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.command.UtilityCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||
|
@ -72,7 +72,9 @@ public class PlatformManager {
|
||||
private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class);
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
private final PlatformCommandManager platformCommandManager;
|
||||
|
||||
private PlatformCommandManager platformCommandManager;
|
||||
|
||||
private final List<Platform> platforms = new ArrayList<>();
|
||||
private final Map<Capability, Platform> preferences = new EnumMap<>(Capability.class);
|
||||
private @Nullable String firstSeenVersion;
|
||||
@ -87,7 +89,6 @@ public class PlatformManager {
|
||||
public PlatformManager(WorldEdit worldEdit) {
|
||||
checkNotNull(worldEdit);
|
||||
this.worldEdit = worldEdit;
|
||||
this.platformCommandManager = new PlatformCommandManager(worldEdit, this);
|
||||
|
||||
// Register this instance for events
|
||||
worldEdit.getEventBus().register(this);
|
||||
@ -117,6 +118,10 @@ public class PlatformManager {
|
||||
} else {
|
||||
firstSeenVersion = platform.getVersion();
|
||||
}
|
||||
|
||||
if (this.platformCommandManager == null) {
|
||||
this.platformCommandManager = new PlatformCommandManager(worldEdit, this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,14 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.internal.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import com.sk89q.worldedit.internal.util.Substring;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.exception.CommandException;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
@ -40,6 +38,9 @@ import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
public class CommandUtil {
|
||||
|
||||
public static Map<String, Command> getSubCommands(Command currentCommand) {
|
||||
@ -64,20 +65,37 @@ public class CommandUtil {
|
||||
* Fix {@code suggestions} to replace the last space-separated word in {@code arguments}.
|
||||
*/
|
||||
public static List<String> fixSuggestions(String arguments, List<Substring> suggestions) {
|
||||
Substring lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments));
|
||||
Substring lastArg = Iterables.getLast(
|
||||
CommandArgParser.spaceSplit(arguments)
|
||||
);
|
||||
return suggestions.stream()
|
||||
.map(suggestion -> CommandUtil.suggestLast(lastArg, suggestion))
|
||||
// Re-map suggestions to only operate on the last non-quoted word
|
||||
.map(suggestion -> onlyOnLastQuotedWord(lastArg, suggestion))
|
||||
.map(suggestion -> suggestLast(lastArg, suggestion))
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
private static Substring onlyOnLastQuotedWord(Substring lastArg, Substring suggestion) {
|
||||
if (suggestion.getSubstring().startsWith(lastArg.getSubstring())) {
|
||||
// This is already fine.
|
||||
return suggestion;
|
||||
}
|
||||
String substr = suggestion.getSubstring();
|
||||
int sp = substr.lastIndexOf(' ');
|
||||
if (sp < 0) {
|
||||
return suggestion;
|
||||
}
|
||||
return Substring.wrap(substr.substring(sp + 1), suggestion.getStart() + sp + 1, suggestion.getEnd());
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the last word of a command, mutate the suggestion to replace the last word, if
|
||||
* possible.
|
||||
*/
|
||||
private static Optional<String> suggestLast(Substring last, Substring suggestion) {
|
||||
if (suggestion.getStart() == last.getEnd()) {
|
||||
if (suggestion.getStart() == last.getEnd() && !last.getSubstring().equals("\"")) {
|
||||
// this suggestion is for the next argument.
|
||||
if (last.getSubstring().isEmpty()) {
|
||||
return Optional.of(suggestion.getSubstring());
|
||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -114,11 +115,12 @@ public class ServerCUIHandler {
|
||||
}
|
||||
|
||||
// Borrowed this math from FAWE
|
||||
double rotX = player.getLocation().getYaw();
|
||||
double rotY = player.getLocation().getPitch();
|
||||
final Location location = player.getLocation();
|
||||
double rotX = location.getYaw();
|
||||
double rotY = location.getPitch();
|
||||
double xz = Math.cos(Math.toRadians(rotY));
|
||||
int x = (int) (player.getLocation().getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12);
|
||||
int z = (int) (player.getLocation().getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12);
|
||||
int x = (int) (location.getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12);
|
||||
int z = (int) (location.getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12);
|
||||
int y = Math.max(0, Math.min(Math.min(255, posY + 32), posY + 3));
|
||||
|
||||
Map<String, Tag> structureTag = new HashMap<>();
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.sk89q.worldedit.registry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.enginehub.piston.converter.SuggestionHelper.limitByPrefix;
|
||||
|
||||
public interface IRegistry<V> extends Iterable<V> {
|
||||
String getName();
|
||||
|
||||
V get(final String key);
|
||||
|
||||
Set<String> keySet();
|
||||
|
||||
Collection<V> values();
|
||||
|
||||
@Override
|
||||
default Iterator<V> iterator() {
|
||||
return values().iterator();
|
||||
}
|
||||
|
||||
default <V extends Keyed> Stream<String> getSuggestions(String input) {
|
||||
return limitByPrefix(keySet().stream(), input).stream();
|
||||
}
|
||||
}
|
@ -19,30 +19,39 @@
|
||||
|
||||
package com.sk89q.worldedit.registry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class Registry<V extends Keyed> implements Iterable<V> {
|
||||
private final Map<String, V> map = new HashMap<>();
|
||||
public class Registry<V extends Keyed> implements IRegistry<V> {
|
||||
private final Map<String, V> map;
|
||||
private final String name;
|
||||
|
||||
public Registry(final String name) {
|
||||
public Registry(String name, Map<String, V> map) {
|
||||
this.name = name;
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public Registry(final String name) {
|
||||
this(name, Maps.newHashMap());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Map<String, V> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public V get(final String key) {
|
||||
checkState(key.equals(key.toLowerCase(Locale.ROOT)), "key must be lowercase");
|
||||
@ -66,9 +75,4 @@ public class Registry<V extends Keyed> implements Iterable<V> {
|
||||
return Collections.unmodifiableCollection(this.map.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<V> iterator() {
|
||||
return this.map.values().iterator();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class SessionManager {
|
||||
private static final Logger log = LoggerFactory.getLogger(SessionManager.class);
|
||||
private static boolean warnedInvalidTool;
|
||||
|
||||
private final Timer timer = new Timer();
|
||||
private final Timer timer = new Timer("WorldEdit Session Manager");
|
||||
private final WorldEdit worldEdit;
|
||||
private final Map<UUID, SessionHolder> sessions = new HashMap<>();
|
||||
private SessionStore store = new VoidStore();
|
||||
|
@ -19,8 +19,10 @@
|
||||
|
||||
package com.sk89q.worldedit.util.concurrency;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -43,11 +45,29 @@ public final class EvenMoreExecutors {
|
||||
* @return the newly created thread pool
|
||||
*/
|
||||
public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize) {
|
||||
return newBoundedCachedThreadPool(minThreads, maxThreads, queueSize, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a thread pool that creates new threads as needed up to
|
||||
* a maximum number of threads, but will reuse previously constructed
|
||||
* threads when they are available.
|
||||
*
|
||||
* @param minThreads the minimum number of threads to have at a given time
|
||||
* @param maxThreads the maximum number of threads to have at a given time
|
||||
* @param queueSize the size of the queue before new submissions are rejected
|
||||
* @param threadFormat thread name formatter
|
||||
* @return the newly created thread pool
|
||||
*/
|
||||
public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize, String threadFormat) {
|
||||
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
|
||||
minThreads, maxThreads,
|
||||
60L, TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(queueSize));
|
||||
new LinkedBlockingDeque<>(queueSize));
|
||||
threadPoolExecutor.allowCoreThreadTimeOut(true);
|
||||
if (threadFormat != null) {
|
||||
threadPoolExecutor.setThreadFactory(new ThreadFactoryBuilder().setNameFormat(threadFormat).build());
|
||||
}
|
||||
return threadPoolExecutor;
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.util.paste;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.util.net.HttpRequest;
|
||||
import org.json.simple.JSONValue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -33,6 +34,8 @@ public class EngineHubPaste implements Paster {
|
||||
|
||||
private static final Pattern URL_PATTERN = Pattern.compile("https?://.+$");
|
||||
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
@Override
|
||||
public Callable<URL> paste(String content) {
|
||||
return new PasteTask(content);
|
||||
@ -59,10 +62,10 @@ public class EngineHubPaste implements Paster {
|
||||
.returnContent()
|
||||
.asString("UTF-8").trim();
|
||||
|
||||
Object object = JSONValue.parse(result);
|
||||
if (object instanceof Map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
String urlString = String.valueOf(((Map<Object, Object>) object).get("url"));
|
||||
Map<Object, Object> object = GSON.fromJson(result, new TypeToken<Map<Object, Object>>() {
|
||||
}.getType());
|
||||
if (object != null) {
|
||||
String urlString = String.valueOf(object.get("url"));
|
||||
Matcher m = URL_PATTERN.matcher(urlString);
|
||||
|
||||
if (m.matches()) {
|
||||
|
@ -134,6 +134,11 @@ public class NullWorld extends AbstractWorld {
|
||||
return BlockVector3.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChunk(int X, int Z, int mask) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkGet get(int x, int z) {
|
||||
return NullChunkGet.INSTANCE;
|
||||
|
@ -72,7 +72,6 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
|
||||
*
|
||||
* @return the maximum Y
|
||||
*/
|
||||
@Override
|
||||
int getMaxY();
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.function.mask.SingleBlockTypeMask;
|
||||
import com.sk89q.worldedit.function.pattern.FawePattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.Keyed;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
@ -36,6 +37,7 @@ import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -45,6 +47,9 @@ import java.util.stream.IntStream;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockType implements FawePattern, Keyed {
|
||||
|
||||
public static final NamespacedRegistry<BlockType> REGISTRY = new NamespacedRegistry<>("block type");
|
||||
|
||||
private final String id;
|
||||
private final BlockTypes.Settings settings;
|
||||
|
||||
|
@ -26,11 +26,17 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.registry.IRegistry;
|
||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.registry.Registries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Field;
|
||||
@ -871,18 +877,22 @@ public final class BlockTypes {
|
||||
public static final int BIT_OFFSET; // Used internally
|
||||
protected static final int BIT_MASK; // Used internally
|
||||
|
||||
private static final Map<String, BlockType> $REGISTRY = new HashMap<>();
|
||||
// private static final Map<String, BlockType> $REGISTRY = new HashMap<>();
|
||||
// public static final NamespacedRegistry<BlockType> REGISTRY = new NamespacedRegistry<>("block type", $REGISTRY);
|
||||
|
||||
public static final BlockType[] values;
|
||||
public static final BlockState[] states;
|
||||
|
||||
private static final Set<String> $NAMESPACES = new LinkedHashSet<String>();
|
||||
private static final Set<String> $NAMESPACES = new LinkedHashSet<>();
|
||||
|
||||
static {
|
||||
try {
|
||||
ArrayList<BlockState> stateList = new ArrayList<>();
|
||||
|
||||
Collection<String> blocks = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().registerBlocks();
|
||||
Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS);
|
||||
Registries registries = platform.getRegistries();
|
||||
BlockRegistry blockReg = registries.getBlockRegistry();
|
||||
Collection<String> blocks = blockReg.registerBlocks();
|
||||
Map<String, String> blockMap = blocks.stream().collect(Collectors.toMap(item -> item.charAt(item.length() - 1) == ']' ? item.substring(0, item.indexOf('[')) : item, item -> item));
|
||||
|
||||
int size = blockMap.size();
|
||||
@ -928,7 +938,7 @@ public final class BlockTypes {
|
||||
|
||||
// Add to $Registry
|
||||
for (BlockType type : values) {
|
||||
$REGISTRY.put(type.getId().toLowerCase(Locale.ROOT), type);
|
||||
BlockType.REGISTRY.register(type.getId().toLowerCase(Locale.ROOT), type);
|
||||
}
|
||||
states = stateList.toArray(new BlockState[stateList.size()]);
|
||||
|
||||
@ -954,15 +964,13 @@ public final class BlockTypes {
|
||||
try {
|
||||
Field field = BlockTypes.class.getDeclaredField(enumName);
|
||||
ReflectionUtils.setFailsafeFieldValue(field, null, existing);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// register states
|
||||
if (typeName.startsWith("minecraft:")) $REGISTRY.put(typeName.substring(10), existing);
|
||||
$REGISTRY.put(typeName, existing);
|
||||
if (typeName.startsWith("minecraft:")) BlockType.REGISTRY.register(typeName.substring(10), existing);
|
||||
BlockType.REGISTRY.register(typeName, existing);
|
||||
String nameSpace = typeName.substring(0, typeName.indexOf(':'));
|
||||
$NAMESPACES.add(nameSpace);
|
||||
return existing;
|
||||
@ -980,7 +988,7 @@ public final class BlockTypes {
|
||||
String input = inputLower;
|
||||
|
||||
if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input;
|
||||
BlockType result = $REGISTRY.get(input);
|
||||
BlockType result = BlockType.REGISTRY.get(input);
|
||||
if (result != null) return result;
|
||||
|
||||
try {
|
||||
@ -1002,11 +1010,11 @@ public final class BlockTypes {
|
||||
}
|
||||
|
||||
public static @Nullable BlockType get(final String id) {
|
||||
return $REGISTRY.get(id);
|
||||
return BlockType.REGISTRY.getMap().get(id);
|
||||
}
|
||||
|
||||
public static @Nullable BlockType get(final CharSequence id) {
|
||||
return $REGISTRY.get(id);
|
||||
return BlockType.REGISTRY.getMap().get(id);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -22,6 +22,8 @@ package com.sk89q.worldedit.world.registry;
|
||||
import com.google.common.io.Resources;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
@ -76,6 +78,15 @@ public final class BundledBlockData {
|
||||
private void loadFromResource() throws IOException {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter());
|
||||
gsonBuilder.registerTypeAdapter(int.class, (JsonDeserializer<Integer>) (json, typeOfT, context) -> {
|
||||
JsonPrimitive primitive = (JsonPrimitive) json;
|
||||
if (primitive.isString()) {
|
||||
String value = primitive.getAsString();
|
||||
if (value.charAt(0) == '#') return Integer.parseInt(value.substring(1), 16);
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
return primitive.getAsInt();
|
||||
});
|
||||
Gson gson = gsonBuilder.create();
|
||||
URL url = null;
|
||||
final int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataVersion();
|
||||
|
@ -66,13 +66,13 @@ public class SnapshotRepository {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of snapshots in a directory. The newest snapshot is near the top of the array.
|
||||
* Get a list of snapshots in a directory. The newest snapshot is
|
||||
* near the top of the array.
|
||||
*
|
||||
* @param newestFirst true to get the newest first
|
||||
* @return a list of snapshots
|
||||
*/
|
||||
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName)
|
||||
throws MissingWorldException {
|
||||
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException {
|
||||
FilenameFilter filter = (dir, name) -> {
|
||||
File f = new File(dir, name);
|
||||
return isValidSnapshot(f);
|
||||
@ -116,8 +116,7 @@ public class SnapshotRepository {
|
||||
* @return a snapshot or null
|
||||
*/
|
||||
@Nullable
|
||||
public Snapshot getSnapshotAfter(ZonedDateTime date, String world)
|
||||
throws MissingWorldException {
|
||||
public Snapshot getSnapshotAfter(ZonedDateTime date, String world) throws MissingWorldException {
|
||||
List<Snapshot> snapshots = getSnapshots(true, world);
|
||||
Snapshot last = null;
|
||||
|
||||
@ -139,8 +138,7 @@ public class SnapshotRepository {
|
||||
* @return a snapshot or null
|
||||
*/
|
||||
@Nullable
|
||||
public Snapshot getSnapshotBefore(ZonedDateTime date, String world)
|
||||
throws MissingWorldException {
|
||||
public Snapshot getSnapshotBefore(ZonedDateTime date, String world) throws MissingWorldException {
|
||||
List<Snapshot> snapshots = getSnapshots(false, world);
|
||||
Snapshot last = null;
|
||||
|
||||
@ -206,8 +204,7 @@ public class SnapshotRepository {
|
||||
* @return whether it is a valid snapshot
|
||||
*/
|
||||
protected boolean isValidSnapshot(File file) {
|
||||
if (!file.getName()
|
||||
.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
|
||||
if (!file.getName().matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@
|
||||
"hardness": 2.0,
|
||||
"resistance": 3.0,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -758,7 +758,7 @@
|
||||
"hardness": 3.0,
|
||||
"resistance": 3.0,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -771,7 +771,7 @@
|
||||
"unpushable": false,
|
||||
"mapColor": "#000000",
|
||||
"isTranslucent": false,
|
||||
"hasContainer": false
|
||||
"hasContainer": true
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -1133,7 +1133,7 @@
|
||||
"hardness": 2.0,
|
||||
"resistance": 3.0,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -1246,7 +1246,7 @@
|
||||
"unpushable": false,
|
||||
"mapColor": "#8f7748",
|
||||
"isTranslucent": false,
|
||||
"hasContainer": false
|
||||
"hasContainer": true
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -1383,7 +1383,7 @@
|
||||
"hardness": 2.0,
|
||||
"resistance": 2.0,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
@ -1391,10 +1391,10 @@
|
||||
"burnable": false,
|
||||
"opaque": true,
|
||||
"replacedDuringPlacement": false,
|
||||
"toolRequired": false,
|
||||
"toolRequired": true,
|
||||
"fragileWhenPushed": false,
|
||||
"unpushable": false,
|
||||
"mapColor": "#7f3fb2",
|
||||
"mapColor": "#707070",
|
||||
"isTranslucent": true,
|
||||
"hasContainer": true
|
||||
}
|
||||
@ -1408,7 +1408,7 @@
|
||||
"hardness": 0.3,
|
||||
"resistance": 0.3,
|
||||
"ticksRandomly": false,
|
||||
"fullCube": true,
|
||||
"fullCube": false,
|
||||
"slipperiness": 0.6,
|
||||
"liquid": false,
|
||||
"solid": true,
|
||||
|
@ -316,16 +316,11 @@
|
||||
"47:0": "minecraft:bookshelf",
|
||||
"48:0": "minecraft:mossy_cobblestone",
|
||||
"49:0": "minecraft:obsidian",
|
||||
"50:0": "minecraft:torch",
|
||||
"50:1": "minecraft:wall_torch[facing=east]",
|
||||
"50:2": "minecraft:wall_torch[facing=west]",
|
||||
"50:3": "minecraft:wall_torch[facing=south]",
|
||||
"50:4": "minecraft:wall_torch[facing=north]",
|
||||
"50:9": "minecraft:wall_torch[facing=east]",
|
||||
"50:10": "minecraft:wall_torch[facing=west]",
|
||||
"50:11": "minecraft:wall_torch[facing=south]",
|
||||
"50:12": "minecraft:wall_torch[facing=north]",
|
||||
"50:13": "minecraft:torch",
|
||||
"50:5": "minecraft:torch",
|
||||
"51:0": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=0]",
|
||||
"51:1": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=1]",
|
||||
"51:2": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=2]",
|
||||
@ -351,15 +346,10 @@
|
||||
"53:5": "minecraft:oak_stairs[half=top,shape=outer_right,facing=west]",
|
||||
"53:6": "minecraft:oak_stairs[half=top,shape=outer_right,facing=south]",
|
||||
"53:7": "minecraft:oak_stairs[half=top,shape=outer_right,facing=north]",
|
||||
"54:0": "minecraft:chest",
|
||||
"54:2": "minecraft:chest[facing=north,type=single]",
|
||||
"54:3": "minecraft:chest[facing=south,type=single]",
|
||||
"54:4": "minecraft:chest[facing=west,type=single]",
|
||||
"54:5": "minecraft:chest[facing=east,type=single]",
|
||||
"54:10": "minecraft:chest[facing=north]",
|
||||
"54:11": "minecraft:chest[facing=south]",
|
||||
"54:12": "minecraft:chest[facing=west]",
|
||||
"54:13": "minecraft:chest[facing=east]",
|
||||
"55:0": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=0]",
|
||||
"55:1": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=1]",
|
||||
"55:2": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=2]",
|
||||
@ -395,40 +385,30 @@
|
||||
"60:5": "minecraft:farmland[moisture=5]",
|
||||
"60:6": "minecraft:farmland[moisture=6]",
|
||||
"60:7": "minecraft:farmland[moisture=7]",
|
||||
"61:0": "minecraft:furnace",
|
||||
"61:2": "minecraft:furnace[facing=north,lit=false]",
|
||||
"61:3": "minecraft:furnace[facing=south,lit=false]",
|
||||
"61:4": "minecraft:furnace[facing=west,lit=false]",
|
||||
"61:5": "minecraft:furnace[facing=east,lit=false]",
|
||||
"61:10": "minecraft:furnace[facing=north,lit=false]",
|
||||
"61:11": "minecraft:furnace[facing=south,lit=false]",
|
||||
"61:12": "minecraft:furnace[facing=west,lit=false]",
|
||||
"61:13": "minecraft:furnace[facing=east,lit=false]",
|
||||
"62:0": "minecraft:furnace[lit=true]",
|
||||
"62:2": "minecraft:furnace[facing=north,lit=true]",
|
||||
"62:3": "minecraft:furnace[facing=south,lit=true]",
|
||||
"62:4": "minecraft:furnace[facing=west,lit=true]",
|
||||
"62:5": "minecraft:furnace[facing=east,lit=true]",
|
||||
"62:10": "minecraft:furnace[facing=north,lit=true]",
|
||||
"62:11": "minecraft:furnace[facing=south,lit=true]",
|
||||
"62:12": "minecraft:furnace[facing=west,lit=true]",
|
||||
"62:13": "minecraft:furnace[facing=east,lit=true]",
|
||||
"63:0": "minecraft:oak_sign[rotation=0]",
|
||||
"63:1": "minecraft:oak_sign[rotation=1]",
|
||||
"63:2": "minecraft:oak_sign[rotation=2]",
|
||||
"63:3": "minecraft:oak_sign[rotation=3]",
|
||||
"63:4": "minecraft:oak_sign[rotation=4]",
|
||||
"63:5": "minecraft:oak_sign[rotation=5]",
|
||||
"63:6": "minecraft:oak_sign[rotation=6]",
|
||||
"63:7": "minecraft:oak_sign[rotation=7]",
|
||||
"63:8": "minecraft:oak_sign[rotation=8]",
|
||||
"63:9": "minecraft:oak_sign[rotation=9]",
|
||||
"63:10": "minecraft:oak_sign[rotation=10]",
|
||||
"63:11": "minecraft:oak_sign[rotation=11]",
|
||||
"63:12": "minecraft:oak_sign[rotation=12]",
|
||||
"63:13": "minecraft:oak_sign[rotation=13]",
|
||||
"63:14": "minecraft:oak_sign[rotation=14]",
|
||||
"63:15": "minecraft:oak_sign[rotation=15]",
|
||||
"63:0": "minecraft:sign[rotation=0]",
|
||||
"63:1": "minecraft:sign[rotation=1]",
|
||||
"63:2": "minecraft:sign[rotation=2]",
|
||||
"63:3": "minecraft:sign[rotation=3]",
|
||||
"63:4": "minecraft:sign[rotation=4]",
|
||||
"63:5": "minecraft:sign[rotation=5]",
|
||||
"63:6": "minecraft:sign[rotation=6]",
|
||||
"63:7": "minecraft:sign[rotation=7]",
|
||||
"63:8": "minecraft:sign[rotation=8]",
|
||||
"63:9": "minecraft:sign[rotation=9]",
|
||||
"63:10": "minecraft:sign[rotation=10]",
|
||||
"63:11": "minecraft:sign[rotation=11]",
|
||||
"63:12": "minecraft:sign[rotation=12]",
|
||||
"63:13": "minecraft:sign[rotation=13]",
|
||||
"63:14": "minecraft:sign[rotation=14]",
|
||||
"63:15": "minecraft:sign[rotation=15]",
|
||||
"64:0": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]",
|
||||
"64:1": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=south,open=false]",
|
||||
"64:2": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=west,open=false]",
|
||||
@ -441,15 +421,10 @@
|
||||
"64:9": "minecraft:oak_door[hinge=right,half=upper,powered=false,facing=east,open=false]",
|
||||
"64:10": "minecraft:oak_door[hinge=left,half=upper,powered=true,facing=east,open=false]",
|
||||
"64:11": "minecraft:oak_door[hinge=right,half=upper,powered=true,facing=east,open=false]",
|
||||
"65:0": "minecraft:ladder",
|
||||
"65:2": "minecraft:ladder[facing=north]",
|
||||
"65:3": "minecraft:ladder[facing=south]",
|
||||
"65:4": "minecraft:ladder[facing=west]",
|
||||
"65:5": "minecraft:ladder[facing=east]",
|
||||
"65:10": "minecraft:ladder[facing=north]",
|
||||
"65:11": "minecraft:ladder[facing=south]",
|
||||
"65:12": "minecraft:ladder[facing=west]",
|
||||
"65:13": "minecraft:ladder[facing=east]",
|
||||
"66:0": "minecraft:rail[shape=north_south]",
|
||||
"66:1": "minecraft:rail[shape=east_west]",
|
||||
"66:2": "minecraft:rail[shape=ascending_east]",
|
||||
@ -468,15 +443,10 @@
|
||||
"67:5": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=west]",
|
||||
"67:6": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=south]",
|
||||
"67:7": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=north]",
|
||||
"68:0": "minecraft:oak_wall_sign",
|
||||
"68:2": "minecraft:oak_wall_sign[facing=north]",
|
||||
"68:3": "minecraft:oak_wall_sign[facing=south]",
|
||||
"68:4": "minecraft:oak_wall_sign[facing=west]",
|
||||
"68:5": "minecraft:oak_wall_sign[facing=east]",
|
||||
"68:10": "minecraft:oak_wall_sign[facing=north]",
|
||||
"68:11": "minecraft:oak_wall_sign[facing=south]",
|
||||
"68:12": "minecraft:oak_wall_sign[facing=west]",
|
||||
"68:13": "minecraft:oak_wall_sign[facing=east]",
|
||||
"68:2": "minecraft:wall_sign[facing=north]",
|
||||
"68:3": "minecraft:wall_sign[facing=south]",
|
||||
"68:4": "minecraft:wall_sign[facing=west]",
|
||||
"68:5": "minecraft:wall_sign[facing=east]",
|
||||
"69:0": "minecraft:lever[powered=false,facing=north,face=ceiling]",
|
||||
"69:1": "minecraft:lever[powered=false,facing=east,face=wall]",
|
||||
"69:2": "minecraft:lever[powered=false,facing=west,face=wall]",
|
||||
@ -511,28 +481,16 @@
|
||||
"72:1": "minecraft:oak_pressure_plate[powered=true]",
|
||||
"73:0": "minecraft:redstone_ore[lit=false]",
|
||||
"74:0": "minecraft:redstone_ore[lit=true]",
|
||||
"75:0": "minecraft:redstone_torch[lit=false]",
|
||||
"75:1": "minecraft:redstone_wall_torch[facing=east,lit=false]",
|
||||
"75:2": "minecraft:redstone_wall_torch[facing=west,lit=false]",
|
||||
"75:3": "minecraft:redstone_wall_torch[facing=south,lit=false]",
|
||||
"75:4": "minecraft:redstone_wall_torch[facing=north,lit=false]",
|
||||
"75:5": "minecraft:redstone_torch[lit=false]",
|
||||
"75:9": "minecraft:redstone_wall_torch[facing=east,lit=false]",
|
||||
"75:10": "minecraft:redstone_wall_torch[facing=west,lit=false]",
|
||||
"75:11": "minecraft:redstone_wall_torch[facing=south,lit=false]",
|
||||
"75:12": "minecraft:redstone_wall_torch[facing=north,lit=false]",
|
||||
"75:13": "minecraft:redstone_wall_torch[lit=false]",
|
||||
"76:0": "minecraft:redstone_torch[lit=true]",
|
||||
"76:1": "minecraft:redstone_wall_torch[facing=east,lit=true]",
|
||||
"76:2": "minecraft:redstone_wall_torch[facing=west,lit=true]",
|
||||
"76:3": "minecraft:redstone_wall_torch[facing=south,lit=true]",
|
||||
"76:4": "minecraft:redstone_wall_torch[facing=north,lit=true]",
|
||||
"76:5": "minecraft:redstone_wall_torch[lit=true]",
|
||||
"76:9": "minecraft:redstone_wall_torch[facing=east,lit=true]",
|
||||
"76:10": "minecraft:redstone_wall_torch[facing=west,lit=true]",
|
||||
"76:11": "minecraft:redstone_wall_torch[facing=south,lit=true]",
|
||||
"76:12": "minecraft:redstone_wall_torch[facing=north,lit=true]",
|
||||
"76:13": "minecraft:redstone_wall_torch[lit=true]",
|
||||
"76:5": "minecraft:redstone_torch[lit=true]",
|
||||
"77:0": "minecraft:stone_button[powered=false,facing=east,face=ceiling]",
|
||||
"77:1": "minecraft:stone_button[powered=false,facing=east,face=wall]",
|
||||
"77:2": "minecraft:stone_button[powered=false,facing=west,face=wall]",
|
||||
@ -598,15 +556,8 @@
|
||||
"87:0": "minecraft:netherrack",
|
||||
"88:0": "minecraft:soul_sand",
|
||||
"89:0": "minecraft:glowstone",
|
||||
"90:0": "minecraft:nether_portal",
|
||||
"90:1": "minecraft:nether_portal[axis=x]",
|
||||
"90:2": "minecraft:nether_portal[axis=z]",
|
||||
"90:5": "minecraft:nether_portal[axis=x]",
|
||||
"90:6": "minecraft:nether_portal[axis=z]",
|
||||
"90:9": "minecraft:nether_portal[axis=x]",
|
||||
"90:10": "minecraft:nether_portal[axis=z]",
|
||||
"90:13": "minecraft:nether_portal[axis=x]",
|
||||
"90:14": "minecraft:nether_portal[axis=z]",
|
||||
"91:0": "minecraft:jack_o_lantern[facing=south]",
|
||||
"91:1": "minecraft:jack_o_lantern[facing=west]",
|
||||
"91:2": "minecraft:jack_o_lantern[facing=north]",
|
||||
@ -866,15 +817,10 @@
|
||||
"128:6": "minecraft:sandstone_stairs[half=top,shape=straight,facing=south]",
|
||||
"128:7": "minecraft:sandstone_stairs[half=top,shape=straight,facing=north]",
|
||||
"129:0": "minecraft:emerald_ore",
|
||||
"130:0": "minecraft:ender_chest",
|
||||
"130:2": "minecraft:ender_chest[facing=north]",
|
||||
"130:3": "minecraft:ender_chest[facing=south]",
|
||||
"130:4": "minecraft:ender_chest[facing=west]",
|
||||
"130:5": "minecraft:ender_chest[facing=east]",
|
||||
"130:10": "minecraft:ender_chest[facing=north]",
|
||||
"130:11": "minecraft:ender_chest[facing=south]",
|
||||
"130:12": "minecraft:ender_chest[facing=west]",
|
||||
"130:13": "minecraft:ender_chest[facing=east]",
|
||||
"131:0": "minecraft:tripwire_hook[powered=false,attached=false,facing=south]",
|
||||
"131:1": "minecraft:tripwire_hook[powered=false,attached=false,facing=west]",
|
||||
"131:2": "minecraft:tripwire_hook[powered=false,attached=false,facing=north]",
|
||||
@ -1007,15 +953,10 @@
|
||||
"145:9": "minecraft:damaged_anvil[facing=west]",
|
||||
"145:10": "minecraft:damaged_anvil[facing=north]",
|
||||
"145:11": "minecraft:damaged_anvil[facing=east]",
|
||||
"146:0": "minecraft:trapped_chest",
|
||||
"146:2": "minecraft:trapped_chest[facing=north,type=single]",
|
||||
"146:3": "minecraft:trapped_chest[facing=south,type=single]",
|
||||
"146:4": "minecraft:trapped_chest[facing=west,type=single]",
|
||||
"146:5": "minecraft:trapped_chest[facing=east,type=single]",
|
||||
"146:10": "minecraft:trapped_chest[facing=north,type=single]",
|
||||
"146:11": "minecraft:trapped_chest[facing=south,type=single]",
|
||||
"146:12": "minecraft:trapped_chest[facing=west,type=single]",
|
||||
"146:13": "minecraft:trapped_chest[facing=east,type=single]",
|
||||
"147:0": "minecraft:light_weighted_pressure_plate[power=0]",
|
||||
"147:1": "minecraft:light_weighted_pressure_plate[power=1]",
|
||||
"147:2": "minecraft:light_weighted_pressure_plate[power=2]",
|
||||
@ -1283,15 +1224,10 @@
|
||||
"176:13": "minecraft:white_banner[rotation=13]",
|
||||
"176:14": "minecraft:white_banner[rotation=14]",
|
||||
"176:15": "minecraft:white_banner[rotation=15]",
|
||||
"177:0": "minecraft:white_wall_banner",
|
||||
"177:2": "minecraft:white_wall_banner[facing=north]",
|
||||
"177:3": "minecraft:white_wall_banner[facing=south]",
|
||||
"177:4": "minecraft:white_wall_banner[facing=west]",
|
||||
"177:5": "minecraft:white_wall_banner[facing=east]",
|
||||
"177:10": "minecraft:white_wall_banner[facing=north]",
|
||||
"177:11": "minecraft:white_wall_banner[facing=south]",
|
||||
"177:12": "minecraft:white_wall_banner[facing=west]",
|
||||
"177:13": "minecraft:white_wall_banner[facing=east]",
|
||||
"178:0": "minecraft:daylight_detector[inverted=true,power=0]",
|
||||
"178:1": "minecraft:daylight_detector[inverted=true,power=1]",
|
||||
"178:2": "minecraft:daylight_detector[inverted=true,power=2]",
|
||||
@ -2196,7 +2132,7 @@
|
||||
"321:0": "minecraft:painting",
|
||||
"322:0": "minecraft:golden_apple",
|
||||
"322:1": "minecraft:enchanted_golden_apple",
|
||||
"323:0": "minecraft:oak_sign",
|
||||
"323:0": "minecraft:sign",
|
||||
"324:0": "minecraft:oak_door",
|
||||
"325:0": "minecraft:bucket",
|
||||
"326:0": "minecraft:water_bucket",
|
||||
|
@ -19,19 +19,20 @@
|
||||
|
||||
package com.sk89q.minecraft.util.commands;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class CommandContextTest {
|
||||
|
||||
@ -39,7 +40,7 @@ public class CommandContextTest {
|
||||
private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something";
|
||||
CommandContext firstCommand;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUpTest() {
|
||||
try {
|
||||
firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w')));
|
||||
@ -49,10 +50,12 @@ public class CommandContextTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = CommandException.class)
|
||||
public void testInvalidFlags() throws CommandException {
|
||||
@Test
|
||||
public void testInvalidFlags() {
|
||||
final String failingCommand = "herpderp -opw testers";
|
||||
assertThrows(CommandException.class, () -> {
|
||||
new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w')));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -19,34 +19,29 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.transform;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
|
||||
@Ignore("A platform is currently required to get properties, preventing this test.")
|
||||
@Disabled("A platform is currently required to get properties, preventing this test.")
|
||||
public class BlockTransformExtentTest {
|
||||
|
||||
private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90);
|
||||
private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90);
|
||||
private final Set<BlockType> ignored = new HashSet<>();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
// BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransform() throws Exception {
|
||||
public void testTransform() {
|
||||
// for (BlockType type : BlockType.REGISTRY.values()) {
|
||||
// if (ignored.contains(type)) {
|
||||
// continue;
|
||||
|
@ -0,0 +1,5 @@
|
||||
junit.jupiter.execution.parallel.enabled=true
|
||||
junit.jupiter.execution.parallel.mode.default=concurrent
|
||||
junit.jupiter.execution.parallel.mode.classes.default=same_thread
|
||||
junit.jupiter.execution.parallel.config.strategy=dynamic
|
||||
junit.jupiter.execution.parallel.config.dynamic.factor=4
|
@ -5,7 +5,7 @@ loaderVersion="[24,)"
|
||||
# A URL to refer people to when problems occur with this mod
|
||||
issueTrackerURL="https://discord.gg/enginehub"
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
displayURL="http://wiki.sk89q.com/wiki/WorldEdit/"
|
||||
displayURL="https://worldedit.enginehub.org/"
|
||||
# A file name (in the root of the mod JAR) containing a logo for display
|
||||
logoFile="worldedit-icon.png"
|
||||
# A text field displayed in the mod UI
|
||||
|
@ -1,152 +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((?:/|$).*)'
|
||||
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:core/build/libs/core-$pistonVersion:lastSuccessfulBuild@jar"
|
||||
shade "FAWE-Piston:core-ap/runtime/build/libs/runtime-$pistonVersion:lastSuccessfulBuild@jar"
|
||||
shade "FAWE-Piston:default-impl/build/libs/default-impl-$pistonVersion:lastSuccessfulBuild@jar"
|
||||
}
|
||||
|
||||
project("ap") {
|
||||
dependencies {
|
||||
// def avVersion = "1.6.5"
|
||||
// shade "com.google.auto.value:auto-value-annotations:$avVersion"
|
||||
shade "FAWE-Piston:core/build/libs/core-$pistonVersion:lastSuccessfulBuild@jar"
|
||||
shade "FAWE-Piston:core-ap/annotations/build/libs/annotations-$pistonVersion:lastSuccessfulBuild@jar"
|
||||
shade "FAWE-Piston:core-ap/processor/build/libs/processor-$pistonVersion:lastSuccessfulBuild@jar"
|
||||
|
||||
shade "org.enginehub.piston.core-ap:annotations:0.4.3"
|
||||
shade "org.enginehub.piston.core-ap:processor:0.4.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
project("bukkit") {
|
||||
repositories {
|
||||
maven {
|
||||
name = "SpigotMC"
|
||||
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
shade "net.kyori:text-adapter-bukkit:$textExtrasVersion"
|
||||
}
|
||||
}
|
||||
/*
|
||||
project("sponge") {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Sponge"
|
||||
url = "https://repo.spongepowered.org/maven"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
shade "net.kyori:text-adapter-spongeapi:$textExtrasVersion"
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
tasks.register("build") {
|
||||
dependsOn(subprojects.collect { it.tasks.named("build") })
|
||||
}
|
3
worldedit-libs/build.gradle.kts
Normal file
3
worldedit-libs/build.gradle.kts
Normal file
@ -0,0 +1,3 @@
|
||||
tasks.register("build") {
|
||||
dependsOn(subprojects.map { it.tasks.named("build") })
|
||||
}
|
11
worldedit-libs/bukkit/build.gradle.kts
Normal file
11
worldedit-libs/bukkit/build.gradle.kts
Normal file
@ -0,0 +1,11 @@
|
||||
applyLibrariesConfiguration()
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "SpigotMC"
|
||||
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
"shade"("net.kyori:text-adapter-bukkit:${Versions.TEXT_EXTRAS}")
|
||||
}
|
9
worldedit-libs/core/ap/build.gradle.kts
Normal file
9
worldedit-libs/core/ap/build.gradle.kts
Normal file
@ -0,0 +1,9 @@
|
||||
applyLibrariesConfiguration()
|
||||
|
||||
dependencies {
|
||||
"shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||
"shade"("FAWE-Piston:core-ap/annotations/build/libs/annotations-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||
"shade"("FAWE-Piston:core-ap/processor/build/libs/processor-${Versions.PISTON}:lastSuccessfulBuild@jar")
|
||||
"shade"("org.enginehub.piston.core-ap:annotations:0.4.3")
|
||||
"shade"("org.enginehub.piston.core-ap:processor:0.4.3")
|
||||
}
|
19
worldedit-libs/core/build.gradle.kts
Normal file
19
worldedit-libs/core/build.gradle.kts
Normal file
@ -0,0 +1,19 @@
|
||||
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.github.luben:zstd-jni:1.4.3-1")
|
||||
"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")
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user